summarylogtreecommitdiffstats
path: root/sickrage-pip.install
blob: 82fba20b87f34e24190a30fe31d810a153d8ae58 (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
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
  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
  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 --clear --no-download --no-wheel --no-pip /opt/sickrage

  echo "==> Some files in /opt/sickrage may not have been removed."

  # 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"
}