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