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