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