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