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