SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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
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.
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:
#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
}
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.