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