92 kx #!/bin/sh
92 kx
92 kx # Preserve new files
92 kx install_file() {
92 kx NEW="$1"
92 kx OLD="`dirname $NEW`/`basename $NEW .new`"
92 kx # If there's no file by that name, mv it over:
92 kx if [ ! -r $OLD ]; then
92 kx mv $NEW $OLD
92 kx elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then # toss the redundant copy
92 kx rm $NEW
92 kx fi
92 kx # Otherwise, we leave the .new copy for the admin to consider...
92 kx }
92 kx
92 kx
92 kx # arg 1: the new package version
92 kx pre_install() {
92 kx /bin/true
92 kx }
92 kx
92 kx # arg 1: the new package version
92 kx post_install() {
92 kx for file in etc/sane.d/*.new ; do
92 kx install_file $file
92 kx done
92 kx
92 kx # If the netdev and avahi groups don't exist, add them
92 kx if ! grep "^scanner:" etc/group >/dev/null 2>&1; then
92 kx echo "scanner:x:93:" >>etc/group
92 kx fi
92 kx }
92 kx
92 kx # arg 1: the new package version
92 kx # arg 2: the old package version
92 kx pre_update() {
92 kx /bin/true
92 kx }
92 kx
92 kx # arg 1: the new package version
92 kx # arg 2: the old package version
92 kx post_update() {
92 kx post_install
92 kx }
92 kx
92 kx # arg 1: the old package version
92 kx pre_remove() {
92 kx /bin/true
92 kx }
92 kx
92 kx # arg 1: the old package version
92 kx post_remove() {
92 kx /bin/true
92 kx }
92 kx
92 kx
92 kx operation=$1
92 kx shift
92 kx
92 kx $operation $*