LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 01-25-2007, 06:21 AM   #1
Dark Carnival
Member
 
Registered: Jun 2003
Posts: 166

Rep: Reputation: 30
doinst.sh syntax (help please)


I'm currently adding packages to my slackware install cd's and I've finally come to a point where I do need to write a doinst.sh script to sort a few things out after the installation..

I need the packages to install and word inside the slackware installer.. so I suppose they should be ash-compatible.

I've seen a few scripts inside packages such as:
( cd /path/to/program; ln -s link sourcefile )
( cd /path/to/program; ln -s link2 sourcefile2 )

Now.. that hardly look like my average bash script..

Is it not possible for me to just omit parenthesises and handle the same action like so:

cd /path/to/program
ln -s link sourcefile
ln -s link2 sourcefile2

And can't I just use if-blocks, for-loops and so on like I usually do with bash scripts ?

The reason I ask is because the tutorial on linuxpackages.net show regular sh syntax but the scripts I've seen in doinst.sh files so far show the other syntax...

Please help
 
Old 01-25-2007, 07:24 AM   #2
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 30
The effect of the parentheses is to fire off a subshell to do the work within those parentheses, and then come back to your original shell.

In the example you cite, this aspect is important. When you come back to the main shell, your current directory is as it was before you did the work. Try this at your shell prompt:

pwd
(cd /; pwd)
pwd
cd ;/ pwd
pwd

.. and you'll see what the parentheses buy for you.
 
Old 01-25-2007, 07:49 AM   #3
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 5,223

Rep: Reputation: Disabled
The doinst.sh is just a shell script. You have to take into account though that when you have a package on the install CD, the shell it runs in is not bash but the less powerful "ash" (which does not have all of the functionality of the bigger bash). So you should check your script against the ash manual perhaps.
Most standard shell scripting commands will be handled properly by ash, so I expect no real problems here.

An important thing to know is that you should not use absolute paths in the doinst.sh script. That is why you'll see lines like
Code:
config etc/rc.d/rc.httpd.new
instead of
Code:
config /etc/rc.d/rc.httpd.new
. The reason is that you can instruct installpkg to install a package somewhere else than to "/" (your root filesystem), and that is exactly how the install CD works (the partition that Slackware is being installed to is mounted somewhere under /var IIRC).

Eric
 
Old 01-25-2007, 09:08 AM   #4
Dark Carnival
Member
 
Registered: Jun 2003
Posts: 166

Original Poster
Rep: Reputation: 30
Thanks a lot to both of you

I'll keep both things in mind and hopefully my packages won't blow up during installation or anything
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
doinst.sh i need to install packages using command line Clarence27 Zenwalk 2 10-07-2006 07:03 AM
C syntax ashlesha Programming 6 07-04-2006 07:53 PM
appending to perllocal.pod via doinst.sh jong357 Slackware 1 10-31-2005 10:48 AM
C++ syntax error before :: token HELP, i cant find the syntax error :( qwijibow Programming 2 12-14-2004 06:09 PM
C syntax help please ... DarkDrive Programming 2 08-07-2003 04:13 PM


All times are GMT -5. The time now is 08:54 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration