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