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