331 kx #!/bin/sh
331 kx
331 kx # Preserve new files
331 kx install_file() {
331 kx NEW="$1"
331 kx OLD="`dirname $NEW`/`basename $NEW .new`"
331 kx # If there's no file by that name, mv it over:
331 kx if [ ! -r $OLD ]; then
331 kx mv $NEW $OLD
331 kx elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then # toss the redundant copy
331 kx rm $NEW
331 kx fi
331 kx # Otherwise, we leave the .new copy for the admin to consider...
331 kx }
331 kx
331 kx preserve_perms() {
331 kx NEW="$1"
331 kx OLD="$(dirname $NEW)/$(basename $NEW .new)"
331 kx if [ -e $OLD ]; then
331 kx cp -a $OLD ${NEW}.incoming
331 kx cat $NEW > ${NEW}.incoming
331 kx mv ${NEW}.incoming $NEW
331 kx fi
331 kx install_file $NEW
331 kx }
331 kx
331 kx
331 kx # arg 1: the new package version
331 kx pre_install() {
331 kx /bin/true
331 kx }
331 kx
331 kx # arg 1: the new package version
331 kx post_install() {
331 kx preserve_perms etc/rc.d/rc.avahidaemon.new
331 kx preserve_perms etc/rc.d/rc.avahidnsconfd.new
331 kx preserve_perms etc/avahi/avahi-daemon.conf.new
331 kx
331 kx # Try to run these. If they fail, no biggie.
331 kx # Also we have to be sure that we are on the working system
331 kx # on the target hardware ("proc/sys/kernel/osrelease" - relative path).
331 kx if [ -r proc/sys/kernel/osrelease -a -x /usr/bin/update-desktop-database ] ; then
331 kx /usr/bin/update-desktop-database -q usr/share/applications 1> /dev/null 2> /dev/null
331 kx fi
331 kx
331 kx # Reload messagebus daemon:
334 kx if [ -r proc/sys/kernel/osrelease -a ! -r /etc/system-installer -a -x etc/rc.d/rc.messagebus ] ; then
331 kx chroot . /etc/rc.d/rc.messagebus reload 1> /dev/null 2> /dev/null
331 kx fi
331 kx }
331 kx
331 kx # arg 1: the new package version
331 kx # arg 2: the old package version
331 kx pre_update() {
331 kx /bin/true
331 kx }
331 kx
331 kx # arg 1: the new package version
331 kx # arg 2: the old package version
331 kx post_update() {
331 kx post_install
331 kx }
331 kx
331 kx # arg 1: the old package version
331 kx pre_remove() {
331 kx /bin/true
331 kx }
331 kx
331 kx # arg 1: the old package version
331 kx post_remove() {
331 kx /bin/true
331 kx }
331 kx
331 kx
331 kx operation=$1
331 kx shift
331 kx
331 kx $operation $*