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