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