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