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