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