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