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