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