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