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