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