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