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