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