Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I need to create a .sh installer file. I have the files, i just need to know the commands that will lead the terminal into placing the files in certain locations. there is a folder that needs to be placed in the /var directory, and a file in the /etc/init.d directory. Does anyone know what commands in the file are appropriate?

there is a folder that needs to be placed in the /var directory, and a file in the /etc/init.d directory.

share|improve this question
1  
it would help us a lot if you could tell us which files you wanna install and where to put them –  Jeggy Jun 24 '12 at 22:31
    
sorry, there is a folder that needs to be placed in the /var directory, and a file in the /etc/init.d directory. –  Nick Bailuc Jun 25 '12 at 1:43
    
By "installer file", do you mean executing an installer program, or moving files around on the hard drive? –  InkBlend Jun 25 '12 at 2:00
    
You mean sh file installers like installer of netbeans IDE? –  Tachyons Jun 25 '12 at 2:13
    
executing an installer program with the terminal –  Nick Bailuc Jun 25 '12 at 15:57
add comment

1 Answer 1

up vote 1 down vote accepted

Basically, a shell .sh script is nothing more than the same commands you would type at the command line. For instance, if your files are "a.sh, b.txt, c.conf" and they need to reside in /var, and "d.sh" goes in "/etc/init.d", then you would do something like this:

cp a.sh /var
cp b.txt /var
cp c.conf /var
cp d.sh /etc/init.d

That assumes the installer file is separate from the other files. If you need to make a single unified installer script that contains these file, then you'll want to look a "shar" file (short for "Shell Archive").

A shar file can also setup permissions and take other actions that might be necessary for your installation. You can use the chown and chmod command as necessary in the install script you write, too.

share|improve this answer
    
do you know the command that is able to stop, pause, or ask for choise(yes/no)? –  Nick Bailuc Jun 28 '12 at 1:50
    
You will use the read command. Googling for "shell script input" pulls up a number of example sites, this page has a good example: thelinuxblog.com/shell-script-get-user-input –  dan_linder Jun 28 '12 at 16:06
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.