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