373 kx #!/bin/sh
373 kx
373 kx # Preserve new files
373 kx install_file() {
373 kx NEW="$1"
373 kx OLD="`dirname $NEW`/`basename $NEW .new`"
373 kx # If there's no file by that name, mv it over:
373 kx if [ ! -r $OLD ]; then
373 kx mv $NEW $OLD
373 kx elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then # toss the redundant copy
373 kx rm $NEW
373 kx fi
373 kx # Otherwise, we leave the .new copy for the admin to consider...
373 kx }
373 kx
373 kx preserve_perms() {
373 kx NEW="$1"
373 kx OLD="$(dirname $NEW)/$(basename $NEW .new)"
373 kx if [ -e $OLD ]; then
373 kx cp -a $OLD ${NEW}.incoming
373 kx cat $NEW > ${NEW}.incoming
373 kx touch -r $NEW ${NEW}.incoming
373 kx mv ${NEW}.incoming $NEW
373 kx fi
373 kx install_file $NEW
373 kx }
373 kx
373 kx
373 kx # arg 1: the new package version
373 kx pre_install() {
373 kx /bin/true
373 kx }
373 kx
373 kx # arg 1: the new package version
373 kx post_install() {
373 kx /bin/true
373 kx }
373 kx
373 kx # arg 1: the new package version
373 kx # arg 2: the old package version
373 kx pre_update() {
373 kx /bin/true
373 kx }
373 kx
373 kx # arg 1: the new package version
373 kx # arg 2: the old package version
373 kx post_update() {
373 kx post_install
373 kx }
373 kx
373 kx # arg 1: the old package version
373 kx pre_remove() {
373 kx /bin/true
373 kx }
373 kx
373 kx # arg 1: the old package version
373 kx post_remove() {
373 kx /bin/true
373 kx }
373 kx
373 kx
373 kx operation=$1
373 kx shift
373 kx
373 kx $operation $*