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