#!/bin/bash { # DietPi-Update pre-patches that need to run before new scripts are downloaded and/or before APT upgrades # Created by MichaIng / micha@dietpi.com / https://dietpi.com/ # License: GPLv2 / https://github.com/MichaIng/DietPi#license # Load DietPi-Globals . /boot/dietpi/func/dietpi-globals readonly G_PROGRAM_NAME='DietPi-Pre-patches' G_CHECK_ROOT_USER G_CHECK_ROOTFS_RW G_INIT # Use DietPi version from inputs to reapply pre-patches on updater internal subversion decrease [[ $1 ]] && G_DIETPI_VERSION_CORE=$1 [[ $2 ]] && G_DIETPI_VERSION_SUB=$2 # IMPORTANT: This script can be called with DietPi v6.17, hence assure compatibility! # - Pre-v6.29: Create G_EXEC as G_RUN_CMD wrapper declare -F G_EXEC > /dev/null || G_EXEC(){ G_RUN_CMD "$@"; } # v7.0: Update Jellyfin APT repo key: https://dietpi.com/phpbb/viewtopic.php?t=8703 if (( $G_DIETPI_VERSION_CORE < 7 || ( $G_DIETPI_VERSION_CORE == 7 && $G_DIETPI_VERSION_SUB < 0 ) )) && [[ -f '/etc/apt/trusted.gpg.d/dietpi-jellyfin.gpg' ]] && (( $(date -u '+%Y%m%d' -r '/etc/apt/trusted.gpg.d/dietpi-jellyfin.gpg') < 20201216 )) then G_DIETPI-NOTIFY 2 'Updating Jellyfin APT repo key' G_EXEC curl -sSfLO 'https://repo.jellyfin.org/jellyfin_team.gpg.key' G_EXEC gpg --dearmor -o /etc/apt/trusted.gpg.d/dietpi-jellyfin.gpg --yes jellyfin_team.gpg.key G_EXEC rm jellyfin_team.gpg.key fi # v7.2: Rename Bitwarden_RS into vaultwarden: https://github.com/MichaIng/DietPi/issues/4325 if (( $G_DIETPI_VERSION_CORE < 7 || ( $G_DIETPI_VERSION_CORE == 7 && $G_DIETPI_VERSION_SUB < 2 ) )) && [[ -d '/mnt/dietpi_userdata/bitwarden_rs' ]] then G_WHIP_BUTTON_OK_TEXT='Continue' G_WHIP_BUTTON_CANCEL_TEXT='Cancel' if G_WHIP_YESNO '[ INFO ] Bitwarden_RS detected \nDue to user confusion and to avoid any possible trademark/brand issues with the official Bitwarden server, Bitwarden_RS has been renamed to vaultwarden by its author: https://github.com/dani-garcia/vaultwarden/discussions/1642 \nTo be able to continue providing support for vaultwarden, DietPi-Update will force a re-installation. This process can take 30 minutes up to several hours, especially on slower SBCs like RPi Zero and similar, like it was on the initial Bitwarden_RS install you did. \nContinue DietPi-Update now, if you are ok with the re-installation of vaultwarden and grab yourself a coffee or tea. If not, you are ok to cancel the update process and return later. \nNB: All your passwords, data and config will be preserved by the re-installation process.' then G_DIETPI-NOTIFY 2 'vaultwarden will be reinstalled during DietPi-Update incremental patches.' else G_DIETPI-NOTIFY 2 'DietPi-Update aborted by user.' exit 1 fi fi # v7.4 if (( $G_DIETPI_VERSION_CORE < 7 || ( $G_DIETPI_VERSION_CORE == 7 && $G_DIETPI_VERSION_SUB < 4 ) )) && getent passwd debian-transmission > /dev/null && ! getent group debian-transmission > /dev/null then G_DIETPI-NOTIFY 2 'Recreating the "debian-transmission" group for the "debian-transmission" user to prevent Transmission package upgrade issues: https://github.com/MichaIng/DietPi/issues/4244' G_EXEC groupadd -r debian-transmission G_EXEC usermod -aG debian-transmission debian-transmission fi # v7.6 if (( $G_DIETPI_VERSION_CORE < 7 || ( $G_DIETPI_VERSION_CORE == 7 && $G_DIETPI_VERSION_SUB < 6 ) )) && (( $G_HW_MODEL < 10 )) && [[ -f '/etc/apt/preferences.d/dietpi-lxde' ]] && ! grep -q ' lx\*$' /etc/apt/preferences.d/dietpi-lxde then G_DIETPI-NOTIFY 2 'Updating the Raspberry Pi desktop package blocks' G_EXEC sed --follow-symlinks -i '/^Package:/c\Package: openbox* obconf* libob* pcmanfm* libfm* gtk-* libgtk* libgail* gir1.2-gtk-* lx*' /etc/apt/preferences.d/dietpi-lxde fi # v7.7 if (( $G_DIETPI_VERSION_CORE < 7 || ( $G_DIETPI_VERSION_CORE == 7 && $G_DIETPI_VERSION_SUB < 7 ) )) then if [[ $G_HW_ARCH == 10 && $(findmnt -Ufnro FSTYPE -M /boot) == 'vfat' ]] then G_DIETPI-NOTIFY 2 'Creating kernel upgrade hook to remove existing files from /boot FAT partition before installing the new files: https://github.com/MichaIng/DietPi/issues/4788' G_EXEC mkdir -p /etc/kernel/preinst.d cat << '_EOF_' > /etc/kernel/preinst.d/dietpi #!/bin/sh -e # Remove old kernel files if existing: https://github.com/MichaIng/DietPi/issues/4788 { # Fail if the package name was not passed, which is done when being invoked by dpkg if [ -z "$DPKG_MAINTSCRIPT_PACKAGE" ] then echo 'DPKG_MAINTSCRIPT_PACKAGE was not set, this script must be invoked by dpkg.' exit 1 fi # Loop through files in /boot, shipped by the package, and remove them, if existing for file in $(dpkg -L "$DPKG_MAINTSCRIPT_PACKAGE" | grep '^/boot/') do [ ! -f "$file" ] || rm "$file" done } _EOF_ G_EXEC chmod +x /etc/kernel/preinst.d/dietpi fi G_DIETPI-NOTIFY 2 'Connecting to Mosquitto and Webmin repositories via plain HTTP once until latest OpenSSL has been installed: https://github.com/MichaIng/DietPi/issues/4795' G_EXEC sed --follow-symlinks -Ei 's#https://(repo.mosquitto.org|download.webmin.com)#http://\1#' /etc/apt/sources.list [[ $(find /etc/apt/sources.list/*.list 2> /dev/null) ]] && G_EXEC sed --follow-symlinks -Ei 's#https://(repo.mosquitto.org|download.webmin.com)#http://\1#' /etc/apt/sources.list.d/*.list # Add execute permissions to kernel/initramfs hooks [[ -f '/etc/initramfs/post-update.d/99-dietpi-uboot' && ! -x '/etc/initramfs/post-update.d/99-dietpi-uboot' ]] && G_EXEC chmod +x /etc/initramfs/post-update.d/99-dietpi-uboot [[ -f '/etc/kernel/preinst.d/dietpi-initramfs_cleanup' && ! -x '/etc/kernel/preinst.d/dietpi-initramfs_cleanup' ]] && G_EXEC chmod +x /etc/kernel/preinst.d/dietpi-initramfs_cleanup fi # v8.0: ARMv6: Remove Mosquitto repository: https://github.com/MichaIng/DietPi/issues/5140 if (( $G_DIETPI_VERSION_CORE < 8 || ( $G_DIETPI_VERSION_CORE == 8 && $G_DIETPI_VERSION_SUB < 0 ) )) && (( $G_HW_ARCH == 1 )) && [[ -f '/etc/apt/sources.list.d/dietpi-mosquitto.list' ]] then G_DIETPI-NOTIFY 2 'Removing Mosquitto APT repository as the latest builds are not compatible with ARMv6: https://github.com/MichaIng/DietPi/issues/5140' G_EXEC rm /etc/apt/sources.list.d/dietpi-mosquitto.list [[ -f '/etc/apt/trusted.gpg.d/dietpi-mosquitto.gpg' ]] && G_EXEC rm /etc/apt/trusted.gpg.d/dietpi-mosquitto.gpg fi # v8.2: Remove immutable flag from MS VSCode repo and key, when present, else the "raspberrypi-sys-mods" package and our own patch cannot remove them: https://github.com/MichaIng/DietPi/issues/5267 if (( $G_DIETPI_VERSION_CORE < 8 || ( $G_DIETPI_VERSION_CORE == 8 && $G_DIETPI_VERSION_SUB < 2 ) )) then if (( $G_HW_MODEL < 10 )) then [[ -f '/etc/apt/trusted.gpg.d/microsoft.gpg' && $(lsattr /etc/apt/trusted.gpg.d/microsoft.gpg 2> /dev/null) == *'i'* ]] && G_EXEC chattr -i /etc/apt/trusted.gpg.d/microsoft.gpg [[ -f '/etc/apt/sources.list.d/vscode.list' && $(lsattr /etc/apt/sources.list.d/vscode.list 2> /dev/null) == *'i'* ]] && G_EXEC chattr -i /etc/apt/sources.list.d/vscode.list fi # https://github.com/MichaIng/DietPi/commit/c52e812 # shellcheck disable=SC2016 if grep -q 'chmod -R g-w "DietPi-\$G_GITBRANCH"' /boot/dietpi/dietpi-update then GITBRANCH_TARGET=$(sed -n '/^[[:blank:]]*DEV_GITBRANCH=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) [[ $GITBRANCH_TARGET == "$G_GITBRANCH" ]] || G_EXEC ln -s '/tmp/DietPi-Update/DietPi-'{"$GITBRANCH_TARGET","$G_GITBRANCH"} fi fi # v8.5: https://github.com/MichaIng/DietPi/issues/5467 if (( $G_DIETPI_VERSION_CORE < 8 || ( $G_DIETPI_VERSION_CORE == 8 && $G_DIETPI_VERSION_SUB < 5 ) )) && dpkg-query -s systemd-timesyncd &> /dev/null && [[ $(apt-mark showauto systemd-timesyncd) ]] then G_DIETPI-NOTIFY 2 'Marking systemd-timesyncd as manually installed to prevent its autoremoval' G_EXEC apt-mark manual systemd-timesyncd fi # v8.6 if (( $G_DIETPI_VERSION_CORE < 8 || ( $G_DIETPI_VERSION_CORE == 8 && $G_DIETPI_VERSION_SUB < 6 ) )) && [[ -f '/etc/kernel/postinst.d/dietpi-initramfs_cleanup' ]] then G_DIETPI-NOTIFY 2 'Updating initramfs cleanup script' cat << '_EOF_' > /etc/kernel/postinst.d/dietpi-initramfs_cleanup #!/bin/dash echo 'Removing obsolete initramfs images' find /boot -maxdepth 1 -name 'initrd.img-*' -o -name 'uInitrd-*' | while read -r f do [ ! -d "/lib/modules/${f#*-}" ] || continue rm -v "$f" done exit 0 _EOF_ G_EXEC chmod +x /etc/kernel/postinst.d/dietpi-initramfs_cleanup [[ -d '/etc/kernel/postrm.d' ]] || G_EXEC mkdir /etc/kernel/postrm.d G_EXEC ln -sf /etc/kernel/post{inst,rm}.d/dietpi-initramfs_cleanup fi # v8.7 if (( $G_DIETPI_VERSION_CORE < 8 || ( $G_DIETPI_VERSION_CORE == 8 && $G_DIETPI_VERSION_SUB < 7 ) )) && [[ -f '/etc/apt/sources.list.d/dietpi-tailscale.list' && ! -f '/etc/apt/trusted.gpg.d/dietpi-tailscale.gpg' ]] then G_DIETPI-NOTIFY 2 'Removing invalid Tailscale APT list' G_EXEC rm /etc/apt/sources.list.d/dietpi-tailscale.list fi # v8.11 if (( $G_DIETPI_VERSION_CORE < 8 || ( $G_DIETPI_VERSION_CORE == 8 && $G_DIETPI_VERSION_SUB < 11 ) )) && [[ -f '/etc/apt/sources.list.d/grafana.list' ]] then G_DIETPI-NOTIFY 2 'Updating Grafana APT list to use the new repository: https://grafana.com/docs/grafana/latest/setup-grafana/installation/debian/#repository-migration-november-8th-2022' G_EXEC eval "echo 'deb https://apt.grafana.com stable main' > /etc/apt/sources.list.d/grafana.list" fi # v8.13 if (( $G_DIETPI_VERSION_CORE < 8 || ( $G_DIETPI_VERSION_CORE == 8 && $G_DIETPI_VERSION_SUB < 13 ) )) then if [[ -f '/etc/apt/trusted.gpg.d/dietpi-mympd.gpg' ]] && (( $(date -u '+%Y%m%d' -r '/etc/apt/trusted.gpg.d/dietpi-mympd.gpg') < 20221223 )) then G_DIETPI-NOTIFY 2 'Updating myMPD APT repo key' # Distro: https://download.opensuse.org/repositories/home:/jcorporation/ distro='Debian_' (( $G_HW_MODEL < 10 )) && (( $G_RASPBIAN )) && distro='Raspbian_' (( $G_DISTRO == 6 )) && distro+='11' || distro+='12' G_EXEC curl -sSfLO "https://download.opensuse.org/repositories/home:/jcorporation/$distro/Release.key" G_EXEC gpg --dearmor -o /etc/apt/trusted.gpg.d/dietpi-mympd.gpg --yes Release.key G_EXEC rm Release.key fi fi # v8.14 if (( $G_DIETPI_VERSION_CORE < 8 || ( $G_DIETPI_VERSION_CORE == 8 && $G_DIETPI_VERSION_SUB < 14 ) )) then if [[ -f '/etc/apt/trusted.gpg.d/dietpi-influxdb.gpg' ]] && (( $(date -u '+%Y%m%d' -r '/etc/apt/trusted.gpg.d/dietpi-influxdb.gpg') < 20230127 )) then G_DIETPI-NOTIFY 2 'Updating InfluxDB APT repo key' # https://github.com/influxdata/influxdb/pull/24061 G_EXEC curl -sSfLO 'https://repos.influxdata.com/influxdata-archive_compat.key' G_EXEC gpg --dearmor -o /etc/apt/trusted.gpg.d/dietpi-influxdb.gpg --yes influxdata-archive_compat.key G_EXEC rm influxdata-archive_compat.key fi if (( $G_DISTRO > 6 )) && [[ -f '/etc/apt/sources.list.d/dietpi-jellyfin.list' ]] && grep -q 'bullseye' /etc/apt/sources.list.d/dietpi-jellyfin.list then G_DIETPI-NOTIFY 2 'Updating Jellyfin APT repo suite' G_EXEC sed --follow-symlinks -i 's/bullseye/bookworm/' /etc/apt/sources.list.d/dietpi-jellyfin.list fi if (( $G_DISTRO > 6 )) && [[ -f '/etc/apt/sources.list.d/docker.list' ]] && grep -q 'bullseye' /etc/apt/sources.list.d/docker.list then G_DIETPI-NOTIFY 2 'Updating Docker APT repo suite' G_EXEC sed --follow-symlinks -i 's/bullseye/bookworm/' /etc/apt/sources.list.d/docker.list fi fi # v8.15 if (( $G_DIETPI_VERSION_CORE < 8 || ( $G_DIETPI_VERSION_CORE == 8 && $G_DIETPI_VERSION_SUB < 15 ) )) then if [[ $G_RASPBIAN != 1 ]] && (( $G_DISTRO > 6 )) && grep -q 'non-free' /etc/apt/sources.list && ! grep -q 'non-free-firmware' /etc/apt/sources.list then # https://www.debian.org/releases/bookworm/amd64/release-notes/ch-information.en.html#non-free-split G_DIETPI-NOTIFY 2 'Adding new non-free-firmware component to APT lists, to re-enable firmware upgrades' G_EXEC sed --follow-symlinks -i '/non-free/s/$/ non-free-firmware/' /etc/apt/sources.list fi if (( $G_DISTRO > 6 )) && [[ -f '/etc/apt/sources.list.d/dietpi-armbian.list' || -f '/etc/apt/sources.list.d/armbian.list' ]] then G_DIETPI-NOTIFY 2 'Updating Armbian APT repo list with Bookworm suite' [[ -f '/etc/apt/sources.list.d/dietpi-armbian.list' ]] && G_EXEC sed --follow-symlinks -i 's/bullseye/bookworm/' /etc/apt/sources.list.d/dietpi-armbian.list [[ -f '/etc/apt/sources.list.d/armbian.list' ]] && G_EXEC sed --follow-symlinks -i 's/bullseye/bookworm/' /etc/apt/sources.list.d/armbian.list fi fi # v8.21 if (( $G_DIETPI_VERSION_CORE < 8 || ( $G_DIETPI_VERSION_CORE == 8 && $G_DIETPI_VERSION_SUB < 21 ) )) then # Update Grafana APT key: https://grafana.com/blog/2023/08/24/grafana-security-update-gpg-signing-key-rotation/ if [[ -f '/etc/apt/trusted.gpg.d/dietpi-grafana.gpg' ]] && (( $(date -u '+%Y%m%d' -r '/etc/apt/trusted.gpg.d/dietpi-grafana.gpg') < 20230825 )) then G_DIETPI-NOTIFY 2 'Updating Grafana APT repo key' G_EXEC curl -sSfLO 'https://apt.grafana.com/gpg.key' G_EXEC gpg --dearmor -o /etc/apt/trusted.gpg.d/dietpi-grafana.gpg --yes gpg.key G_EXEC rm gpg.key fi fi # v8.22 if (( $G_DIETPI_VERSION_CORE < 8 || ( $G_DIETPI_VERSION_CORE == 8 && $G_DIETPI_VERSION_SUB < 22 ) )) then # Block and enforce downgrade of Armbian's base-files package to Debian's: https://github.com/MichaIng/DietPi/issues/6227#issuecomment-1713688577 [[ -f '/etc/apt/sources.list.d/armbian.list' ]] && G_EXEC mv /etc/apt/sources.list.d/{,dietpi-}armbian.list if [[ -f '/etc/apt/sources.list.d/dietpi-armbian.list' ]] then G_DIETPI-NOTIFY 2 'Preventing any unintended packages from being installed from Armbian'\''s APT repository' cat << '_EOF_' > /etc/apt/preferences.d/dietpi-armbian Package: * Pin: origin apt.armbian.com Pin-Priority: -1 Package: armbian-firmware* linux-* Pin: origin apt.armbian.com Pin-Priority: 500 _EOF_ fi if dpkg --compare-versions "$(dpkg-query -Wf '${Version}' base-files)" gt 20 then G_DIETPI-NOTIFY 2 'Enforcing downgrade of Armbian'\''s base-files package to Debian'\''s' cat << '_EOF_' > /etc/apt/preferences.d/dietpi-armbian-tmp Package: base-files Pin: release o=Debian Pin-Priority: 1000 _EOF_ G_EXEC eval 'echo '\''APT::Get::Allow-Downgrades "1";'\'' > /etc/apt/apt.conf.d/dietpi-armbian' fi # Odroid C1: Pin "current" and "edge" kernel versions to Armbian 23.02.2, which are the latest currently known functional versions for C1: # - https://dietpi.com/forum/t/odroid-c1-not-booting-after-kernel-upgrade/17818 # - https://github.com/MichaIng/DietPi/issues/6616#issuecomment-1730900296 if (( $G_HW_MODEL == 10 )) then G_DIETPI-NOTIFY 2 'Pinning Odroid C1 "current" and "edge" kernel packages to latest known functional version and in case enforcing automated downgrade' cat << '_EOF_' > /etc/apt/preferences.d/00-dietpi-odroidc1 Package: linux-image-current-meson linux-dtb-current-meson linux-headers-current-meson linux-image-edge-meson linux-dtb-edge-meson linux-headers-edge-meson Pin: version 23.02.2 Pin-Priority: 1000 _EOF_ G_EXEC eval 'echo '\''APT::Get::Allow-Downgrades "1";'\'' > /etc/apt/apt.conf.d/dietpi-armbian' fi fi # v8.23 if (( $G_DIETPI_VERSION_CORE < 8 || ( $G_DIETPI_VERSION_CORE == 8 && $G_DIETPI_VERSION_SUB < 23 ) )) then # RISC-V: Migrate from Debian ports to regular Debian Sid if (( $G_HW_ARCH == 11 )) then G_DIETPI-NOTIFY 2 'Migrating from Debian ports to regular Debian Sid repository, which now supports RISC-V' G_EXEC eval 'echo '\''deb https://deb.debian.org/debian sid main contrib non-free non-free-firmware'\'' > /etc/apt/sources.list' dpkg-query -s 'debian-ports-archive-keyring' &> /dev/null && G_EXEC apt-mark auto debian-ports-archive-keyring # RPi/ARMv6 container Bookworm elif [[ $G_DISTRO -ge 7 && -f '/etc/apt/sources.list.d/raspi.list' ]] then G_DIETPI-NOTIFY 2 'Migrating RPi APT repository to Bookworm' G_EXEC eval 'echo '\''deb https://archive.raspberrypi.com/debian bookworm main'\'' > /etc/apt/sources.list.d/raspi.list' G_DIETPI-NOTIFY 2 'Removing faulty non-free-firmware component if present' (( $G_RASPBIAN )) && G_EXEC sed --follow-symlinks -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_DIETPI-NOTIFY 2 'Migrating Armbian keyring from /etc/apt/trusted.gpg to /etc/apt/trusted.gpg.d' 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_DIETPI-NOTIFY 2 'Migrating Sonarr keyring from apt-key and /etc/apt/trusted.gpg to /etc/apt/trusted.gpg.d' 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' 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 # Workaround for Beta v8.23.1 users as previous gpg method installed a 0600 file [[ -f '/etc/apt/trusted.gpg.d/dietpi-sonarr.gpg' ]] && G_EXEC chmod 0644 /etc/apt/trusted.gpg.d/dietpi-sonarr.gpg fi # v8.24 if (( $G_DIETPI_VERSION_CORE < 8 || ( $G_DIETPI_VERSION_CORE == 8 && $G_DIETPI_VERSION_SUB < 24 ) )) then if [[ $G_DISTRO -ge 7 && -f '/etc/apt/sources.list.d/dietpi-mosquitto.list' ]] then G_DIETPI-NOTIFY 2 'Migrating Mosquitto APT repository to Bookworm' G_EXEC sed --follow-symlinks -i 's/bullseye/bookworm/' /etc/apt/sources.list.d/dietpi-mosquitto.list fi if [[ $G_DISTRO == 7 && -f '/etc/apt/sources.list.d/dietpi-mympd.list' ]] then G_DIETPI-NOTIFY 2 'Migrating myMPD APT repository from testing suite to Bookworm suite' G_EXEC sed --follow-symlinks -i 's/Debian_Testing/Debian_12/' /etc/apt/sources.list.d/dietpi-mympd.list fi if [[ $G_DISTRO == 7 && -f '/etc/apt/sources.list.d/raspi.list' && -f '/etc/apt/preferences.d/dietpi-ffmpeg' ]] then G_DIETPI-NOTIFY 2 'Removing obsolete FFmpeg workaround from RPi Bookworm systems' G_EXEC rm /etc/apt/preferences.d/dietpi-ffmpeg fi if [[ -f '/etc/apt/sources.list.d/dietpi-openhab.list' ]] then G_DIETPI-NOTIFY 2 'Migrating openHAB APT repository from testing suite to stable suite' G_EXEC sed --follow-symlinks -i 's/ testing / stable /' /etc/apt/sources.list.d/dietpi-openhab.list fi if [[ $G_DISTRO -ge 7 && -f '/etc/apt/sources.list.d/raspi.list' ]] && dpkg-query -s 'kodi-repository-kodi' &> /dev/null then G_DIETPI-NOTIFY 2 'Purging conflicting kodi-repository-kodi package' G_AGP kodi-repository-kodi fi fi # v8.25 if (( $G_DIETPI_VERSION_CORE < 8 || ( $G_DIETPI_VERSION_CORE == 8 && $G_DIETPI_VERSION_SUB < 25 ) )) then if [[ -f '/etc/apt/sources.list.d/webmin.list' ]] then G_DIETPI-NOTIFY 2 'Updating Webmin APT repo' G_EXEC eval 'curl -sSfL '\''https://webmin.com/developers-key.asc'\'' | gpg --dearmor -o /etc/apt/trusted.gpg.d/dietpi-webmin.gpg --yes' G_EXEC eval 'echo '\''deb https://download.webmin.com/download/newkey/repository stable contrib'\'' > /etc/apt/sources.list.d/webmin.list' fi fi # v9.0 if (( $G_DIETPI_VERSION_CORE < 9 || ( $G_DIETPI_VERSION_CORE == 9 && $G_DIETPI_VERSION_SUB < 0 ) )) then if dpkg-query -s rpi-eeprom &> /dev/null then G_DIETPI-NOTIFY 2 'Reverting now obsolete rpi-eeprom hold' G_EXEC apt-mark unhold rpi-eeprom fi if (( $G_HW_MODEL < 10 || ( $G_HW_MODEL == 75 && ${G_RASPBIAN:-0} == 1 ) )) then G_DIETPI-NOTIFY 2 'Migrating from raspberrypi.org to raspberrypi.com' G_EXEC sed --follow-symlinks -i 's/raspberrypi.org/raspberrypi.com/' /etc/apt/sources.list /boot/dietpi.txt find /etc/apt/sources.list.d/* &> /dev/null && G_EXEC sed --follow-symlinks -i 's/raspberrypi.org/raspberrypi.com/' /etc/apt/sources.list.d/*.list find /etc/apt/preferences.d/* &> /dev/null && G_EXEC sed --follow-symlinks -i 's/raspberrypi.org/raspberrypi.com/' /etc/apt/preferences.d/* fi GITBRANCH_TARGET=$(sed -n '/^[[:blank:]]*DEV_GITBRANCH=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) GITBRANCH_TARGET=${GITBRANCH_TARGET:-master} GITBRANCH_TARGET=${GITBRANCH_TARGET//\//-} G_EXEC mkdir -p "../DietPi-Update/DietPi-$GITBRANCH_TARGET/dietpi" # shellcheck disable=SC2261 grep -q 'DietPi v6' /boot/dietpi/dietpi-update && > "../DietPi-Update/DietPi-$GITBRANCH_TARGET/dietpi/server_version-6" > "../DietPi-Update/DietPi-$GITBRANCH_TARGET/dietpi/pre-patch_file" > /boot/dietpi/patch_file fi # v9.1 if (( $G_DIETPI_VERSION_CORE < 9 || ( $G_DIETPI_VERSION_CORE == 9 && $G_DIETPI_VERSION_SUB < 1 ) )) then # RPi/ARMv6 container Trixie if [[ $G_DISTRO -ge 8 && -f '/etc/apt/sources.list.d/raspi.list' ]] then G_DIETPI-NOTIFY 2 'Adding FFmpeg workaround for RPi Trixie systems' G_EXEC eval 'echo -e '\''Package: src:ffmpeg\nPin: origin archive.raspberrypi.com\nPin-Priority: -1'\'' > /etc/apt/preferences.d/dietpi-ffmpeg' fi fi # v9.3 if (( $G_DIETPI_VERSION_CORE < 9 || ( $G_DIETPI_VERSION_CORE == 9 && $G_DIETPI_VERSION_SUB < 3 ) )) then # Update APT repo on Bullseye systems to Bookworm, but re-assure only kernel and firmware packages are pulled form it. Armbian dropped Bullseye support. if [[ $G_DISTRO == 6 && -f '/etc/apt/sources.list.d/dietpi-armbian.list' ]] then G_DIETPI-NOTIFY 2 'Moving EOL Armbian Bullseye repo to Bookworm for Debian-version-agnostic firmware and kernel upgrades' cat << '_EOF_' > /etc/apt/preferences.d/dietpi-armbian || exit 1 Package: * Pin: origin apt.armbian.com Pin-Priority: -1 Package: armbian-firmware* linux-* Pin: origin apt.armbian.com Pin-Priority: 500 _EOF_ G_EXEC sed --follow-symlinks -i 's/bullseye/bookworm/g' /etc/apt/sources.list.d/dietpi-armbian.list fi fi exit 0 }