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