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