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