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