You can add commands between any of the normal instructions. Usually, it's handy to put them just after fake_install -unless the commands are meant to undo something that is done automatically. The routines after fake_install do a lot of perms checking which may be beneficial, but if you are making 'unusual' directories it won't catch them. You sometimes need or want to clean up or add to what is done with the man-pages and docs. Very commonly, you'll want to add some arbitrary docs to the package.
src2pkg provides convenient 'shortcut' variables for the most commonly used locations: $CWD is the loaction where src2pkg is run from, $SRC_DIR is the location of the unpacked sources. $PKG_DIR is the toplevel of the package tree where everything gets assembled before compressing the final package. You can also use $DOC_DIR -this is the full path to the docs, normally: $PKG_DIR/usr/doc/$NAME-$VERSION
So, say you want to copy some html files from the working dir into the docs:
cp $CWD/*.html $DOC_DIR
will do the trick if you put it after the normal docs are done. If you do it before, be sure to create the directory first:
mkdir -p $DOC_DIR
cp $CWD/*.html $DOC_DIR
If you need to copy stuff from the sources into the package:
mkdir -p $PKG_DIR/opt/squid/stuff
cp $SRC_DIR/somedir/oddfile $PKG_DIR/opt/squid/stuff
Mostly, stuff like this:
chown -R nobody.nogroup /opt/squid/var/cache
chown -R nobody.nogroup /opt/squid/var/logs
should go in your doinst.sh script.
And it should be very 'safe' and correct by using grep to make sure that it is necessary:
Code:
if ! [ $(grep squid /etc/passwd) ] ; then
echo "Be sure to run 'htpasswd -c /opt/squid/etc/squidpwd user-name' "
echo "to enable a user for squid."
if ! [ $(grep '/opt/squid/var/logs' /etc/rc.d/rc.local) ] ; then
echo "Add startup info to rc"
echo "rm /opt/squid/var/logs/*.pid" >> /etc/rc.d/rc.local
echo "/opt/squid/sbin/squid" >> /etc/rc.d/rc.local
fi
fi
That's just a quick example which is not completely correct. But it gives you the idea. Study some of the doinst.sh scripts from Alien Bob Robby Workman or Pat Volkerding for more sane examples.
Actually, I have a build of squid which may help you out -it has not been tested, but some of the ideas or code came from someone who was actually using the program. Anyway, the build shows a fairly complete example of how to do a complex setup using src2pkg. See here:
http://distro.ibiblio.org/pub/linux/...-2.6.stable17/
The still-unreleased development version of src2pkg does even more for you seamlessly. But what you are using can automatically handle rc.d files for you. In other words, if you write a good rc.d/rc.$NAME file, all you have to do is place it in the $CWD and it will automatically be added to the package, plus src2pkg will add lines to the doinst.sh which take care of writing the entry in rc.local when the package is installed.
FWIW, src2pkg also does the same thing wiith png or xpm icons, desktop files and others -just placing them in CWD causes them to be placed in the package. the new version does lots more of this and better -I promise I'm gonna release pretty soon as it has been a long time...
Oh, and yes, if you need to use multiple 'rules' with make just add them with:
-m='make deps all'
or
-i='make install install_data'