summarylogtreecommitdiffstats
path: root/sickgear.install
blob: fe3f623bcdcbac9f94be7e19b8c16ec892c2a6a1 (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
59
60
61
62
63
64
post_install() {
	systemd-sysusers sickgear.conf
	systemd-tmpfiles --create sickgear.conf

	if [ ! -d /opt/sickgear/data ]; then
		mkdir -p -m 755 /opt/sickgear/data &> /dev/null

cat << 'EOM'

==> In order to start SickGear, you must issue the following command:

	systemctl start sickgear.service

==> To have SickGear start automatically on system startup and after
==> version upgrades, also issue the following command:
	
	systemctl enable sickgear.service

==> Once started, SickGear can be accessed by navigating your browser to:

	http://localhost:8081/

EOM
	fi

	chown -R sickgear:sickgear /opt/sickgear &> /dev/null
}

pre_upgrade() {
	if systemctl is-active sickgear.service &> /dev/null; then
		systemctl stop sickgear.service &> /dev/null
	fi
}

post_upgrade() {
	post_install
	systemctl daemon-reload &> /dev/null

	if systemctl is-enabled sickgear.service &> /dev/null; then
		systemctl start sickgear.service
	fi
}

pre_remove() {
	pre_upgrade

	if systemctl is-enabled sickgear.service &> /dev/null; then
		systemctl disable sickgear.service &> /dev/null
	fi
}

post_remove() {
	if ! rmdir /opt/sickgear/data &> /dev/null; then
cat << 'EOM'

==> Data directory has not been removed since it contains files.
==> If you no longer want your show data, you may removing it by issuing 
==> the following command:

	rm -rf /opt/sickgear

EOM
	fi
}