summarylogtreecommitdiffstats
path: root/stremio.install
blob: 8cc991f1137f7fdd014b8e720e50591adda07a9c (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
set -e

setup_icons() {
	cd /opt/stremio/icons
	regex="([^_]+)_([0-9]+).png$"
	for file in *.png
	do
		if [[ $file  =~ $regex ]]
		then
			icon="${BASH_REMATCH[1]##*/}"
			size="${BASH_REMATCH[2]}"
			case "$1" in
				install)
					echo xdg-icon-resource install --context apps --size "$size" "$file" "$icon"
					;;
				uninstall)
					echo xdg-icon-resource uninstall --context apps --size "$size" "$icon"
					;;
				*)
					exit 1
					;;
			esac
		fi
	done
}

post_install() {
	ln -s /opt/stremio/stremio /usr/bin/stremio

	xdg-desktop-menu install --mode system /opt/stremio/smartcode-stremio.desktop

	setup_icons install
}

pre_remove() {
	rm -f /usr/bin/stremio

	xdg-desktop-menu uninstall --mode system /opt/stremio/smartcode-stremio.desktop

	setup_icons uninstall
}