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