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