Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DietPi-Software | Sonarr: Migrate to v3 #4292

Merged
merged 13 commits into from
Apr 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .update/patches
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,14 @@ fi
# v7.1: Remove obsolete DietPi-NordVPN and No-IP install states
[[ -f '/boot/dietpi/.installed' ]] && grep -qE '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[(67|171)\]=' /boot/dietpi/.installed && G_EXEC sed -Ei '/^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[(67|171)\]=/d' /boot/dietpi/.installed

# v7.1: Inform user about possible Sonarr v2 => v3 upgrade
[[ -f '/mnt/dietpi_userdata/sonarr/nzbdrone.pid' ]] && G_WHIP_MSG '[ INFO ] Sonarr v3 has been released
\nYou seem to use Sonarr v2 while Sonarr v3 is now available. A migration is safe to do, but in some cases you might need to redo some configuration, so we do not force the upgrade now.
\nTo migrate to Sonarr v3, run the following command from console:
- dietpi-software reinstall 144'

# v7.1: Removing obsolete DietPi-Arr_to_RAM backup files
rm -f /mnt/dietpi_userdata/{{sonarr,radarr}/nzbdrone.db-{shm,wal},lidarr/lidarr.db-{shm,wal}}.bak

exit 0
}
2 changes: 2 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Changes:
- DietPi-LetsEncrypt | It is now possible to enable OCSP (Online Certificate Status Protocol) stapling for the obtained certificate. This allows clients to check if the certificate has been revoked, e.g. when the server has been compromised or the private key stolen.
- DietPi-LetsEncrypt | Lighttpd: HTTPS is now enabled for IPv6 requests and the deprecated TLSv1.0 and TLSv1.1 are disabled from Debian Buster on. With the Lighttpd version shipped by Debian Stretch, those TLS versions cannot be disabled.
- DietPi-NordVPN | The script reveived a major rework to allow being setup as ProtonVPN client and even with a custom OVPN config. For this reason it has been renamed to "DietPi-VPN", with the script moved to /boot/dietpi/dietpi-vpn and the console command alias changed to "dietpi-vpn" accordingly. Additionally a killswitch feature has been added which forcefully drops all WAN packets not sent through the VPN, when the connection got lost, until the VPN is disconnected manually/intentionally. Further is IPv6 now automatically disabled when the VPN connection is established. This is required to prevent IPv6 leaks as most publish VPN providers/servers do not support IPv6. When it has not been disabled before, IPv6 is re-enabled automatically once the VPN connection stops. Many thanks to @ravenclaw900 for doing this major rework: https://github.com/MichaIng/DietPi/pull/4180
- DietPi-Arr_to_RAM | Support for Sonarr v3 and Radarr v3 has been added. On first link to RAM, a script "/mnt/dietpi_userdata/(sonarr|radarr|lidarr)/dietpi-arr_to_RAM.sh" is created, which allows updating the linked database backups via the programs "Custom Script" feature. Since v3, it is not possible anymore to pass arguments to custom script or call scripts inside the /boot directory at all, which broke the previous "/boot/dietpi/misc/dietpi-arr_to_RAM 2 (sonarr|radarr|lidarr)" calls in two ways.
- DietPi-FS_partition_resize | Added support to automatically resize F2FS and Btrfs filesystems on first boot.
- DietPi-Drive_Manager | Added support for resizing F2FS and Btrfs filesystems as well as format- and filesystem check & repair support for XFS filesystems.
- DietPi-Drive_Manager | When adding Samba mounts, credentials are not added in plain text to /etc/fstab anymore, but stored instead in a separate per-mount credential file with strict root-only read permissions. Many thanks to @TheOriginalMrWolf for doing this suggestion: https://github.com/MichaIng/DietPi/issues/4082
Expand All @@ -27,6 +28,7 @@ Changes:
- DietPi-Software | Koel: On fresh installs and reinstalls, the listening port has been changed from 8000 to 8003 to avoid conflicts with IceCast. Additionally the install process has been simplified and dependencies reduces, since after Koel v5.0.0 pre-compiled frontend binaries are available. This also allows a completely unattended install now. As little security hardening, the Koel MariaDB database password has been changed to a long random character string and the config files permission mode has been changed to 600 to permit read access to the Koel service user only. Finally as little performance enhancement, Koel now connects via UNIX socket to MariaDB instead of view TCP connection, which allows to disable TCP listening in MariaDB.
- DietPi-Software | YaCy: New installs and reinstalls will now have the latest version detected and downloaded automatically. This enables an easy update method by simply reinstalling YaCy via "dietpi-software reinstall 133", independent of the DietPi version.
- DietPi-Software | Remot3.it: After the install finished, it is now offered to do the interactive "connectd_installer" setup directly. Neither is a reboot required, nor does any service need to run to be registered. This is especially helpful for installs via "dietpi-software install 68", where the hint about this required setup was not shown before.
- DietPi-Software | Sonarr: Support for and migration to v3 has been implemented. Existing installs won't be migrated automatically, run "dietpi-software reinstall 144" to upgrade your Sonarr to v3. On DietPi update, Sonarr v2 users will receive a related notification.

New Scripts:
- DietPi-DDNS | This new tool has been added, which allows you to manage domains for your dynamic IP address. Select a Dynamic DNS (DDNS) provider or add a custom API URL, to have your DDNS entry updated regularly, via cURL and Cron job. Among others, it supports No-IP and replaces the No-IP client that DietPi supported until now.
Expand Down
73 changes: 39 additions & 34 deletions dietpi/dietpi-software
Original file line number Diff line number Diff line change
Expand Up @@ -3478,17 +3478,17 @@ _EOF_

Banner_Installing # https://www.mono-project.com/download/stable/#download-lin-debian

apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
G_EXEC apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF

# On RPi use separate Raspbian repo: https://github.com/MichaIng/DietPi/issues/1023
# Use Buster branch on Bullseye
if (( $G_HW_MODEL < 10 )) && (( $G_RASPBIAN )); then

echo "deb https://download.mono-project.com/repo/debian/ raspbian${G_DISTRO_NAME/bullseye/buster} main" > /etc/apt/sources.list.d/mono-xamarin.list
G_EXEC eval "echo 'deb https://download.mono-project.com/repo/debian/ raspbian${G_DISTRO_NAME/bullseye/buster} main' > /etc/apt/sources.list.d/mono-xamarin.list"

else

echo "deb https://download.mono-project.com/repo/debian/ ${G_DISTRO_NAME/bullseye/buster} main" > /etc/apt/sources.list.d/mono-xamarin.list
G_EXEC eval "echo 'deb https://download.mono-project.com/repo/debian/ ${G_DISTRO_NAME/bullseye/buster} main' > /etc/apt/sources.list.d/mono-xamarin.list"

fi

Expand Down Expand Up @@ -3684,7 +3684,7 @@ _EOF_

Banner_Installing

debconf-set-selections <<< 'proftpd-basic shared/proftpd/inetd_or_standalone select standalone'
G_EXEC eval "debconf-set-selections <<< 'proftpd-basic shared/proftpd/inetd_or_standalone select standalone'"
G_AGI proftpd-basic

fi
Expand Down Expand Up @@ -6218,34 +6218,28 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=bullseye\nPin-
software_id=144 # Sonarr
if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then

Banner_Installing

# ARMv8 binary install: https://github.com/MichaIng/DietPi/issues/1502
if (( $G_HW_ARCH == 3 )); then

# Reinstall: Skip download and install, advice to use internal updater from web UI
if [[ -d '/opt/NzbDrone' ]]; then
Banner_Installing # https://sonarr.tv/#downloads-v3-linux-debian

G_DIETPI-NOTIFY 2 "${aSOFTWARE_NAME[$software_id]} install dir \"/opt/NzbDrone\" already exists. Download and install steps will be skipped.
- If you want to update ${aSOFTWARE_NAME[$software_id]}, please use the internal updater from web UI.
- If you need to reinstall (e.g. broken instance), please manually remove the install dir \"/opt/NzbDrone\" and rerun \"dietpi-software reinstall $software_id\"."

else
# APT repo key
G_EXEC apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 2009837CBFFD68F45BC180471F4F90DE2A9B4BF8

DEPS_LIST='mediainfo'
Download_Install 'https://download.sonarr.tv/v2/master/mono/NzbDrone.master.tar.gz' /opt
# APT repo list: Use Buster suite on Bullseye
G_EXEC eval "echo 'deb https://apt.sonarr.tv/debian/ ${G_DISTRO_NAME/bullseye/buster} main' > /etc/apt/sources.list.d/sonarr.list"

fi
# Update package lists
G_AGUP

# Repo install
else
# Pre-configure DEB package
G_EXEC eval "debconf-set-selections <<< 'sonarr sonarr/owning_group string dietpi'"
G_EXEC eval "debconf-set-selections <<< 'sonarr sonarr/config_directory string /mnt/dietpi_userdata/sonarr'"

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0xA236C58F409091A18ACA53CBEBFF6B99D9B78493
echo 'deb https://apt.sonarr.tv/ master main' > /etc/apt/sources.list.d/sonarr.list
G_AGUP
G_AGI nzbdrone
# Install Sonarr and mediainfo
G_AGI sonarr mediainfo

fi
# Pre-v7.1: Remove Sonarr v2 key, PID file and database backups from DietPi-Arr_to_RAM
[[ $(apt-key list 'A236C58F409091A18ACA53CBEBFF6B99D9B78493' 2> /dev/null) ]] && G_EXEC_NOEXIT=1 G_EXEC apt-key del 'A236C58F409091A18ACA53CBEBFF6B99D9B78493'
[[ -f '/mnt/dietpi_userdata/sonarr/nzbdrone.pid' ]] && G_EXEC_NOEXIT=1 G_EXEC rm /mnt/dietpi_userdata/sonarr/nzbdrone.pid
[[ -f '/mnt/dietpi_userdata/sonarr/nzbdrone.db.bak' ]] && G_EXEC_NOEXIT=1 G_EXEC rm /mnt/dietpi_userdata/sonarr/nzbdrone.db.bak

fi

Expand Down Expand Up @@ -6313,6 +6307,10 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=bullseye\nPin-
Download_Install "$INSTALL_URL_ADDRESS"
G_EXEC mv Radarr /opt/radarr
fi

# Radarr v2: Remove old PID file and database backups from DietPi-Arr_to_RAM
[[ -f '/mnt/dietpi_userdata/radarr/nzbdrone.pid' ]] && G_EXEC_NOEXIT=1 G_EXEC rm /mnt/dietpi_userdata/radarr/nzbdrone.pid
[[ -f '/mnt/dietpi_userdata/radarr/nzbdrone.db.bak' ]] && G_EXEC_NOEXIT=1 G_EXEC rm /mnt/dietpi_userdata/radarr/nzbdrone.db.bak
fi

software_id=106 # Lidarr
Expand Down Expand Up @@ -12051,7 +12049,7 @@ After=network-online.target dietpi-boot.service
SyslogIdentifier=Sonarr
User=sonarr
UMask=002
ExecStart=$(command -v mono) -O=-aot /opt/NzbDrone/NzbDrone.exe -nobrowser -data=/mnt/dietpi_userdata/sonarr
ExecStart=$(command -v mono) /usr/lib/sonarr/bin/Sonarr.exe -nobrowser -data=/mnt/dietpi_userdata/sonarr
TimeoutStopSec=20
KillMode=process
Restart=on-failure
Expand All @@ -12062,7 +12060,7 @@ ProtectHome=true
PrivateDevices=true
ProtectKernelTunables=true
ProtectControlGroups=true
ReadWritePaths=/opt/NzbDrone /mnt /media /var/log/sonarr /tmp
ReadWritePaths=/usr/lib/sonarr /mnt /media /var/log/sonarr /tmp

[Install]
WantedBy=multi-user.target
Expand All @@ -12076,7 +12074,7 @@ _EOF_
G_EXEC ln -s /var/log/sonarr/logs.db-wal /mnt/dietpi_userdata/sonarr/logs.db-wal

# Permissions
G_EXEC chown -R sonarr:dietpi /mnt/dietpi_userdata/sonarr /opt/NzbDrone /var/log/sonarr
G_EXEC chown -R sonarr:dietpi /mnt/dietpi_userdata/sonarr /usr/lib/sonarr /var/log/sonarr

fi

Expand Down Expand Up @@ -12119,7 +12117,7 @@ ReadWritePaths=/opt/radarr /mnt /media /var/log/radarr /tmp
WantedBy=multi-user.target
_EOF_
# - ARMv6 devices use Mono
(( $G_HW_ARCH == 1 )) && G_CONFIG_INJECT 'ExecStart=' "ExecStart=$(command -v mono) -O=-aot /opt/radarr/Radarr.exe -nobrowser -data=/mnt/dietpi_userdata/radarr" /etc/systemd/system/radarr.service
(( $G_HW_ARCH == 1 )) && G_CONFIG_INJECT 'ExecStart=' "ExecStart=$(command -v mono) /opt/radarr/Radarr.exe -nobrowser -data=/mnt/dietpi_userdata/radarr" /etc/systemd/system/radarr.service

# Logs to RAM
G_EXEC rm -Rf /mnt/dietpi_userdata/radarr/logs*
Expand Down Expand Up @@ -12156,7 +12154,7 @@ After=network-online.target dietpi-boot.service
SyslogIdentifier=Lidarr
User=lidarr
UMask=002
ExecStart=$(command -v mono) -O=-aot /opt/Lidarr/Lidarr.exe -nobrowser -data=/mnt/dietpi_userdata/lidarr
ExecStart=$(command -v mono) /opt/Lidarr/Lidarr.exe -nobrowser -data=/mnt/dietpi_userdata/lidarr
TimeoutStopSec=20
KillMode=process
Restart=on-failure
Expand Down Expand Up @@ -12213,6 +12211,7 @@ ExecStart=$(command -v python3) /opt/bazarr/bazarr.py -c /mnt/dietpi_userdata/ba
ProtectSystem=strict
ProtectHome=true
PrivateDevices=true
PrivateTmp=true
ProtectKernelTunables=true
ProtectControlGroups=true
ReadWritePaths=/opt/bazarr /mnt /media /var/log/bazarr /tmp
Expand Down Expand Up @@ -12320,13 +12319,15 @@ ProtectSystem=strict
ProtectHome=true
PrivateDevices=true
PrivateTmp=true
ProtectKernelTunables=true
ProtectControlGroups=true
ReadWritePaths=/opt/jackett

[Install]
WantedBy=multi-user.target
_EOF_
# - ARMv6 devices use Mono
(( $G_HW_ARCH == 1 )) && G_CONFIG_INJECT 'ExecStart=' "ExecStart=$(command -v mono) -O=-aot /opt/jackett/JackettConsole.exe --NoRestart" /etc/systemd/system/jackett.service
(( $G_HW_ARCH == 1 )) && G_CONFIG_INJECT 'ExecStart=' "ExecStart=$(command -v mono) /opt/jackett/JackettConsole.exe --NoRestart" /etc/systemd/system/jackett.service

fi

Expand Down Expand Up @@ -13975,10 +13976,14 @@ _EOF_

fi
[[ -d '/etc/systemd/system/sonarr.service.d' ]] && rm -R /etc/systemd/system/sonarr.service.d
G_AGP nzbdrone
G_AGP sonarr nzbdrone # Pre-v7.1
getent passwd sonarr > /dev/null && userdel sonarr
getent group sonarr > /dev/null && groupdel sonarr # Pre-v6.29
rm -Rf /opt/NzbDrone /mnt/dietpi_userdata/sonarr /var/log/sonarr /etc/apt/sources.list.d/sonarr.list
[[ -d '/var/log/sonarr' ]] && G_EXEC_NOEXIT=1 G_EXEC rm -R /var/log/sonarr
rm -Rf /mnt/dietpi_userdata/sonarr /opt/NzbDrone # Pre-v7.1
[[ -f '/etc/apt/sources.list.d/sonarr.list' ]] && G_EXEC_NOEXIT=1 G_EXEC rm /etc/apt/sources.list.d/sonarr.list
[[ $(apt-key list '2009837CBFFD68F45BC180471F4F90DE2A9B4BF8' 2> /dev/null) ]] && G_EXEC_NOEXIT=1 G_EXEC apt-key del '2009837CBFFD68F45BC180471F4F90DE2A9B4BF8'
[[ $(apt-key list 'A236C58F409091A18ACA53CBEBFF6B99D9B78493' 2> /dev/null) ]] && G_EXEC_NOEXIT=1 G_EXEC apt-key del 'A236C58F409091A18ACA53CBEBFF6B99D9B78493' # Pre-v7.1

fi

Expand Down
Loading