278 kx #!/bin/sh
278 kx
278 kx # Preserve new files
278 kx install_file() {
278 kx NEW="$1"
278 kx OLD="`dirname $NEW`/`basename $NEW .new`"
278 kx # If there's no file by that name, mv it over:
278 kx if [ ! -r $OLD ]; then
278 kx mv $NEW $OLD
278 kx elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then # toss the redundant copy
278 kx rm $NEW
278 kx fi
278 kx # Otherwise, we leave the .new copy for the admin to consider...
278 kx }
278 kx
278 kx
278 kx # arg 1: the new package version
278 kx pre_install() {
278 kx /bin/true
278 kx }
278 kx
278 kx # arg 1: the new package version
278 kx post_install() {
278 kx # Update desktop database
278 kx if [ -x /usr/bin/update-desktop-database ]; then
278 kx /usr/bin/update-desktop-database -q usr/share/applications > /dev/null 2>&1
278 kx fi
278 kx
278 kx # Recompile glib schemas:
278 kx if [ -e usr/share/glib-2.0/schemas ] ; then
278 kx if [ -r proc/sys/kernel/osrelease -a -x usr/bin/glib-compile-schemas ] ; then
278 kx chroot . /usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas/ 1> /dev/null 2> /dev/null
278 kx fi
278 kx fi
278 kx
278 kx if [ -e usr/share/icons/hicolor/icon-theme.cache ] ; then
278 kx if [ -r proc/sys/kernel/osrelease -a -x /usr/bin/gtk-update-icon-cache ] ; then
278 kx /usr/bin/gtk-update-icon-cache -f usr/share/icons/hicolor 1> /dev/null 2> /dev/null
278 kx fi
278 kx fi
278 kx }
278 kx
278 kx # arg 1: the new package version
278 kx # arg 2: the old package version
278 kx pre_update() {
278 kx /bin/true
278 kx }
278 kx
278 kx # arg 1: the new package version
278 kx # arg 2: the old package version
278 kx post_update() {
278 kx post_install
278 kx }
278 kx
278 kx # arg 1: the old package version
278 kx pre_remove() {
278 kx /bin/true
278 kx }
278 kx
278 kx # arg 1: the old package version
278 kx post_remove() {
278 kx /bin/true
278 kx }
278 kx
278 kx
278 kx operation=$1
278 kx shift
278 kx
278 kx $operation $*