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