summarylogtreecommitdiffstats
path: root/lazylibrarian.install
blob: 5a4698c66a093b12f1f51ad3b8985943a3d38270 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
post_upgrade() {
  if (( $(vercmp "1.5.0-6" "$2") > 0 )); then
    if [[ -f /etc/lazylibrarian/lazylibrarian.ini && ! -f /var/lib/lazylibrarian/lazylibrarian.ini ]]; then
      cp /etc/lazylibrarian/lazylibrarian.ini /var/lib/lazylibrarian/lazylibrarian.ini
      echo "Copied lazylibrarian.ini from /etc/lazylibrarian/ -> /var/lib/lazylibrarian/"
    fi
  fi

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

  if [[ -d /etc/lazylibrarian ]]; then
    echo "Remove /etc/lazylibrarian if everything is working correctly from /var/lib/lazylibrarian now."
  fi
}