blob: b487c4bcf9686e08d0a706174995497500f7eb4e (
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
|
_patch_pip_path() {
find /opt/sickrage/lib/python*/site-packages/sickrage -name "*.py" -exec \
sed -i "s|\('pip_path'.*\)'pip'|\1'/opt/sickrage/bin/pip2'|" '{}' \;
}
post_install() {
systemd-sysusers sickrage.conf
systemd-tmpfiles --create sickgear.conf
mkdir /opt/sickrage
chown -R sickrage:sickrage /opt/sickrage
sudo -u sickrage virtualenv2 /opt/sickrage
sudo -u sickrage /opt/sickrage/bin/pip2 install --isolated sickrage lxml pyopenssl
_patch_pip_path
echo "==> Start and enable sickrage.service. Then visit http://localhost:8081/"
}
post_upgrade() {
if [ ! -d /opt/sickrage ]; then
post_install $1
else
sudo -u sickrage /opt/sickrage/bin/pip2 install --isolated --upgrade sickrage lxml pyopenssl
_patch_pip_path
fi
}
post_remove() {
sudo -u sickrage /opt/sickrage/bin/pip2 uninstall --isolated --yes $(/opt/sickrage/bin/pip2 list --isolated | awk '{ print $1 }')
systemctl --quiet is-active sickrage.service
if [ $? -eq 0 ]; then
systemctl stop sickrage.service
fi
sudo -u sickrage virtualenv2 --no-wheel --no-setuptools --no-pip --clear --no-download /opt/sickrage
echo -e "\n==> Some files in /opt/sickrage may not have been removed.\n"
# Do not delete the 'sickrage' user automatically. It may still own files.
# If 'sickrage' is the only user in group 'sickrage', then the group will also be deleted.
echo "==> To delete the 'sickrage' user, run as root: userdel --force sickrage"
}
|