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