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