From SlackWiki
Jump to navigation Jump to search

This script is usually included under ./install within Slackware packages and contains post-install actions.

Usually automatically created by makepkg for cleaning up and recreating symbolic links, advanced packagers may wish to include further configuration instructions here to be executed after files have been extracted from the .tgz package.


Within packages, is located in install/.

After installation, the scripts are placed in /var/log/scripts, and renamed into the package name.


Handling symbolic links

The package 'udev-064-i486-2' (from Slackware 10.2), contains a script which includes the following:

( cd etc/hotplug.d/default ; rm -rf 10-udev.hotplug )
( cd etc/hotplug.d/default ; ln -sf /sbin/udevsend 10-udev.hotplug )
( cd usr/man/man8 ; rm -rf udevsend.8.gz )
( cd usr/man/man8 ; ln -sf udevd.8.gz udevsend.8.gz )

Thus, during installation of this package, it will delete 'etc/hotplug.d/default/10-udev.hotplug' and 'usr/man/man8/udevsend.8.gz', then immediately recreate them using symbolic links.

This part of scripts is the most common, and is almost always generated by makepkg automatically during the creation of the package. In fact, 'makepkg' strongly suggests handling symbolic links using the script this way.

Configuration Files

The package 'vim-7.0.109-i486-1' (from Slackware 11.0), contains a script which includes the following:

config() {
 OLD="$(dirname $NEW)/$(basename $NEW .new)"
 # If there's no config file by that name, mv it over:
 if [ ! -r $OLD ]; then
   mv $NEW $OLD
 elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then # toss the redundant copy
   rm $NEW
 # Otherwise, we leave the .new copy for the admin to consider...
config usr/share/vim/

The config() function checks whether the configuration file in the package (vimrc) already exists on the system, or is exactly the same as the new one included in the package; if it exists and is not the same as the package's copy, it will not overwrite the old one but instead will be copied with a .new file extension (

This is a common, and the preferred, way of dealing with configuration files in Slackware packages.

See Also