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