summaryrefslogtreecommitdiff
path: root/grc/freedesktop/grc_setup_freedesktop.in
blob: 33fc4e1ac6b53439ac4f359b7815ebc23c9b77c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
##################################################
# setup grc on a freedesktop platform
# $1 should be install or uninstall
# $2 is the optional path to the files
# when $2 is unspecified, the path is:
# @SRCDIR@
##################################################

ICON_SIZES="32 48 64 128 256"
MENU_ITEMS="grc usrp2_probe usrp_probe"
if [ -n "$2" ]; then
	SRCDIR="$2"
else
	SRCDIR="@SRCDIR@"
fi

case "$1" in
'install')
	echo "Begin freedesktop install..."
	for size in ${ICON_SIZES}; do \
		echo "Install icon: ${size}x${size}"
		xdg-icon-resource install --context mimetypes --theme gnome --size ${size} ${SRCDIR}/grc-icon-${size}.png application-gnuradio-grc; \
		xdg-icon-resource install --context mimetypes --size ${size} ${SRCDIR}/grc-icon-${size}.png application-gnuradio-grc; \
		xdg-icon-resource install --context apps --theme gnome --size ${size} ${SRCDIR}/grc-icon-${size}.png gnuradio-grc; \
		xdg-icon-resource install --context apps --size ${size} ${SRCDIR}/grc-icon-${size}.png gnuradio-grc; \
	done
	echo "Install mime type"
	xdg-mime install ${SRCDIR}/gnuradio-grc.xml
	echo "Install menu items"
	for menu_item in ${MENU_ITEMS}; do \
		xdg-desktop-menu install ${SRCDIR}/gnuradio-${menu_item}.desktop; \
	done
	echo "Done!"
	echo ""
	;;
'uninstall')
	echo "Begin freedesktop uninstall..."
	for size in ${ICON_SIZES}; do \
		echo "Uninstall icon: ${size}x${size}"
		xdg-icon-resource uninstall --context mimetypes --theme gnome --size ${size} application-gnuradio-grc; \
		xdg-icon-resource uninstall --context mimetypes --size ${size} application-gnuradio-grc; \
		xdg-icon-resource uninstall --context apps --theme gnome --size ${size} gnuradio-grc; \
		xdg-icon-resource uninstall --context apps --size ${size} gnuradio-grc; \
	done
	echo "Uninstall mime type"
	xdg-mime uninstall ${SRCDIR}/gnuradio-grc.xml
	echo "Uninstall menu items"
	for menu_item in ${MENU_ITEMS}; do \
		xdg-desktop-menu uninstall gnuradio-${menu_item}.desktop; \
	done
	echo "Done!"
	echo ""
	;;
*)
	echo "Usage: $0 [install|uninstall]"
	;;
esac