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