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