Skip to content

Commit

Permalink
v8.23
Browse files Browse the repository at this point in the history
- DietPi-Software | Sonarr: Migrate APT keyring from apt-key and /etc/apt/trusted.gpg to /etc/apt/trusted.gpg.d. Also remove /etc/apt/trusted.gpg when removing Sonarr v2 keyring, if there is no other keyring inside. Do all keyring-related actions in pre-patches, to take effect on APT upgrades proceeding the DietPi update and (post-)patches.
  • Loading branch information
MichaIng committed Oct 18, 2023
1 parent 26806be commit a93f4fd
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 15 deletions.
8 changes: 0 additions & 8 deletions .update/patches
Original file line number Diff line number Diff line change
Expand Up @@ -1401,14 +1401,6 @@ Patch_8_22()
[[ -f '/etc/apt/preferences.d/dietpi-armbian-tmp' ]] && G_EXEC rm /etc/apt/preferences.d/dietpi-armbian-tmp
[[ -f '/etc/apt/apt.conf.d/dietpi-armbian' ]] && G_EXEC rm /etc/apt/apt.conf.d/dietpi-armbian

# Migrate Armbian keyring from /etc/apt/trusted.gpg to /etc/apt/trusted.gpg.d for old images
if [[ -f '/etc/apt/trusted.gpg' && $(apt-key --keyring /etc/apt/trusted.gpg list 'DF00FAF1C577104B50BF1D0093D6889F9F0E78D5' 2> /dev/null) ]]
then
G_EXEC eval 'curl -sSfL '\''https://apt.armbian.com/armbian.key'\'' | gpg --dearmor -o /etc/apt/trusted.gpg.d/dietpi-armbian.gpg --yes'
G_EXEC apt-key --keyring /etc/apt/trusted.gpg del 'DF00FAF1C577104B50BF1D0093D6889F9F0E78D5'
[[ $(apt-key --keyring /etc/apt/trusted.gpg list 2> /dev/null) ]] || G_EXEC rm /etc/apt/trusted.gpg
fi

# Odroid C1: Set kernel packages on hold. We pin them in pre-patches and enforce an automated downgrade, in case, but since v23.02.2 might not be available forever, we should also set them on hold, until we know there is a compatble newer version available:
# - https://dietpi.com/forum/t/odroid-c1-not-booting-after-kernel-upgrade/17818
# - https://github.com/MichaIng/DietPi/issues/6616#issuecomment-1730900296
Expand Down
16 changes: 16 additions & 0 deletions .update/pre-patches
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,22 @@ then
G_DIETPI-NOTIFY 2 'Removing faulty non-free-firmware component if present'
(( $G_RASPBIAN )) && G_EXEC sed -i 's/ non-free-firmware$//' /etc/apt/sources.list
fi

# Migrate Armbian keyring from /etc/apt/trusted.gpg to /etc/apt/trusted.gpg.d for old images
if [[ -f '/etc/apt/trusted.gpg' && $(apt-key --keyring /etc/apt/trusted.gpg list 'DF00FAF1C577104B50BF1D0093D6889F9F0E78D5' 2> /dev/null) ]]
then
G_EXEC eval 'curl -sSfL '\''https://apt.armbian.com/armbian.key'\'' | gpg --dearmor -o /etc/apt/trusted.gpg.d/dietpi-armbian.gpg --yes'
G_EXEC apt-key --keyring /etc/apt/trusted.gpg del 'DF00FAF1C577104B50BF1D0093D6889F9F0E78D5'
[[ $(apt-key --keyring /etc/apt/trusted.gpg list 2> /dev/null) ]] || G_EXEC rm /etc/apt/trusted.gpg
fi

# Migrate Sonarr keyring from apt-key and /etc/apt/trusted.gpg to /etc/apt/trusted.gpg.d
if [[ -f '/etc/apt/trusted.gpg' && $(apt-key --keyring /etc/apt/trusted.gpg list '2009837CBFFD68F45BC180471F4F90DE2A9B4BF8' 2> /dev/null) ]]
then
G_EXEC gpg --keyserver 'hkp://keyserver.ubuntu.com:80' --no-default-keyring --keyring /etc/apt/trusted.gpg.d/dietpi-sonarr.gpg --recv-keys '2009837CBFFD68F45BC180471F4F90DE2A9B4BF8'
G_EXEC apt-key --keyring /etc/apt/trusted.gpg del '2009837CBFFD68F45BC180471F4F90DE2A9B4BF8'
[[ $(apt-key --keyring /etc/apt/trusted.gpg list 2> /dev/null) ]] || G_EXEC rm /etc/apt/trusted.gpg
fi
fi

exit 0
Expand Down
22 changes: 15 additions & 7 deletions dietpi/dietpi-software
Original file line number Diff line number Diff line change
Expand Up @@ -9644,11 +9644,10 @@ _EOF_
then
# https://sonarr.tv/#downloads-v3-linux-debian
# APT repo key
G_EXEC apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-keys '2009837CBFFD68F45BC180471F4F90DE2A9B4BF8'
G_EXEC gpg --keyserver 'hkp://keyserver.ubuntu.com:80' --no-default-keyring --keyring /etc/apt/trusted.gpg.d/dietpi-sonarr.gpg --recv-keys '2009837CBFFD68F45BC180471F4F90DE2A9B4BF8'

# APT repo list
local distro=${G_DISTRO_NAME/bookworm/bullseye}
G_EXEC eval "echo 'deb https://apt.sonarr.tv/debian/ ${distro/bullseye/buster} main' > /etc/apt/sources.list.d/sonarr.list"
# APT repo 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
Expand All @@ -9662,7 +9661,11 @@ _EOF_
G_EXEC systemctl stop sonarr

# 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 apt-key del 'A236C58F409091A18ACA53CBEBFF6B99D9B78493'
if [[ -f '/etc/apt/trusted.gpg' && $(apt-key --keyring /etc/apt/trusted.gpg list 'A236C58F409091A18ACA53CBEBFF6B99D9B78493' 2> /dev/null) ]]
then
G_EXEC apt-key --keyring /etc/apt/trusted.gpg del 'A236C58F409091A18ACA53CBEBFF6B99D9B78493'
[[ $(apt-key --keyring /etc/apt/trusted.gpg list 2> /dev/null) ]] || G_EXEC rm /etc/apt/trusted.gpg
fi
[[ -f '/mnt/dietpi_userdata/sonarr/nzbdrone.pid' ]] && G_EXEC rm /mnt/dietpi_userdata/sonarr/nzbdrone.pid
[[ -f '/mnt/dietpi_userdata/sonarr/nzbdrone.db.bak' ]] && G_EXEC rm /mnt/dietpi_userdata/sonarr/nzbdrone.db.bak

Expand Down Expand Up @@ -12944,8 +12947,13 @@ If no WireGuard (auto)start is included, but you require it, please do the follo
[[ -d '/var/log/sonarr' ]] && G_EXEC rm -R /var/log/sonarr
G_EXEC rm -Rf /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
[[ $(apt-key list '2009837CBFFD68F45BC180471F4F90DE2A9B4BF8' 2> /dev/null) ]] && G_EXEC apt-key del '2009837CBFFD68F45BC180471F4F90DE2A9B4BF8'
[[ $(apt-key list 'A236C58F409091A18ACA53CBEBFF6B99D9B78493' 2> /dev/null) ]] && G_EXEC apt-key del 'A236C58F409091A18ACA53CBEBFF6B99D9B78493' # Pre-v7.1
[[ -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
if [[ -f '/etc/apt/trusted.gpg' && $(apt-key --keyring /etc/apt/trusted.gpg list 'A236C58F409091A18ACA53CBEBFF6B99D9B78493' 2> /dev/null) ]]
then
G_EXEC apt-key --keyring /etc/apt/trusted.gpg del 'A236C58F409091A18ACA53CBEBFF6B99D9B78493'
[[ $(apt-key --keyring /etc/apt/trusted.gpg list 2> /dev/null) ]] || G_EXEC rm /etc/apt/trusted.gpg
fi
fi

if To_Uninstall 145 # Radarr
Expand Down

0 comments on commit a93f4fd

Please sign in to comment.