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