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