function make_doinst

Main purpose

  1. Create a doinst.sh script for use when the package is installed, if needed.

Notes

Most of the work done by the function used to be done by running the Slackware makepkg, but code was here for adding some flexibility of usage. I finally integrated the needed code from makepkg into src2pkg to simplify things.

This function will first search the current directory(CWD) for any existing doinst.sh file. If one is found it will be inserted into the package tree (PKG_DIR). Otherwise, the PKG_DIR is searched for links. If any are found they are removed from the PKG_DIR and a doinst.sh script is written which will create them when the package is installed with installpkg.
Removal of links can be disabled using MAKE_LINKS=NO, but this is not likely to be needed.

This function provides an easy way to customize and maintain your doinst.sh scripts. It will allow you to add instructions to the file either before or after (or both) the lines which create the links. This is especially useful for maintaining doins.sh files which need added code but also have many link-creation lines which must be updated when the version is upgraded. Placing a file called doinst.prepend in the CWD will cause the contents to be written into the doinst.sh script before the link-creation lines. In the same way, the lines from a doinst.append will be added to the script after the link-creation lines.

In most cases a copy of any doinst.sh created will be placed in the CWD named new.doinst.sh. You should check it very carefully and test-install the package to make sure the doinst.sh is working correctly. If you have supplied a doinst.sh script it will be inserted as-is so make sure that it works correctly by also doing as above.

This function will also insert any slack-requires files found in the CWD into the PKG_DIR, for those of you who build swaret-compliant packages. As a more Slack-like alternative it also includes a routine which will list the library dependencies for any binaries or libraries in the current package tree(PKG_DIR).
You can see this output by using DEBUG=1 or SHOW_DEPS=YES.