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