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