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