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