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