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