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