5 kx #!/bin/sh
5 kx
5 kx # Preserve new files
5 kx install_file() {
5 kx NEW="$1"
5 kx OLD="`dirname $NEW`/`basename $NEW .new`"
5 kx # If there's no file by that name, mv it over:
5 kx if [ ! -r $OLD ]; then
5 kx mv $NEW $OLD
5 kx elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then # toss the redundant copy
5 kx rm $NEW
5 kx fi
5 kx # Otherwise, we leave the .new copy for the admin to consider...
5 kx }
5 kx
5 kx
5 kx # arg 1: the new package version
5 kx pre_install() {
5 kx /bin/true
5 kx }
5 kx
5 kx # arg 1: the new package version
5 kx post_install() {
5 kx ( cd etc
5 kx for dir in init.d rc0.d rc1.d rc2.d rc3.d rc4.d rc5.d rc6.d ; do
5 kx if [ ! -L $dir -a -d $dir ]; then
5 kx mv ${dir} ${dir}.bak
5 kx fi
5 kx done
5 kx )
5 kx ( cd etc ; rm -rf init.d )
5 kx ( cd etc ; ln -sf rc.d/init.d init.d )
5 kx ( cd etc ; rm -rf rc0.d )
5 kx ( cd etc ; ln -sf rc.d/rc0.d rc0.d )
5 kx ( cd etc ; rm -rf rc1.d )
5 kx ( cd etc ; ln -sf rc.d/rc1.d rc1.d )
5 kx ( cd etc ; rm -rf rc2.d )
5 kx ( cd etc ; ln -sf rc.d/rc2.d rc2.d )
5 kx ( cd etc ; rm -rf rc3.d )
5 kx ( cd etc ; ln -sf rc.d/rc3.d rc3.d )
5 kx ( cd etc ; rm -rf rc4.d )
5 kx ( cd etc ; ln -sf rc.d/rc4.d rc4.d )
5 kx ( cd etc ; rm -rf rc5.d )
5 kx ( cd etc ; ln -sf rc.d/rc5.d rc5.d )
5 kx ( cd etc ; rm -rf rc6.d )
5 kx ( cd etc ; ln -sf rc.d/rc6.d rc6.d )
5 kx }
5 kx
5 kx # arg 1: the new package version
5 kx # arg 2: the old package version
5 kx pre_update() {
5 kx /bin/true
5 kx }
5 kx
5 kx # arg 1: the new package version
5 kx # arg 2: the old package version
5 kx post_update() {
5 kx post_install
5 kx }
5 kx
5 kx # arg 1: the old package version
5 kx pre_remove() {
5 kx /bin/true
5 kx }
5 kx
5 kx # arg 1: the old package version
5 kx post_remove() {
5 kx /bin/true
5 kx }
5 kx
5 kx
5 kx operation=$1
5 kx shift
5 kx
5 kx $operation $*