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