ab4ce82ef883c20ee5238a3acca407b5a793b59c
[debian/gnuradio] / grc / freedesktop / grc_setup_freedesktop.in
1 #!/bin/bash
2 #
3 # Copyright 2008, 2009, 2010 Free Software Foundation, Inc.
4 #
5 # This file is part of GNU Radio
6 #
7 # GNU Radio is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3, or (at your option)
10 # any later version.
11 #
12 # GNU Radio is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with GNU Radio; see the file COPYING.  If not, write to
19 # the Free Software Foundation, Inc., 51 Franklin Street,
20 # Boston, MA 02110-1301, USA.
21 #
22 ##################################################
23 # setup grc on a freedesktop platform
24 # $1 should be install or uninstall
25 # $2 is the optional path to the files
26 # when $2 is unspecified, the path is:
27 # @SRCDIR@
28 ##################################################
29
30 ICON_SIZES="32 48 64 128 256"
31 MENU_ITEMS="grc usrp2_probe usrp_probe"
32 if [ -n "$2" ]; then
33         SRCDIR="$2"
34 else
35         SRCDIR="@SRCDIR@"
36 fi
37
38 case "$1" in
39 'install')
40         echo "Begin freedesktop install..."
41         for size in ${ICON_SIZES}; do \
42                 echo "Install icon: ${size}x${size}"
43                 xdg-icon-resource install --noupdate --context mimetypes --theme gnome --size ${size} ${SRCDIR}/grc-icon-${size}.png application-gnuradio-grc; \
44                 xdg-icon-resource install --noupdate --context mimetypes --size ${size} ${SRCDIR}/grc-icon-${size}.png application-gnuradio-grc; \
45                 xdg-icon-resource install --noupdate --context apps --theme gnome --size ${size} ${SRCDIR}/grc-icon-${size}.png gnuradio-grc; \
46                 xdg-icon-resource install --noupdate --context apps --size ${size} ${SRCDIR}/grc-icon-${size}.png gnuradio-grc; \
47         done
48         xdg-icon-resource forceupdate
49         echo "Install mime type"
50         xdg-mime install ${SRCDIR}/gnuradio-grc.xml
51         echo "Install menu items"
52         for menu_item in ${MENU_ITEMS}; do \
53                 xdg-desktop-menu install ${SRCDIR}/gnuradio-${menu_item}.desktop; \
54         done
55         echo "Done!"
56         echo ""
57         ;;
58 'uninstall')
59         echo "Begin freedesktop uninstall..."
60         for size in ${ICON_SIZES}; do \
61                 echo "Uninstall icon: ${size}x${size}"
62                 xdg-icon-resource uninstall --noupdate --context mimetypes --theme gnome --size ${size} application-gnuradio-grc; \
63                 xdg-icon-resource uninstall --noupdate --context mimetypes --size ${size} application-gnuradio-grc; \
64                 xdg-icon-resource uninstall --noupdate --context apps --theme gnome --size ${size} gnuradio-grc; \
65                 xdg-icon-resource uninstall --noupdate --context apps --size ${size} gnuradio-grc; \
66         done
67         xdg-icon-resource forceupdate
68         echo "Uninstall mime type"
69         xdg-mime uninstall ${SRCDIR}/gnuradio-grc.xml
70         echo "Uninstall menu items"
71         for menu_item in ${MENU_ITEMS}; do \
72                 xdg-desktop-menu uninstall gnuradio-${menu_item}.desktop; \
73         done
74         echo "Done!"
75         echo ""
76         ;;
77 *)
78         echo "Usage: $0 [install|uninstall]"
79         ;;
80 esac