summarylogtreecommitdiffstats
path: root/jackett.install
blob: 7864f54f41f836eeae30e67abecbf343a521d47e (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
post_upgrade() {
  if (( $(vercmp "0.8.749-2" "$2") > 0 )); then
    if [[ -d /usr/share/Jackett/.config/Jackett && ! -f /var/lib/jackett/ServerConfig.json ]]; then
      cp -a /usr/share/Jackett/.config/Jackett/* /var/lib/jackett/
      echo "Copied config and db from /usr/share/Jackett/.config/Jackett/ -> /var/lib/jackett/"
    fi

    if [[ -d /usr/share/Jackett/.config/.mono && ! -d /var/lib/jackett/.mono ]]; then
      cp -a /usr/share/Jackett/.config/.mono /var/lib/jackett/
      echo "Copied mono configs from /usr/share/Jackett/.config/.mono -> /var/lib/jackett/"
    fi
  fi

  if [[ "$( getent passwd jackett | cut -d: -f6 )" != "/var/lib/jackett" ]]; then
    usermod -d /var/lib/jackett jackett
    if [[ $? -ne 0 ]]; then
      echo "Could not change jackett users home directory."
      echo "Run: sudo systemctl stop jackett ; sudo usermod -d /var/lib/jackett jackett ; sudo systemctl start jackett"
    fi
  fi

  if [[ -d /usr/share/Jackett/ ]]; then
    echo "Remove /usr/share/Jackett if everything is working correctly from /var/lib/jackett now."
  fi
}