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