2015-06-20 03:56:05 +02:00
|
|
|
post_install() {
|
2018-03-13 23:03:44 +01:00
|
|
|
chown -R jackett: /usr/lib/jackett /var/lib/jackett
|
2015-06-20 03:56:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
post_upgrade() {
|
2018-03-13 23:03:44 +01:00
|
|
|
# At version 0.8.749-2 we moved configs to /var/lib/jackett, so
|
|
|
|
# migrate old config directory.
|
|
|
|
if [[ $(vercmp "0.8.749-2" "$2") -eq 1 ]]; then
|
|
|
|
|
|
|
|
# Check for existing old config directory and non-existance of new config file.
|
|
|
|
if [[ -d /usr/share/Jackett/.config/Jackett && ! -f /var/lib/jackett/ServerConfig.json ]]; then
|
|
|
|
cp -a /usr/share/Jackett/.config/Jackett/* /var/lib/jackett/
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Check for existing old mono config directory and non-existance of new mono config directory.
|
|
|
|
if [[ -d /usr/share/Jackett/.config/.mono && ! -d /var/lib/jackett/.config/.mono ]]; then
|
2018-03-14 23:37:26 +01:00
|
|
|
cp -a /usr/share/Jackett/.config/.mono /var/lib/jackett/
|
2018-03-13 23:03:44 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
# The jackett user's home directory needs to change too.
|
|
|
|
if [[ "$( getent passwd jackett | cut -d: -f6 )" != "/var/lib/jackett" ]]; then
|
|
|
|
usermod -d /var/lib/jackett jackett
|
|
|
|
fi
|
2018-03-14 03:38:49 +01:00
|
|
|
|
|
|
|
echo "Configs copied from /usr/share/Jackett/.config/Jackett -> /var/lib/jackett/."
|
|
|
|
echo "After confirming, rm -rf /opt/Jackett /usr/share/Jackett."
|
2018-03-13 23:03:44 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
post_install "$1"
|
2015-06-20 03:56:05 +02:00
|
|
|
}
|