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