371 kx #!/bin/sh
371 kx
371 kx # Preserve new files
371 kx install_file() {
371 kx NEW="$1"
371 kx OLD="`dirname $NEW`/`basename $NEW .new`"
371 kx # If there's no file by that name, mv it over:
371 kx if [ ! -r $OLD ]; then
371 kx mv $NEW $OLD
371 kx elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then # toss the redundant copy
371 kx rm $NEW
371 kx fi
371 kx # Otherwise, we leave the .new copy for the admin to consider...
371 kx }
371 kx
371 kx
371 kx # arg 1: the new package version
371 kx pre_install() {
371 kx /bin/true
371 kx }
371 kx
371 kx # arg 1: the new package version
371 kx post_install() {
371 kx install_file etc/profile.d/libreoffice.csh.new
371 kx install_file etc/profile.d/libreoffice.sh.new
371 kx
371 kx # Update desktop database
371 kx if [ -x /usr/bin/update-desktop-database ]; then
371 kx /usr/bin/update-desktop-database -q usr/share/applications > /dev/null 2>&1
371 kx fi
371 kx
371 kx # Notice we use an absolute path below, rather than usr/bin/update-mime-database.
371 kx # This is because we're testing to see if we are on the bootdisk, which will not
371 kx # have /usr/bin/update-mime-database.
371 kx # The presence of "/etc/system-installer" is under consideration as a better test.
371 kx # Also we have to check that we are not in the installer mode on the target system
371 kx # ("/etc/system-installer"), and we have to be sure that we are on the working system
371 kx # on the target hardware ("proc/sys/kernel/osrelease" - relative path).
371 kx if [ -r proc/sys/kernel/osrelease -a ! -r /etc/system-installer -a -x /usr/bin/update-mime-database ]; then
371 kx /usr/bin/update-mime-database /usr/share/mime 1>/dev/null 2>/dev/null
371 kx cat /etc/passwd | while read passwdline ; do
371 kx homedir=$(echo $passwdline | cut -f 6 -d :)
371 kx if [ -d $homedir/.local/share/mime ]; then
371 kx username=$(echo $passwdline | cut -f 1 -d :)
371 kx su $username -c "/usr/bin/update-mime-database $homedir/.local/share/mime 1>/dev/null 2>/dev/null" 2> /dev/null
371 kx fi
371 kx done
371 kx # This is just "cleanup" in case something might be missed in /home/*/
371 kx for homemimedir in /home/*/.local/share/mime ; do
371 kx if [ -d $homemimedir ]; then
371 kx username=$(echo $homemimedir | cut -f 3 -d /)
371 kx su $username -c "/usr/bin/update-mime-database $homemimedir 1>/dev/null 2>/dev/null" 2> /dev/null
371 kx fi
371 kx done
371 kx else
371 kx # We are not on the target system and we can make use build-machine's utility
371 kx if [ -x /usr/bin/update-mime-database ] ; then
371 kx update-mime-database usr/share/mime 1>/dev/null 2>/dev/null
371 kx fi
371 kx fi
371 kx
371 kx if [ -e usr/share/icons/hicolor/icon-theme.cache ]; then
371 kx if [ -x /usr/bin/gtk-update-icon-cache ]; then
371 kx /usr/bin/gtk-update-icon-cache usr/share/icons/hicolor > /dev/null 2>&1
371 kx fi
371 kx fi
371 kx }
371 kx
371 kx # arg 1: the new package version
371 kx # arg 2: the old package version
371 kx pre_update() {
371 kx /bin/true
371 kx }
371 kx
371 kx # arg 1: the new package version
371 kx # arg 2: the old package version
371 kx post_update() {
371 kx post_install
371 kx }
371 kx
371 kx # arg 1: the old package version
371 kx pre_remove() {
371 kx /bin/true
371 kx }
371 kx
371 kx # arg 1: the old package version
371 kx post_remove() {
371 kx /bin/true
371 kx }
371 kx
371 kx
371 kx operation=$1
371 kx shift
371 kx
371 kx $operation $*