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