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