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