420 kx #!/bin/sh
420 kx
420 kx # Preserve new files
420 kx install_file() {
420 kx NEW="$1"
420 kx OLD="`dirname $NEW`/`basename $NEW .new`"
420 kx # If there's no file by that name, mv it over:
420 kx if [ ! -r $OLD ]; then
420 kx mv $NEW $OLD
420 kx elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then # toss the redundant copy
420 kx rm $NEW
420 kx fi
420 kx # Otherwise, we leave the .new copy for the admin to consider...
420 kx }
420 kx
420 kx
420 kx # arg 1: the new package version
420 kx pre_install() {
420 kx /bin/true
420 kx }
420 kx
420 kx # arg 1: the new package version
420 kx post_install() {
420 kx # If there is a known buggy certwatch script with no local modifications, just replace it:
420 kx if [ "$(md5sum etc/cron.daily/certwatch 2> /dev/null)" = "f4cf63e557820781f40c4cac67a44d77 etc/cron.daily/certwatch" ]; then
420 kx cat etc/cron.daily/certwatch.new > etc/cron.daily/certwatch
420 kx touch -r etc/cron.daily/certwatch.new etc/cron.daily/certwatch
420 kx fi
420 kx
420 kx install_file etc/ssl/openssl.cnf.new
420 kx install_file etc/cron.daily/certwatch.new
420 kx
420 kx # Rehash certificates if the package is upgraded on a running system:
420 kx # Note that we have to be sure that we are on the working system
420 kx # on the target hardware ("proc/sys/kernel/osrelease" - relative path).
420 kx if [ -r proc/sys/kernel/osrelease -a -x /usr/bin/c_rehash ]; then
420 kx /usr/bin/c_rehash 1> /dev/null 2> /dev/null
420 kx fi
420 kx }
420 kx
420 kx # arg 1: the new package version
420 kx # arg 2: the old package version
420 kx pre_update() {
420 kx /bin/true
420 kx }
420 kx
420 kx # arg 1: the new package version
420 kx # arg 2: the old package version
420 kx post_update() {
420 kx post_install
420 kx }
420 kx
420 kx # arg 1: the old package version
420 kx pre_remove() {
420 kx /bin/true
420 kx }
420 kx
420 kx # arg 1: the old package version
420 kx post_remove() {
420 kx /bin/true
420 kx }
420 kx
420 kx
420 kx operation=$1
420 kx shift
420 kx
420 kx $operation $*