postinst.include revision 868fa2fe829687343ffae624259930155e16dbd8
1# Add icons to the system icons 2XDG_ICON_RESOURCE="`which xdg-icon-resource 2> /dev/null`" 3if [ ! -x "$XDG_ICON_RESOURCE" ]; then 4 echo "Error: Could not find xdg-icon-resource" >&2 5 exit 1 6fi 7for icon in "@@INSTALLDIR@@/product_logo_"*.png; do 8 size="${icon##*/product_logo_}" 9 "$XDG_ICON_RESOURCE" install --size "${size%.png}" "$icon" "@@PACKAGE@@" 10done 11 12# Add an entry to the system menu 13XDG_DESKTOP_MENU="`which xdg-desktop-menu 2> /dev/null`" 14UPDATE_MENUS="`which update-menus 2> /dev/null`" 15if [ ! -x "$XDG_DESKTOP_MENU" ]; then 16 echo "Error: Could not find xdg-desktop-menu" >&2 17 exit 1 18fi 19"$XDG_DESKTOP_MENU" install @@INSTALLDIR@@/@@PACKAGE@@.desktop 20 21if [ -x "$UPDATE_MENUS" ]; then 22 update-menus 23fi 24 25# This function uses sed to insert the contents of one file into another file, 26# after the first line matching a given regular expression. If there is no 27# matching line, then the file is unchanged. 28insert_after_first_match() { 29 # $1: file to update 30 # $2: regular expression 31 # $3: file to insert 32 sed -i -e "1,/$2/ { 33 /$2/ r $3 34 }" "$1" 35} 36 37# If /usr/share/gnome-control-center/gnome-default-applications.xml exists, it 38# may need to be updated to add ourselves to the default applications list. If 39# we find the file and it does not seem to contain our patch already (the patch 40# is safe to leave even after uninstall), update it. 41GNOME_DFL_APPS=/usr/share/gnome-control-center/gnome-default-applications.xml 42if [ -f "$GNOME_DFL_APPS" ]; then 43# Conditionally insert the contents of the file "default-app-block" after the 44# first "<web-browsers>" line we find in gnome-default-applications.xml 45 fgrep -q "@@MENUNAME@@" "$GNOME_DFL_APPS" || insert_after_first_match \ 46 "$GNOME_DFL_APPS" \ 47 "^[ ]*<web-browsers>[ ]*$" \ 48 "@@INSTALLDIR@@/default-app-block" 49fi 50