bash script questions.

General support questions
supertight
Posts: 149
Joined: 2017/02/07 21:47:51

bash script questions.

Postby supertight » 2018/01/23 03:30:37

I have a few commands I need to run after most installs. I wanted to setup a little script that would speed things up.

This is the set of commands.

Code: Select all

scl enable devtoolset-4 bash
cmake3 /home/xmr-stak
make /home/xmr-stak/install


I used vim and set the commands into xmr.install.sh with chmod +x
I think, but I'm not sure, the cmake3 command on line 3 isn't correct. Same with make install on line 4.

Code: Select all

#! /bin/bash
scl enable devtoolset-4 bash
cmake3 /home/xmr-stak
make install /home/xmr-stak/


I know I need something else so It all compiles and installs into the correct path. I don't know what that is. I also would like if the whole thing was verbose. Any help in the correct direction would be awesome. Thanks for reading.

bertalanimre
Posts: 137
Joined: 2015/06/02 13:04:03

Re: bash script questions.

Postby bertalanimre » 2018/01/23 12:50:21

What kind of install do you want to run these scripts after? Minimal probably doesn't have the required packages installed that are needed.

What I would do is as the 1st line, I would just install the dev-tools. Then I guess your other commands would run safe and sound too.

Add before your scl line:

Code: Select all

sudo yum group install "Development Tools"


If it still doesn't work, try:

Code: Select all

sudo yum groupinstall "Development Tools"


Also, shouldn't you add sudo before each line? Just asking. It is not always enough if you run the script file as sudo you know.

User avatar
TrevorH
Forum Moderator
Posts: 21731
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: bash script questions.

Postby TrevorH » 2018/01/23 13:26:43

Ideally what you'd do is learn about packaging and create your own rpm containing your app. If you distribute this in the way that you are now you'll end up with a development environment on all the boxes you install it on. With a package you'll have that on your build machine and nowhere else.
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

supertight
Posts: 149
Joined: 2017/02/07 21:47:51

Re: bash script questions.

Postby supertight » 2018/01/24 00:21:24

bertalanimre wrote:What kind of install do you want to run these scripts after? Minimal probably doesn't have the required packages installed that are needed.

What I would do is as the 1st line, I would just install the dev-tools. Then I guess your other commands would run safe and sound too.

Add before your scl line:

Code: Select all

sudo yum group install "Development Tools"


If it still doesn't work, try:

Code: Select all

sudo yum groupinstall "Development Tools"


Also, shouldn't you add sudo before each line? Just asking. It is not always enough if you run the script file as sudo you know.



The kickstart file used for install already has all the items required for the commands listed. Thank you.

supertight
Posts: 149
Joined: 2017/02/07 21:47:51

Re: bash script questions.

Postby supertight » 2018/01/24 00:27:07

TrevorH wrote:Ideally what you'd do is learn about packaging and create your own rpm containing your app. If you distribute this in the way that you are now you'll end up with a development environment on all the boxes you install it on. With a package you'll have that on your build machine and nowhere else.



I didn't know that was a possibility and I can work on that. I need a short term patch for now while I learn packaging. I have the kickstart file setup to provide all the proper dev packages on install.

The script as written does nothing. What should I add to it?

thanks for reading.

**EDIT**
A recommendation for packaging tutorial?