Skip to content

Commit

Permalink
v9.9
Browse files Browse the repository at this point in the history
- DietPi-Software | Move to Sonarr v4
  • Loading branch information
MichaIng committed Dec 12, 2024
1 parent ed5586b commit e702280
Showing 1 changed file with 47 additions and 15 deletions.
62 changes: 47 additions & 15 deletions dietpi/dietpi-software
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,8 @@ Available commands:
aSOFTWARE_DESC[$software_id]='Automatically download TV shows'
aSOFTWARE_CATX[$software_id]=3
aSOFTWARE_DOCS[$software_id]='https://dietpi.com/docs/software/bittorrent/#sonarr'
aSOFTWARE_DEPS[$software_id]='87 150'
aSOFTWARE_DEPS[$software_id]='87'
(( $G_HW_ARCH == 1 )) && aSOFTWARE_DEPS[$software_id]+=' 150'
# - RISC-V: Missing package
aSOFTWARE_AVAIL_G_HW_ARCH[$software_id,11]=0
#------------------
Expand Down Expand Up @@ -9488,23 +9489,54 @@ _EOF_

if To_Install 144 sonarr # Sonarr
then
# https://sonarr.tv/#downloads-v3-linux-debian
# APT key
G_EXEC eval 'curl -sSf '\''https://keyserver.ubuntu.com/pks/lookup?search=0x2009837CBFFD68F45BC180471F4F90DE2A9B4BF8&op=get'\'' | gpg --dearmor -o /etc/apt/trusted.gpg.d/dietpi-sonarr.gpg --yes'
# Sonarr v4 does not support ARMv6
if (( $G_HW_ARCH == 1 ))
then
# https://sonarr.tv/#downloads-v3-linux-debian
# APT key
G_EXEC eval 'curl -sSf '\''https://keyserver.ubuntu.com/pks/lookup?search=0x2009837CBFFD68F45BC180471F4F90DE2A9B4BF8&op=get'\'' | gpg --dearmor -o /etc/apt/trusted.gpg.d/dietpi-sonarr.gpg --yes'

# APT list: Buster is the latest available suite: https://apt.sonarr.tv/debian/dists/
G_EXEC eval 'echo '\''deb https://apt.sonarr.tv/debian buster main'\'' > /etc/apt/sources.list.d/sonarr.list'
# APT list: Buster is the latest available suite: https://apt.sonarr.tv/debian/dists/
G_EXEC eval 'echo '\''deb https://apt.sonarr.tv/debian buster main'\'' > /etc/apt/sources.list.d/sonarr.list'

# Update package lists
G_AGUP
# Update package lists
G_AGUP

# 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'"

# Install Sonarr and mediainfo
G_AGI sonarr mediainfo
G_EXEC systemctl stop sonarr
else
# Pre-v9.9 cleanup
[[ -f '/etc/apt/sources.list.d/sonarr.list' ]] && G_EXEC rm /etc/apt/sources.list.d/sonarr.list
[[ -f '/etc/apt/trusted.gpg.d/dietpi-sonarr.gpg' ]] && G_EXEC rm /etc/apt/trusted.gpg.d/dietpi-sonarr.gpg
dpkg-query -s 'sonarr' &> /dev/null && G_AGP sonarr

# APT dependencies
aDEPS=('mediainfo')
# - .NET: https://github.com/dotnet/docs/blob/main/docs/core/install/linux-debian.md#dependencies
case $G_DISTRO in
6) aDEPS+=('libicu67');;
*) aDEPS+=('libicu72');;
esac

# 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'"
# Download
case $G_HW_ARCH in
2) local arch='arm';;
3) local arch='arm64';;
*) local arch='x64';;
esac

# Install Sonarr and mediainfo
G_AGI sonarr mediainfo
G_EXEC systemctl stop sonarr
local fallback_url="https://github.com/Sonarr/Sonarr/releases/download/v4.0.11.2680/Sonarr.main.4.0.11.2680.linux-$arch.tar.gz"
Download_Install "$(curl -sSfL 'https://api.github.com/repos/Sonarr/Sonarr/releases/latest' | mawk -F\" "/^ *\"browser_download_url\": \".*linux-$arch\.tar\.gz\"$/{print \$4}")"

# Install: Remove previous instance on reinstall
[[ -d '/opt/sonarr' ]] && G_EXEC rm -R /opt/sonarr
G_EXEC mv Sonarr /opt/sonarr
fi

# Pre-v7.1: Remove Sonarr v2 key, PID file and database backups from DietPi-Arr_to_RAM
if [[ -f '/etc/apt/trusted.gpg' && $(apt-key --keyring /etc/apt/trusted.gpg list 'A236C58F409091A18ACA53CBEBFF6B99D9B78493' 2> /dev/null) ]]
Expand Down Expand Up @@ -12883,7 +12915,7 @@ _EOF_
Remove_Service sonarr 1 1 # group for pre-v6.29
G_AGP sonarr nzbdrone # Pre-v7.1
[[ -d '/var/log/sonarr' ]] && G_EXEC rm -R /var/log/sonarr
G_EXEC rm -Rf /mnt/dietpi_userdata/sonarr /opt/NzbDrone # Pre-v7.1
G_EXEC rm -Rf /opt/sonarr /mnt/dietpi_userdata/sonarr /opt/NzbDrone # Pre-v7.1
[[ -f '/etc/apt/sources.list.d/sonarr.list' ]] && G_EXEC rm /etc/apt/sources.list.d/sonarr.list
[[ -f '/etc/apt/trusted.gpg.d/dietpi-sonarr.gpg' ]] && G_EXEC rm /etc/apt/trusted.gpg.d/dietpi-sonarr.gpg
# Pre-v7.1: Remove Sonarr v2 key
Expand Down

0 comments on commit e702280

Please sign in to comment.