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