# arg 1: the new package version
pre_install () {
if [ ! -f /sbin/halt-init ]
then
mv /sbin/halt /sbin/halt-init
mv /sbin/shutdown /sbin/shutdown-init
fi
rm -f /sbin/reboot
rm -f /sbin/poweroff
}
pre_upgrade () {
if [ ! -f /sbin/halt-init ]
then
mv /sbin/halt /sbin/halt-init
fi
if [ ! -f /sbin/shutdown-init ]
then
mv /sbin/shutdown /sbin/shutdown-init
fi
rm -f /sbin/reboot
rm -f /sbin/poweroff
}
post_install () {
[ -e /sbin/halt ] || ln -s /sbin/halt.script /sbin/halt
[ -e /sbin/reboot ] || ln -s /sbin/reboot.script /sbin/reboot
[ -e /sbin/poweroff ] || ln -s /sbin/poweroff.script /sbin/poweroff
[ -e /sbin/reboot.init ] || ln -s /sbin/halt-init /sbin/reboot.init
[ -e /sbin/poweroff.init ] || ln -s /sbin/halt-init /sbin/poweroff.init
[ -e /sbin/shutdown ] || ln -s /sbin/shutdown.script /sbin/shutdown
}
# arg 1: the new package version
# arg 2: the old package version
post_upgrade(){
post_install
}
op=$1
shift
$op $*