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