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