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