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