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