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