From 975fe98cbf29710f8ea5ecb876a2b3eea13664dc Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Sat, 10 Nov 2018 01:07:41 +0100 Subject: [PATCH] Moved from /opt back to /usr/lib based on debian policy. --- distribution/debian/install | 2 +- distribution/debian/postinst | 17 ++++++++++++++--- distribution/debian/sonarr.service | 2 +- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/distribution/debian/install b/distribution/debian/install index 0562c3716..5a394e0c9 100644 --- a/distribution/debian/install +++ b/distribution/debian/install @@ -1 +1 @@ -sonarr_bin/* /opt/sonarr/bin +sonarr_bin/* /usr/lib/sonarr/bin diff --git a/distribution/debian/postinst b/distribution/debian/postinst index e2729e59b..245caf3e1 100644 --- a/distribution/debian/postinst +++ b/distribution/debian/postinst @@ -20,17 +20,28 @@ if ! getent passwd "$USER" >/dev/null; then adduser --system --no-create-home --ingroup "$GROUP" "$USER" fi +# Migrate old data dir (Sonarr v3 alpha) +if [ -d "/var/opt/sonarr" ] && [ "$CONFDIR" != "/var/opt/sonarr" ]; then + if [ ! -f "/var/opt/sonarr/sonarr.db" ] && [ -f "/var/opt/sonarr/.config/Sonarr/sonarr.db" ]; then + mv "/var/opt/sonarr/.config/Sonarr" "$CONFDIR" + rm -rf "/var/opt/sonarr" + else + mv "/var/opt/sonarr" "$CONFDIR" + fi + chown -R $USER:$GROUP "$CONFDIR" +fi + # Create data directory if [ ! -d "$CONFDIR" ]; then mkdir -p "$CONFDIR" chown -R $USER:$GROUP "$CONFDIR" fi -# Set permissions on /opt/sonarr -chown -R $USER:$GROUP /opt/sonarr +# Set permissions on /usr/lib/sonarr +chown -R $USER:$GROUP /usr/lib/sonarr # Update sonarr.service file -sed -i "s:User=sonarr:User=$USER:g; s:Group=sonarr:Group=$GROUP:g; s:-data=/var/opt/sonarr:-data=$CONFDIR:g" $SYSTEMD_UNIT +sed -i "s:User=sonarr:User=$USER:g; s:Group=sonarr:Group=$GROUP:g; s:-data=/var/lib/sonarr:-data=$CONFDIR:g" $SYSTEMD_UNIT #DEBHELPER# diff --git a/distribution/debian/sonarr.service b/distribution/debian/sonarr.service index ae035ef6d..2c42f4e6a 100644 --- a/distribution/debian/sonarr.service +++ b/distribution/debian/sonarr.service @@ -8,7 +8,7 @@ Group=sonarr UMask=002 Type=simple -ExecStart=/usr/bin/mono --debug /opt/sonarr/bin/Sonarr.exe -nobrowser -data=/var/opt/sonarr +ExecStart=/usr/bin/mono --debug /usr/lib/sonarr/bin/Sonarr.exe -nobrowser -data=/var/lib/sonarr TimeoutStopSec=20 KillMode=process Restart=on-failure