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