LinuxQuestions.org
Review your favorite Linux distribution.
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 11-02-2007, 07:17 PM   #1
binarybob0001
Member
 
Registered: Dec 2004
Distribution: Debian Wheezy
Posts: 441

Rep: Reputation: 30
Can I just generate doinst.sh with package?


There are some cases where I would just love to generate a doinst.sh without actually packaging anything. Is this possible?

Last edited by binarybob0001; 11-02-2007 at 08:05 PM.
 
Old 11-02-2007, 07:39 PM   #2
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 5,335

Rep: Reputation: Disabled
Quote:
Originally Posted by binarybob0001 View Post
There are some cases where I would just love to generate a doinst.sh with actually packaging anything. Is this possible?
I have no clue about what your words mean, really. What exactly do you want to achieve?

Eric
 
Old 11-02-2007, 08:06 PM   #3
binarybob0001
Member
 
Registered: Dec 2004
Distribution: Debian Wheezy
Posts: 441

Original Poster
Rep: Reputation: 30
Change with to without. Does that make it easier to understand?
 
Old 11-02-2007, 09:20 PM   #4
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 5,335

Rep: Reputation: Disabled
No.
This "generate a doinst.sh without actually packaging anything" - it does not make any sense at all. Explain what you want with a clear example.

A doinst.sh script is just something that runs at the end of a package install... usually updating configuration files and such. It is a shell script, and if you want to write a piece of shell script without adding it to a package no one is going to stop you.

Eric
 
Old 11-02-2007, 09:34 PM   #5
binarybob0001
Member
 
Registered: Dec 2004
Distribution: Debian Wheezy
Posts: 441

Original Poster
Rep: Reputation: 30
OK here's and example. You download the ALSA lib tarball. You run
./configure
make
make DESTDIR=/usr/src/build
You cd into the /usr/src/build and you remove the links and make a doinst.sh without actually making a .tgz. That's what I want to do.
 
Old 11-02-2007, 10:16 PM   #6
Stroker
Member
 
Registered: Dec 2006
Location: The Nature Coast
Distribution: Slackware 01001101
Posts: 83

Rep: Reputation: 18
Quote:
Originally Posted by binarybob0001 View Post
OK here's and example. You download the ALSA lib tarball. You run
./configure
make
make DESTDIR=/usr/src/build
You cd into the /usr/src/build and you remove the links and make a doinst.sh without actually making a .tgz. That's what I want to do.
Sure just call the famous mkdoinst command

Contents of /usr/local/sbin/mkdoinst :

#!/bin/sh
#
# Strokers world famous mkdoinst script
# copyleft no rites reserved

makepkg foo.tgz
tar -xvvzf foo.tgz
rm foo.tgz

exit 0
 
Old 11-03-2007, 12:46 AM   #7
binarybob0001
Member
 
Registered: Dec 2004
Distribution: Debian Wheezy
Posts: 441

Original Poster
Rep: Reputation: 30
Thanks a bunch, sorry I was unclear. Writing is not my specialty.
 
Old 11-03-2007, 12:49 AM   #8
binarybob0001
Member
 
Registered: Dec 2004
Distribution: Debian Wheezy
Posts: 441

Original Poster
Rep: Reputation: 30
I don't have that command and google didn't turn up any results. It can't be that famous. Were you being sarcastic.
 
Old 11-03-2007, 01:44 AM   #9
drumz
Member
 
Registered: Apr 2005
Location: Scottsdale, AZ, USA
Distribution: Slackware
Posts: 188

Rep: Reputation: 33
Code:
#!/bin/sh
#
# Strokers world famous mkdoinst script
# copyleft no rites reserved

makepkg foo.tgz
tar -xvvzf foo.tgz
rm foo.tgz

exit 0
That was it. You could try looking at /sbin/makepkg to try seeing how it makes the links for you when you make the package.
 
Old 11-03-2007, 02:48 AM   #10
MS3FGX
Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 351Reputation: 351Reputation: 351Reputation: 351
I still don't see what you actually want to do here.

All makepkg does when creating your doinst.sh is remove the symbolic links from the directory structure, and make a Bash script that will recreate them on the destination machine. Is that what you are looking to do?

Anything else done in a doinst.sh is custom written by the person who packaged the software, and does not follow any preset rules or requirements. It is no different from a normal Bash script, and you can do whatever you please in it.
 
Old 11-03-2007, 03:58 AM   #11
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,772

Rep: Reputation: 478Reputation: 478Reputation: 478Reputation: 478Reputation: 478
src2pkg includes some of the dame code used in makepkg which creates the doinst.sh script, when applicable. As mentioned, all it does is search the contents of the package tree for links and creates a script which will create those links when the package is installed using installpkg. It then removes the actual links from the package tree and inserts the doinst.sh into the package tree before creating the final package by tarring and compressing the contents of the package tree.
drumz method is much simpler, but if you want to see what it does it goes like this:

# make_link_script
make_install_script() {
COUNT=1
LINE="$(sed -n "$COUNT p" $1)"
while [ ! "$LINE" = "" ]; do
LINKGOESIN="$(echo "$LINE" | cut -f 1 -d " ")"
LINKGOESIN="$(dirname $LINKGOESIN)"
LINKNAMEIS="$(echo "$LINE" | cut -f 1 -d ' ')"
LINKNAMEIS="$(basename "$LINKNAMEIS")"
LINKPOINTSTO="$(echo "$LINE" | cut -f 3 -d ' ')"
echo "( cd $LINKGOESIN ; rm -rf $LINKNAMEIS )"
echo "( cd $LINKGOESIN ; ln -sf $LINKPOINTSTO $LINKNAMEIS )"
COUNT=$(expr $COUNT + 1)
LINE="$(sed -n "$COUNT p" $1)"
done
}

#search for links and make link creation script if necessary
make_doinst_links() {
cd $PKG_DIR ;
TMP=/tmp
echo -n $BLUE"Searching for links in the PKG_DIR - "$NORMAL
INST=$(mktemp $TMP/src2pkg.XXXXXX)
# This requires the ls from coreutils-5.0 (or newer):
find . -type l -exec ls -l --time-style=long-iso {} \; | white_out | cut -f 8- -d ' ' | cut -b3- | tee $INST 1> /dev/null
if [ ! "$(cat $INST)" = "" ]; then
echo $GREEN"Done"$NORMAL
# echo -n $BLUE"Making link creation script - "$NORMAL
make_install_script $INST | tee $CWD/doinst.links 1> /dev/null
# echo $GREEN"Done"$NORMAL
else
echo "None found"
fi
rm -f $INST
}
 
Old 11-03-2007, 02:07 PM   #12
binarybob0001
Member
 
Registered: Dec 2004
Distribution: Debian Wheezy
Posts: 441

Original Poster
Rep: Reputation: 30
Thanks guys, I did what you all seemed to be leaning towards, I made my own script. Here it is for anyone who wants my crappy code. It's not well tested but so far it gets the job done.
Code:
GetDir()
{
  i=1
  tmp=`echo $1 | cut -c1 `
  if [ $tmp = "/" ]
  then
    i=2
  fi
  tmp=`echo $1 | cut -f $i -d '/' `
  while [ ! $tmp = " " ]
  do
    dir=$tmp
    i=`expr $i + 1 `
    tmp=`echo $1 | cut -f $i -d '/' `
  done
  name=$dir
  dir=`echo $1 | awk -F"/$dir" ' { print $1 }' `
  return
}

mkdir install
find . -type l -exec ls -l {} \; | while read var
do 
  pertanent=`echo $var | cut -f 8- -d ' ' | cut -b3-`
  linkpath=`echo $pertanent | awk -F" -> " ' { print $1 }' `
  targpath=`echo $pertanent | awk -F" -> " ' { print $2 }' `
  GetDir $linkpath
  rm $linkpath
  echo "( cd $dir ; rm -rf $name )" | tee -a install/doinst.sh
  echo "( cd $dir ; ln -sf $targpath $name)" | tee -a install/doinst.sh
done
Finally, I get the chance to give something back. Thanks again.
 
  


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 syntax (help please) Dark Carnival Slackware 3 01-25-2007 10:08 AM
doinst.sh i need to install packages using command line Clarence27 Zenwalk 2 10-07-2006 08:03 AM
how to generate .so abd_bela Programming 1 01-31-2006 05:12 AM
appending to perllocal.pod via doinst.sh jong357 Slackware 1 10-31-2005 11:48 AM
How to generate ps from texinfo abd_bela Debian 1 05-02-2005 07:58 PM


All times are GMT -5. The time now is 12:13 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