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