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