268 kx #!/bin/sh
268 kx
268 kx # Preserve new files
268 kx install_file() {
268 kx NEW="$1"
268 kx OLD="`dirname $NEW`/`basename $NEW .new`"
268 kx # If there's no file by that name, mv it over:
268 kx if [ ! -r $OLD ]; then
268 kx mv $NEW $OLD
268 kx elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then # toss the redundant copy
268 kx rm $NEW
268 kx fi
268 kx # Otherwise, we leave the .new copy for the admin to consider...
268 kx }
268 kx
268 kx
268 kx # arg 1: the new package version
268 kx pre_install() {
268 kx /bin/true
268 kx }
268 kx
268 kx # arg 1: the new package version
268 kx post_install() {
268 kx # Try to run these. If they fail, no biggie.
268 kx # Also we have to be sure that we are on the working system
268 kx # on the target hardware ("proc/sys/kernel/osrelease" - relative path).
268 kx if [ -r proc/sys/kernel/osrelease -a -x /usr/bin/update-desktop-database ] ; then
268 kx /usr/bin/update-desktop-database -q usr/share/applications 1> /dev/null 2> /dev/null
268 kx fi
268 kx }
268 kx
268 kx # arg 1: the new package version
268 kx # arg 2: the old package version
268 kx pre_update() {
268 kx /bin/true
268 kx }
268 kx
268 kx # arg 1: the new package version
268 kx # arg 2: the old package version
268 kx post_update() {
268 kx post_install
268 kx }
268 kx
268 kx # arg 1: the old package version
268 kx pre_remove() {
268 kx /bin/true
268 kx }
268 kx
268 kx # arg 1: the old package version
268 kx post_remove() {
268 kx /bin/true
268 kx }
268 kx
268 kx
268 kx operation=$1
268 kx shift
268 kx
268 kx $operation $*