db65064524577a859218760b26e3d5b9efbda6a6
[debian/gnuradio] / grc / freedesktop / grc_setup_freedesktop.in
1 #!/bin/bash
2 ##################################################
3 # setup grc on a freedesktop platform
4 # $1 should be install or uninstall
5 # $2 is the optional path to the files
6 # when $2 is unspecified, the path is:
7 # @SRCDIR@
8 ##################################################
9
10 ICON_SIZES="32 48 64 128 256"
11 MENU_ITEMS="grc usrp2_probe usrp_probe"
12 if [ -n "$2" ]; then
13         SRCDIR="$2"
14 else
15         SRCDIR="@SRCDIR@"
16 fi
17
18 case "$1" in
19 'install')
20         echo "Begin freedesktop install..."
21         for size in ${ICON_SIZES}; do \
22                 echo "Install icon: ${size}x${size}"
23                 xdg-icon-resource install --noupdate --context mimetypes --theme gnome --size ${size} ${SRCDIR}/grc-icon-${size}.png application-gnuradio-grc; \
24                 xdg-icon-resource install --noupdate --context mimetypes --size ${size} ${SRCDIR}/grc-icon-${size}.png application-gnuradio-grc; \
25                 xdg-icon-resource install --noupdate --context apps --theme gnome --size ${size} ${SRCDIR}/grc-icon-${size}.png gnuradio-grc; \
26                 xdg-icon-resource install --noupdate --context apps --size ${size} ${SRCDIR}/grc-icon-${size}.png gnuradio-grc; \
27         done
28         xdg-icon-resource forceupdate
29         echo "Install mime type"
30         xdg-mime install ${SRCDIR}/gnuradio-grc.xml
31         echo "Install menu items"
32         for menu_item in ${MENU_ITEMS}; do \
33                 xdg-desktop-menu install ${SRCDIR}/gnuradio-${menu_item}.desktop; \
34         done
35         echo "Done!"
36         echo ""
37         ;;
38 'uninstall')
39         echo "Begin freedesktop uninstall..."
40         for size in ${ICON_SIZES}; do \
41                 echo "Uninstall icon: ${size}x${size}"
42                 xdg-icon-resource uninstall --context mimetypes --theme gnome --size ${size} application-gnuradio-grc; \
43                 xdg-icon-resource uninstall --context mimetypes --size ${size} application-gnuradio-grc; \
44                 xdg-icon-resource uninstall --context apps --theme gnome --size ${size} gnuradio-grc; \
45                 xdg-icon-resource uninstall --context apps --size ${size} gnuradio-grc; \
46         done
47         echo "Uninstall mime type"
48         xdg-mime uninstall ${SRCDIR}/gnuradio-grc.xml
49         echo "Uninstall menu items"
50         for menu_item in ${MENU_ITEMS}; do \
51                 xdg-desktop-menu uninstall gnuradio-${menu_item}.desktop; \
52         done
53         echo "Done!"
54         echo ""
55         ;;
56 *)
57         echo "Usage: $0 [install|uninstall]"
58         ;;
59 esac