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