diff --git a/.build/images/dietpi-build b/.build/images/dietpi-build
index 17f17785dd..3df67896c6 100755
--- a/.build/images/dietpi-build
+++ b/.build/images/dietpi-build
@@ -595,10 +595,10 @@ _EOF_
G_CONFIG_INJECT 'AUTO_SETUP_AUTOSTART_TARGET_INDEX=' 'AUTO_SETUP_AUTOSTART_TARGET_INDEX=0' rootfs/boot/dietpi.txt
# Force ARMv6 arch on Raspbian
- (( $HW_ARCH == 1 )) && echo 'sed -i -e '\''/^G_HW_ARCH=/c\G_HW_ARCH=1'\'' -e '\''/^G_HW_ARCH_NAME=/c\G_HW_ARCH_NAME=armv6l'\'' /boot/dietpi/.hw_model' > rootfs/boot/Automation_Custom_PreScript.sh
+ (( $HW_ARCH == 1 )) && echo 'sed --follow-symlinks -i -e '\''/^G_HW_ARCH=/c\G_HW_ARCH=1'\'' -e '\''/^G_HW_ARCH_NAME=/c\G_HW_ARCH_NAME=armv6l'\'' /boot/dietpi/.hw_model' > rootfs/boot/Automation_Custom_PreScript.sh
# Temporary fix for failing NAA Daemon install on Trixie
- (( $DISTRO == 8 )) && G_EXEC sed -i '\|www.signalyst.eu|s|bookworm/bullseye|trixie/bullseye|' rootfs/boot/dietpi/dietpi-software
+ (( $DISTRO == 8 )) && G_EXEC sed --follow-symlinks -i '\|www.signalyst.eu|s|bookworm/bullseye|trixie/bullseye|' rootfs/boot/dietpi/dietpi-software
# Skip filesystem expansion
G_EXEC rm rootfs/etc/systemd/system/local-fs.target.wants/dietpi-fs_partition_resize.service
@@ -627,7 +627,7 @@ then
systemctl mask serial-getty@ttyS0
/boot/dietpi/func/dietpi-set_hardware serialconsole 1 serial0
G_CONFIG_INJECT 'temp_limit=' 'temp_limit=75' /boot/config.txt # since most RPis are now RPi 4 and Allo ships the CM3 with USBridge Sig and Allo GUI image
- G_EXEC sed -Ei 's/^(arm_freq|over_voltage)=/#\1=/' /boot/config.txt
+ G_EXEC sed --follow-symlinks -Ei 's/^(arm_freq|over_voltage)=/#\1=/' /boot/config.txt
fi
# FirstBoot
@@ -658,7 +658,7 @@ G_EXEC rm /etc/bashrc.d/00-dietpi-build.sh /boot/Automation_Custom_Script.sh
poweroff
}
_EOF_
- (( $HW_ARCH == 1 )) && G_EXEC sed -i 's/Custom_Script/Custom_{Pre,}Script/' rootfs/boot/Automation_Custom_Script.sh
+ (( $HW_ARCH == 1 )) && G_EXEC sed --follow-symlinks -i 's/Custom_Script/Custom_{Pre,}Script/' rootfs/boot/Automation_Custom_Script.sh
# Start container
# - Bind mounts required to allow container reading its own drive info, /dev/disk for GRUB and probably other tools to detect UUIDs
@@ -1053,37 +1053,14 @@ then
[[ -x 'upload.sh' ]] && G_EXEC_OUTPUT=1 G_EXEC ./upload.sh "$image_name.vhdx.xz"{,.sha256} "${signature[@]}" && G_EXEC rm "$image_name.vhdx.xz"{,.sha256} "${signature[@]}"
fi
-####### Proxmox ############################
-if [[ $VMTYPE =~ ^(proxmox|all)$ ]]
-then
- image_name=${OUTPUT_IMG_NAME/_VM-/_Proxmox-}
- # Convert raw image to QCOW2
- G_EXEC qemu-img convert -c -O qcow2 "$OUTPUT_IMG_NAME.img" "$image_name.qcow2"
-
- # Keep QCOW2 in compression when UTM appliance shall be generated from it as well.
- keep=()
- [[ $VMTYPE == 'all' ]] && keep=('-k')
-
- G_EXEC_DESC='Creating Proxmox xz archive' G_EXEC xz -9e "${limit_threads[@]}" "${keep[@]}" "$image_name.qcow2"
- G_EXEC_DESC='Generating SHA256 hash' G_EXEC eval "sha256sum '$image_name.qcow2.xz' > '$image_name.qcow2.xz.sha256'"
- signature=()
- [[ $SIGN_PASS ]] && { G_DIETPI-NOTIFY 2 'Signing archive ...'; gpg --batch --pinentry-mode loopback --passphrase "$SIGN_PASS" -b --armor "$image_name.qcow2.xz" || exit 1; signature=("$image_name.qcow2.xz.asc"); }
- [[ -x 'upload.sh' ]] && G_EXEC_OUTPUT=1 G_EXEC ./upload.sh "$image_name.qcow2.xz"{,.sha256} "${signature[@]}" && G_EXEC rm "$image_name.qcow2.xz"{,.sha256} "${signature[@]}"
-fi
-
####### UTM ##############################
if [[ $VMTYPE =~ ^(utm|all)$ ]]
then
image_name=${OUTPUT_IMG_NAME/_VM-/_UTM-}
# Create directory which is interpreted as VM appliance file on macOS
G_EXEC mkdir -p "$image_name.utm/Images"
- # Reuse or convert raw image to QCOW2
- if [[ $VMTYPE == 'all' ]]
- then
- G_EXEC mv "${OUTPUT_IMG_NAME/_VM-/_Proxmox-}.qcow2" "$image_name.utm/Images/data.qcow2"
- else
- G_EXEC qemu-img convert -c -O qcow2 "$OUTPUT_IMG_NAME.img" "$image_name.utm/Images/data.qcow2"
- fi
+ # Convert raw image to QCOW2
+ G_EXEC qemu-img convert -c -O qcow2 "$OUTPUT_IMG_NAME.img" "$image_name.utm/Images/data.qcow2"
# Generate random MAC address and UUID for VM
mac=$(tr -dc '0-9A-F' < /dev/urandom | head -c10 | sed -E 's/(..)/\1:/g;s/:$//;s/^/02:/') # ToDo: Beginning with "D2:"?
vmuuid=$( '$image_name.qcow2.xz.sha256'"
+ signature=()
+ [[ $SIGN_PASS ]] && { G_DIETPI-NOTIFY 2 'Signing archive ...'; gpg --batch --pinentry-mode loopback --passphrase "$SIGN_PASS" -b --armor "$image_name.qcow2.xz" || exit 1; signature=("$image_name.qcow2.xz.asc"); }
+ [[ -x 'upload.sh' ]] && G_EXEC_OUTPUT=1 G_EXEC ./upload.sh "$image_name.qcow2.xz"{,.sha256} "${signature[@]}" && G_EXEC rm "$image_name.qcow2.xz"{,.sha256} "${signature[@]}"
+fi
+
# Cleanup
G_EXEC rm "$OUTPUT_IMG_NAME.img"
diff --git a/.build/images/dietpi-imager b/.build/images/dietpi-imager
index 5679df1b30..e69025bf47 100755
--- a/.build/images/dietpi-imager
+++ b/.build/images/dietpi-imager
@@ -667,7 +667,7 @@ _EOF_
sed '/^menuentry /,$d' tmpiso/boot/grub/clonezilla.cfg > tmpiso/boot/grub/grub.cfg
sed -n '/menuentry .*Safe graphic/,/}/s/^ //p' tmpiso/boot/grub/clonezilla.cfg >> tmpiso/boot/grub/grub.cfg
# shellcheck disable=SC2016
- sed -i -e '/^set timeout=/c\set timeout="-1"' -e '/^set pref=/a\set theme=\$pref/theme.txt' -e '/^menuentry /c\menuentry "Install DietPi" {' \
+ sed --follow-symlinks -i -e '/^set timeout=/c\set timeout="-1"' -e '/^set pref=/a\set theme=\$pref/theme.txt' -e '/^menuentry /c\menuentry "Install DietPi" {' \
-e 's/locales= /locales=C.UTF-8 /' -e 's/keyboard-layouts= /keyboard-layouts=gb /' -e 's/ocs-live-general/ocs-live-restore/' \
-e "s|ocs_live_extra_param=\"\"|ocs_live_extra_param=\"-icds -k1 -r -e2 -j2 -b -p poweroff restoredisk $OUTPUT_IMG_NAME ask_user\"|" \
-e 's/ocs_live_batch="no"/ocs_live_batch="yes"/' tmpiso/boot/grub/grub.cfg
@@ -680,10 +680,10 @@ _EOF_
G_EXEC curl -sSf "$DIETPI_REPO/.build/images/Clonezilla/dietpi-background_480p.png" -o tmpiso/syslinux/dietpibg.png
G_EXEC cp /usr/lib/syslinux/modules/bios/poweroff.c32 tmpiso/syslinux/
G_EXEC mv tmpiso/syslinux/{syslinux,clonezilla}.cfg
- sed -i '/^MENU TITLE/c\MENU TITLE Clonezilla live' tmpiso/syslinux/clonezilla.cfg
+ sed --follow-symlinks -i '/^MENU TITLE/c\MENU TITLE Clonezilla live' tmpiso/syslinux/clonezilla.cfg
sed '/^label /,$d' tmpiso/syslinux/clonezilla.cfg > tmpiso/syslinux/syslinux.cfg
sed -n '/^label .*framebuffer/,/ENDTEXT/p' tmpiso/syslinux/clonezilla.cfg >> tmpiso/syslinux/syslinux.cfg
- sed -i -e '/^timeout /c\timeout 0' -e 's|\(MENU BACKGROUND\) .*|\1 dietpibg.png|' -e '/^MENU TITLE /c\MENU TABMSG' \
+ sed --follow-symlinks -i -e '/^timeout /c\timeout 0' -e 's|\(MENU BACKGROUND\) .*|\1 dietpibg.png|' -e '/^MENU TITLE /c\MENU TABMSG' \
-e '/menu title/d' -e '/^say /d' -e '/MENU MARGIN/a\MENU HSHIFT 80\n MENU COLOR BORDER 0 #00000000 #00000000 none' \
-e '/^label /c\label Install DietPi' -e '/^ MENU LABEL /c\ MENU LABEL Install DietPi' -e '/^ TEXT HELP/,/^ ENDTEXT/d' \
-e 's/locales= /locales=C.UTF-8 /' -e 's/keyboard-layouts= /keyboard-layouts=gb /' -e 's/ocs-live-general/ocs-live-restore/' \
diff --git a/.build/images/dietpi-installer b/.build/images/dietpi-installer
index 78bed75eeb..cab8f40399 100755
--- a/.build/images/dietpi-installer
+++ b/.build/images/dietpi-installer
@@ -578,13 +578,13 @@ _EOF_
local model='OdroidC1'
(( $G_HW_MODEL == 11 )) && model='OdroidXU4'
G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/$model/boot.ini" /boot/boot.ini
- G_EXEC sed -i "s/root=[^[:blank:]]*/root=UUID=$(findmnt -Ufnro UUID -M /)/" /boot/boot.ini
- G_EXEC sed -i "s/rootfstype=[^[:blank:]]*/rootfstype=$(findmnt -Ufnro FSTYPE -M /)/" /boot/boot.ini
+ G_EXEC sed --follow-symlinks -i "s/root=[^[:blank:]]*/root=UUID=$(findmnt -Ufnro UUID -M /)/" /boot/boot.ini
+ G_EXEC sed --follow-symlinks -i "s/rootfstype=[^[:blank:]]*/rootfstype=$(findmnt -Ufnro FSTYPE -M /)/" /boot/boot.ini
G_EXEC mkdir -p /etc/kernel/post{inst,rm}.d /etc/initramfs/post-update.d
G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/dietpi-initramfs_cleanup" /etc/kernel/postinst.d/dietpi-initramfs_cleanup
G_EXEC ln -sf /etc/kernel/post{inst,rm}.d/dietpi-initramfs_cleanup
G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/99-dietpi-uboot" /etc/initramfs/post-update.d/99-dietpi-uboot
- G_EXEC sed -i 's/arm64/arm/' /etc/initramfs/post-update.d/99-dietpi-uboot
+ G_EXEC sed --follow-symlinks -i 's/arm64/arm/' /etc/initramfs/post-update.d/99-dietpi-uboot
elif [[ $G_HW_MODEL =~ ^(12|15|16|40|42|43|44|45|46|47|48|52|54|55|56|57|58|59|60|62|63|64|65|66|67|68|72|73|74|77|78|80|82|83|85|86)$ ]]
then
@@ -600,28 +600,28 @@ _EOF_
# Odroid C2: Fix USB device detection: https://github.com/MichaIng/DietPi/issues/5963
if (( $G_HW_MODEL == 12 ))
then
- G_EXEC sed -i 's/coherent_pool=2M/coherent_pool=2M usbcore.autosuspend=-1/' /boot/boot.cmd
+ G_EXEC sed --follow-symlinks -i 's/coherent_pool=2M/coherent_pool=2M usbcore.autosuspend=-1/' /boot/boot.cmd
# Odroid N2/HC4
elif [[ $G_HW_MODEL =~ ^(15|16)$ ]]
then
# Enable USB boot via petitboot support: https://github.com/MichaIng/DietPi/issues/5634
- G_EXEC sed -i '1i[main]' /boot/dietpiEnv.txt
+ G_EXEC sed --follow-symlinks -i '1i[main]' /boot/dietpiEnv.txt
# shellcheck disable=SC2016
- (( $G_HW_MODEL == 15 )) && G_EXEC sed -i '/^setenv overlay_error/a\
+ (( $G_HW_MODEL == 15 )) && G_EXEC sed --follow-symlinks -i '/^setenv overlay_error/a\
\n# petitboot workarounds\
if test "${variant}" = "n2_plus"; then setenv variant "n2-plus"; fi\
setenv fdtfile "amlogic/meson-g12b-odroid-${variant}.dtb"\
setenv rootuuid "true"' /boot/boot.cmd
# shellcheck disable=SC2016
- (( $G_HW_MODEL == 16 )) && G_EXEC sed -i '/^setenv overlay_error/a\
+ (( $G_HW_MODEL == 16 )) && G_EXEC sed --follow-symlinks -i '/^setenv overlay_error/a\
\n# petitboot workarounds\
setenv fdtfile "amlogic/meson-sm1-odroid-${variant}.dtb"\
setenv rootuuid "true"' /boot/boot.cmd
# shellcheck disable=SC2016
- G_EXEC sed -i '/env import/c\ ini main ${scriptaddr} || env import -t ${scriptaddr} ${filesize}' /boot/boot.cmd
+ G_EXEC sed --follow-symlinks -i '/env import/c\ ini main ${scriptaddr} || env import -t ${scriptaddr} ${filesize}' /boot/boot.cmd
# shellcheck disable=SC2016
- G_EXEC sed -i '/test -e/s/fixup.scr;/fixup.scr || test "${petitboot_active}" = "1";/' /boot/boot.cmd
+ G_EXEC sed --follow-symlinks -i '/test -e/s/fixup.scr;/fixup.scr || test "${petitboot_active}" = "1";/' /boot/boot.cmd
# Odroid N2: Assure that hardware random generator driver is loaded as early as possible to prevent rngd failures: https://github.com/MichaIng/DietPi/issues/6483
(( $G_HW_MODEL == 15 )) && G_EXEC eval 'echo '\''meson_rng'\'' > /etc/modules-load.d/dietpi-hwrng.conf'
@@ -629,7 +629,7 @@ setenv rootuuid "true"' /boot/boot.cmd
# Rockchip 64-bit (configs work with Amlogic OOTB)
elif [[ $G_HW_MODEL =~ ^(42|43|46|47|55|56|58|68|72|73|77|78|80|82|85|86)$ ]]
then
- G_EXEC sed -Ei '/^setenv (kernel|fdt)_addr_r/d' /boot/boot.cmd
+ G_EXEC sed --follow-symlinks -Ei '/^setenv (kernel|fdt)_addr_r/d' /boot/boot.cmd
G_CONFIG_INJECT 'setenv scriptaddr ' 'setenv scriptaddr "0x9000000"' /boot/boot.cmd
G_CONFIG_INJECT 'overlay_path=' 'overlay_path=rockchip' /boot/dietpiEnv.txt
case $G_HW_MODEL in
@@ -650,29 +650,29 @@ setenv rootuuid "true"' /boot/boot.cmd
case $G_HW_MODEL in
73) G_CONFIG_INJECT 'consoleargs=' 'consoleargs=console=ttyS0,1500000' /boot/dietpiEnv.txt;; # headless
47|55|56) G_CONFIG_INJECT 'consoleargs=' 'consoleargs=console=ttyS2,1500000' /boot/dietpiEnv.txt;; # headless
- 78|80|82) G_EXEC sed -i 's/ttyAML0,115200/ttyFIQ0,1500000/' /boot/dietpiEnv.txt;;
- *) G_EXEC sed -i 's/ttyAML0,115200/ttyS2,1500000/' /boot/dietpiEnv.txt;;
+ 78|80|82) G_EXEC sed --follow-symlinks -i 's/ttyAML0,115200/ttyFIQ0,1500000/' /boot/dietpiEnv.txt;;
+ *) G_EXEC sed --follow-symlinks -i 's/ttyAML0,115200/ttyS2,1500000/' /boot/dietpiEnv.txt;;
esac
# ASUS Tinker Board (32-bit)
elif (( $G_HW_MODEL == 52 ))
then
- G_EXEC sed -i 's/arm64/arm/' /etc/initramfs/post-update.d/99-dietpi-uboot /boot/boot.cmd
- G_EXEC sed -Ei '/^setenv (kernel_addr_r|fdt_addr_r|overlay_path)/d' /boot/boot.cmd
+ G_EXEC sed --follow-symlinks -i 's/arm64/arm/' /etc/initramfs/post-update.d/99-dietpi-uboot /boot/boot.cmd
+ G_EXEC sed --follow-symlinks -Ei '/^setenv (kernel_addr_r|fdt_addr_r|overlay_path)/d' /boot/boot.cmd
G_CONFIG_INJECT 'setenv scriptaddr ' 'setenv scriptaddr "0x39000000"' /boot/boot.cmd
G_CONFIG_INJECT 'setenv ramdisk_addr_r ' 'setenv ramdisk_addr_r "0x21000000"' /boot/boot.cmd '^setenv scriptaddr'
# shellcheck disable=SC2016
- G_EXEC sed -i -e 's|\${prefix}Image|${prefix}zImage|' -e 's/booti/bootz/' -e 's|\${overlay_path}/||' /boot/boot.cmd
- G_EXEC sed -i '/^overlay_path/d' /boot/dietpiEnv.txt
+ G_EXEC sed --follow-symlinks -i -e 's|\${prefix}Image|${prefix}zImage|' -e 's/booti/bootz/' -e 's|\${overlay_path}/||' /boot/boot.cmd
+ G_EXEC sed --follow-symlinks -i '/^overlay_path/d' /boot/dietpiEnv.txt
G_CONFIG_INJECT 'overlay_prefix=' 'overlay_prefix=rockchip' /boot/dietpiEnv.txt
G_CONFIG_INJECT 'overlays=' 'overlays=uart2' /boot/dietpiEnv.txt
# ASUS Tinker Board: https://github.com/MichaIng/DietPi/issues/5554
- G_EXEC sed -i -e 's/ttyAML0/ttyS2/' -e '/^extraargs=/s/$/ systemd.unified_cgroup_hierarchy=0/' /boot/dietpiEnv.txt
+ G_EXEC sed --follow-symlinks -i -e 's/ttyAML0/ttyS2/' -e '/^extraargs=/s/$/ systemd.unified_cgroup_hierarchy=0/' /boot/dietpiEnv.txt
# Allwinner 64-bit
elif [[ $G_HW_MODEL =~ ^(40|44|45|57|65|67|83)$ ]]
then
- G_EXEC sed -Ei '/^setenv (kernel|fdt)_addr_r/d' /boot/boot.cmd
+ G_EXEC sed --follow-symlinks -Ei '/^setenv (kernel|fdt)_addr_r/d' /boot/boot.cmd
G_CONFIG_INJECT 'setenv scriptaddr ' 'setenv scriptaddr "0x45000000"' /boot/boot.cmd
G_CONFIG_INJECT 'overlay_path=' 'overlay_path=allwinner' /boot/dietpiEnv.txt
case $G_HW_MODEL in
@@ -693,18 +693,18 @@ setenv rootuuid "true"' /boot/boot.cmd
esac
case $G_HW_MODEL in
57|65) G_CONFIG_INJECT 'consoleargs=' 'consoleargs=console=ttyS0,115200' /boot/dietpiEnv.txt;; # headless
- *) G_EXEC sed -i 's/ttyAML0/ttyS0/' /boot/dietpiEnv.txt;;
+ *) G_EXEC sed --follow-symlinks -i 's/ttyAML0/ttyS0/' /boot/dietpiEnv.txt;;
esac
# Allwinner H3 (32-bit)
elif [[ $G_HW_MODEL =~ ^(48|59|60|63|64|66)$ ]]
then
- G_EXEC sed -i 's/arm64/arm/' /etc/initramfs/post-update.d/99-dietpi-uboot /boot/boot.cmd
- G_EXEC sed -Ei '/^setenv (kernel_addr_r|fdt_addr_r|overlay_path)/d' /boot/boot.cmd
+ G_EXEC sed --follow-symlinks -i 's/arm64/arm/' /etc/initramfs/post-update.d/99-dietpi-uboot /boot/boot.cmd
+ G_EXEC sed --follow-symlinks -Ei '/^setenv (kernel_addr_r|fdt_addr_r|overlay_path)/d' /boot/boot.cmd
G_CONFIG_INJECT 'setenv scriptaddr ' 'setenv scriptaddr "0x45000000"' /boot/boot.cmd
# shellcheck disable=SC2016
- G_EXEC sed -i -e 's|\${prefix}Image|${prefix}zImage|' -e 's/booti/bootz/' -e 's|\${overlay_path}/||' /boot/boot.cmd
- G_EXEC sed -i '/^overlay_path/d' /boot/dietpiEnv.txt
+ G_EXEC sed --follow-symlinks -i -e 's|\${prefix}Image|${prefix}zImage|' -e 's/booti/bootz/' -e 's|\${overlay_path}/||' /boot/boot.cmd
+ G_EXEC sed --follow-symlinks -i '/^overlay_path/d' /boot/dietpiEnv.txt
G_CONFIG_INJECT 'overlay_prefix=' 'overlay_prefix=sun8i-h3' /boot/dietpiEnv.txt
case $G_HW_MODEL in
48) G_CONFIG_INJECT 'overlays=' 'overlays=usbhost1 usbhost2 uart1' /boot/dietpiEnv.txt;;
@@ -715,20 +715,20 @@ setenv rootuuid "true"' /boot/boot.cmd
case $G_HW_MODEL in
48) G_CONFIG_INJECT 'consoleargs=' 'consoleargs=console=ttyS1,115200' /boot/dietpiEnv.txt;; # headless
59|60|64) G_CONFIG_INJECT 'consoleargs=' 'consoleargs=console=ttyS0,115200' /boot/dietpiEnv.txt;; # headless
- *) G_EXEC sed -i 's/ttyAML0/ttyS0/' /boot/dietpiEnv.txt;;
+ *) G_EXEC sed --follow-symlinks -i 's/ttyAML0/ttyS0/' /boot/dietpiEnv.txt;;
esac
# NanoPi M3/T3/Fire3 (64-bit)
elif (( $G_HW_MODEL == 62 ))
then
G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/NanoPiM3/boot.cmd" /boot/boot.cmd
- G_EXEC sed -i '/overlay/d' /boot/dietpiEnv.txt
- G_EXEC sed -i 's/ttyAML0/ttySAC0/' /boot/dietpiEnv.txt
+ G_EXEC sed --follow-symlinks -i '/overlay/d' /boot/dietpiEnv.txt
+ G_EXEC sed --follow-symlinks -i 's/ttyAML0/ttySAC0/' /boot/dietpiEnv.txt
fi
fi
# shellcheck disable=SC2016
- [[ -f '/etc/initramfs/post-update.d/99-dietpi-uboot' && $(findmnt -t vfat -M /boot) ]] && G_EXEC sed -i '/^ln -s/c\mv -v "/boot/uInitrd-$1" /boot/uInitrd' /etc/initramfs/post-update.d/99-dietpi-uboot # FAT does not support symlinks
+ [[ -f '/etc/initramfs/post-update.d/99-dietpi-uboot' && $(findmnt -t vfat -M /boot) ]] && G_EXEC sed --follow-symlinks -i '/^ln -s/c\mv -v "/boot/uInitrd-$1" /boot/uInitrd' /etc/initramfs/post-update.d/99-dietpi-uboot # FAT does not support symlinks
G_EXEC mv "DietPi-$G_GITBRANCH/dietpi.txt" /boot/
G_EXEC mv "DietPi-$G_GITBRANCH/README.md" /boot/dietpi-README.md
@@ -833,7 +833,6 @@ _EOF_
'locales' # Support locales, used by dietpi-config > Language/Regional Options > Locale
'mawk' # Minimal awk implementation
'nano' # Simple text editor
- 'p7zip' # .7z archiver
'parted' # partprobe + drive partitioning, used by DietPi-Drive_Manager
'procps' # "kill", "ps", "pgrep", "sysctl", used by several DietPi scripts
'psmisc' # "killall", used by several DietPi scripts
@@ -847,6 +846,14 @@ _EOF_
#'xz-utils' # (.tar).xz archiver
)
+ # - Trixie: 7zip now provides the same commands p7zip does, so we can do a smooth migration without adjusting commands across our scripts.
+ if (( $DISTRO_TARGET > 7 ))
+ then
+ aPACKAGES_REQUIRED_INSTALL+=('7zip')
+ else
+ aPACKAGES_REQUIRED_INSTALL+=('p7zip')
+ fi
+
# Install gdisk if root filesystem is on a GPT partition, used by DietPi-FS_partition_resize
local ROOT_DEVICE=$(findmnt -Ufnro SOURCE -M /)
[[ $(blkid -s PTTYPE -o value -c /dev/null "$(lsblk -npo PKNAME "$ROOT_DEVICE")") == 'gpt' ]] && aPACKAGES_REQUIRED_INSTALL+=('gdisk')
@@ -1244,8 +1251,8 @@ _EOF_
done
G_EXEC_OUTPUT=1 G_EXEC dpkg -i package.deb
G_EXEC rm package.deb
- G_EXEC sed -i "s/root=[^[:blank:]]*/root=PARTUUID=$(findmnt -Ufnro PARTUUID -M /)/" /boot/extlinux/extlinux.conf
- G_EXEC sed -i "s/rootfstype=[^[:blank:]]*/rootfstype=$(findmnt -Ufnro FSTYPE -M /)/" /boot/extlinux/extlinux.conf
+ G_EXEC sed --follow-symlinks -i "s/root=[^[:blank:]]*/root=PARTUUID=$(findmnt -Ufnro PARTUUID -M /)/" /boot/extlinux/extlinux.conf
+ G_EXEC sed --follow-symlinks -i "s/rootfstype=[^[:blank:]]*/rootfstype=$(findmnt -Ufnro FSTYPE -M /)/" /boot/extlinux/extlinux.conf
aPACKAGES_REQUIRED_INSTALL+=('libubootenv-tool')
# Star64
@@ -1258,8 +1265,8 @@ _EOF_
done
G_EXEC_OUTPUT=1 G_EXEC dpkg -i package.deb
G_EXEC rm package.deb
- G_EXEC sed -i "s/root=[^[:blank:]]*/root=PARTUUID=$(findmnt -Ufnro PARTUUID -M /)/" /boot/extlinux/extlinux.conf
- G_EXEC sed -i "s/rootfstype=[^[:blank:]]*/rootfstype=$(findmnt -Ufnro FSTYPE -M /)/" /boot/extlinux/extlinux.conf
+ G_EXEC sed --follow-symlinks -i "s/root=[^[:blank:]]*/root=PARTUUID=$(findmnt -Ufnro PARTUUID -M /)/" /boot/extlinux/extlinux.conf
+ G_EXEC sed --follow-symlinks -i "s/rootfstype=[^[:blank:]]*/rootfstype=$(findmnt -Ufnro FSTYPE -M /)/" /boot/extlinux/extlinux.conf
aPACKAGES_REQUIRED_INSTALL+=('libubootenv-tool')
# Orange Pi Zero 3
@@ -1285,7 +1292,7 @@ _EOF_
# Apply device tree adjustment for Ethernet adapter
# shellcheck disable=SC2016
- sed -i -e '/^setenv bootargs /s/"$/ ethernet_phy=${ethernet_phy}"/' -e '/^# Boot/i\
+ sed --follow-symlinks -i -e '/^setenv bootargs /s/"$/ ethernet_phy=${ethernet_phy}"/' -e '/^# Boot/i\
if test "${ethernet_phy}" = "rtl8211f"; then\
echo "Ethernet adapter: ${ethernet_phy}, adjusting device tree ..."\
fdt set "/soc/ethernet@5020000" "allwinner,rx-delay-ps" "<3100>"\
@@ -1311,9 +1318,6 @@ fi\
# Cleanup
[[ -f '/boot/orangepiEnv.txt' ]] && G_EXEC rm /boot/orangepiEnv.txt
- # Load WiFi and Bluetooth modules explicitly, as they do not load automatically, until DietPi v8.24 does it via dietpi-set_hardware
- G_EXEC eval 'echo -e '\''sprdwl_ng\nsprdbt_tty'\'' > /etc/modules-load.d/dietpi-enable_wifi.conf'
-
# Sparky SBC
elif (( $G_HW_MODEL == 70 ))
then
@@ -1738,7 +1742,7 @@ _EOF_
#-----------------------------------------------------------------------------------
# Bash Profiles
# - Enable /etc/bashrc.d/ support for custom interactive non-login shell scripts:
- sed -i '\#/etc/bashrc\.d/#d' /etc/bash.bashrc
+ sed --follow-symlinks -i '\#/etc/bashrc\.d/#d' /etc/bash.bashrc
# shellcheck disable=SC2016
echo 'for i in /etc/bashrc.d/*.sh /etc/bashrc.d/*.bash; do [ -r "$i" ] && . $i; done; unset -v i' >> /etc/bash.bashrc
# - Enable bash-completion for non-login shells:
@@ -2094,14 +2098,14 @@ rm -v /tmp/ax88179_178a.ko || exit 0
_EOF_
G_EXEC chmod +x /etc/kernel/postinst.d/dietpi-USBridgeSig
# Force upgrade now, regardless of current host machine
- G_EXEC sed -i 's/^grep/#grep/' /etc/kernel/postinst.d/dietpi-USBridgeSig
+ G_EXEC sed --follow-symlinks -i 's/^grep/#grep/' /etc/kernel/postinst.d/dietpi-USBridgeSig
for i in /lib/modules/*-v7+
do
[[ -d $i ]] || continue
i=${i##*/}
/etc/kernel/postinst.d/dietpi-USBridgeSig "$i"
done
- G_EXEC sed -i 's/^#grep/grep/' /etc/kernel/postinst.d/dietpi-USBridgeSig
+ G_EXEC sed --follow-symlinks -i 's/^#grep/grep/' /etc/kernel/postinst.d/dietpi-USBridgeSig
# For backwards compatibility with software compiled against older libraspberrypi0, create symlinks from old to new filenames
if (( $G_HW_ARCH < 3 ))
@@ -2188,7 +2192,7 @@ _EOF_
then
G_CONFIG_INJECT 'CONFIG_NTP_MODE=' 'CONFIG_NTP_MODE=0' /boot/dietpi.txt
else
- G_EXEC_DESC='Enable Dropbear autostart' G_EXEC sed -i '/NO_START=1/c\NO_START=0' /etc/default/dropbear
+ G_EXEC_DESC='Enable Dropbear autostart' G_EXEC sed --follow-symlinks -i '/NO_START=1/c\NO_START=0' /etc/default/dropbear
G_EXEC systemctl unmask dropbear
G_EXEC systemctl enable dropbear
fi
@@ -2205,7 +2209,7 @@ _EOF_
# Re-enable for next run
(( $G_HW_MODEL == 75 )) || G_CONFIG_INJECT 'AUTO_SETUP_SWAPFILE_SIZE=' 'AUTO_SETUP_SWAPFILE_SIZE=1' /boot/dietpi.txt
# Reset /tmp size to default (512 MiB)
- sed -i '\|/tmp|s|size=[^,]*,||' /etc/fstab
+ sed --follow-symlinks -i '\|/tmp|s|size=[^,]*,||' /etc/fstab
# Set WiFi
local tmp_info='Disabling'
@@ -2236,10 +2240,8 @@ _EOF_
fi
# - x86_64: GRUB install and config
- if (( $G_HW_ARCH == 10 && $G_HW_MODEL != 75 )); then
-
- G_EXEC_DESC='Detecting additional OS installed on system' G_EXEC_OUTPUT=1 G_EXEC os-prober
-
+ if (( $G_HW_ARCH == 10 && $G_HW_MODEL != 75 ))
+ then
# UEFI
if [[ -d '/boot/efi' ]] && dpkg-query -s 'grub-efi-amd64' &> /dev/null
then
@@ -2266,9 +2268,6 @@ _EOF_
G_CONFIG_INJECT 'GRUB_CMDLINE_LINUX=' 'GRUB_CMDLINE_LINUX="net.ifnames=0"' /etc/default/grub
G_CONFIG_INJECT 'GRUB_TIMEOUT=' 'GRUB_TIMEOUT=0' /etc/default/grub
G_EXEC_DESC='Regenerating GRUB config' G_EXEC_OUTPUT=1 G_EXEC grub-mkconfig -o /boot/grub/grub.cfg
-
- # Purge "os-prober" again
- G_AGP os-prober
fi
G_DIETPI-NOTIFY 2 'Disabling soundcards by default'
diff --git a/.build/software/Amiberry/build.bash b/.build/software/Amiberry/build.bash
index e2f559fb8f..488dabbac2 100755
--- a/.build/software/Amiberry/build.bash
+++ b/.build/software/Amiberry/build.bash
@@ -183,7 +183,7 @@ do
done
DEPS_APT_VERSIONED=${DEPS_APT_VERSIONED%,}
# shellcheck disable=SC2001
-[[ $G_HW_ARCH_NAME == 'armv6l' ]] && DEPS_APT_VERSIONED=$(sed 's/+rp[it][0-9]\+[^)]*)/)/g' <<< "$DEPS_APT_VERSIONED") || DEPS_APT_VERSIONED=$(sed 's/+b[0-9]\+)/)/g' <<< "$DEPS_APT_VERSIONED")
+grep -q '^ID=raspbian' /etc/os-release && DEPS_APT_VERSIONED=$(sed 's/+rp[it][0-9]\+[^)]*)/)/g' <<< "$DEPS_APT_VERSIONED") || DEPS_APT_VERSIONED=$(sed 's/+b[0-9]\+)/)/g' <<< "$DEPS_APT_VERSIONED")
# - Obtain version suffix
G_EXEC curl -sSfo package.deb "https://dietpi.com/downloads/binaries/$G_DISTRO_NAME/amiberry_$PLATFORM.deb"
diff --git a/.build/software/Amiberry/container_build.bash b/.build/software/Amiberry/container_build.bash
index 67c9d5f874..45da9337b6 100755
--- a/.build/software/Amiberry/container_build.bash
+++ b/.build/software/Amiberry/container_build.bash
@@ -84,7 +84,7 @@ G_EXEC mkdir rootfs
G_EXEC mount "${FP_LOOP}p1" rootfs
# Enforce ARMv6 arch on Raspbian
-(( $arch > 1 )) || echo 'sed -i -e '\''/^G_HW_ARCH=/c\G_HW_ARCH=1'\'' -e '\''/^G_HW_ARCH_NAME=/c\G_HW_ARCH_NAME=armv6l'\'' /boot/dietpi/.hw_model' > rootfs/boot/Automation_Custom_PreScript.sh || Error_Exit 'Failed to generate Automation_Custom_PreScript.sh'
+(( $arch > 1 )) || echo 'sed --follow-symlinks -i -e '\''/^G_HW_ARCH=/c\G_HW_ARCH=1'\'' -e '\''/^G_HW_ARCH_NAME=/c\G_HW_ARCH_NAME=armv6l'\'' /boot/dietpi/.hw_model' > rootfs/boot/Automation_Custom_PreScript.sh || Error_Exit 'Failed to generate Automation_Custom_PreScript.sh'
# Enable automated setup
G_CONFIG_INJECT 'AUTO_SETUP_AUTOMATED=' 'AUTO_SETUP_AUTOMATED=1' rootfs/boot/dietpi.txt
diff --git a/.build/software/dietpi-software-build.bash b/.build/software/dietpi-software-build.bash
index cc05c7d281..f5346d543e 100644
--- a/.build/software/dietpi-software-build.bash
+++ b/.build/software/dietpi-software-build.bash
@@ -89,7 +89,7 @@ G_EXEC mkdir rootfs
G_EXEC mount "${FP_LOOP}p1" rootfs
# Enforce ARMv6 arch on Raspbian
-(( $arch > 1 )) || echo 'sed -i -e '\''/^G_HW_ARCH=/c\G_HW_ARCH=1'\'' -e '\''/^G_HW_ARCH_NAME=/c\G_HW_ARCH_NAME=armv6l'\'' /boot/dietpi/.hw_model' > rootfs/boot/Automation_Custom_PreScript.sh || Error_Exit 'Failed to generate Automation_Custom_PreScript.sh'
+(( $arch > 1 )) || echo 'sed --follow-symlinks -i -e '\''/^G_HW_ARCH=/c\G_HW_ARCH=1'\'' -e '\''/^G_HW_ARCH_NAME=/c\G_HW_ARCH_NAME=armv6l'\'' /boot/dietpi/.hw_model' > rootfs/boot/Automation_Custom_PreScript.sh || Error_Exit 'Failed to generate Automation_Custom_PreScript.sh'
# Enable automated setup
G_CONFIG_INJECT 'AUTO_SETUP_AUTOMATED=' 'AUTO_SETUP_AUTOMATED=1' rootfs/boot/dietpi.txt
diff --git a/.build/software/gmediarender/build.bash b/.build/software/gmediarender/build.bash
index 791313df19..a75b6da683 100755
--- a/.build/software/gmediarender/build.bash
+++ b/.build/software/gmediarender/build.bash
@@ -41,7 +41,8 @@ G_EXEC strip --remove-section=.comment --remove-section=.note "src/$name"
# Package dir: In case of Raspbian, force ARMv6
G_DIETPI-NOTIFY 2 "Preparing $name_pretty DEB package directory"
G_EXEC cd /tmp
-grep -q 'raspbian' /etc/os-release && DIR='gmediarender_armv6l' || DIR="gmediarender_$G_HW_ARCH_NAME"
+grep -q '^ID=raspbian' /etc/os-release && G_HW_ARCH_NAME='armv6l'
+DIR="gmediarender_$G_HW_ARCH_NAME"
[[ -d $DIR ]] && G_EXEC rm -R "$DIR"
# - Control files, config, systemd service, executable, icons, copyright
G_EXEC mkdir -p "$DIR/"{DEBIAN,etc/default,lib/systemd/system,usr/{bin,share/{,doc/}gmediarender}}
@@ -97,7 +98,7 @@ then
INTERFACE=$(ip r l 0/0 | awk '{print $5;exit}')
[ "$INTERFACE" ] || INTERFACE=$(ip -br a | awk '$2=="UP"{print $1;exit}')
[ "$INTERFACE" ] || exit 1
- sed -i "s/-u UUID -f HOSTNAME -I eth0/-u $G_HW_UUID -f $HOSTNAME -I $INTERFACE/" /etc/default/gmediarender
+ sed --follow-symlinks -i "s/-u UUID -f HOSTNAME -I eth0/-u $G_HW_UUID -f $HOSTNAME -I $INTERFACE/" /etc/default/gmediarender
fi
if getent passwd gmediarender > /dev/null
diff --git a/.build/software/gogs/build.bash b/.build/software/gogs/build.bash
index e29b14dc36..57ca5c09a2 100755
--- a/.build/software/gogs/build.bash
+++ b/.build/software/gogs/build.bash
@@ -20,6 +20,7 @@ G_EXEC_OUTPUT=1 G_EXEC go install 'gogs.io/gogs@latest'
G_EXEC mkdir gogs
G_EXEC mv /root/go/bin/gogs gogs/
G_EXEC strip gogs/gogs
+grep -q '^ID=raspbian' /etc/os-release && G_HW_ARCH_NAME='armv6l'
G_EXEC "$c7zip" a -mx=9 "/tmp/gogs_$G_HW_ARCH_NAME.7z" gogs
# Cleanup
diff --git a/.build/software/raspberrypi-sys-mods/build.bash b/.build/software/raspberrypi-sys-mods/build.bash
index 2e9ba2badb..ac91cd6ef2 100755
--- a/.build/software/raspberrypi-sys-mods/build.bash
+++ b/.build/software/raspberrypi-sys-mods/build.bash
@@ -37,7 +37,7 @@ G_EXEC curl -sSfo raspberrypi-sys-mods/lib/udev/rules.d/15-i2c-modprobe.rules 'h
G_EXEC curl -sSfo raspberrypi-sys-mods/lib/udev/rules.d/99-com.rules 'https://raw.githubusercontent.com/RPi-Distro/raspberrypi-sys-mods/master/etc.armhf/udev/rules.d/99-com.rules'
# The original rule uses the "strings" command from binutils, which we do not want to have pre-installed (it is huge!). So we use cat, which is safe for the node values read here.
-G_EXEC sed -i 's/(strings/(cat/g' raspberrypi-sys-mods/lib/udev/rules.d/99-com.rules
+G_EXEC sed --follow-symlinks -i 's/(strings/(cat/g' raspberrypi-sys-mods/lib/udev/rules.d/99-com.rules
cat << '_EOF_' > raspberrypi-sys-mods/DEBIAN/preinst
#!/bin/dash
diff --git a/.build/software/shairport-sync/build.bash b/.build/software/shairport-sync/build.bash
index 940e13ff1a..37ca209a36 100755
--- a/.build/software/shairport-sync/build.bash
+++ b/.build/software/shairport-sync/build.bash
@@ -53,7 +53,8 @@ G_EXEC strip --remove-section=.comment --remove-section=.note "$name"
# Package dir: In case of Raspbian, force ARMv6
G_DIETPI-NOTIFY 2 "Preparing $name_pretty DEB package directory"
G_EXEC cd /tmp
-grep -q 'raspbian' /etc/os-release && DIR="${name}_armv6l" || DIR="${name}_$G_HW_ARCH_NAME"
+grep -q '^ID=raspbian' /etc/os-release && G_HW_ARCH_NAME='armv6l'
+DIR="${name}_$G_HW_ARCH_NAME"
[[ -d $DIR ]] && G_EXEC rm -R "$DIR"
# - Control files, systemd service, executable, configs, copyright
G_EXEC mkdir -p "$DIR/"{DEBIAN,lib/systemd/system,usr/local/{bin,etc,"share/doc/$name"},etc/dbus-1/system.d}
diff --git a/.build/software/squeezelite/build.bash b/.build/software/squeezelite/build.bash
index 1acf1e07b0..ccf8c3b921 100755
--- a/.build/software/squeezelite/build.bash
+++ b/.build/software/squeezelite/build.bash
@@ -36,7 +36,8 @@ G_DIETPI-NOTIFY 2 'Starting packaging...'
# Package dir
G_EXEC cd /tmp
-grep -q 'raspbian' /etc/os-release && DIR='squeezelite_armv6l' || DIR="squeezelite_$G_HW_ARCH_NAME"
+grep -q '^ID=raspbian' /etc/os-release && G_HW_ARCH_NAME='armv6l'
+DIR="squeezelite_$G_HW_ARCH_NAME"
G_EXEC rm -Rf "$DIR"
G_EXEC mkdir -p "$DIR/"{DEBIAN,lib/systemd/system,etc/default,usr/{bin,share/doc/squeezelite,share/man/man1}}
diff --git a/.build/software/vaultwarden/build.bash b/.build/software/vaultwarden/build.bash
index d269988f76..dd09f2cc07 100755
--- a/.build/software/vaultwarden/build.bash
+++ b/.build/software/vaultwarden/build.bash
@@ -134,7 +134,7 @@ cat << '_EOF_' > "$DIR/DEBIAN/postinst"
if [[ ! $2 ]] && grep -q '^# ROCKET_ADDRESS=0.0.0.0$' /mnt/dietpi_userdata/vaultwarden/vaultwarden.env
then
echo 'Enabling web vault remote access ...'
- sed -i '/^# ROCKET_ADDRESS=0.0.0.0$/c\ROCKET_ADDRESS=0.0.0.0' /mnt/dietpi_userdata/vaultwarden/vaultwarden.env
+ sed --follow-symlinks -i '/^# ROCKET_ADDRESS=0.0.0.0$/c\ROCKET_ADDRESS=0.0.0.0' /mnt/dietpi_userdata/vaultwarden/vaultwarden.env
fi
if [[ -d '/run/systemd/system' ]]
diff --git a/.build/software/ympd/build.bash b/.build/software/ympd/build.bash
index 202a2660a2..8e08f05e17 100644
--- a/.build/software/ympd/build.bash
+++ b/.build/software/ympd/build.bash
@@ -39,6 +39,7 @@ G_DIETPI-NOTIFY 2 'Starting packaging...'
# Package dir
G_EXEC cd /tmp
+grep -q '^ID=raspbian' /etc/os-release && G_HW_ARCH_NAME='armv6l'
DIR="ympd_$G_HW_ARCH_NAME"
[[ -d $DIR ]] && G_EXEC rm -R "$DIR"
G_EXEC mkdir -p "$DIR/"{DEBIAN,lib/systemd/system,usr/{bin,share/man/man1}}
@@ -142,7 +143,7 @@ do
done
DEPS_APT_VERSIONED=${DEPS_APT_VERSIONED%,}
# shellcheck disable=SC2001
-(( $G_HW_ARCH == 1 )) && DEPS_APT_VERSIONED=$(sed 's/+rp[it][0-9]\+[^)]*)/)/g' <<< "$DEPS_APT_VERSIONED") || DEPS_APT_VERSIONED=$(sed 's/+b[0-9]\+)/)/g' <<< "$DEPS_APT_VERSIONED")
+[[ $G_HW_ARCH_NAME == 'armv6l' ]] && DEPS_APT_VERSIONED=$(sed 's/+rp[it][0-9]\+[^)]*)/)/g' <<< "$DEPS_APT_VERSIONED") || DEPS_APT_VERSIONED=$(sed 's/+b[0-9]\+)/)/g' <<< "$DEPS_APT_VERSIONED")
# - Obtain version
version="$(mawk -F\" '/CPACK_PACKAGE_VERSION_MAJOR/{print $2;exit}' ympd-master/CMakeLists.txt).$(mawk -F\" '/CPACK_PACKAGE_VERSION_MINOR/{print $2;exit}' ympd-master/CMakeLists.txt).$(mawk -F\" '/CPACK_PACKAGE_VERSION_PATCH/{print $2;exit}' ympd-master/CMakeLists.txt)"
diff --git a/.conf/dps_114/lighttpd.nextcloud.conf b/.conf/dps_114/lighttpd.nextcloud.conf
index 0b908919b7..1604d1c625 100644
--- a/.conf/dps_114/lighttpd.nextcloud.conf
+++ b/.conf/dps_114/lighttpd.nextcloud.conf
@@ -9,7 +9,6 @@ url.redirect += (
)
$HTTP["url"] =~ "^/nextcloud($|/)" {
-
# Hardening
# - Directories
$HTTP["url"] =~ "^/nextcloud/(build|tests|config|lib|3rdparty|templates|data)($|/)" { url.access-deny = ("") }
@@ -18,7 +17,7 @@ $HTTP["url"] =~ "^/nextcloud($|/)" {
# - Directory listing
dir-listing.activate = "disable"
# - Security and cache control headers for static resources
- $HTTP["url"] =~ "\.(css|js|svg|gif|png|jpg|ico|wasm|tflite|map|woff2?)$" {
+ $HTTP["url"] =~ "\.(css|js|mjs|svg|gif|png|jpg|ico|wasm|tflite|map|woff2?)$" {
setenv.add-response-header += (
"Referrer-Policy" => "no-referrer",
"X-Content-Type-Options" => "nosniff",
@@ -30,15 +29,13 @@ $HTTP["url"] =~ "^/nextcloud($|/)" {
"Cache-Control" => "public, max-age=15778463",
)
}
-
# Rewrites
url.rewrite-once += (
"^/nextcloud/remote/(.*)" => "/nextcloud/remote.php/$1",
"^/nextcloud/ocm-provider($|/\?.*)" => "/nextcloud/index.php$1"
)
url.rewrite-if-not-file += (
- "^/nextcloud/((core/ajax/update|cron|public|remote|status|ocs/v[12])\.php|ocs-provider/|updater/)" => "",
+ "^/nextcloud/((core/ajax/update|cron|public|remote|status|ocs/v[12]|richdocumentscode(_arm64)?/proxy)\.php|ocs-provider/|updater/)" => "",
"^/nextcloud(.*)" => "/nextcloud/index.php$1"
)
-
}
diff --git a/.conf/dps_114/nginx.nextcloud.conf b/.conf/dps_114/nginx.nextcloud.conf
index 9e14d43b1c..d537626e4b 100644
--- a/.conf/dps_114/nginx.nextcloud.conf
+++ b/.conf/dps_114/nginx.nextcloud.conf
@@ -77,7 +77,7 @@ location ^~ /nextcloud {
fastcgi_max_temp_file_size 0; # Allow downloads > 1 GiB: https://github.com/nextcloud/documentation/pull/7979
}
- location ~ \.(?:css|js|svg|gif|png|jpg|ico|wasm|tflite|map)$ {
+ location ~ \.(?:css|js|mjs|svg|gif|png|jpg|ico|wasm|tflite|map)$ {
try_files $uri /nextcloud/index.php$request_uri;
expires 6M; # Cache-Control policy borrowed from `.htaccess`
access_log off; # Optional: Don't log access to assets
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index 76df2760b4..d17c594ffe 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -4,6 +4,7 @@ about: Create a report to help us improve
---
### Creating a bug report/issue
+- [ ] I have searched the existing open and closed issues
#### Required Information
- DietPi version | `cat /boot/dietpi/.version`
diff --git a/.github/workflows/dietpi-software.bash b/.github/workflows/dietpi-software.bash
index 663ea4e861..8b4c6f43aa 100644
--- a/.github/workflows/dietpi-software.bash
+++ b/.github/workflows/dietpi-software.bash
@@ -285,7 +285,7 @@ G_EXEC mkdir rootfs
G_EXEC mount "${FP_LOOP}p1" rootfs
# Force ARMv6 arch on Raspbian
-(( $arch == 1 )) && G_EXEC sed -i '/# Start DietPi-Software/iG_EXEC sed -i -e '\''/^G_HW_ARCH=/cG_HW_ARCH=1'\'' -e '\''/^G_HW_ARCH_NAME=/cG_HW_ARCH_NAME=armv6l'\'' /boot/dietpi/.hw_model' rootfs/boot/dietpi/dietpi-login
+(( $arch == 1 )) && G_EXEC sed --follow-symlinks -i '/# Start DietPi-Software/iG_EXEC sed -i -e '\''/^G_HW_ARCH=/cG_HW_ARCH=1'\'' -e '\''/^G_HW_ARCH_NAME=/cG_HW_ARCH_NAME=armv6l'\'' /boot/dietpi/.hw_model' rootfs/boot/dietpi/dietpi-login
# Force RPi on ARM systems if requested
if [[ $RPI == 'true' ]] && (( $arch < 10 ))
@@ -298,7 +298,7 @@ then
esac
G_EXEC rm rootfs/etc/.dietpi_hw_model_identifier
G_EXEC touch rootfs/boot/{bcm-rpi-dummy.dtb,config.txt,cmdline.txt}
- G_EXEC sed -i "/# Start DietPi-Software/iG_EXEC sed -i -e '/^G_HW_MODEL=/cG_HW_MODEL=$model' -e '/^G_HW_MODEL_NAME=/cG_HW_MODEL_NAME=\"RPi $model ($ARCH)\"' /boot/dietpi/.hw_model" rootfs/boot/dietpi/dietpi-login
+ G_EXEC sed --follow-symlinks -i "/# Start DietPi-Software/iG_EXEC sed -i -e '/^G_HW_MODEL=/cG_HW_MODEL=$model' -e '/^G_HW_MODEL_NAME=/cG_HW_MODEL_NAME=\"RPi $model ($ARCH)\"' /boot/dietpi/.hw_model" rootfs/boot/dietpi/dietpi-login
G_EXEC curl -sSfo keyring.deb 'https://archive.raspberrypi.org/debian/pool/main/r/raspberrypi-archive-keyring/raspberrypi-archive-keyring_2021.1.1+rpt1_all.deb'
G_EXEC dpkg --root=rootfs -i keyring.deb
G_EXEC rm keyring.deb
@@ -312,7 +312,7 @@ fi
# Install test builds from dietpi.com if requested
# shellcheck disable=SC2016
-[[ $TEST == 'true' ]] && G_EXEC sed -i '/# Start DietPi-Software/a\sed -i '\''s|dietpi.com/downloads/binaries/$G_DISTRO_NAME/|dietpi.com/downloads/binaries/$G_DISTRO_NAME/testing/|'\'' /boot/dietpi/dietpi-software' rootfs/boot/dietpi/dietpi-login
+[[ $TEST == 'true' ]] && G_EXEC sed --follow-symlinks -i '/# Start DietPi-Software/a\sed -i '\''s|dietpi.com/downloads/binaries/$G_DISTRO_NAME/|dietpi.com/downloads/binaries/$G_DISTRO_NAME/testing/|'\'' /boot/dietpi/dietpi-software' rootfs/boot/dietpi/dietpi-login
# Workaround invalid TERM on login
# shellcheck disable=SC2016
@@ -365,27 +365,34 @@ G_EXEC eval 'echo -e '\''[Service]\nAmbientCapabilities='\'' > rootfs/etc/system
# Workarounds for failing MariaDB install on Buster within GitHub Actions runner (both cannot be replicated on my test systems with and without QEMU):
# - mysqld does not have write access if our symlink is in place, even that directory permissions are correct.
-# - Type=notify leads to a service start timeout while mysqld has actually fully started.
+# - Type=notify leads to a service start timeout while mysqld has actually fully started. However, with Type=exec, /etc/mysql/debian-start starts too soon after mysqld, so that the UNIX socket is not yet ready to listen. Hence add a second to wait for it.
if [[ $DISTRO == 'buster' ]]
then
- G_EXEC sed -i '/# Start DietPi-Software/a\sed -i -e '\''s|rm -Rf /var/lib/mysql|rm -Rf /mnd/dietpi_userdata/mysql|'\'' -e '\''s|ln -s /mnt/dietpi_userdata/mysql /var/lib/mysql|ln -s /var/lib/mysql /mnt/dietpi_userdata/mysql|'\'' /boot/dietpi/dietpi-software' rootfs/boot/dietpi/dietpi-login
+ G_EXEC sed --follow-symlinks -i '/# Start DietPi-Software/a\sed -i -e '\''s|rm -Rf /var/lib/mysql|rm -Rf /mnd/dietpi_userdata/mysql|'\'' -e '\''s|ln -s /mnt/dietpi_userdata/mysql /var/lib/mysql|ln -s /var/lib/mysql /mnt/dietpi_userdata/mysql|'\'' /boot/dietpi/dietpi-software' rootfs/boot/dietpi/dietpi-login
G_EXEC mkdir rootfs/etc/systemd/system/mariadb.service.d
- G_EXEC eval 'echo -e '\''[Service]\nType=exec'\'' > rootfs/etc/systemd/system/mariadb.service.d/dietpi-container.conf'
+ cat << '_EOF_' > rootfs/etc/systemd/system/mariadb.service.d/dietpi-container.conf || exit 1
+[Service]
+Type=exec
+ExecStartPost=
+ExecStartPost=/bin/sleep 1
+ExecStartPost=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION"
+ExecStartPost=/etc/mysql/debian-start
+_EOF_
fi
# Workaround for failing 32-bit ARM Rust builds on ext4 in QEMU emulated container on 64-bit host: https://github.com/rust-lang/cargo/issues/9545
(( $arch < 3 && $G_HW_ARCH > 9 )) && G_EXEC eval 'echo -e '\''tmpfs /mnt/dietpi_userdata tmpfs size=3G,noatime,lazytime\ntmpfs /root tmpfs size=3G,noatime,lazytime'\'' >> rootfs/etc/fstab'
# Workaround for Node.js on ARMv6
-(( $arch == 1 )) && G_EXEC sed -i '/# Start DietPi-Software/a\sed -i '\''/G_EXEC chmod +x node-install.sh/a\\sed -i "/^ARCH=/c\\ARCH=armv6l" node-install.sh'\'' /boot/dietpi/dietpi-software' rootfs/boot/dietpi/dietpi-login
+(( $arch == 1 )) && G_EXEC sed --follow-symlinks -i '/# Start DietPi-Software/a\sed -i '\''/G_EXEC chmod +x node-install.sh/a\\sed -i "/^ARCH=/c\\ARCH=armv6l" node-install.sh'\'' /boot/dietpi/dietpi-software' rootfs/boot/dietpi/dietpi-login
# Workaround for sysctl: permission denied on key "net.core.rmem_max" in containers
-G_EXEC sed -i '/# Start DietPi-Software/a\sed -i '\''/G_EXEC sysctl -w net\.core\.rmem_max/d'\'' /boot/dietpi/dietpi-software' rootfs/boot/dietpi/dietpi-login
+G_EXEC sed --follow-symlinks -i '/# Start DietPi-Software/a\sed -i '\''/G_EXEC sysctl -w net\.core\.rmem_max/d'\'' /boot/dietpi/dietpi-software' rootfs/boot/dietpi/dietpi-login
# Check for service status, ports and commands
# shellcheck disable=SC2016
# - Start all services
-G_EXEC sed -i '/# Start DietPi-Software/a\sed -i '\''/# Custom 1st run script/a\\for i in "${aSTART_SERVICES[@]}"; do G_EXEC_NOHALT=1 G_EXEC systemctl start "$i"; done'\'' /boot/dietpi/dietpi-software' rootfs/boot/dietpi/dietpi-login
+G_EXEC sed --follow-symlinks -i '/# Start DietPi-Software/a\sed -i '\''/# Custom 1st run script/a\\for i in "${aSTART_SERVICES[@]}"; do G_EXEC_NOHALT=1 G_EXEC systemctl start "$i"; done'\'' /boot/dietpi/dietpi-software' rootfs/boot/dietpi/dietpi-login
delay=10
for i in "${aDELAY[@]}"; do (( $i > $delay )) && delay=$i; done
G_EXEC eval "echo -e '#!/bin/dash\nexit_code=0; /boot/dietpi/dietpi-services start || exit_code=1; echo Waiting $delay seconds for service starts; sleep $delay' > rootfs/boot/Automation_Custom_Script.sh"
@@ -430,7 +437,7 @@ done
G_EXEC eval 'echo '\''[ $exit_code = 0 ] && > /success || { journalctl -n 50; ss -tlpn; df -h; free -h; poweroff; }; poweroff'\'' >> rootfs/boot/Automation_Custom_Script.sh'
# Shutdown as well on failure
-G_EXEC sed -i 's|Prompt_on_Failure$|{ journalctl -n 50; ss -tulpn; df -h; free -h; poweroff; }|' rootfs/boot/dietpi/dietpi-login
+G_EXEC sed --follow-symlinks -i 's|Prompt_on_Failure$|{ journalctl -n 50; ss -tulpn; df -h; free -h; poweroff; }|' rootfs/boot/dietpi/dietpi-login
##########################################
# Boot container
diff --git a/.github/workflows/quartz64.yml b/.github/workflows/quartz64.yml
index 49aa85a11b..c508f04166 100644
--- a/.github/workflows/quartz64.yml
+++ b/.github/workflows/quartz64.yml
@@ -13,12 +13,12 @@ jobs:
# https://github.com/actions/runner-images
runs-on: ubuntu-22.04
env:
- uboot_branch: 'v2022.07-dietpi'
+ uboot_version: '2023.10'
CROSS_COMPILE: 'aarch64-linux-gnu-'
ARCH: 'arm64'
steps:
# https://github.com/actions/setup-python/tags
- - uses: actions/setup-python@v4
+ - uses: actions/setup-python@v5
with:
python-version: '3.x'
check-latest: true
@@ -26,11 +26,11 @@ jobs:
run: |
{ python3 -m pip install --no-cache-dir -U pip setuptools wheel; python3 -m pip install --no-cache-dir -U pyelftools; } &
{ sudo apt-get -q update; sudo DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends -qq install make gcc libc6-dev flex bison gcc-aarch64-linux-gnu bc libssl-dev swig; } &
- { curl -fO "https://gitlab.com/MichaIng/u-boot/-/archive/$uboot_branch/u-boot-$uboot_branch.tar.bz2"; tar xf "u-boot-$uboot_branch.tar.bz2"; rm "u-boot-$uboot_branch.tar.bz2"; } &
+ { curl -fLO "https://github.com/u-boot/u-boot/archive/v$uboot_version.tar.gz"; tar xf "v$uboot_version.tar.gz"; rm "v$uboot_version.tar.gz"; } &
{ curl -fO 'https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/snapshot/linux-rolling-stable.tar.gz'; tar xf linux-rolling-stable.tar.gz; rm linux-rolling-stable.tar.gz; } &
wait
- curl -sSfo "u-boot-$uboot_branch/u-boot-spl-ddr.bin" 'https://raw.githubusercontent.com/JeffyCN/mirrors/ddf03c1/bin/rk35/rk3568_ddr_1560MHz_v1.13.bin' &
- curl -sSfo "u-boot-$uboot_branch/bl31.elf" 'https://raw.githubusercontent.com/JeffyCN/mirrors/6186deb/bin/rk35/rk3568_bl31_v1.28.elf' &
+ curl -sSfo "u-boot-$uboot_version/ddr.bin" 'https://raw.githubusercontent.com/JeffyCN/mirrors/ddf03c1/bin/rk35/rk3568_ddr_1560MHz_v1.13.bin' &
+ curl -sSfo "u-boot-$uboot_version/bl31.elf" 'https://raw.githubusercontent.com/JeffyCN/mirrors/6186deb/bin/rk35/rk3568_bl31_v1.28.elf' &
curl -sSfo linux-rolling-stable/arch/arm64/configs/quartz64_defconfig "https://raw.githubusercontent.com/$GITHUB_REPOSITORY_OWNER/DietPi/$GITHUB_REF_NAME/.build/images/Quartz64/quartz64_defconfig" &
rm -Rf firmware-quartz64a/DEBIAN firmware-quartz64a/boot/extlinux firmware-quartz64a/lib/firmware/brcm
mkdir -p firmware-quartz64a/DEBIAN firmware-quartz64a/boot/extlinux firmware-quartz64a/lib/firmware/brcm
@@ -41,19 +41,22 @@ jobs:
wait
- name: Build U-Boot
run: |
+ export ROCKCHIP_TPL='ddr.bin'
export BL31='bl31.elf'
- cd "u-boot-$uboot_branch"
+ cd "u-boot-$uboot_version"
+ # Patch kernel_comp_addr_r being too narrow for our kernel image
+ sed --follow-symlinks -i 's/kernel_comp_addr_r=0x08000000/kernel_comp_addr_r=0x10000000/' include/configs/rk3568_common.h
make quartz64-a-rk3566_defconfig
make -j$(nproc)
mv u-boot-rockchip.bin ../firmware-quartz64a/boot/u-boot.bin
make quartz64-b-rk3566_defconfig
make -j$(nproc)
mv u-boot-rockchip.bin ../firmware-quartz64b/boot/u-boot.bin
- make soquartz-rk3566_defconfig
+ make soquartz-cm4-rk3566_defconfig
make -j$(nproc)
mv u-boot-rockchip.bin ../firmware-soquartz/boot/u-boot.bin
cd ..
- rm -R "u-boot-$uboot_branch"
+ rm -R "u-boot-$uboot_version"
- name: Build Linux
run: |
cd linux-rolling-stable
@@ -67,7 +70,7 @@ jobs:
mv arch/arm64/boot/dts/rockchip/rk3566-soquartz-cm4.dtb ../firmware-soquartz/boot/
make modules_install INSTALL_MOD_PATH='../firmware-quartz64a'
cd ..
- rm firmware-quartz64a/lib/modules/*/build firmware-quartz64a/lib/modules/*/source
+ rm firmware-quartz64a/lib/modules/*/build
cp -R firmware-quartz64a/lib/modules firmware-quartz64b/lib/
cp -R firmware-quartz64a/lib/modules firmware-soquartz/lib/
- name: Build package
@@ -95,9 +98,9 @@ jobs:
append root=/dev/mmcblk0p1 rootfstype=ext4 rootwait earlycon=uart8250,mmio32,0xfe660000 console=ttyS2,1500000n8 console=tty1 consoleblank=0 net.ifnames=0
_EOF_
cp firmware-quartz64a/boot/extlinux/extlinux.conf firmware-quartz64b/boot/extlinux/
- sed -i 's/quartz64-a.dtb/quartz64-b.dtb/' firmware-quartz64b/boot/extlinux/extlinux.conf
+ sed --follow-symlinks -i 's/quartz64-a.dtb/quartz64-b.dtb/' firmware-quartz64b/boot/extlinux/extlinux.conf
cp firmware-quartz64a/boot/extlinux/extlinux.conf firmware-soquartz/boot/extlinux/
- sed -i 's/quartz64-a.dtb/soquartz-cm4.dtb/' firmware-soquartz/boot/extlinux/extlinux.conf
+ sed --follow-symlinks -i 's/quartz64-a.dtb/soquartz-cm4.dtb/' firmware-soquartz/boot/extlinux/extlinux.conf
echo '/boot/extlinux/extlinux.conf' > firmware-quartz64a/DEBIAN/conffiles
echo '/boot/extlinux/extlinux.conf' > firmware-quartz64b/DEBIAN/conffiles
echo '/boot/extlinux/extlinux.conf' > firmware-soquartz/DEBIAN/conffiles
@@ -124,7 +127,7 @@ jobs:
echo 'ERROR: Unable to detect root filessystem PARTUUID, aborting'
exit 1
fi
- sed -i "s|root=/dev/mmcblk0p1|root=PARTUUID=$ROOT_PARTUUID|" /boot/extlinux/extlinux.conf
+ sed --follow-symlinks -i "s|root=/dev/mmcblk0p1|root=PARTUUID=$ROOT_PARTUUID|" /boot/extlinux/extlinux.conf
ROOT_FSTYPE=$(findmnt -Ufnro FSTYPE -M /)
if [ $ROOT_FSTYPE ]
then
@@ -133,7 +136,7 @@ jobs:
echo 'ERROR: Unable to detect root filesystem type, aborting'
exit 1
fi
- sed -i "s|rootfstype=ext4|rootfstype=$ROOT_FSTYPE|" /boot/extlinux/extlinux.conf
+ sed --follow-symlinks -i "s|rootfstype=ext4|rootfstype=$ROOT_FSTYPE|" /boot/extlinux/extlinux.conf
fi
exit 0
_EOF_
@@ -155,15 +158,16 @@ jobs:
Priority: optional
Description: Linux kernel and U-Boot bootloader for Quartz64 Model A
_EOF_
- sed -i "/^Installed-Size:/c\Installed-Size: $(du -sk 'firmware-quartz64a' | mawk '{print $1}')" firmware-quartz64a/DEBIAN/control
+ sed --follow-symlinks -i "/^Installed-Size:/c\Installed-Size: $(du -sk 'firmware-quartz64a' | mawk '{print $1}')" firmware-quartz64a/DEBIAN/control
cp firmware-quartz64a/DEBIAN/control firmware-quartz64b/DEBIAN/
- sed -i -e 's/quartz64a/quartz64b/' -e 's/Model A$/Model B/' -e "/^Installed-Size:/c\Installed-Size: $(du -sk 'firmware-quartz64b' | mawk '{print $1}')" firmware-quartz64b/DEBIAN/control
+ sed --follow-symlinks -i -e 's/quartz64a/quartz64b/' -e 's/Model A$/Model B/' -e "/^Installed-Size:/c\Installed-Size: $(du -sk 'firmware-quartz64b' | mawk '{print $1}')" firmware-quartz64b/DEBIAN/control
cp firmware-quartz64a/DEBIAN/control firmware-soquartz/DEBIAN/
- sed -i -e 's/quartz64a/soquartz/' -e 's/Quartz64 Model A$/SOQuartz/' -e "/^Installed-Size:/c\Installed-Size: $(du -sk 'firmware-soquartz' | mawk '{print $1}')" firmware-soquartz/DEBIAN/control
+ sed --follow-symlinks -i -e 's/quartz64a/soquartz/' -e 's/Quartz64 Model A$/SOQuartz/' -e "/^Installed-Size:/c\Installed-Size: $(du -sk 'firmware-soquartz' | mawk '{print $1}')" firmware-soquartz/DEBIAN/control
+ sudo chown -R root:root firmware-quartz64a firmware-quartz64b firmware-soquartz
dpkg-deb -b -Zxz -z9 -Sextreme firmware-quartz64a
dpkg-deb -b -Zxz -z9 -Sextreme firmware-quartz64b
dpkg-deb -b -Zxz -z9 -Sextreme firmware-soquartz
- rm -R firmware-quartz64a firmware-quartz64b firmware-soquartz
+ sudo rm -R firmware-quartz64a firmware-quartz64b firmware-soquartz
- name: Upload
run: |
[ -d ~/.ssh ] || mkdir ~/.ssh
diff --git a/.meta/dietpi-bookworm-upgrade b/.meta/dietpi-bookworm-upgrade
index 736a62ec0b..ac630cc000 100755
--- a/.meta/dietpi-bookworm-upgrade
+++ b/.meta/dietpi-bookworm-upgrade
@@ -55,16 +55,16 @@ mapfile -t apackages < <(apt-mark showhold)
unset -v apackages
G_DIETPI-NOTIFY 2 'Migrating package lists to Bookworm suite'
-G_EXEC sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list
-(( $G_RASPBIAN )) || G_EXEC sed -i 's/ non-free$/ non-free non-free-firmware/' /etc/apt/sources.list
-[[ $(find /etc/apt/sources.list.d/*.list 2> /dev/null) ]] && G_EXEC sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list.d/*.list
-[[ -f '/etc/apt/sources.list.d/dietpi-mympd.list' ]] && G_EXEC sed -i 's/Debian_11/Debian_12/' /etc/apt/sources.list.d/dietpi-mympd.list
+G_EXEC sed --follow-symlinks -i 's/bullseye/bookworm/g' /etc/apt/sources.list
+(( $G_RASPBIAN )) || G_EXEC sed --follow-symlinks -i 's/ non-free$/ non-free non-free-firmware/' /etc/apt/sources.list
+[[ $(find /etc/apt/sources.list.d/*.list 2> /dev/null) ]] && G_EXEC sed --follow-symlinks -i 's/bullseye/bookworm/g' /etc/apt/sources.list.d/*.list
+[[ -f '/etc/apt/sources.list.d/dietpi-mympd.list' ]] && G_EXEC sed --follow-symlinks -i 's/Debian_11/Debian_12/' /etc/apt/sources.list.d/dietpi-mympd.list
G_DIETPI-NOTIFY 2 'Reverting some package lists to Bullseye which have no Bookworm suite (yet)'
-[[ -f '/etc/apt/sources.list.d/radxa.list' ]] && G_EXEC sed -i 's/bookworm/bullseye/g' /etc/apt/sources.list.d/radxa.list
-[[ -f '/etc/apt/sources.list.d/dietpi-radxa.list' ]] && G_EXEC sed -i 's/bookworm/bullseye/g' /etc/apt/sources.list.d/dietpi-radxa.list
-[[ -f '/etc/apt/sources.list.d/influxdb.list' ]] && G_EXEC sed -i 's/bookworm/bullseye/' /etc/apt/sources.list.d/influxdb.list
-[[ -f '/etc/apt/sources.list.d/mopidy.list' ]] && G_EXEC sed -i 's/bookworm/bullseye/' /etc/apt/sources.list.d/mopidy.list
+[[ -f '/etc/apt/sources.list.d/radxa.list' ]] && G_EXEC sed --follow-symlinks -i 's/bookworm/bullseye/g' /etc/apt/sources.list.d/radxa.list
+[[ -f '/etc/apt/sources.list.d/dietpi-radxa.list' ]] && G_EXEC sed --follow-symlinks -i 's/bookworm/bullseye/g' /etc/apt/sources.list.d/dietpi-radxa.list
+[[ -f '/etc/apt/sources.list.d/influxdb.list' ]] && G_EXEC sed --follow-symlinks -i 's/bookworm/bullseye/' /etc/apt/sources.list.d/influxdb.list
+[[ -f '/etc/apt/sources.list.d/mopidy.list' ]] && G_EXEC sed --follow-symlinks -i 's/bookworm/bullseye/' /etc/apt/sources.list.d/mopidy.list
if (( $G_HW_MODEL == 4 )) && dpkg-query -s rpi-eeprom &> /dev/null
then
@@ -111,7 +111,7 @@ G_EXEC rm -Rf /etc/php/7.4 /usr/local/lib/python3.9 /usr/local/bin/pip3*
# Install (mark as manually installed) root trust anchors for Unbound, which was degraded from dependency to recommendation: https://github.com/MichaIng/DietPi/issues/5612
dpkg-query -s unbound &> /dev/null && G_AGI dns-root-data
# Allow IPv6 port binding failure explicitly, not implicit anymore since Bookworm: https://github.com/MichaIng/DietPi/pull/6103#issuecomment-1407749720
-[[ -f '/etc/redis/redis.conf' ]] && G_EXEC sed -i '/^bind 127.0.0.1 ::1$/c\bind 127.0.0.1 -::1' /etc/redis/redis.conf
+[[ -f '/etc/redis/redis.conf' ]] && G_EXEC sed --follow-symlinks -i '/^bind 127.0.0.1 ::1$/c\bind 127.0.0.1 -::1' /etc/redis/redis.conf
# Reinstall all PHP applications which require non-standard PHP modules, webservers which did access a versioned PHP-FPM socket, Python applications installed via pip, ...
G_PROMPT_BACKUP_DISABLED=1 /boot/dietpi/dietpi-software reinstall 38 40 47 48 83 84 85 89 93 114 118 125 130 134 136 139 143 153 155 157 180
diff --git a/.meta/dietpi-rpi-firmware-migration b/.meta/dietpi-rpi-firmware-migration
new file mode 100644
index 0000000000..06fc5e89a6
--- /dev/null
+++ b/.meta/dietpi-rpi-firmware-migration
@@ -0,0 +1,62 @@
+#!/bin/bash
+{
+# Import DietPi-Globals ---------------------------------------------------------------
+. /boot/dietpi/func/dietpi-globals
+readonly G_PROGRAM_NAME='dietpi-rpi-firmware-migration'
+(( $G_HW_MODEL > 9 )) && { G_DIETPI-NOTIFY 1 'You can run this script on RPi systems or Trixie only!'; exit 1; }
+[[ $G_DISTRO == [78] ]] || { G_DIETPI-NOTIFY 1 'You can run this script on Debian Bookworm or Trixie systems only!'; exit 1; }
+G_CHECK_ROOT_USER
+G_CHECK_ROOTFS_RW
+G_CHECK_FREESPACE / 200
+(( $(findmnt -nbo SIZE /boot) > 128000000 )) || { G_DIETPI-NOTIFY 1 'You can run this script on a system with at least 128 MiB boot partition only!'; exit 1; }
+G_INIT
+# Import DietPi-Globals ---------------------------------------------------------------
+
+# Offer a backup before doing any changes to the system
+G_PROMPT_BACKUP
+
+G_DIETPI-NOTIFY 2 'Updating DietPi to latest version'
+/boot/dietpi/dietpi-update 1
+
+# Temporary rootfs mount
+G_EXEC mkdir -p rootfs
+G_EXEC mount "$G_ROOTFS_DEV" rootfs
+
+# Copy DietPi files from bootfs to rootfs
+G_EXEC cp -a /boot/dietpi* rootfs/boot/
+
+# Remount bootfs to /boot/firmware
+G_EXEC mkdir -p rootfs/boot/firmware
+G_EXEC sed -i 's|[[:blank:]]/boot[[:blank:]]| /boot/firmware |' /etc/fstab
+G_EXEC systemctl daemon-reload
+G_EXEC umount /boot
+G_EXEC mount /boot/firmware
+G_EXEC umount rootfs
+
+# Generate config symlinks
+G_EXEC ln -s firmware/cmdline.txt /boot/cmdline.txt
+G_EXEC ln -s firmware/config.txt /boot/config.txt
+
+# Install new firmware packages
+apackages=()
+if [[ $(dpkg --print-architecture) == 'arm64' ]]
+then
+ apackages=('linux-image-rpi-v8')
+ dpkg-query -s 'raspberrypi-kernel-headers' &> /dev/null && apackages+=('linux-headers-rpi-v8')
+else
+ apackages=('linux-image-rpi-v6' 'linux-image-rpi-v7' 'linux-image-rpi-v7l' 'linux-image-rpi-v8')
+ dpkg-query -s 'raspberrypi-kernel-headers' &> /dev/null && apackages+=('linux-headers-rpi-v6' 'linux-headers-rpi-v7' 'linux-headers-rpi-v7l' 'linux-headers-rpi-v8')
+ # Add foreign arm64 arch until the 64-bit kernel package has been added to the armhf repo: https://github.com/RPi-Distro/repo/issues/356
+ G_EXEC dpkg --add-architecture arm64
+fi
+G_AGUP
+G_AGI "${apackages[@]}" raspi-firmware
+
+# Remove old firmware packages
+G_AGP raspberrypi-kernel raspberrypi-headers-kernel raspberrypi-bootloader
+
+# Remove obsolete files
+G_EXEC rm -Rf /boot/firmware/{dietpi*,COPYING.linux}
+
+G_WHIP_YESNO 'All finished!\n\nWe highly recommend to reboot, shall we reboot now?' && reboot
+}
\ No newline at end of file
diff --git a/.meta/dietpi-survey_report b/.meta/dietpi-survey_report
index 04ebb14276..5aa998c5ee 100755
--- a/.meta/dietpi-survey_report
+++ b/.meta/dietpi-survey_report
@@ -698,14 +698,16 @@ shopt -s extglob
aSOFTWARE_NAME8_23=()
aSOFTWARE_NAME8_24=()
+ aSOFTWARE_NAME8_25=()
for i in "${!aSOFTWARE_NAME8_22[@]}"
do
aSOFTWARE_NAME8_23[i]=${aSOFTWARE_NAME8_22[i]}
aSOFTWARE_NAME8_24[i]=${aSOFTWARE_NAME8_23[i]}
+ aSOFTWARE_NAME8_25[i]=${aSOFTWARE_NAME8_24[i]}
done
# Pre-create software counter array so that we can see also software (available in newest version) with 0 installs
- for i in "${aSOFTWARE_NAME8_24[@]}"
+ for i in "${aSOFTWARE_NAME8_25[@]}"
do
aSOFTWARE[$i]=0
done
diff --git a/.update/patches b/.update/patches
index 7b35bc5b13..068faa74ea 100755
--- a/.update/patches
+++ b/.update/patches
@@ -36,6 +36,10 @@ export G_PROMPT_BACKUP_DISABLED=1
# Prevent initial and final service control during DietPi-Software reinstalls
export G_SERVICE_CONTROL=0
+# ToDo: On RPi 4, the 64-bit kernel is now used by default, without "arm_64bit=1" set: https://forums.raspberrypi.com/viewtopic.php?p=2088935#p2088935
+# - We could set "arm_64bit=0", but for now lets assure that 32-bit software is installed and see how it goes. This enables general support for RPi with 64-bit kernel running 32-bit userland.
+[[ $G_HW_MODEL == [2-9] && $G_HW_ARCH == 3 && $(dpkg --print-architecture) == 'armhf' ]] && G_HW_ARCH=2 G_HW_ARCH_NAME='armv7l'
+
# Version-based incremental patches
Patch_7_0()
{
@@ -50,13 +54,13 @@ Patch_7_1()
[[ -d '/var/lib/dietpi/dietpi-software/installed/dietpi-nordvpn' ]] && G_EXEC mv /var/lib/dietpi/dietpi-software/installed/dietpi-nordvpn /var/lib/dietpi/dietpi-vpn
if [[ -f '/var/lib/dietpi/dietpi-vpn/settings_dietpi.conf' ]]
then
- G_EXEC sed -Ei 's/^NORDVPN_(SERVER|USERNAME|PASSWORD)=/VPN_\1=/' /var/lib/dietpi/dietpi-vpn/settings_dietpi.conf
+ G_EXEC sed --follow-symlinks -Ei 's/^NORDVPN_(SERVER|USERNAME|PASSWORD)=/VPN_\1=/' /var/lib/dietpi/dietpi-vpn/settings_dietpi.conf
local PROTOCOL VPN_SERVER
# shellcheck disable=SC1091
. /var/lib/dietpi/dietpi-vpn/settings_dietpi.conf
[[ -f '/etc/openvpn/client.ovpn' ]] || G_EXEC cp -a "/etc/openvpn/ovpn_$PROTOCOL/$VPN_SERVER" /etc/openvpn/client.ovpn
unset -v VPN_SERVER PROTOCOL VPN_USERNAME VPN_PASSWORD
- G_EXEC sed -i 's|/var/lib/dietpi/dietpi-software/installed/dietpi-nordvpn/|/var/lib/dietpi/dietpi-vpn/|' /etc/openvpn/client.ovpn
+ G_EXEC sed --follow-symlinks -i 's|/var/lib/dietpi/dietpi-software/installed/dietpi-nordvpn/|/var/lib/dietpi/dietpi-vpn/|' /etc/openvpn/client.ovpn
fi
if [[ -f '/etc/systemd/system/dietpi-nordvpn.service' ]]
then
@@ -80,7 +84,7 @@ Patch_7_1()
\nSimply run "dietpi-ddns" from console, select "No-IP" as provider, enter domain and credentials, then select "Apply". The old No-IP client and service will be removed automatically as last step, once a final DDNS update test succeeded.'
# 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
+ [[ -f '/boot/dietpi/.installed' ]] && grep -qE '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[(67|171)\]=' /boot/dietpi/.installed && G_EXEC sed --follow-symlinks -Ei '/^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[(67|171)\]=/d' /boot/dietpi/.installed
# Inform user about possible Sonarr v2 => v3 upgrade
[[ -f '/mnt/dietpi_userdata/sonarr/nzbdrone.pid' ]] && G_WHIP_MSG '[ INFO ] Sonarr v3 has been released
@@ -140,14 +144,14 @@ Patch_7_2()
fi
# Fix disabling dietpi-desktop_setup
- [[ -f '/var/lib/dietpi/dietpi-software/installed/desktop/dietpi-desktop_setup.sh' ]] && grep -q 'echo -e' /var/lib/dietpi/dietpi-software/installed/desktop/dietpi-desktop_setup.sh && G_EXEC sed -i 's/echo -e/echo/' /var/lib/dietpi/dietpi-software/installed/desktop/dietpi-desktop_setup.sh
+ [[ -f '/var/lib/dietpi/dietpi-software/installed/desktop/dietpi-desktop_setup.sh' ]] && grep -q 'echo -e' /var/lib/dietpi/dietpi-software/installed/desktop/dietpi-desktop_setup.sh && G_EXEC sed --follow-symlinks -i 's/echo -e/echo/' /var/lib/dietpi/dietpi-software/installed/desktop/dietpi-desktop_setup.sh
for i in /{root,home/*}/.config/autostart/dietpi-desktop_setup.desktop
do
- [[ -f $i ]] && grep -q '^-e ' "$i" && G_EXEC sed -i 's/^-e //' "$i"
+ [[ -f $i ]] && grep -q '^-e ' "$i" && G_EXEC sed --follow-symlinks -i 's/^-e //' "$i"
done
# LibSSL1.0.0: Remove obsolete install state
- [[ -f '/boot/dietpi/.installed' ]] && grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[126\]=' /boot/dietpi/.installed && G_EXEC sed -i '/^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[126\]=/d' /boot/dietpi/.installed
+ [[ -f '/boot/dietpi/.installed' ]] && grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[126\]=' /boot/dietpi/.installed && G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[126\]=/d' /boot/dietpi/.installed
# Roon Extension Manager: Inform users about available upgrade: https://github.com/MichaIng/DietPi/pull/4399
[[ -f '/boot/dietpi/.installed' ]] && grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[86\]=2' /boot/dietpi/.installed && G_WHIP_MSG '[ INFO ] Roon Extension Manager: Major upgrade available
@@ -199,10 +203,10 @@ _EOF_
fi
# RPi: Remove deprecated I2C setting from config.txt
- (( $G_HW_MODEL > 9 )) || G_EXEC sed -i '/dtparam=i2c1=/d' /boot/config.txt
+ (( $G_HW_MODEL > 9 )) || G_EXEC sed --follow-symlinks -i '/dtparam=i2c1=/d' /boot/config.txt
# Tomcat 8: Remove obsolete install state
- [[ -f '/boot/dietpi/.installed' ]] && grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[125\]=' /boot/dietpi/.installed && G_EXEC sed -i '/^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[125\]=/d' /boot/dietpi/.installed
+ [[ -f '/boot/dietpi/.installed' ]] && grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[125\]=' /boot/dietpi/.installed && G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[125\]=/d' /boot/dietpi/.installed
# Remove license (flag) file if AUTO_SETUP_AUTOMATED=1 is set, which would otherwise never happen on pre-v7.2 images, and if AUTO_SETUP_ACCEPT_LICENSE=1 is set, to assure the prompt is skipped when for some reason the script is reloaded between update and first installs.
[[ -f '/var/lib/dietpi/license.txt' ]] && grep -Eq '^[[:blank:]]*AUTO_SETUP_A(UTOMATED|CCEPT_LICENSE)=1' /boot/dietpi.txt && G_EXEC rm /var/lib/dietpi/license.txt
@@ -235,8 +239,8 @@ Patch_7_5()
if [[ $G_HW_MODEL -le 9 && -f '/boot/dietpi/.dietpi-autostart_index' && $( 4 ))
then
G_DIETPI-NOTIFY 2 'Removing obsolete "elevator" entry from /boot/cmdline.txt'
- G_EXEC sed -Ei 's/elevator=[^[:blank:]]*[[:blank:]]+//' /boot/cmdline.txt
- G_EXEC sed -Ei 's/[[:blank:]]*elevator=[^[:blank:]]*//' /boot/cmdline.txt
+ G_EXEC sed --follow-symlinks -Ei 's/elevator=[^[:blank:]]*[[:blank:]]+//' /boot/cmdline.txt
+ G_EXEC sed --follow-symlinks -Ei 's/[[:blank:]]*elevator=[^[:blank:]]*//' /boot/cmdline.txt
fi
# https://github.com/jirka-h/haveged/pull/7 https://github.com/MichaIng/DietPi/issues/3689#issuecomment-678322767
@@ -286,8 +290,8 @@ Patch_7_6()
Patch_7_7()
{
G_DIETPI-NOTIFY 2 'Reverting Mosquitto and Webmin repositories back to HTTPS'
- G_EXEC sed -Ei 's#http://(repo.mosquitto.org|download.webmin.com)#https://\1#' /etc/apt/sources.list
- [[ $(find /etc/apt/sources.list/*.list 2> /dev/null) ]] && G_EXEC sed -Ei 's#http://(repo.mosquitto.org|download.webmin.com)#https://\1#' /etc/apt/sources.list.d/*.list
+ G_EXEC sed --follow-symlinks -Ei 's#http://(repo.mosquitto.org|download.webmin.com)#https://\1#' /etc/apt/sources.list
+ [[ $(find /etc/apt/sources.list/*.list 2> /dev/null) ]] && G_EXEC sed --follow-symlinks -Ei 's#http://(repo.mosquitto.org|download.webmin.com)#https://\1#' /etc/apt/sources.list.d/*.list
# Inform users about abandoned CouchPotato and in case add service to DietPi-Services includes, as it has been removed from the hardcoded list
if [[ -f '/boot/dietpi/.installed' ]] && grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[142\]=2' /boot/dietpi/.installed
@@ -305,13 +309,13 @@ Patch_7_7()
fi
fi
# Remove obsolete CouchPotato install state
- [[ -f '/boot/dietpi/.installed' ]] && grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[142\]=' /boot/dietpi/.installed && G_EXEC sed -i '/^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[142\]=/d' /boot/dietpi/.installed
+ [[ -f '/boot/dietpi/.installed' ]] && grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[142\]=' /boot/dietpi/.installed && G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[142\]=/d' /boot/dietpi/.installed
# Fix Deluge web interface service on Bullseye: https://github.com/MichaIng/DietPi/issues/4785
if [[ $G_DISTRO -ge 6 && -f '/boot/dietpi/.installed' ]] && grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[45\]=2' /boot/dietpi/.installed && ! grep -q 'ExecStart.* -d ' /etc/systemd/system/deluge-web.service
then
G_DIETPI-NOTIFY 2 'Patching Deluge web interface service to fix startup at Bullseye'
- G_EXEC sed -i 's/deluge-web -l/deluge-web -d -l/' /etc/systemd/system/deluge-web.service
+ G_EXEC sed --follow-symlinks -i 's/deluge-web -l/deluge-web -d -l/' /etc/systemd/system/deluge-web.service
fi
# Mono: Migrate APT list and key to new location and naming
@@ -327,8 +331,8 @@ Patch_7_7()
if [[ -f '/etc/wireguard/wg0.conf' ]]
then
G_DIETPI-NOTIFY 2 'Updating WireGuard wg0 configuration'
- G_EXEC sed -i '\|/boot/dietpi/func/obtain_network_details|d' /etc/wireguard/wg0.conf
- G_EXEC sed -Ei "s#mawk .NR==3. /(run|boot|DietPi)/dietpi/.network#ip r l 0/0 | mawk '{print \$5;exit}'#g" /etc/wireguard/wg0.conf
+ G_EXEC sed --follow-symlinks -i '\|/boot/dietpi/func/obtain_network_details|d' /etc/wireguard/wg0.conf
+ G_EXEC sed --follow-symlinks -Ei "s#mawk .NR==3. /(run|boot|DietPi)/dietpi/.network#ip r l 0/0 | mawk '{print \$5;exit}'#g" /etc/wireguard/wg0.conf
fi
# GMediaRender: Patch service
@@ -375,7 +379,7 @@ _EOF_
then
/boot/dietpi/func/dietpi-set_software boot_wait_for_network 1
fi
- G_EXEC sed -i '/^[[:blank:]]*CONFIG_BOOT_WAIT_FOR_NETWORK=/d' /boot/dietpi.txt
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*CONFIG_BOOT_WAIT_FOR_NETWORK=/d' /boot/dietpi.txt
# Enable systemd-timesyncd on oneshot modes to start early at boot
local time_sync_mode=$(sed -n '/^[[:blank:]]*CONFIG_NTP_MODE=/{s/^[^=]*=//p;q}' /boot/dietpi.txt)
@@ -388,8 +392,8 @@ _EOF_
then
[[ -d '/root/.ssh' ]] || G_EXEC mkdir -p /root/.ssh
[[ -f '/root/.ssh/known_hosts' ]] || > /root/.ssh/known_hosts
- G_EXEC sed -i '/^dietpi.com/d' /root/.ssh/known_hosts
- G_EXEC sed -i '/^185.101.93.93/d' /root/.ssh/known_hosts
+ G_EXEC sed --follow-symlinks -i '/^dietpi.com/d' /root/.ssh/known_hosts
+ G_EXEC sed --follow-symlinks -i '/^185.101.93.93/d' /root/.ssh/known_hosts
G_CONFIG_INJECT '\[?ssh.dietpi.com(]:29248)?[[:blank:]]' '[ssh.dietpi.com]:29248 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDE6aw3r6aOEqendNu376iiCHr9tGBIWPgfrLkzjXjEsHGyVSUFNnZt6pftrDeK7UX+qX4FxOwQlugG4fymOHbimRCFiv6cf7VpYg1Ednquq9TLb7/cIIbX8a6AuRmX4fjdGuqwmBq3OG7ZksFcYEFKt5U4mAJIaL8hXiM2iXjgY02LqiQY/QWATsHI4ie9ZOnwrQE+Rr6mASN1BVFuIgyHIbwX54jsFSnZ/7CdBMkuAd9B8JkxppWVYpYIFHE9oWNfjh/epdK8yv9Oo6r0w5Rb+4qaAc5g+RAaknHeV6Gp75d2lxBdCm5XknKKbGma2+/DfoE8WZTSgzXrYcRlStYN' /root/.ssh/known_hosts
fi
@@ -403,8 +407,8 @@ _EOF_
Patch_7_8()
{
# Remove IPv4 preference
- G_EXEC sed -i '/CONFIG_PREFER_IPV4/d' /boot/dietpi.txt
- [[ -f '/etc/wgetrc' ]] && G_EXEC sed -i 's/^[[:blank:]]*prefer-family[[:blank:]]*=/#&/' /etc/wgetrc
+ G_EXEC sed --follow-symlinks -i '/CONFIG_PREFER_IPV4/d' /boot/dietpi.txt
+ [[ -f '/etc/wgetrc' ]] && G_EXEC sed --follow-symlinks -i 's/^[[:blank:]]*prefer-family[[:blank:]]*=/#&/' /etc/wgetrc
[[ -f '/etc/apt/apt.conf.d/99-dietpi-force-ipv4' ]] && G_EXEC rm /etc/apt/apt.conf.d/99-dietpi-force-ipv4
# Inform users about removed Subsonic and in case add service to DietPi-Services includes, as it has been removed from the hardcoded list
@@ -423,7 +427,7 @@ Patch_7_8()
fi
fi
# Remove obsolete Subsonic install state
- [[ -f '/boot/dietpi/.installed' ]] && grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[34\]=' /boot/dietpi/.installed && G_EXEC sed -i '/^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[34\]=/d' /boot/dietpi/.installed
+ [[ -f '/boot/dietpi/.installed' ]] && grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[34\]=' /boot/dietpi/.installed && G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[34\]=/d' /boot/dietpi/.installed
# Inform users about removed emonHub and in case add service to DietPi-Services includes, as it has been removed from the hardcoded list
if [[ -f '/boot/dietpi/.installed' ]] && grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[99\]=2' /boot/dietpi/.installed
@@ -441,9 +445,9 @@ Patch_7_8()
fi
fi
# Remove obsolete emonHub install state
- [[ -f '/boot/dietpi/.installed' ]] && grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[99\]=' /boot/dietpi/.installed && G_EXEC sed -i '/^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[99\]=/d' /boot/dietpi/.installed
+ [[ -f '/boot/dietpi/.installed' ]] && grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[99\]=' /boot/dietpi/.installed && G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[99\]=/d' /boot/dietpi/.installed
# Remove obsolete emonHub API key setting from dietpi.txt
- grep -q 'SOFTWARE_EMONHUB_APIKEY' /boot/dietpi.txt && G_EXEC sed -Ei '/(SOFTWARE_EMONHUB_APIKEY|^#.*EmonCMS)/d' /boot/dietpi.txt
+ grep -q 'SOFTWARE_EMONHUB_APIKEY' /boot/dietpi.txt && G_EXEC sed --follow-symlinks -Ei '/(SOFTWARE_EMONHUB_APIKEY|^#.*EmonCMS)/d' /boot/dietpi.txt
# Reinstall Roon Server
if [[ -f '/boot/dietpi/.installed' && ! -d '/opt/roonserver' ]] && grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[154\]=2' /boot/dietpi/.installed
@@ -467,7 +471,7 @@ Patch_7_8()
if (( $G_HW_MODEL < 10 )) && grep -Eq '(^|[[:blank:]])rootwait([[:blank:]]|$)' /boot/cmdline.txt && grep -Eq '(^|[[:blank:]])rootdelay=' /boot/cmdline.txt
then
G_DIETPI-NOTIFY 2 'Removing ineffective "rootdelay" argument from /boot/cmdline.txt'
- G_EXEC sed -i -e 's/^rootdelay=[^[:blank:]]*[[:blank:]]*//g' -e 's/[[:blank:]]*[[:blank:]]rootdelay=[^[:blank:]]*//g' /boot/cmdline.txt
+ G_EXEC sed --follow-symlinks -i -e 's/^rootdelay=[^[:blank:]]*[[:blank:]]*//g' -e 's/[[:blank:]]*[[:blank:]]rootdelay=[^[:blank:]]*//g' /boot/cmdline.txt
fi
# DietPi-Backup: Move logs to persistent backup location
@@ -496,7 +500,7 @@ Patch_7_9()
fi
# Update choice and preference index variables
- [[ -f '/boot/dietpi/.installed' ]] && G_EXEC sed -Ei -e 's/INDEX_(LOGGING|WEBSERVER|DESKTOP|BROWSER)_CURRENT/INDEX_\1/g' -e '/INDEX_(LOGGING|WEBSERVER|DESKTOP|BROWSER|SSHSERVER|FILESERVER)_TARGET/d' -e '/INDEX_(SSHSERVER|FILESERVER)_CURRENT/d' /boot/dietpi/.installed
+ [[ -f '/boot/dietpi/.installed' ]] && G_EXEC sed --follow-symlinks -Ei -e 's/INDEX_(LOGGING|WEBSERVER|DESKTOP|BROWSER)_CURRENT/INDEX_\1/g' -e '/INDEX_(LOGGING|WEBSERVER|DESKTOP|BROWSER|SSHSERVER|FILESERVER)_TARGET/d' -e '/INDEX_(SSHSERVER|FILESERVER)_CURRENT/d' /boot/dietpi/.installed
# Offer to update DietPi-Dashboard TCP port: https://github.com/MichaIng/DietPi/issues/4966
if [[ -f '/opt/dietpi-dashboard/config.toml' ]] && grep -Eq '^[[:blank:]]*port[[:blank:]]+=[[:blank:]]+8088$' /opt/dietpi-dashboard/config.toml
@@ -509,8 +513,8 @@ Patch_7_9()
fi
# ownCloud/Nextcloud: Disable maintenance mode once manually, since DietPi-Services enabled of before this update but doesn't handle/disable it anymore afterwards.
- [[ -f '/var/www/owncloud/config/config.php' ]] && grep -Eq "^[[:blank:]]*'maintenance'[[:blank:]]+=>[[:blank:]]+true,\$" /var/www/owncloud/config/config.php && G_EXEC sed -Ei "s/^[[:blank:]]*'maintenance'[[:blank:]]+=>[[:blank:]]+true,\$/ 'maintenance' => false,/" /var/www/owncloud/config/config.php
- [[ -f '/var/www/nextcloud/config/config.php' ]] && grep -Eq "^[[:blank:]]*'maintenance'[[:blank:]]+=>[[:blank:]]+true,\$" /var/www/nextcloud/config/config.php && G_EXEC sed -Ei "s/^[[:blank:]]*'maintenance'[[:blank:]]+=>[[:blank:]]+true,\$/ 'maintenance' => false,/" /var/www/nextcloud/config/config.php
+ [[ -f '/var/www/owncloud/config/config.php' ]] && grep -Eq "^[[:blank:]]*'maintenance'[[:blank:]]+=>[[:blank:]]+true,\$" /var/www/owncloud/config/config.php && G_EXEC sed --follow-symlinks -Ei "s/^[[:blank:]]*'maintenance'[[:blank:]]+=>[[:blank:]]+true,\$/ 'maintenance' => false,/" /var/www/owncloud/config/config.php
+ [[ -f '/var/www/nextcloud/config/config.php' ]] && grep -Eq "^[[:blank:]]*'maintenance'[[:blank:]]+=>[[:blank:]]+true,\$" /var/www/nextcloud/config/config.php && G_EXEC sed --follow-symlinks -Ei "s/^[[:blank:]]*'maintenance'[[:blank:]]+=>[[:blank:]]+true,\$/ 'maintenance' => false,/" /var/www/nextcloud/config/config.php
}
Patch_8_0()
@@ -521,7 +525,7 @@ Patch_8_0()
G_DIETPI-NOTIFY 2 'Fixing doubled CMA size in KMS overlay setting'
while grep -Eq 'dtoverlay=vc4-f?kms-v3d.*,cma-.*,cma-' /boot/config.txt
do
- G_EXEC sed -Ei '/dtoverlay=vc4-f?kms-v3d.*,cma-.*,cma-/s/,cma-[^,]*//' /boot/config.txt
+ G_EXEC sed --follow-symlinks -Ei '/dtoverlay=vc4-f?kms-v3d.*,cma-.*,cma-/s/,cma-[^,]*//' /boot/config.txt
done
fi
@@ -547,10 +551,10 @@ Patch_8_0()
fi
# RPi: Fix forced max frequencies: https://github.com/MichaIng/DietPi/issues/5088
- (( $G_HW_MODEL < 10 )) && grep -Eq '(.){100}' /boot/config.txt && G_EXEC sed -Ei 's/^((.){99})..*$/\1/' /boot/config.txt
+ (( $G_HW_MODEL < 10 )) && grep -Eq '(.){100}' /boot/config.txt && G_EXEC sed --follow-symlinks -Ei 's/^((.){99})..*$/\1/' /boot/config.txt
# Blynk Server: Apply Log4Shell mitigation
- [[ -f '/etc/systemd/system/blynkserver.service' ]] && ! grep -q '\-Dlog4j2.formatMsgNoLookups=true' /etc/systemd/system/blynkserver.service && G_EXEC sed -i 's/java -jar/java -Dlog4j2.formatMsgNoLookups=true -jar/' /etc/systemd/system/blynkserver.service
+ [[ -f '/etc/systemd/system/blynkserver.service' ]] && ! grep -q '\-Dlog4j2.formatMsgNoLookups=true' /etc/systemd/system/blynkserver.service && G_EXEC sed --follow-symlinks -i 's/java -jar/java -Dlog4j2.formatMsgNoLookups=true -jar/' /etc/systemd/system/blynkserver.service
}
Patch_8_1()
@@ -562,7 +566,7 @@ Patch_8_1()
# RPi: Remove obsolete VCSM overlay since the device node has been removed
if (( $G_HW_MODEL < 10 ))
then
- grep -q 'dtoverlay=dietpi-disable_vcsm' /boot/config.txt && G_EXEC sed -i '/dtoverlay=dietpi-disable_vcsm/d' /boot/config.txt
+ grep -q 'dtoverlay=dietpi-disable_vcsm' /boot/config.txt && G_EXEC sed --follow-symlinks -i '/dtoverlay=dietpi-disable_vcsm/d' /boot/config.txt
[[ -f '/boot/overlays/dietpi-disable_vcsm.dtbo' ]] && G_EXEC rm /boot/overlays/dietpi-disable_vcsm.dtbo
fi
@@ -583,10 +587,10 @@ _EOF_
Patch_8_2()
{
# Remove obsolete quotation from armbianEnv.txt
- [[ -f '/boot/armbianEnv.txt' ]] && grep -q '^[[:blank:]]*extraargs="' /boot/armbianEnv.txt && G_EXEC sed -i -e 's/^[[:blank:]]*extraargs="[[:blank:]]*/extraargs=/' -e 's/[[:blank:]]*"[[:blank:]]*$//' /boot/armbianEnv.txt
+ [[ -f '/boot/armbianEnv.txt' ]] && grep -q '^[[:blank:]]*extraargs="' /boot/armbianEnv.txt && G_EXEC sed --follow-symlinks -i -e 's/^[[:blank:]]*extraargs="[[:blank:]]*/extraargs=/' -e 's/[[:blank:]]*"[[:blank:]]*$//' /boot/armbianEnv.txt
# RPi: Remove multiple cgroup_enable=memory entries from cmdline.txt: https://github.com/MichaIng/DietPi/issues/5225#issuecomment-1033056312
- [[ -f '/boot/cmdline.txt' ]] && while grep -q 'cgroup_enable=memory cgroup_enable=memory' /boot/cmdline.txt; do G_EXEC sed -i 's/cgroup_enable=memory cgroup_enable=memory/cgroup_enable=memory/g' /boot/cmdline.txt; done
+ [[ -f '/boot/cmdline.txt' ]] && while grep -q 'cgroup_enable=memory cgroup_enable=memory' /boot/cmdline.txt; do G_EXEC sed --follow-symlinks -i 's/cgroup_enable=memory cgroup_enable=memory/cgroup_enable=memory/g' /boot/cmdline.txt; done
# Apply cgroups-v2 workaround if the kernel does not support it: https://github.com/MichaIng/DietPi/issues/4705
# - This is required on Bullseye only, but we'll apply it on Buster as well to cover later distro upgrades, since the logic is too complicated for our upgrade blog article.
@@ -596,19 +600,19 @@ Patch_8_2()
if [[ $G_HW_MODEL -gt 9 && $G_HW_MODEL -le 16 && -f '/boot/boot.ini' ]] && ! grep -q 'systemd.unified_cgroup_hierarchy=0' /boot/boot.ini
then
G_DIETPI-NOTIFY 2 'Forcing legacy cgroups v1 hierarchy on old kernel device'
- G_EXEC sed -i '/^setenv bootargs "/s/"$/ systemd.unified_cgroup_hierarchy=0"/' /boot/boot.ini
+ G_EXEC sed --follow-symlinks -i '/^setenv bootargs "/s/"$/ systemd.unified_cgroup_hierarchy=0"/' /boot/boot.ini
# Sparky SBC
elif [[ $G_HW_MODEL == 70 && -f '/boot/uenv.txt' ]] && ! grep -q 'systemd.unified_cgroup_hierarchy=0' /boot/uenv.txt
then
G_DIETPI-NOTIFY 2 'Forcing legacy cgroups v1 hierarchy on old kernel device'
- G_EXEC sed -i '/^bootargs=/s/$/ systemd.unified_cgroup_hierarchy=0/' /boot/uenv.txt
+ G_EXEC sed --follow-symlinks -i '/^bootargs=/s/$/ systemd.unified_cgroup_hierarchy=0/' /boot/uenv.txt
# ROCK Pi S
elif [[ $G_HW_MODEL == 73 && -f '/boot/boot.cmd' ]] && ! grep -q 'systemd.unified_cgroup_hierarchy=0' /boot/boot.cmd
then
G_DIETPI-NOTIFY 2 'Forcing legacy cgroups v1 hierarchy on old kernel device'
- G_EXEC sed -i '/^setenv bootargs "/s/"$/ systemd.unified_cgroup_hierarchy=0"/' /boot/boot.cmd
+ G_EXEC sed --follow-symlinks -i '/^setenv bootargs "/s/"$/ systemd.unified_cgroup_hierarchy=0"/' /boot/boot.cmd
G_AG_CHECK_INSTALL_PREREQ u-boot-tools
G_EXEC mkimage -C none -A arm64 -T script -d /boot/boot.cmd /boot/boot.scr
fi
@@ -618,7 +622,7 @@ Patch_8_2()
if [[ $G_HW_MODEL == 40 && $(uname -r) == '5'* ]]
then
[[ -f '/etc/bashrc.d/dietpi-pine64-cursorfix.sh' ]] && G_EXEC rm /etc/bashrc.d/dietpi-pine64-cursorfix.sh
- grep -q '^8723bs$' /etc/modules && G_EXEC sed -i '/^8723bs$/d' /etc/modules
+ grep -q '^8723bs$' /etc/modules && G_EXEC sed --follow-symlinks -i '/^8723bs$/d' /etc/modules
fi
# Remove and migrate Chromium config files
@@ -631,7 +635,7 @@ Patch_8_2()
[[ -f '/etc/chromium.d/custom_flags' ]] && G_EXEC mv /etc/chromium.d/{custom_flags,dietpi}
# Remove obsolete Nvidia install state
- [[ -f '/boot/dietpi/.installed' ]] && grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[151\]=' /boot/dietpi/.installed && G_EXEC sed -i '/^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[151\]=/d' /boot/dietpi/.installed
+ [[ -f '/boot/dietpi/.installed' ]] && grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[151\]=' /boot/dietpi/.installed && G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[151\]=/d' /boot/dietpi/.installed
# Deluge: Apply autoconnect for web interface
if [[ -f '/mnt/dietpi_userdata/deluge/.config/deluge/hostlist.conf' && -f '/mnt/dietpi_userdata/deluge/.config/deluge/web.conf' ]] && grep -q '"default_daemon": "",' /mnt/dietpi_userdata/deluge/.config/deluge/web.conf
@@ -649,11 +653,11 @@ Patch_8_4()
if [[ -f '/boot/armbianEnv.txt' ]] && grep -q 'extraargs="net.ifnames=0"' /boot/armbianEnv.txt
then
G_DIETPI-NOTIFY 2 'Fixing syntax for legacy network interface nameing (eth0/wlan0). \e[33mNB: If you rely on "predictable" interface naming (enp0s0/wlp0s0), remove "net.ifnames=0" from /boot/armbianEnv.txt!'
- G_EXEC sed -i 's/extraargs="net.ifnames=0"/extraargs=net.ifnames=0/' /boot/armbianEnv.txt
+ G_EXEC sed --follow-symlinks -i 's/extraargs="net.ifnames=0"/extraargs=net.ifnames=0/' /boot/armbianEnv.txt
fi
# Update workaround for numpy on ARMv6/7 Buster
- (( $G_HW_ARCH < 3 && $G_DISTRO == 5 )) && [[ -f '/etc/pip-constraints.txt' ]] && G_EXEC sed -i '/^numpy!=1.21.5; python_version=='\''3.7'\''$/c\numpy<1.21.5; python_version=='\''3.7'\' /etc/pip-constraints.txt
+ (( $G_HW_ARCH < 3 && $G_DISTRO == 5 )) && [[ -f '/etc/pip-constraints.txt' ]] && G_EXEC sed --follow-symlinks -i '/^numpy!=1.21.5; python_version=='\''3.7'\''$/c\numpy<1.21.5; python_version=='\''3.7'\' /etc/pip-constraints.txt
# https://github.com/MichaIng/DietPi/issues/5441
if [[ -f '/etc/sudoers.d/dietpi' ]]
@@ -663,11 +667,11 @@ Patch_8_4()
fi
# Remove obsolete software preference indices
- [[ -f '/boot/dietpi/.installed' ]] && G_EXEC sed -Ei '/^[[:blank:]]*INDEX_(WEBSERVER|DESKTOP|BROWSER)=/d' /boot/dietpi/.installed
+ [[ -f '/boot/dietpi/.installed' ]] && G_EXEC sed --follow-symlinks -Ei '/^[[:blank:]]*INDEX_(WEBSERVER|DESKTOP|BROWSER)=/d' /boot/dietpi/.installed
# Remove obsolete license file and setting
[[ -f '/var/lib/dietpi/license.txt' ]] && G_EXEC rm /var/lib/dietpi/license.txt
- G_EXEC sed -i '/^[[:blank:]]*AUTO_SETUP_ACCEPT_LICENSE=/d' /boot/dietpi.txt
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*AUTO_SETUP_ACCEPT_LICENSE=/d' /boot/dietpi.txt
# Update DietPi initramfs cleanup script, following reasonable changes done by Armbian
if [[ -f '/etc/kernel/preinst.d/dietpi-initramfs_cleanup' ]]
@@ -691,7 +695,7 @@ Patch_8_4()
fi
# Remove obsolete OpenBazaar install state
- [[ -f '/boot/dietpi/.installed' ]] && grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[58\]=' /boot/dietpi/.installed && G_EXEC sed -i '/^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[58\]=/d' /boot/dietpi/.installed
+ [[ -f '/boot/dietpi/.installed' ]] && grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[58\]=' /boot/dietpi/.installed && G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[58\]=/d' /boot/dietpi/.installed
}
Patch_8_5(){ :; }
@@ -727,7 +731,7 @@ Patch_8_7()
(( $G_HW_MODEL > 9 )) || while grep -q 'cgroup_enable=memory.* cgroup_enable=memory' /boot/cmdline.txt
do
G_DIETPI-NOTIFY 2 'Removing duplicate "cgroup_enable=memory" kernel command-line argument...'
- G_EXEC sed -i 's/ cgroup_enable=memory//' /boot/cmdline.txt
+ G_EXEC sed --follow-symlinks -i 's/ cgroup_enable=memory//' /boot/cmdline.txt
done
}
@@ -761,8 +765,8 @@ Patch_8_9()
if [[ -f '/etc/turnserver.conf' && -f '/boot/dietpi/.installed' ]] && grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[168\]=2' /boot/dietpi/.installed
then
G_DIETPI-NOTIFY 2 'Removing obsolete Coturn settings...'
- grep -q '^[[:blank:]]*use-auth-secret' /etc/turnserver.conf && grep -q '^[[:blank:]]*lt-cred-mech' /etc/turnserver.conf && G_EXEC sed -i 's/^[[:blank:]]*lt-cred-mech/#lt-cred-mech/' /etc/turnserver.conf
- grep -q '^[[:blank:]]*no-loopback-peers' /etc/turnserver.conf && G_EXEC sed -i -e '/^[[:blank:]]*no-loopback-peers/d' -e 's/^[[:blank:]]*allow-loopback-peers/#allow-loopback-peers/' /etc/turnserver.conf
+ grep -q '^[[:blank:]]*use-auth-secret' /etc/turnserver.conf && grep -q '^[[:blank:]]*lt-cred-mech' /etc/turnserver.conf && G_EXEC sed --follow-symlinks -i 's/^[[:blank:]]*lt-cred-mech/#lt-cred-mech/' /etc/turnserver.conf
+ grep -q '^[[:blank:]]*no-loopback-peers' /etc/turnserver.conf && G_EXEC sed --follow-symlinks -i -e '/^[[:blank:]]*no-loopback-peers/d' -e 's/^[[:blank:]]*allow-loopback-peers/#allow-loopback-peers/' /etc/turnserver.conf
fi
}
@@ -805,12 +809,12 @@ Patch_8_11()
if [[ -f '/etc/apt/sources.list.d/armbian.list' ]] && grep -q 'http://apt.armbian.com' /etc/apt/sources.list.d/armbian.list
then
G_DIETPI-NOTIFY 2 'Connecting to apt.armbian.com via secure HTTPS since their router now handles HTTPS redirects reliably'
- G_EXEC sed -i 's|http://apt.armbian.com|https://apt.armbian.com|' /etc/apt/sources.list.d/armbian.list
+ G_EXEC sed --follow-symlinks -i 's|http://apt.armbian.com|https://apt.armbian.com|' /etc/apt/sources.list.d/armbian.list
fi
if [[ -f '/etc/apt/sources.list.d/dietpi-armbian.list' ]] && grep -q 'http://apt.armbian.com' /etc/apt/sources.list.d/dietpi-armbian.list
then
G_DIETPI-NOTIFY 2 'Connecting to apt.armbian.com via secure HTTPS since their router now handles HTTPS redirects reliably'
- G_EXEC sed -i 's|http://apt.armbian.com|https://apt.armbian.com|' /etc/apt/sources.list.d/dietpi-armbian.list
+ G_EXEC sed --follow-symlinks -i 's|http://apt.armbian.com|https://apt.armbian.com|' /etc/apt/sources.list.d/dietpi-armbian.list
fi
if (( $G_HW_MODEL == 56 ))
@@ -819,7 +823,7 @@ Patch_8_11()
if [[ -f '/boot/dtb/rockchip/rk3328-nanopi-neo3-rev02.dtb' ]] && grep -q 'rk3328-nanopi-r2-rev00.dtb' /boot/armbianEnv.txt
then
G_DIETPI-NOTIFY 2 'Switching back to NEO3 device tree, which is available again'
- G_EXEC sed -i 's/rk3328-nanopi-r2-rev00.dtb/rk3328-nanopi-neo3-rev02.dtb/' /boot/armbianEnv.txt
+ G_EXEC sed --follow-symlinks -i 's/rk3328-nanopi-r2-rev00.dtb/rk3328-nanopi-neo3-rev02.dtb/' /boot/armbianEnv.txt
fi
fi
@@ -843,11 +847,11 @@ Patch_8_11()
elif (( $G_HW_MODEL == 52 ))
then
# https://github.com/MichaIng/DietPi/issues/5554
- grep -q 'systemd.unified_cgroup_hierarchy=0' /boot/armbianEnv.txt || G_EXEC sed -i '/^extraargs=/s/$/ systemd.unified_cgroup_hierarchy=0/' /boot/armbianEnv.txt
+ grep -q 'systemd.unified_cgroup_hierarchy=0' /boot/armbianEnv.txt || G_EXEC sed --follow-symlinks -i '/^extraargs=/s/$/ systemd.unified_cgroup_hierarchy=0/' /boot/armbianEnv.txt
fi
# https://github.com/MichaIng/DietPi/issues/5830
- [[ -f '/var/lib/dietpi/dietpi-ddns/update.sh' ]] && grep -q '^curl -6or4' /var/lib/dietpi/dietpi-ddns/update.sh && G_EXEC sed -i 's/^curl -6or4/curl/' /var/lib/dietpi/dietpi-ddns/update.sh
+ [[ -f '/var/lib/dietpi/dietpi-ddns/update.sh' ]] && grep -q '^curl -6or4' /var/lib/dietpi/dietpi-ddns/update.sh && G_EXEC sed --follow-symlinks -i 's/^curl -6or4/curl/' /var/lib/dietpi/dietpi-ddns/update.sh
[[ -f '/etc/dpkg/dpkg.cfg.d/01-dietpi-exclude_doubled_devicetrees' ]] && G_EXEC_DESC='Removing obsolete DPKG exclude' G_EXEC rm /etc/dpkg/dpkg.cfg.d/01-dietpi-exclude_doubled_devicetrees
}
@@ -889,7 +893,7 @@ _EOF_
if [[ $G_HW_MODEL == 12 && -f '/boot/boot.cmd' ]] && ! grep -q 'usbcore.autosuspend=-1' /boot/boot.cmd
then
G_DIETPI-NOTIFY 2 'Fixing USB device detection on Odroid C2'
- G_EXEC sed -i 's/coherent_pool=2M/coherent_pool=2M usbcore.autosuspend=-1/' /boot/boot.cmd
+ G_EXEC sed --follow-symlinks -i 's/coherent_pool=2M/coherent_pool=2M usbcore.autosuspend=-1/' /boot/boot.cmd
G_EXEC mkimage -C none -A arm64 -T script -d /boot/boot.cmd /boot/boot.scr
fi
}
@@ -947,7 +951,7 @@ Patch_8_15()
[[ -d '/etc/systemd/system/haveged.service.d' ]] || G_EXEC rm -R /etc/systemd/system/haveged.service.d
# Revert with new kernel: https://github.com/MichaIng/DietPi/issues/5890
- grep -q ' systemd.unified_cgroup_hierarchy=0' /boot/extlinux/extlinux.conf && G_EXEC sed -i '/^append /s/ systemd.unified_cgroup_hierarchy=0//' /boot/extlinux/extlinux.conf
+ grep -q ' systemd.unified_cgroup_hierarchy=0' /boot/extlinux/extlinux.conf && G_EXEC sed --follow-symlinks -i '/^append /s/ systemd.unified_cgroup_hierarchy=0//' /boot/extlinux/extlinux.conf
fi
(( $G_DISTRO > 6 )) || for i in '/etc/systemd/system/serial-getty@'*'.service.d/dietpi-baudrate.conf'
@@ -967,7 +971,7 @@ _EOF_
grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[60\]=2' /boot/dietpi/.installed && G_EXEC systemctl enable hostapd isc-dhcp-server
# Remove obsolete Build-Essential install state
- grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[16\]=' /boot/dietpi/.installed && G_EXEC sed -i '/^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[16\]=/d' /boot/dietpi/.installed
+ grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[16\]=' /boot/dietpi/.installed && G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[16\]=/d' /boot/dietpi/.installed
# Remove obsolete CAVA console font
grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[119\]=' /boot/dietpi/.installed && G_EXEC rm -f /{root,home/*}/cava.psf
@@ -981,7 +985,7 @@ Patch_8_16()
if systemctl -q is-enabled 'serial-getty@ttyS2'
then
G_DIETPI-NOTIFY 2 'Fixing UART console on ttyFIQ0 instead of ttyS2'
- G_EXEC sed -i '/^consoleargs=console=ttyS2,1500000 console=tty1$/c\consoleargs=console=ttyFIQ0,1500000 console=tty1' /boot/dietpiEnv.txt
+ G_EXEC sed --follow-symlinks -i '/^consoleargs=console=ttyS2,1500000 console=tty1$/c\consoleargs=console=ttyFIQ0,1500000 console=tty1' /boot/dietpiEnv.txt
/boot/dietpi/func/dietpi-set_hardware serialconsole disable ttyS2
/boot/dietpi/func/dietpi-set_hardware serialconsole enable ttyFIQ0
fi
@@ -1092,7 +1096,7 @@ Patch_8_16()
fi
# Remove custom mode from /var/log tmpfs mount. It has common 0755 by default, not sure why we change that.
- grep -q '^tmpfs /var/log tmpfs .*,mode=1777$' /etc/fstab && G_EXEC sed -i '\|^tmpfs /var/log tmpfs |s|,mode=1777$||' /etc/fstab
+ grep -q '^tmpfs /var/log tmpfs .*,mode=1777$' /etc/fstab && G_EXEC sed --follow-symlinks -i '\|^tmpfs /var/log tmpfs |s|,mode=1777$||' /etc/fstab
# CONFIG_GPU_DRIVER Change: https://github.com/MichaIng/DietPi/issues/6262
if (( $G_HW_MODEL == 21 && $G_DIETPI_INSTALL_STAGE == 2 ))
@@ -1123,13 +1127,13 @@ Patch_8_17()
[[ -f '/etc/modprobe.d/dietpi-disable_rpi_sound.conf' ]] && G_EXEC mv /etc/modprobe.d/dietpi-disable_rpi_{sound,audio}.conf
if grep -q '^[[:blank:]]*dtoverlay=dietpi-disable_hdmi_audio' /boot/config.txt
then
- G_EXEC sed -i '/^[[:blank:]]*dtoverlay=dietpi-disable_hdmi_audio/d' /boot/config.txt
- G_EXEC sed -i '/root=/s/$/ snd_bcm2835.enable_hdmi=0/' /boot/cmdline.txt
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*dtoverlay=dietpi-disable_hdmi_audio/d' /boot/config.txt
+ G_EXEC sed --follow-symlinks -i '/root=/s/$/ snd_bcm2835.enable_hdmi=0/' /boot/cmdline.txt
fi
if grep -q '^[[:blank:]]*dtoverlay=dietpi-disable_headphones' /boot/config.txt
then
- G_EXEC sed -i '/^[[:blank:]]*dtoverlay=dietpi-disable_headphones/d' /boot/config.txt
- G_EXEC sed -i '/root=/s/$/ snd_bcm2835.enable_headphones=0/' /boot/cmdline.txt
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*dtoverlay=dietpi-disable_headphones/d' /boot/config.txt
+ G_EXEC sed --follow-symlinks -i '/root=/s/$/ snd_bcm2835.enable_headphones=0/' /boot/cmdline.txt
fi
[[ -f '/boot/overlays/dietpi-disable_hdmi_audio.dtbo' ]] && G_EXEC rm /boot/overlays/dietpi-disable_hdmi_audio.dtbo
[[ -f '/boot/overlays/dietpi-disable_headphones.dtbo' ]] && G_EXEC rm /boot/overlays/dietpi-disable_headphones.dtbo
@@ -1138,13 +1142,13 @@ Patch_8_17()
if (( $G_DISTRO > 5 )) && grep -q '^[[:blank:]]*dtoverlay=rpivid-v4l2$' /boot/config.txt
then
G_DIETPI-NOTIFY 2 'Removing deprecated device tree overlay: rpivid-v4l2'
- G_EXEC sed -i '/^[[:blank:]]*dtoverlay=rpivid-v4l2$/d' /boot/config.txt
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*dtoverlay=rpivid-v4l2$/d' /boot/config.txt
fi
# Sparky SBC: Fix Roonbridge: https://dietpi.com/forum/t/allogui-not-working-apache-service-doesnt-start/15708/13
elif (( $G_HW_MODEL == 70 ))
then
- [[ -f '/etc/systemd/system/roonbridge.service' ]] && G_EXEC sed -i '/^AmbientCapabilities=/d' /etc/systemd/system/roonbridge.service
+ [[ -f '/etc/systemd/system/roonbridge.service' ]] && G_EXEC sed --follow-symlinks -i '/^AmbientCapabilities=/d' /etc/systemd/system/roonbridge.service
[[ -f '/etc/systemd/system/roonbridge.service.d/dietpi-no-caps.conf' ]] && G_EXEC rm /etc/systemd/system/roonbridge.service.d/dietpi-no-caps.conf
[[ -f '/etc/systemd/system/roonbridge.service.d' ]] && G_EXEC rmdir --ignore-fail-on-non-empty /etc/systemd/system/roonbridge.service.d
@@ -1249,10 +1253,10 @@ Patch_8_19()
if [[ -f '/boot/dietpi/.installed' ]]
then
# Remove obsolete Spotify Connect Web and Firefox Sync Server install states
- grep -Eq '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[(141|177)\]=' /boot/dietpi/.installed && G_EXEC sed -Ei '/^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[(141|177)\]=/d' /boot/dietpi/.installed
+ grep -Eq '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[(141|177)\]=' /boot/dietpi/.installed && G_EXEC sed --follow-symlinks -Ei '/^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[(141|177)\]=/d' /boot/dietpi/.installed
# Mopidy: Bullseye suite now available in official APT repo
- (( $G_DISTRO > 5 )) && [[ -f '/etc/apt/sources.list.d/mopidy.list' ]] && grep -q buster /etc/apt/sources.list.d/mopidy.list && G_EXEC sed -i 's/buster/bullseye/' /etc/apt/sources.list.d/mopidy.list
+ (( $G_DISTRO > 5 )) && [[ -f '/etc/apt/sources.list.d/mopidy.list' ]] && grep -q buster /etc/apt/sources.list.d/mopidy.list && G_EXEC sed --follow-symlinks -i 's/buster/bullseye/' /etc/apt/sources.list.d/mopidy.list
# GMediaRender
grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[163\]=2' /boot/dietpi/.installed && dpkg --compare-versions "$(dpkg-query -Wf '${Version}' gmediarender 2> /dev/null)" lt 0.1-dietpi1 && G_WHIP_MSG '[ INFO ] GMediaRender update available
@@ -1319,22 +1323,22 @@ Patch_8_20()
# - Apache
if grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[83\]=2' /boot/dietpi/.installed
then
- [[ -f '/etc/apache2/conf-available/dietpi.conf' ]] && G_EXEC sed -i '/^Header set X-XSS-Protection "/c\Header set X-XSS-Protection "0"' /etc/apache2/conf-available/dietpi.conf
+ [[ -f '/etc/apache2/conf-available/dietpi.conf' ]] && G_EXEC sed --follow-symlinks -i '/^Header set X-XSS-Protection "/c\Header set X-XSS-Protection "0"' /etc/apache2/conf-available/dietpi.conf
# Nextcloud: Revert to mute Nextcloud's outdated admin panel warning
- [[ -f '/etc/apache2/sites-available/dietpi-nextcloud.conf' ]] && G_EXEC sed -i '/<\/IfModule>/a\\n\t# Mute outdated admin panel warning\n\tHeader set X-XSS-Protection "1; mode=block"' /etc/apache2/sites-available/dietpi-nextcloud.conf
+ [[ -f '/etc/apache2/sites-available/dietpi-nextcloud.conf' ]] && G_EXEC sed --follow-symlinks -i '/<\/IfModule>/a\\n\t# Mute outdated admin panel warning\n\tHeader set X-XSS-Protection "1; mode=block"' /etc/apache2/sites-available/dietpi-nextcloud.conf
fi
# - ownCloud
if grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[47\]=2' /boot/dietpi/.installed
then
- [[ -f '/etc/nginx/sites-dietpi/dietpi-owncloud.conf' ]] && G_EXEC sed -i 's/add_header X-XSS-Protection "1; mode=block" always;/add_header X-XSS-Protection "0" always;/' /etc/nginx/sites-dietpi/dietpi-owncloud.conf
- [[ -f '/etc/lighttpd/conf-available/99-dietpi-owncloud.conf' ]] && G_EXEC sed -i 's/"X-XSS-Protection" => "1; mode=block"/"X-XSS-Protection" => "0"/' /etc/lighttpd/conf-available/99-dietpi-owncloud.conf
+ [[ -f '/etc/nginx/sites-dietpi/dietpi-owncloud.conf' ]] && G_EXEC sed --follow-symlinks -i 's/add_header X-XSS-Protection "1; mode=block" always;/add_header X-XSS-Protection "0" always;/' /etc/nginx/sites-dietpi/dietpi-owncloud.conf
+ [[ -f '/etc/lighttpd/conf-available/99-dietpi-owncloud.conf' ]] && G_EXEC sed --follow-symlinks -i 's/"X-XSS-Protection" => "1; mode=block"/"X-XSS-Protection" => "0"/' /etc/lighttpd/conf-available/99-dietpi-owncloud.conf
fi
# - Pi-hole
if grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[93\]=2' /boot/dietpi/.installed
then
- [[ -f '/etc/nginx/sites-dietpi/dietpi-pihole.conf' ]] && G_EXEC sed -i 's/add_header X-XSS-Protection "1; mode=block";/add_header X-XSS-Protection "0";/' /etc/nginx/sites-dietpi/dietpi-pihole.conf
- [[ -f '/etc/lighttpd/conf-available/99-dietpi-pihole.conf' ]] && G_EXEC sed -i 's/"X-XSS-Protection" => "1; mode=block"/"X-XSS-Protection" => "0"/' /etc/lighttpd/conf-available/99-dietpi-pihole.conf
+ [[ -f '/etc/nginx/sites-dietpi/dietpi-pihole.conf' ]] && G_EXEC sed --follow-symlinks -i 's/add_header X-XSS-Protection "1; mode=block";/add_header X-XSS-Protection "0";/' /etc/nginx/sites-dietpi/dietpi-pihole.conf
+ [[ -f '/etc/lighttpd/conf-available/99-dietpi-pihole.conf' ]] && G_EXEC sed --follow-symlinks -i 's/"X-XSS-Protection" => "1; mode=block"/"X-XSS-Protection" => "0"/' /etc/lighttpd/conf-available/99-dietpi-pihole.conf
fi
# DietPi-Dashboard: https://github.com/ravenclaw900/DietPi-Dashboard/releases/tag/v0.6.2
@@ -1361,7 +1365,7 @@ Patch_8_21()
local apackages=('linux-image-legacy-rk35xx' 'linux-dtb-legacy-rk35xx')
dpkg-query -s 'linux-headers-legacy-rockchip-rk3588' &> /dev/null && apackages+=('linux-headers-legacy-rk35xx')
G_AGI "${apackages[@]}"
- (( $G_HW_MODEL == 80 )) && G_CONFIG_INJECT 'overlay_prefix=' 'overlay_prefix=rk3588' /boot/dietpiEnv.txt && G_EXEC sed -i '/^[[:blank:]]*fdtfile=/d' /boot/dietpiEnv.txt
+ (( $G_HW_MODEL == 80 )) && G_CONFIG_INJECT 'overlay_prefix=' 'overlay_prefix=rk3588' /boot/dietpiEnv.txt && G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*fdtfile=/d' /boot/dietpiEnv.txt
G_EXEC apt-mark auto "${apackages[@]/rk35xx/rockchip-rk3588}"
fi
}
@@ -1394,7 +1398,7 @@ _EOF_
elif (( $G_HW_MODEL == 80 )) && grep -q '^fdtfile=$' /boot/dietpiEnv.txt
then
G_DIETPI-NOTIFY 2 'Fixing fdtfile entry in dietpiEnv.txt ...'
- G_EXEC sed -i '/^fdtfile=$/d' /boot/dietpiEnv.txt
+ G_EXEC sed --follow-symlinks -i '/^fdtfile=$/d' /boot/dietpiEnv.txt
fi
}
@@ -1470,21 +1474,8 @@ Patch_8_23()
Patch_8_24()
{
- # Quartz64
- if (( $G_HW_MODEL == 49 ))
- then
- for i in quartz64{a,b} soquartz
- do
- dpkg --compare-versions "$(dpkg-query -Wf '${Version}' "firmware-$i" 2> /dev/null)" lt-nl 6.5.11-dietpi2 || continue
- G_DIETPI-NOTIFY 2 "Updating $i kernel and bootloader ..."
- G_EXEC_OUTPUT=1 G_EXEC curl -fo package.deb "https://dietpi.com/downloads/binaries/firmware-$i.deb"
- G_EXEC_OUTPUT=1 G_EXEC dpkg -i --force-confdef,confold package.deb
- G_EXEC rm package.deb
- break
- done
-
# ROCK 3A: The "rk35xx" kernel packages have been merged into "rockchip64", and "edge-rk35xx" is Linux 6.1.11, older than "current-rockchip64", which is 6.1.50
- elif (( $G_HW_MODEL == 77 )) && dpkg-query -s 'linux-image-edge-rk35xx' &> /dev/null
+ if (( $G_HW_MODEL == 77 )) && dpkg-query -s 'linux-image-edge-rk35xx' &> /dev/null
then
G_DIETPI-NOTIFY 2 'Updating ROCK 3A kernel package ...'
local apackages=('linux-image-current-rockchip64' 'linux-dtb-current-rockchip64')
@@ -1523,9 +1514,30 @@ Patch_8_24()
G_AGI ./package.deb
G_EXEC rm package.deb
fi
+ fi
+}
+Patch_8_25()
+{
+ # Quartz64
+ if (( $G_HW_MODEL == 49 ))
+ then
+ for i in quartz64{a,b} soquartz
+ do
+ dpkg --compare-versions "$(dpkg-query -Wf '${Version}' "firmware-$i" 2> /dev/null)" lt-nl 6.6.3-dietpi1 || continue
+ G_DIETPI-NOTIFY 2 "Updating $i kernel and bootloader ..."
+ G_EXEC_OUTPUT=1 G_EXEC curl -fo package.deb "https://dietpi.com/downloads/binaries/firmware-$i.deb"
+ G_EXEC_OUTPUT=1 G_EXEC dpkg -i --force-confdef,confold package.deb
+ G_EXEC rm package.deb
+ break
+ done
+ fi
+
+ # Software updates and migrations
+ if [[ -f '/boot/dietpi/.installed' ]]
+ then
# vaultwarden
- if grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[183\]=2' /boot/dietpi/.installed && dpkg --compare-versions "$(dpkg-query -Wf '${Version}' vaultwarden 2> /dev/null)" lt 1.30.0-dietpi1
+ if grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[183\]=2' /boot/dietpi/.installed && dpkg --compare-versions "$(dpkg-query -Wf '${Version}' vaultwarden 2> /dev/null)" lt 1.30.1-dietpi1
then
# Pre-v8.7 cleanup
if [[ -f '/opt/vaultwarden/target/release/vaultwarden' ]]
@@ -1540,12 +1552,20 @@ Patch_8_24()
fi
# Amiberry
- grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[108\]=2' /boot/dietpi/.installed && dpkg --compare-versions "$(dpkg-query -Wf '${Version}' amiberry 2> /dev/null)" lt 5.6.3-dietpi1 && G_WHIP_YESNO '[ INFO ] Amiberry update available
-\nAn update to Amiberry v5.6.3 is available, including LibSDL2 v2.28.5.
+ grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[108\]=2' /boot/dietpi/.installed && dpkg --compare-versions "$(dpkg-query -Wf '${Version}' amiberry 2> /dev/null)" lt 5.6.4-dietpi1 && G_WHIP_YESNO '[ INFO ] Amiberry update available
+\nAn update to Amiberry v5.6.4 is available, including LibSDL2 v2.28.5.
Release notes: https://github.com/BlitterStudio/amiberry/releases
\nDo you want to apply the update now?
\nYou can manually apply it any time via:
# dietpi-software reinstall 108' && echo 108 >> /var/tmp/dietpi/dietpi-update_reinstalls
+
+ # NZBGet: Disable file logging
+ if grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[149\]=2' /boot/dietpi/.installed && [[ -f '/mnt/dietpi_userdata/nzbget/nzbget.conf' ]]
+ then
+ G_CONFIG_INJECT 'WriteLog=' 'WriteLog=none' /mnt/dietpi_userdata/nzbget/nzbget.conf
+ [[ -f '/etc/systemd/system/nzbget.service' ]] && G_EXEC sed --follow-symlinks -i -e '/^Type=/d' -e '/^ExecStart=/c\ExecStart=/mnt/dietpi_userdata/nzbget/nzbget -so OutputMode=log' /etc/systemd/system/nzbget.service
+ [[ -f '/var/log/nzbget.log' ]] && G_EXEC rm /var/log/nzbget.log
+ fi
fi
}
diff --git a/.update/pre-patches b/.update/pre-patches
index 2e8174e28e..56dd60e582 100755
--- a/.update/pre-patches
+++ b/.update/pre-patches
@@ -66,7 +66,7 @@ fi
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 -i '/^Package:/c\Package: openbox* obconf* libob* pcmanfm* libfm* gtk-* libgtk* libgail* gir1.2-gtk-* lx*' /etc/apt/preferences.d/dietpi-lxde
+ 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
@@ -97,8 +97,8 @@ _EOF_
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 -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 -Ei 's#https://(repo.mosquitto.org|download.webmin.com)#http://\1#' /etc/apt/sources.list.d/*.list
+ 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
@@ -209,12 +209,12 @@ then
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 -i 's/bullseye/bookworm/' /etc/apt/sources.list.d/dietpi-jellyfin.list
+ 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 -i 's/bullseye/bookworm/' /etc/apt/sources.list.d/docker.list
+ G_EXEC sed --follow-symlinks -i 's/bullseye/bookworm/' /etc/apt/sources.list.d/docker.list
fi
fi
@@ -225,13 +225,13 @@ then
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 -i '/non-free/s/$/ non-free-firmware/' /etc/apt/sources.list
+ 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 -i 's/bullseye/bookworm/' /etc/apt/sources.list.d/dietpi-armbian.list
- [[ -f '/etc/apt/sources.list.d/armbian.list' ]] && G_EXEC sed -i 's/bullseye/bookworm/' /etc/apt/sources.list.d/armbian.list
+ [[ -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
@@ -310,7 +310,7 @@ then
[[ -f '/etc/apt/preferences.d/dietpi-ffmpeg' ]] && G_EXEC rm /etc/apt/preferences.d/dietpi-ffmpeg
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
+ (( $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
@@ -340,12 +340,12 @@ 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 -i 's/bullseye/bookworm/' /etc/apt/sources.list.d/dietpi-mosquitto.list
+ 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 -i 's/Debian_Testing/Debian_12/' /etc/apt/sources.list.d/dietpi-mympd.list
+ 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
@@ -355,7 +355,7 @@ then
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 -i 's/ testing / stable /' /etc/apt/sources.list.d/dietpi-openhab.list
+ G_EXEC sed --follow-symlinks -i 's/ testing / stable /' /etc/apt/sources.list.d/dietpi-openhab.list
(( $G_DISTRO < 6 )) && G_EXEC eval 'echo -e '\''Package: openhab*\nPin: version 3.*\nPin-Priority: 501'\'' > /etc/apt/preferences.d/dietpi-openhab'
fi
if [[ $G_DISTRO -ge 7 && -f '/etc/apt/sources.list.d/raspi.list' ]] && dpkg-query -s 'kodi-repository-kodi' &> /dev/null
@@ -363,10 +363,21 @@ then
G_DIETPI-NOTIFY 2 'Purging conflicting kodi-repository-kodi package'
G_AGP kodi-repository-kodi
fi
- if (( $G_HW_MODEL == 4 && $G_DISTRO > 6 )) && dpkg-query -s rpi-eeprom &> /dev/null
+fi
+
+# v8.25
+if (( $G_DIETPI_VERSION_CORE < 8 || ( $G_DIETPI_VERSION_CORE == 8 && $G_DIETPI_VERSION_SUB < 25 ) ))
+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 [[ -f '/etc/apt/sources.list.d/webmin.list' ]]
then
- G_DIETPI-NOTIFY 2 'Setting rpi-eeprom package on hold to prevent conflicting upgrade attempt'
- G_EXEC apt-mark hold rpi-eeprom
+ 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
diff --git a/.update/version b/.update/version
index 8be7f630f4..78ef0952fa 100644
--- a/.update/version
+++ b/.update/version
@@ -2,8 +2,8 @@
# shellcheck disable=SC2034
# Available DietPi version
G_REMOTE_VERSION_CORE=8
-G_REMOTE_VERSION_SUB=24
-G_REMOTE_VERSION_RC=1
+G_REMOTE_VERSION_SUB=25
+G_REMOTE_VERSION_RC=0
# Minimum DietPi version to allow update
G_MIN_VERSION_CORE=6
G_MIN_VERSION_SUB=14
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index ddada5475a..3d3f5b931a 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,3 +1,26 @@
+v8.25
+(2023-12-16)
+
+New images:
+- Star64
+- Orange Pi 3B
+
+Enhancements:
+- Raspberry Pi | We applied preparations for supporting the new official Raspberry Pi firmware and kernel packages, which implies support for Raspberry Pi 5. A script allows to the migration to the new package set, including the switch for the boot mountpoint from /boot to /boot/firmware. Please see the following topic about how to apply the script. Note that it is in beta stage for now, since the change might cause issues among our scripts which we did not detect yet: https://github.com/MichaIng/DietPi/issues/6676
+- Quartz64 | The kernel receives a major upgrade to Linux 6.6.3 and we switched to latest unmodified mainline U-Boot 2023.10. Among others changes, this implies a fixed onboard Ethernet MAC address, which was previously changing on every boot.
+- DietPi-Software | NZBGet: We migrated to the repository of the new project maintainer, since the original author stopped development: https://dietpi.com/forum/t/nzbget-new-maintainer-dietpi-software-already-updated/18425. Being on it, plain text file logging has been disabled in favour for journal logging, i.e. all NZBGet related logs are now combined in "journalct -u nzbget". The logging change will be applied on next DietPi update, the NZBGet upgrade itself can be done via reinstall: dietpi-software reinstall 149
+
+Bug fixes:
+- Proxmox | Now really resolved the issue where the QEMU guest agent was not always installed automatically on first boot.
+- DietPi-Update | Resolved an issue on RPi 4 systems with 32-bit userland/OS (but 64-bit kernel enabled) where wrong package variants could have been installed during patch stages. Many thanks to @diment08 for reporting this issue: https://github.com/MichaIng/DietPi/issues/6768
+- DietPi-Backup | Resolved an issue where updating or restoring backups between different distro version may have been incomplete (particularly in case of Bookworm and Bullseye), since the /etc/debian_version is identical in size and mtime, and hence seen as identical by rsync (by default), while its content is different.
+- DietPi-Software | Ampache: Resolved an issue on Bullseye and Bookworm systems where the initial web UI access failed because our pre-generated database was too old. A template shipped with Ampache will now be used, the initial admin user and music catalogue added via CLI. Many thanks to @mostly_offline for reporting this issue: https://dietpi.com/forum/t/bypassing-ampache-update-page/17367
+- DietPi-Software | Kodi: Worked around an issue on RPi Bookworm systems where installing Kodi failed due to a missing directory. Many thanks to @joshi0531 for reporting this issue: https://github.com/MichaIng/DietPi/issues/6703
+
+As always, many smaller code performance and stability improvements, visual and spelling fixes have been done, too much to list all of them here. Check out all code changes of this release on GitHub: https://github.com/MichaIng/DietPi/pull/ADDME
+
+-----------------------------------------------------------------------------------------------------------
+
v8.24
(2023-11-18)
diff --git a/dietpi/dietpi-backup b/dietpi/dietpi-backup
index 7ad4fea2b6..dff568d11c 100755
--- a/dietpi/dietpi-backup
+++ b/dietpi/dietpi-backup
@@ -216,6 +216,10 @@ However, this check is a rough estimation in reasonable time, thus it could be m
rsync "${aRSYNC_RUN_OPTIONS_BACKUP[@]}" -v --log-file="$FP_TARGET/$FP_LOG" "$FP_SOURCE" "$FP_TARGET/data/"
EXIT_CODE=$?
+ # Manually backup /etc/debian_release, since it can have same size and mtime between different Debian version, hence backing up e.g. a Bookworm system onto an existing Bullseye backup won't include this critical file.
+ # - The alternative would be "-c" to compare checksums, but this can increases the duration significantly.
+ G_EXEC cp -a "${FP_SOURCE}etc/debian_release" "$FP_TARGET/$DATA/etc/debian_release"
+
# touch target directory to show the correct last update timestamp when restoring one of multiple backups from the archive. This needs to be done after the backup since it applies the root / timestamps.
G_EXEC touch "$FP_TARGET/data"
@@ -306,9 +310,9 @@ However, this check is a rough estimation in reasonable time, thus it could be m
do
[[ $mountpoint ]] || continue
local uuid=$(findmnt -Ufnro UUID -M "$mountpoint")
- [[ $uuid ]] && G_EXEC sed -i "\|[[:blank:]]${mountpoint}[[:blank:]]|s|^[[:blank:]]*UUID=[^[:blank:]]*|UUID=$uuid|" /etc/fstab
+ [[ $uuid ]] && G_EXEC sed --follow-symlinks -i "\|[[:blank:]]${mountpoint}[[:blank:]]|s|^[[:blank:]]*UUID=[^[:blank:]]*|UUID=$uuid|" /etc/fstab
local partuuid=$(findmnt -Ufnro PARTUUID -M "$mountpoint")
- [[ $partuuid ]] && G_EXEC sed -i "\|[[:blank:]]${mountpoint}[[:blank:]]|s|^[[:blank:]]*PARTUUID=[^[:blank:]]*|PARTUUID=$partuuid|" /etc/fstab
+ [[ $partuuid ]] && G_EXEC sed --follow-symlinks -i "\|[[:blank:]]${mountpoint}[[:blank:]]|s|^[[:blank:]]*PARTUUID=[^[:blank:]]*|PARTUUID=$partuuid|" /etc/fstab
done < <(lsblk -no MOUNTPOINT "$(lsblk -npo PKNAME "$G_ROOTFS_DEV")")
@@ -324,7 +328,7 @@ However, this check is a rough estimation in reasonable time, thus it could be m
# - RPi
elif (( $UPDATE_RPI == 1 ))
then
- G_EXEC sed -Ei "s/(^|[[:blank:]])root=[^[:blank:]]*/\1root=PARTUUID=$PARTUUID_ROOT/" /boot/cmdline.txt
+ G_EXEC sed --follow-symlinks -Ei "s/(^|[[:blank:]])root=[^[:blank:]]*/\1root=PARTUUID=$PARTUUID_ROOT/" /boot/cmdline.txt
# - DietPi modern U-Boot
elif (( $UPDATE_DIETPI == 1 ))
@@ -341,12 +345,12 @@ However, this check is a rough estimation in reasonable time, thus it could be m
# - Odroids / classic U-Boot
elif (( $UPDATE_ODROID == 1 ))
then
- G_EXEC sed -Ei -e "s/(\"|root=)UUID=[^[:blank:]\"]*/\1UUID=$UUID_ROOT/" -e "s/(\"|root=)PARTUUID=[^[:blank:]\"]*/\1PARTUUID=$PARTUUID_ROOT/" /boot/boot.ini
+ G_EXEC sed --follow-symlinks -Ei -e "s/(\"|root=)UUID=[^[:blank:]\"]*/\1UUID=$UUID_ROOT/" -e "s/(\"|root=)PARTUUID=[^[:blank:]\"]*/\1PARTUUID=$PARTUUID_ROOT/" /boot/boot.ini
# - Modern U-Boot
elif (( $UPDATE_UBOOT == 1 ))
then
- G_EXEC sed -Ei -e "s/(\"|root=)UUID=[^[:blank:]\"]*/\1UUID=$UUID_ROOT/" -e "s/(\"|root=)PARTUUID=[^[:blank:]\"]*/\1PARTUUID=$PARTUUID_ROOT/" /boot/boot.cmd
+ G_EXEC sed --follow-symlinks -Ei -e "s/(\"|root=)UUID=[^[:blank:]\"]*/\1UUID=$UUID_ROOT/" -e "s/(\"|root=)PARTUUID=[^[:blank:]\"]*/\1PARTUUID=$PARTUUID_ROOT/" /boot/boot.cmd
G_EXEC mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr
fi
}
@@ -388,6 +392,10 @@ However, this check is a rough estimation in reasonable time, thus it could be m
rsync "${aRSYNC_RUN_OPTIONS_RESTORE[@]}" -v --log-file="$FP_TARGET/$FP_LOG" "$FP_TARGET/$DATA/" "$FP_SOURCE"
EXIT_CODE=$?
+ # Manually restore /etc/debian_release, since it can have same size and mtime between different Debian version, hence restoring e.g. a Bullseye system on Bookworm won't restore this critical file.
+ # - The alternative would be "-c" to compare checksums, but this can increases the duration significantly.
+ G_EXEC cp -a "$FP_TARGET/$DATA/etc/debian_release" "${FP_SOURCE}etc/debian_release"
+
hash -r # Clear PATH cache
(( $UPDATE_UUIDs )) && Update_UUIDs
diff --git a/dietpi/dietpi-cleaner b/dietpi/dietpi-cleaner
index 774d63601e..1609ee9c48 100755
--- a/dietpi/dietpi-cleaner
+++ b/dietpi/dietpi-cleaner
@@ -336,7 +336,7 @@ $G_PROGRAM_NAME simulation has finished: Press any key to continue..."
# Mark for autoremoval
[[ ${apackages[0]} ]] && { apt-mark auto "${apackages[@]}"; G_AGA; }
- sed -i '/^aSOFTWARE_INSTALL_STATE\[16\]=/d' /boot/dietpi/.installed
+ sed --follow-symlinks -i '/^aSOFTWARE_INSTALL_STATE\[16\]=/d' /boot/dietpi/.installed
fi
diff --git a/dietpi/dietpi-config b/dietpi/dietpi-config
index 38bbc8e5bc..085e905655 100755
--- a/dietpi/dietpi-config
+++ b/dietpi/dietpi-config
@@ -285,7 +285,7 @@
G_CONFIG_INJECT 'disable_overscan=' 'disable_overscan=1' /boot/config.txt
for i in "${overscan_options[@]}"
do
- sed -i "/^[[:blank:]]*$i=/c\#$i=0" /boot/config.txt
+ sed --follow-symlinks -i "/^[[:blank:]]*$i=/c\#$i=0" /boot/config.txt
done
fi
@@ -550,8 +550,8 @@ A long (or insufficiently manufactured) cable may required a higher boost settin
if [[ $G_WHIP_RETURNED_VALUE == 'System default' ]]; then
- sed -i 's/^[[:blank:]]*GRUB_GFXMODE=/#GRUB_GFXMODE=/' /etc/default/grub
- sed -i 's/^[[:blank:]]*GRUB_GFXPAYLOAD_LINUX=/#GRUB_GFXPAYLOAD_LINUX=/' /etc/default/grub
+ sed --follow-symlinks -i 's/^[[:blank:]]*GRUB_GFXMODE=/#GRUB_GFXMODE=/' /etc/default/grub
+ sed --follow-symlinks -i 's/^[[:blank:]]*GRUB_GFXPAYLOAD_LINUX=/#GRUB_GFXPAYLOAD_LINUX=/' /etc/default/grub
else
@@ -691,8 +691,8 @@ Re-enabling HDMI requires a reboot. If you need emergency HDMI output, edit the
# Disable composite if not chosen
if [[ $G_WHIP_RETURNED_VALUE != 'sdtv_mode'* ]]; then
- sed -i '/sdtv_mode=/c\#sdtv_mode=0' /boot/config.txt
- sed -i '/enable_tvout=/c\#enable_tvout=0' /boot/config.txt
+ sed --follow-symlinks -i '/sdtv_mode=/c\#sdtv_mode=0' /boot/config.txt
+ sed --follow-symlinks -i '/enable_tvout=/c\#enable_tvout=0' /boot/config.txt
fi
@@ -849,7 +849,7 @@ Re-enabling HDMI requires a reboot. If you need emergency HDMI output, edit the
[[ $current_resolution != "$G_WHIP_RETURNED_VALUE" ]] && REBOOT_REQUIRED=1
# Always reset vga/dvi options
- sed -Ei 's/^[[:blank:]]*(setenv[[:blank:]]+vout[[:blank:]].*$)/#\1/' /boot/boot.ini
+ sed --follow-symlinks -Ei 's/^[[:blank:]]*(setenv[[:blank:]]+vout[[:blank:]].*$)/#\1/' /boot/boot.ini
# DVI / VU7+
if [[ $G_WHIP_RETURNED_VALUE == '1024x600p 60hz' ]]; then
@@ -1645,7 +1645,7 @@ If unsure, set any value, 'Ondemand Down Factor' option on the next screen will
else
- G_EXEC sed -i "/^[[:blank:]]*arm_freq_min=/c\#arm_freq_min=$DEF_VALUE" /boot/config.txt
+ G_EXEC sed --follow-symlinks -i "/^[[:blank:]]*arm_freq_min=/c\#arm_freq_min=$DEF_VALUE" /boot/config.txt
fi
REBOOT_REQUIRED=1
@@ -1666,7 +1666,7 @@ If unsure, set any value, 'Ondemand Down Factor' option on the next screen will
else
- sed -i '/^[[:blank:]]*initial_turbo=/c\#initial_turbo=20' /boot/config.txt
+ sed --follow-symlinks -i '/^[[:blank:]]*initial_turbo=/c\#initial_turbo=20' /boot/config.txt
fi
REBOOT_REQUIRED=1
@@ -2058,7 +2058,7 @@ _EOF_
# Remove wireless-power setting if not supported by adapter/firmware
# shellcheck disable=SC2015
- (( $WIFI_HARDWARE )) && iw dev "$WIFI_DEV_IFACE" set power_save on 2> /dev/null && iw dev "$WIFI_DEV_IFACE" set power_save off 2> /dev/null || G_EXEC sed -i '/ iw dev .* set power_save /d' /etc/network/interfaces
+ (( $WIFI_HARDWARE )) && iw dev "$WIFI_DEV_IFACE" set power_save on 2> /dev/null && iw dev "$WIFI_DEV_IFACE" set power_save off 2> /dev/null || G_EXEC sed --follow-symlinks -i '/ iw dev .* set power_save /d' /etc/network/interfaces
# Update WiFi db/wpa_supplicant if enabled
(( $WIFI_DISABLED )) || /boot/dietpi/func/dietpi-wifidb 1
@@ -3057,11 +3057,11 @@ Additional benchmarks:
Reset_Overclocking()
{
- sed -i -e '/^[[:blank:]]*over_voltage=/c\#over_voltage=0' \
+ sed --follow-symlinks -i -e '/^[[:blank:]]*over_voltage=/c\#over_voltage=0' \
-e '/^[[:blank:]]*over_voltage_min=/c\#over_voltage_min=0' \
-e "/^[[:blank:]]*arm_freq=/c\#arm_freq=$arm_freq_default" \
-e "/^[[:blank:]]*core_freq=/c\#core_freq=$core_freq_default" /boot/config.txt
- (( $G_HW_MODEL == 4 )) || sed -i "/^[[:blank:]]*sdram_freq=/c\#sdram_freq=$sdram_freq_default" /boot/config.txt
+ (( $G_HW_MODEL == 4 )) || sed --follow-symlinks -i "/^[[:blank:]]*sdram_freq=/c\#sdram_freq=$sdram_freq_default" /boot/config.txt
REBOOT_REQUIRED=1
}
diff --git a/dietpi/dietpi-drive_manager b/dietpi/dietpi-drive_manager
index f310f5e1df..652a8ac5a2 100755
--- a/dietpi/dietpi-drive_manager
+++ b/dietpi/dietpi-drive_manager
@@ -73,7 +73,6 @@
aDRIVE_ISROM[$index]=0
aDRIVE_ISPARTITIONTABLE[$index]=0
aDRIVE_ISACCESS[$index]=1
-
}
Destroy(){
@@ -86,7 +85,6 @@
unset -v aDRIVE_ISFILESYSTEM aDRIVE_ISMOUNTED
unset -v aDRIVE_ISREADONLY_CURRENTLY aDRIVE_ISNETWORKED
unset -v aDRIVE_ISROM aDRIVE_ISPARTITIONTABLE aDRIVE_ISACCESS
-
}
Init_Drives_and_Refresh(){
@@ -262,7 +260,7 @@ $swap_mounts
# /boot is removed from local-fs.target by this (on Buster only?), allowing it to mount after RAMdisk starts and unmount before it stops.
# Source device entry
local dev_entry="UUID=${aDRIVE_UUID[$index]}"
- if [[ ${aDRIVE_MOUNT_TARGET[$index]} =~ ^/(boot(/efi)?)?$ ]]; then
+ if [[ ${aDRIVE_MOUNT_TARGET[$index]} =~ ^/(boot(/efi|/firmware)?)?$ ]]; then
# On RPi we need to use PARTUUID for Root/BootFS
(( $G_HW_MODEL > 9 )) || dev_entry="PARTUUID=${aDRIVE_PART_UUID[$index]}"
@@ -372,7 +370,7 @@ $swap_mounts
# - Container: Assume host supports it (relevant for network drives)
if (( $G_HW_MODEL != 75 )) && ! modprobe -nq autofs4
then
- sed -Ei '/x-systemd\.automount/s/,(noauto|x-systemd\.automount)//g' "$fp_fstab_tmp"
+ sed --follow-symlinks -Ei '/x-systemd\.automount/s/,(noauto|x-systemd\.automount)//g' "$fp_fstab_tmp"
G_DIETPI-NOTIFY 2 'autofs4 module not available in kernel, x-systemd.automount has been disabled, all drives will be mounted at boot instead'
fi
@@ -489,7 +487,7 @@ Do you wish to ignore this warning, and, mount the drive regardless?" || return
local target=$1
G_EXEC_NOEXIT=1 G_EXEC umount "$target" || return 1
- sed -i "\#[[:blank:]]${target}[[:blank:]]#d" /etc/fstab # Only needed for network drives currently, as unmounted physical drives won't be re-added via Init_Drives_and_Refresh
+ sed --follow-symlinks -i "\#[[:blank:]]${target}[[:blank:]]#d" /etc/fstab # Only needed for network drives currently, as unmounted physical drives won't be re-added via Init_Drives_and_Refresh
# Stop automount to unlock mount point
local automount=${target#/}
[[ $automount ]] && { automount=${automount//-/\\x2d}; automount=${automount//\//-}; }
@@ -726,29 +724,29 @@ Do you wish to ignore this warning, and, mount the drive regardless?" || return
# Update fstab
# - Remove automatic entry for target drive
- G_EXEC sed -i "\@[[:blank:]]${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]}[[:blank:]]@d" "${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]}/etc/fstab"
+ G_EXEC sed --follow-symlinks -i "\@[[:blank:]]${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]}[[:blank:]]@d" "${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]}/etc/fstab"
# - Replace old with new rootfs entry
local dev_entry="UUID=${aDRIVE_UUID[$MENU_DRIVE_INDEX]}"
(( $G_HW_MODEL < 10 )) && dev_entry="PARTUUID=${aDRIVE_PART_UUID[$MENU_DRIVE_INDEX]}"
- G_EXEC sed -i "\@[[:blank:]]/[[:blank:]]@c$dev_entry / ${aDRIVE_FSTYPE[$MENU_DRIVE_INDEX]} noatime,lazytime,rw 0 1" "${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]}/etc/fstab"
+ G_EXEC sed --follow-symlinks -i "\@[[:blank:]]/[[:blank:]]@c$dev_entry / ${aDRIVE_FSTYPE[$MENU_DRIVE_INDEX]} noatime,lazytime,rw 0 1" "${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]}/etc/fstab"
# Find and replace current root and rootfstype kernel command line entries
# - RPi: /boot/cmdline.txt
if (( $G_HW_MODEL < 10 ))
then
local rootfs_current=$(mawk '{for(i=1;i<=NF;i++) if($i~/^root=/) {print $i;exit}}' /boot/cmdline.txt)
- G_EXEC sed -i "s#$rootfs_current#root=$dev_entry#g" /boot/cmdline.txt
+ G_EXEC sed --follow-symlinks -i "s#$rootfs_current#root=$dev_entry#g" /boot/cmdline.txt
local rootfstype_current=$(mawk '{for(i=1;i<=NF;i++) if($i~/^rootfstype=/) {print $i;exit}}' /boot/cmdline.txt)
- [[ $rootfstype_current ]] && G_EXEC sed -i "s#$rootfstype_current#rootfstype=${aDRIVE_FSTYPE[$MENU_DRIVE_INDEX]}#g" /boot/cmdline.txt
+ [[ $rootfstype_current ]] && G_EXEC sed --follow-symlinks -i "s#$rootfstype_current#rootfstype=${aDRIVE_FSTYPE[$MENU_DRIVE_INDEX]}#g" /boot/cmdline.txt
# - Odroids: /boot/boot.ini
else
local rootfs_current=$(mawk '-F[" ]' '{for(i=1;i<=NF;i++) if($i~/^root=/) {print $i;exit}}' /boot/boot.ini)
- G_EXEC sed -i "s#$rootfs_current#root=$dev_entry#g" /boot/boot.ini
+ G_EXEC sed --follow-symlinks -i "s#$rootfs_current#root=$dev_entry#g" /boot/boot.ini
local rootfstype_current=$(mawk '-F[" ]' '{for(i=1;i<=NF;i++) if($i~/^rootfstype=/) {print $i;exit}}' /boot/boot.ini)
- [[ $rootfstype_current ]] && G_EXEC sed -i "s#$rootfstype_current#rootfstype=${aDRIVE_FSTYPE[$MENU_DRIVE_INDEX]}#g" /boot/boot.ini
+ [[ $rootfstype_current ]] && G_EXEC sed --follow-symlinks -i "s#$rootfstype_current#rootfstype=${aDRIVE_FSTYPE[$MENU_DRIVE_INDEX]}#g" /boot/boot.ini
fi
G_EXEC systemctl daemon-reload
@@ -777,7 +775,7 @@ Do you wish to ignore this warning, and, mount the drive regardless?" || return
if [[ ${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]} == '/' ]]; then
local line_number=$(grep -n "[[:blank:]]${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]}[[:blank:]].*,rw" /etc/fstab | cut -d : -f 1)
- sed -i "${line_number}s/,rw/,ro/" /etc/fstab
+ sed --follow-symlinks -i "${line_number}s/,rw/,ro/" /etc/fstab
fi
message_result=$(mount -v -o remount,ro "${aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]}" 2>&1)
@@ -953,7 +951,7 @@ Do you wish to ignore this warning, and, mount the drive regardless?" || return
else
- Menu_Exit
+ TARGETMENUID=-1 # Exit
fi
@@ -1023,9 +1021,8 @@ Do you wish to ignore this warning, and, mount the drive regardless?" || return
whiptail_desc+="\nAllocation: Capacity: ${aDRIVE_SIZE_TOTAL[$MENU_DRIVE_INDEX]}iB | Used: ${aDRIVE_SIZE_USED[$MENU_DRIVE_INDEX]}iB (${aDRIVE_SIZE_PERCENTUSED[$MENU_DRIVE_INDEX]})\nStatus: Drive is online and ready for use"
- # Unmount
- # - Disable mount control for /boot /rootfs
- if [[ ${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]} != '/' && ${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]} != '/boot' ]]; then
+ # Unmount: Disable for root and boot mounts
+ if [[ ! ${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]} =~ ^/(boot(/efi|/firmware)?)?$ ]]; then
G_WHIP_MENU_ARRAY+=('' '●─ Mount Control ')
if (( ${aDRIVE_ISNETWORKED[$MENU_DRIVE_INDEX]} )); then
@@ -1116,18 +1113,10 @@ Do you wish to ignore this warning, and, mount the drive regardless?" || return
G_WHIP_MENU_ARRAY+=('Check & Repair' ': Check and optionally repair filesystem')
# Resize
- if [[ ${aDRIVE_FSTYPE[$MENU_DRIVE_INDEX]} =~ ^(ext[2-4]|f2fs|btrfs)$ ]]; then
-
- G_WHIP_MENU_ARRAY+=('Resize' ': Maximize the available filesystem size')
-
- fi
-
- # Format: Disabled for /boot and rootfs
- if [[ ${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]} != '/' && ${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]} != '/boot' ]]; then
+ [[ ${aDRIVE_FSTYPE[$MENU_DRIVE_INDEX]} =~ ^(ext[2-4]|f2fs|btrfs)$ ]] && G_WHIP_MENU_ARRAY+=('Resize' ': Maximize the available filesystem size')
- G_WHIP_MENU_ARRAY+=('Format' ': Select to see formatting options')
-
- fi
+ # Format: Disable for root and boot mounts
+ [[ ${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]} =~ ^/(boot(/efi|/firmware)?)?$ ]] || G_WHIP_MENU_ARRAY+=('Format' ': Select to see formatting options')
fi
@@ -1135,8 +1124,8 @@ Do you wish to ignore this warning, and, mount the drive regardless?" || return
if (( ${aDRIVE_ISACCESS[$MENU_DRIVE_INDEX]} && ! ${aDRIVE_ISROM[$MENU_DRIVE_INDEX]} && ! ${aDRIVE_ISNETWORKED[$MENU_DRIVE_INDEX]} ))
then
- # Transfer RootFS: Supported on RPi and Odroids C2/XU4/N2/C4 if /boot is a dedicated mount
- if [[ ${aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]} != "$G_ROOTFS_DEV" && ( $G_HW_MODEL -le 9 || $G_HW_MODEL == 1[1256] ) ]] && findmnt -M /boot > /dev/null; then
+ # Transfer RootFS: Supported on RPi and Odroids C2/XU4/N2/C4 if there is a dedicated boot mount
+ if [[ ${aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]} != "$G_ROOTFS_DEV" ]] && { (( $G_HW_MODEL < 10 )) || { (( $G_HW_MODEL < 20 )) && findmnt -M /boot > /dev/null; }; } then
G_WHIP_MENU_ARRAY+=('Transfer RootFS' ': Transfer RootFS to this drive')
@@ -1502,7 +1491,7 @@ Read more about I/O scheduling: https://wiki.archlinux.org/index.php/Improving_p
if [[ $G_WHIP_RETURNED_VALUE == 'Reset' ]]; then
- sed -i "/KERNEL==\"${aDRIVE_SOURCE_DEVICE[$MENU_DRIVE_INDEX]}\"/d" "$udev_rules"
+ sed --follow-symlinks -i "/KERNEL==\"${aDRIVE_SOURCE_DEVICE[$MENU_DRIVE_INDEX]}\"/d" "$udev_rules"
grep -q '^ACTION' "$udev_rules" || rm "$udev_rules"
G_WHIP_YESNO '[ INFO ] A reboot is required to reset the I/O scheduler to default.\n\nDo you wish to reboot now?' && reboot
@@ -1779,7 +1768,7 @@ username=$samba_clientuser
password=$samba_clientpassword
_EOF_
# Apply to fstab
- sed -i "\#[[:blank:]]${samba_fp_mount_target}[[:blank:]]#d" /etc/fstab
+ sed --follow-symlinks -i "\#[[:blank:]]${samba_fp_mount_target}[[:blank:]]#d" /etc/fstab
# - NB: Convert spaces to '\040': https://github.com/MichaIng/DietPi/issues/1201#issuecomment-339720271
echo "//$samba_clientname/${samba_clientshare//[[:blank:]]/\\040} $samba_fp_mount_target cifs cred=$cred,iocharset=utf8,uid=dietpi,gid=dietpi,file_mode=0770,dir_mode=0770,vers=$i,nofail,noauto,x-systemd.automount" >> /etc/fstab
@@ -1795,7 +1784,7 @@ _EOF_
done
# Failure
- sed -i '1i\[FAILED] Samba mount failed with the following error output:\n' "$fp_tmp"
+ sed --follow-symlinks -i '1i\[FAILED] Samba mount failed with the following error output:\n' "$fp_tmp"
G_WHIP_VIEWFILE "$fp_tmp"
rm "$fp_tmp"
rmdir --ignore-fail-on-non-empty "$samba_fp_mount_target"
@@ -1893,7 +1882,7 @@ _EOF_
if mount -vt nfs -o port=2049 "$nfs_server_ip:$nfs_fp_server_share" "$nfs_fp_mount_target" &> "$fp_tmp"
then
# Apply to fstab
- sed -i "\#[[:blank:]]${nfs_fp_mount_target}[[:blank:]]#d" /etc/fstab
+ sed --follow-symlinks -i "\#[[:blank:]]${nfs_fp_mount_target}[[:blank:]]#d" /etc/fstab
echo "$nfs_server_ip:$nfs_fp_server_share $nfs_fp_mount_target nfs nofail,noauto,x-systemd.automount" >> /etc/fstab
MENU_DRIVE_TARGET=$nfs_fp_mount_target
@@ -1906,7 +1895,7 @@ _EOF_
fi
# Failure
- sed -i '1i\[FAILED] NFS mount failed with the following error output:\n' "$fp_tmp"
+ sed --follow-symlinks -i '1i\[FAILED] NFS mount failed with the following error output:\n' "$fp_tmp"
G_WHIP_VIEWFILE "$fp_tmp"
rm "$fp_tmp"
rmdir --ignore-fail-on-non-empty "$nfs_fp_mount_target"
@@ -1951,14 +1940,6 @@ _EOF_
}
- Menu_Exit(){
-
- TARGETMENUID=0 # Main menu
- G_WHIP_SIZE_X_MAX=50
- G_WHIP_YESNO "Exit $G_PROGRAM_NAME?" && TARGETMENUID=-1 # Exit
-
- }
-
#/////////////////////////////////////////////////////////////////////////////////////
# Main Loop
#/////////////////////////////////////////////////////////////////////////////////////
diff --git a/dietpi/dietpi-led_control b/dietpi/dietpi-led_control
index 94d32ba298..bde7caa361 100755
--- a/dietpi/dietpi-led_control
+++ b/dietpi/dietpi-led_control
@@ -118,7 +118,7 @@
elif [[ $G_WHIP_RETURNED_VALUE == 'Reset' ]]; then
- G_EXEC_NOHALT=1 G_EXEC sed -i "/KERNEL==\"${aNAME[$SELECTED_LED]}\"/d" "$FP_UDEV_RULES" || return 1
+ G_EXEC_NOHALT=1 G_EXEC sed --follow-symlinks -i "/KERNEL==\"${aNAME[$SELECTED_LED]}\"/d" "$FP_UDEV_RULES" || return 1
unset -v "aTRIGGER_SELECTED[$SELECTED_LED]"
G_WHIP_MSG "LED trigger for ${aNAME[$SELECTED_LED]} has been reset to system defaults.\n\nThis will become active from next reboot."
[[ ${aTRIGGER_SELECTED[*]} || ! -f $FP_UDEV_RULES ]] || G_EXEC_NOHALT=1 G_EXEC rm "$FP_UDEV_RULES" || return 1
diff --git a/dietpi/dietpi-letsencrypt b/dietpi/dietpi-letsencrypt
index 46b42713dc..73055f5473 100755
--- a/dietpi/dietpi-letsencrypt
+++ b/dietpi/dietpi-letsencrypt
@@ -157,7 +157,7 @@ _EOF_
if (( $G_DISTRO > 5 ))
then
G_AG_CHECK_INSTALL_PREREQ lighttpd-mod-openssl
- G_EXEC sed -i 's/,-SessionTicket//' /etc/lighttpd/conf-available/50-dietpi-https.conf
+ G_EXEC sed --follow-symlinks -i 's/,-SessionTicket//' /etc/lighttpd/conf-available/50-dietpi-https.conf
fi
[[ -f '/etc/lighttpd/conf-enabled/50-dietpi-https.conf' ]] || G_EXEC lighty-enable-mod dietpi-https
@@ -238,7 +238,7 @@ _EOF_
fi
# Enable HTTP/2: https://github.com/certbot/certbot/issues/3646
- grep -q 'http2' /etc/nginx/sites-available/default || G_EXEC sed -i '/^[[:blank:]]*listen /s/443 ssl/443 ssl http2/' /etc/nginx/sites-available/default
+ grep -q 'http2' /etc/nginx/sites-available/default || G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*listen /s/443 ssl/443 ssl http2/' /etc/nginx/sites-available/default
Apply_To_Web_Applications
@@ -361,8 +361,8 @@ _EOF_
# Skip this if HTTP access is still possible
(( $LETSENCRYPT_REDIRECT || $LETSENCRYPT_HSTS )) || return
G_DIETPI-NOTIFY 2 'Applying HTTPS domain to known web application configs'
- [[ -f '/var/www/nextcloud/config/config.php' ]] && G_EXEC sed -i "s|'http://localhost/nextcloud'|'https://$primary_domain/nextcloud'|" /var/www/nextcloud/config/config.php
- [[ -f '/var/www/owncloud/config/config.php' ]] && G_EXEC sed -i "s|'http://localhost/owncloud'|'https://$primary_domain/owncloud'|" /var/www/owncloud/config/config.php
+ [[ -f '/var/www/nextcloud/config/config.php' ]] && G_EXEC sed --follow-symlinks -i "s|'http://localhost/nextcloud'|'https://$primary_domain/nextcloud'|" /var/www/nextcloud/config/config.php
+ [[ -f '/var/www/owncloud/config/config.php' ]] && G_EXEC sed --follow-symlinks -i "s|'http://localhost/owncloud'|'https://$primary_domain/owncloud'|" /var/www/owncloud/config/config.php
}
#/////////////////////////////////////////////////////////////////////////////////////
diff --git a/dietpi/dietpi-services b/dietpi/dietpi-services
index dee7d3e2e0..b597d02137 100755
--- a/dietpi/dietpi-services
+++ b/dietpi/dietpi-services
@@ -481,7 +481,7 @@ _EOF_
elif [[ $value == 'reset' ]]
then
unset -v "${aarray[$setting]}[$index]"
- [[ -f $fp ]] && G_EXEC sed -i "/^${asetting[$setting]}=/d" "$fp"
+ [[ -f $fp ]] && G_EXEC sed --follow-symlinks -i "/^${asetting[$setting]}=/d" "$fp"
# Apply process tool setting
else
@@ -768,13 +768,13 @@ This affects starts/stops/restarts during DietPi-Software installs, DietPi-Updat
if [[ $G_WHIP_RETURNED_VALUE == 'Include' ]]
then
# If service is listed here, it was excluded via include/exclude file.
- G_EXEC sed -i "/^- ${aSERVICE_NAME[$MENU_SERVICE_INDEX]}/d" "$FP_INCLUDE_EXCLUDE"
+ G_EXEC sed --follow-symlinks -i "/^- ${aSERVICE_NAME[$MENU_SERVICE_INDEX]}/d" "$FP_INCLUDE_EXCLUDE"
aSERVICE_CONTROL["$MENU_SERVICE_INDEX"]='included'
else
# Remove include entry if existent, else add exclude entry.
if grep -q "^+ ${aSERVICE_NAME[$MENU_SERVICE_INDEX]}" "$FP_INCLUDE_EXCLUDE"
then
- G_EXEC sed -i "/^+ ${aSERVICE_NAME[$MENU_SERVICE_INDEX]}/d" "$FP_INCLUDE_EXCLUDE"
+ G_EXEC sed --follow-symlinks -i "/^+ ${aSERVICE_NAME[$MENU_SERVICE_INDEX]}/d" "$FP_INCLUDE_EXCLUDE"
unset -v "aSERVICE_NAME[$MENU_SERVICE_INDEX]"
# Service needs to be re-added from main menu
MENU_TARGETID=0 # Return to main menu
@@ -805,7 +805,7 @@ Please uncomment and edit only the lines that you need to change.\n\nTo undo cha
- rm $fp\n - systemctl daemon-reload\n - systemctl restart ${aSERVICE_NAME[$MENU_SERVICE_INDEX]}\n\nDo you want to continue?" || return 0
G_EXEC mkdir -p "$dp"
G_EXEC cp -a "${aFP_SERVICE[$MENU_SERVICE_INDEX]}" "$fp"
- G_EXEC sed -Ei 's/^([^[#])/#\1/' "$fp"
+ G_EXEC sed --follow-symlinks -Ei 's/^([^[#])/#\1/' "$fp"
fi
nano "$fp"
SYSTEMD_RELOAD_REQUIRED=1
diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software
index aec1c8659e..c637b711b1 100755
--- a/dietpi/dietpi-software
+++ b/dietpi/dietpi-software
@@ -149,7 +149,7 @@ Available commands:
else
encrypt=1
GLOBAL_PW=$(sed -n '/^[[:blank:]]*AUTO_SETUP_GLOBAL_PASSWORD=/{s/^[^=]*=//p;q}' /boot/dietpi.txt)
- grep -q '^[[:blank:]]*AUTO_SETUP_GLOBAL_PASSWORD=' /boot/dietpi.txt && G_EXEC sed -i '/^[[:blank:]]*AUTO_SETUP_GLOBAL_PASSWORD=/c\#AUTO_SETUP_GLOBAL_PASSWORD= # Password has been encrypted and saved to rootfs' /boot/dietpi.txt
+ grep -q '^[[:blank:]]*AUTO_SETUP_GLOBAL_PASSWORD=' /boot/dietpi.txt && G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*AUTO_SETUP_GLOBAL_PASSWORD=/c\#AUTO_SETUP_GLOBAL_PASSWORD= # Password has been encrypted and saved to rootfs' /boot/dietpi.txt
fi
# Fallback
@@ -2295,7 +2295,7 @@ done
if ! [ -f ~/.gtk-bookmarks ]
then
cp /var/lib/dietpi/dietpi-software/installed/desktop/.gtk-bookmarks ~/.gtk-bookmarks
- sed -i "s|/root|$HOME|g" ~/.gtk-bookmarks
+ sed --follow-symlinks -i "s|/root|$HOME|g" ~/.gtk-bookmarks
fi
# Disable this autostart entry
@@ -2449,7 +2449,7 @@ _EOF_
*'.xz'|*'.txz') command -v xz > /dev/null || aDEPS+=('xz-utils');;
*'.bz2'|*'.tbz2') command -v bzip2 > /dev/null || aDEPS+=('bzip2');;
*'.zip') command -v unzip > /dev/null || aDEPS+=('unzip');;
- *'.7z') command -v 7zr > /dev/null || aDEPS+=('p7zip');;
+ *'.7z') command -v 7zr > /dev/null || { (( $G_DISTRO > 7 )) && aDEPS+=('7zip') || aDEPS+=('p7zip'); };;
*) :;;
esac
@@ -2630,7 +2630,7 @@ _EOF_
{
if (( $G_HW_MODEL < 10 ))
then
- grep -Eq '(^|[[:blank:]])cgroup_enable=memory([[:blank:]]|$)' /boot/cmdline.txt || G_EXEC sed -i '/root=/s/[[:blank:]]*$/ cgroup_enable=memory/' /boot/cmdline.txt
+ grep -Eq '(^|[[:blank:]])cgroup_enable=memory([[:blank:]]|$)' /boot/cmdline.txt || G_EXEC sed --follow-symlinks -i '/root=/s/[[:blank:]]*$/ cgroup_enable=memory/' /boot/cmdline.txt
elif [[ -f '/boot/boot.scr' ]] && grep -q 'docker_optimizations' /boot/boot.scr
then
@@ -2899,7 +2899,7 @@ unix_socket_directories = '/run/postgresql'" > "$i/00dietpi.conf"
then
# Install persistent tmpfs
local var_log_size=$(sed -n '/^[[:blank:]]*AUTO_SETUP_RAMLOG_MAXSIZE=/{s/^[^=]*=//p;q}' /boot/dietpi.txt)
- sed -i '/[[:blank:]]\/var\/log[[:blank:]]/d' /etc/fstab
+ sed --follow-symlinks -i '/[[:blank:]]\/var\/log[[:blank:]]/d' /etc/fstab
echo "tmpfs /var/log tmpfs size=${var_log_size:-50}M,noatime,lazytime,nodev,nosuid" >> /etc/fstab
# Apply logging choice index
@@ -3147,9 +3147,9 @@ _EOF_
then
local chromium='chromium'
(( $G_HW_MODEL > 9 )) || chromium='chromium-browser'
- G_EXEC sed -i "s/firefox-esr/$chromium/" /etc/xdg/lxpanel/LXDE/panels/panel
+ G_EXEC sed --follow-symlinks -i "s/firefox-esr/$chromium/" /etc/xdg/lxpanel/LXDE/panels/panel
else
- G_EXEC sed -i 's/firefox-esr/mousepad/' /etc/xdg/lxpanel/LXDE/panels/panel
+ G_EXEC sed --follow-symlinks -i 's/firefox-esr/mousepad/' /etc/xdg/lxpanel/LXDE/panels/panel
fi
fi
@@ -3430,10 +3430,10 @@ _EOF_
dps_index=$software_id Download_Install 'conf' /etc/proftpd/proftpd.conf
# Do not allow root access via FTP
- G_EXEC sed -i 's/^[[:blank:]]*root/#root/' /etc/ftpusers
+ G_EXEC sed --follow-symlinks -i 's/^[[:blank:]]*root/#root/' /etc/ftpusers
# Bullseye: Fix ident lookup: https://github.com/MichaIng/DietPi/issues/4666
- (( $G_DISTRO < 6 )) || G_EXEC sed -i '/IdentLookups/c\\nIdentLookups off\n' /etc/proftpd/proftpd.conf
+ (( $G_DISTRO < 6 )) || G_EXEC sed --follow-symlinks -i '/IdentLookups/c\\nIdentLookups off\n' /etc/proftpd/proftpd.conf
fi
if To_Install 96 nmbd smbd # Samba Server
@@ -3470,7 +3470,7 @@ _EOF_
G_EXEC systemctl stop vsftpd
# Do not allow root access via FTP
- G_EXEC sed -i 's/^[[:blank:]]*root/#root/' /etc/ftpusers
+ G_EXEC sed --follow-symlinks -i 's/^[[:blank:]]*root/#root/' /etc/ftpusers
fi
if To_Install 109 nfs-kernel-server # NFS Server
@@ -3496,7 +3496,7 @@ _EOF_
_EOF_
# Otherwise assure that the webroot is changed, as all our install options depend on it.
else
- G_EXEC sed -i 's|/var/www/html|/var/www|g' /etc/apache2/sites-available/000-default.conf
+ G_EXEC sed --follow-symlinks -i 's|/var/www/html|/var/www|g' /etc/apache2/sites-available/000-default.conf
fi
local apackages=('apache2')
@@ -3581,10 +3581,10 @@ _EOF_
G_BACKUP_FP /etc/nginx/nginx.conf
dps_index=$software_id Download_Install 'nginx.conf' /etc/nginx/nginx.conf
# Adjust socket name to PHP version
- G_EXEC sed -i "s#/run/php/php.*-fpm.sock#/run/php/php$PHP_VERSION-fpm.sock#g" /etc/nginx/nginx.conf
+ G_EXEC sed --follow-symlinks -i "s#/run/php/php.*-fpm.sock#/run/php/php$PHP_VERSION-fpm.sock#g" /etc/nginx/nginx.conf
# CPU core count
- G_EXEC sed -i "/worker_processes/c\worker_processes $G_HW_CPU_CORES;" /etc/nginx/nginx.conf
+ G_EXEC sed --follow-symlinks -i "/worker_processes/c\worker_processes $G_HW_CPU_CORES;" /etc/nginx/nginx.conf
# Default site
dps_index=$software_id Download_Install 'nginx.default' /etc/nginx/sites-available/default
@@ -3608,15 +3608,15 @@ _EOF_
if grep -q 'create-mime\.assign\.pl' /etc/lighttpd/lighttpd.conf
then
G_DIETPI-NOTIFY 2 'Buster upgrade detected: Migrating from "create-mime.assign.pl" to "create-mime.conf.pl"'
- G_EXEC sed -i 's/create-mime\.assign\.pl/create-mime.conf.pl/' /etc/lighttpd/lighttpd.conf
+ G_EXEC sed --follow-symlinks -i 's/create-mime\.assign\.pl/create-mime.conf.pl/' /etc/lighttpd/lighttpd.conf
fi
# Bullseye: mod_compress has been superseded by mod_deflate
if (( $G_DISTRO > 5 )) && grep -q '^[[:blank:]]*"mod_compress",$' /etc/lighttpd/lighttpd.conf
then
G_DIETPI-NOTIFY 2 'Bullseye upgrade detected: Migrating from mod_compress to mod_deflate'
- G_EXEC sed -Ei '/^compress\..*=[[:blank:]]*["(].*[")]$/d' /etc/lighttpd/lighttpd.conf
- G_EXEC sed -i '/^[[:blank:]]*"mod_compress",$/d' /etc/lighttpd/lighttpd.conf
+ G_EXEC sed --follow-symlinks -Ei '/^compress\..*=[[:blank:]]*["(].*[")]$/d' /etc/lighttpd/lighttpd.conf
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*"mod_compress",$/d' /etc/lighttpd/lighttpd.conf
deflate=('lighttpd-mod-deflate')
fi
@@ -3625,14 +3625,14 @@ _EOF_
then
G_DIETPI-NOTIFY 2 'DietPi-LetsEncrypt usage detected: Installing OpenSSL module'
openssl=('lighttpd-mod-openssl')
- [[ -f '/etc/lighttpd/conf-available/50-dietpi-https.conf' ]] && ! grep -q '"mod_openssl"' /etc/lighttpd/conf-available/50-dietpi-https.conf && G_EXEC sed -i '1iserver.modules += ( "mod_openssl" )' /etc/lighttpd/conf-available/50-dietpi-https.conf
+ [[ -f '/etc/lighttpd/conf-available/50-dietpi-https.conf' ]] && ! grep -q '"mod_openssl"' /etc/lighttpd/conf-available/50-dietpi-https.conf && G_EXEC sed --follow-symlinks -i '1iserver.modules += ( "mod_openssl" )' /etc/lighttpd/conf-available/50-dietpi-https.conf
fi
# Bullseye: Remove obsolete socket version string from FPM module
if [[ $G_DISTRO -gt 5 && -f '/etc/lighttpd/conf-available/15-fastcgi-php-fpm.conf' ]] && grep -q 'php.\..-fpm\.sock' /etc/lighttpd/conf-available/15-fastcgi-php-fpm.conf
then
G_DIETPI-NOTIFY 2 'Bullseye upgrade detected: Removing obsolete socket version string from FPM module'
- G_EXEC sed -i 's/php.\..-fpm\.sock/php-fpm.sock/' /etc/lighttpd/conf-available/15-fastcgi-php-fpm.conf
+ G_EXEC sed --follow-symlinks -i 's/php.\..-fpm\.sock/php-fpm.sock/' /etc/lighttpd/conf-available/15-fastcgi-php-fpm.conf
fi
fi
@@ -3650,7 +3650,7 @@ _EOF_
if [[ -f '/var/www/html/index.lighttpd.html' ]]
then
G_EXEC mv /var/www/html/index.lighttpd.html /var/www/
- G_EXEC sed -i 's|/var/www/html|/var/www|' /etc/lighttpd/lighttpd.conf
+ G_EXEC sed --follow-symlinks -i 's|/var/www/html|/var/www|' /etc/lighttpd/lighttpd.conf
fi
[[ -d '/var/www/html' ]] && G_EXEC rmdir --ignore-fail-on-non-empty /var/www/html
@@ -4029,8 +4029,8 @@ _EOF_
G_CONFIG_INJECT 'bind_addresses:[[:blank:]]' " bind_addresses: ['::']" homeserver.yaml
# Log to journal with log level WARNING
- G_EXEC sed -i 's/ handlers: \[.*\]$/ handlers: [console]/' "$servername.log.config"
- G_EXEC sed -i 's/ level: .*/ level: WARNING/' "$servername.log.config"
+ G_EXEC sed --follow-symlinks -i 's/ handlers: \[.*\]$/ handlers: [console]/' "$servername.log.config"
+ G_EXEC sed --follow-symlinks -i 's/ level: .*/ level: WARNING/' "$servername.log.config"
# Permissions
G_EXEC chown -R synapse:synapse .
@@ -4075,14 +4075,14 @@ _EOF_
G_CONFIG_INJECT 'playlist_directory[[:blank:]]' 'playlist_directory "/mnt/dietpi_userdata/Music"' /etc/mpd.conf
G_CONFIG_INJECT 'db_file[[:blank:]]' 'db_file "/mnt/dietpi_userdata/.mpd_cache/db_file"' /etc/mpd.conf
# - Log to journal
- G_EXEC sed -Ei 's/^[[:blank:]]*log_file[[:blank:]]+/#log_file /' /etc/mpd.conf
+ G_EXEC sed --follow-symlinks -Ei 's/^[[:blank:]]*log_file[[:blank:]]+/#log_file /' /etc/mpd.conf
# - PID file is not required for systemd
- G_EXEC sed -Ei 's/^[[:blank:]]*pid_file[[:blank:]]+/#pid_file /' /etc/mpd.conf
+ G_EXEC sed --follow-symlinks -Ei 's/^[[:blank:]]*pid_file[[:blank:]]+/#pid_file /' /etc/mpd.conf
G_CONFIG_INJECT 'state_file[[:blank:]]' 'state_file "/mnt/dietpi_userdata/.mpd_cache/state"' /etc/mpd.conf
G_CONFIG_INJECT 'sticker_file[[:blank:]]' 'sticker_file "/mnt/dietpi_userdata/.mpd_cache/sticker.sql"' /etc/mpd.conf
# - Our service starts as "mpd" user already
- G_EXEC sed -Ei 's/^[[:blank:]]*user[[:blank:]]+/#user /' /etc/mpd.conf
- G_EXEC sed -Ei 's/^[[:blank:]]*group[[:blank:]]+/#group /' /etc/mpd.conf
+ G_EXEC sed --follow-symlinks -Ei 's/^[[:blank:]]*user[[:blank:]]+/#user /' /etc/mpd.conf
+ G_EXEC sed --follow-symlinks -Ei 's/^[[:blank:]]*group[[:blank:]]+/#group /' /etc/mpd.conf
# - Enable UNIX socket
G_CONFIG_INJECT 'bind_to_address[[:blank:]]+"/run/mpd/socket"' 'bind_to_address "/run/mpd/socket"' /etc/mpd.conf
# - Add simple ALSA output, if none present yet
@@ -4247,8 +4247,8 @@ _EOF_
then
G_EXEC_OUTPUT=1 G_EXEC git clone 'https://git.sr.ht/~tsileo/microblog.pub' "$micro_data_dir"
# Enable remote access on port 8007
- G_EXEC sed -i 's/uvicorn app/uvicorn --host 0.0.0.0 --port 8007 app/' "$micro_data_dir/misc/supervisord.conf"
- G_EXEC sed -i 's/8000/8007/' "$micro_data_dir/data/tests.toml"
+ G_EXEC sed --follow-symlinks -i 's/uvicorn app/uvicorn --host 0.0.0.0 --port 8007 app/' "$micro_data_dir/misc/supervisord.conf"
+ G_EXEC sed --follow-symlinks -i 's/8000/8007/' "$micro_data_dir/data/tests.toml"
fi
# Disable pip cache
@@ -4581,8 +4581,6 @@ The install script will now exit. After applying one of the the above, rerun die
# For MariaDB, temporary database admin user needs to be created, as 'root' uses unix_socket login, which cannot be accessed by sudo -u www-data.
# - Create random temporary alphanumeric 30 characters password
local oc_password=$(tr -dc '[:alnum:]' < /dev/random | head -c30)
- # - Failsafe: Use non-blocking entropy source, if /dev/random fails
- (( ${#oc_password} == 30 )) || oc_password=$(tr -dc '[:alnum:]' < /dev/urandom | head -c30)
G_EXEC mysql -e "grant all privileges on *.* to tmp_root@localhost identified by '$oc_password' with grant option;"
G_EXEC_DESC='ownCloud occ install'
@@ -4606,13 +4604,13 @@ The install script will now exit. After applying one of the the above, rerun die
# If "1 => '" does not exist, the config.php is not copied e.g. from older instance, so we add entries.
if ! grep -q "1 => '" "$config_php"; then
- sed -i "/0 => 'localhost'/a 1 => '$(G_GET_NET ip)'," "$config_php"
- sed -i "/1 => '/a 2 => '$HOSTNAME'," "$config_php"
+ sed --follow-symlinks -i "/0 => 'localhost'/a 1 => '$(G_GET_NET ip)'," "$config_php"
+ sed --follow-symlinks -i "/1 => '/a 2 => '$HOSTNAME'," "$config_php"
fi
# Set CLI URL to ownCloud sub directory:
- G_EXEC sed -i "s|'http://localhost'|'http://localhost/owncloud'|" "$config_php"
+ G_EXEC sed --follow-symlinks -i "s|'http://localhost'|'http://localhost/owncloud'|" "$config_php"
# Set pretty URLs (without /index.php/) on Apache:
if (( ${aSOFTWARE_INSTALL_STATE[83]} > 0 )); then
@@ -4689,9 +4687,9 @@ The install script will now exit. After applying one of the the above, rerun die
\nWe are patching the PHP version check, but this has two implications:
- You will see an integrity check error on Nextcloud admin panel.
- You will need to redo the patch after Nextcloud updates to future 25.x versions:
-# sed -i '\''s/>= 80200/>= 80300/'\'' /var/www/nextcloud/lib/versioncheck.php
+# sed --follow-symlinks -i '\''s/>= 80200/>= 80300/'\'' /var/www/nextcloud/lib/versioncheck.php
\nWe recommend to update to Nextcloud 26 as fast as possible to get official PHP 8.2 support.'
- G_EXEC sed -i 's/>= 80200/>= 80300/' /var/www/nextcloud/lib/versioncheck.php
+ G_EXEC sed --follow-symlinks -i 's/>= 80200/>= 80300/' /var/www/nextcloud/lib/versioncheck.php
fi
[[ ${aDEPS[0]} ]] && { G_DIETPI-NOTIFY 2 'Installing required PHP modules'; G_AGI "${aDEPS[@]}"; aDEPS=(); }
@@ -4848,8 +4846,6 @@ The install script will now exit. After applying one of the the above, rerun die
# For MariaDB, temporary database admin user needs to be created, as 'root' uses unix_socket login, which cannot be accessed by sudo -u www-data.
# - Create random temporary alphanumeric 30 characters password
local nc_password=$(tr -dc '[:alnum:]' < /dev/random | head -c30)
- # - Failsafe: Use non-blocking entropy source, if /dev/random fails
- (( ${#nc_password} == 30 )) || nc_password=$(tr -dc '[:alnum:]' < /dev/urandom | head -c30)
G_EXEC mysql -e "grant all privileges on *.* to tmp_root@localhost identified by '$nc_password' with grant option;"
G_EXEC_DESC='Nextcloud ncc install'
@@ -4883,10 +4879,10 @@ The install script will now exit. After applying one of the the above, rerun die
G_CONFIG_INJECT "'mysql.utf8mb4'" "'mysql.utf8mb4' => true," "$config_php" "'dbpassword'"
# Disable trusted_domains.
- grep -q "1 => '*'" "$config_php" || sed -i "/0 => 'localhost'/a 1 => '*'," "$config_php"
+ grep -q "1 => '*'" "$config_php" || sed --follow-symlinks -i "/0 => 'localhost'/a 1 => '*'," "$config_php"
# Set CLI URL to Nextcloud sub directory:
- G_EXEC sed -i "s|'http://localhost'|'http://localhost/nextcloud'|" "$config_php"
+ G_EXEC sed --follow-symlinks -i "s|'http://localhost'|'http://localhost/nextcloud'|" "$config_php"
# Set pretty URLs (without /index.php/) on Apache:
if (( ${aSOFTWARE_INSTALL_STATE[83]} > 0 )); then
@@ -4988,7 +4984,7 @@ The install script will now exit. After applying one of the the above, rerun die
GCI_PRESERVE=1 G_CONFIG_INJECT 'total-quota=' 'total-quota=100' /etc/turnserver.conf
GCI_PRESERVE=1 G_CONFIG_INJECT 'bps-capacity=' 'bps-capacity=0' /etc/turnserver.conf
G_CONFIG_INJECT 'stale-nonce' 'stale-nonce' /etc/turnserver.conf
- G_EXEC sed -i 's/^[[:blank:]]*allow-loopback-peers/#allow-loopback-peers/' /etc/turnserver.conf
+ G_EXEC sed --follow-symlinks -i 's/^[[:blank:]]*allow-loopback-peers/#allow-loopback-peers/' /etc/turnserver.conf
G_CONFIG_INJECT 'no-multicast-peers' 'no-multicast-peers' /etc/turnserver.conf
# Install Nextcloud Talk app
@@ -5116,7 +5112,7 @@ PrivateTmp=true
WantedBy=multi-user.target
_EOF_
# Sparky SBC: Workaround for failing service start: https://dietpi.com/forum/t/allogui-not-working-apache-service-doesnt-start/15708
- (( $G_HW_MODEL == 70 )) && G_EXEC sed -i '/^AmbientCapabilities=/d' /etc/systemd/system/roonbridge.service
+ (( $G_HW_MODEL == 70 )) && G_EXEC sed --follow-symlinks -i '/^AmbientCapabilities=/d' /etc/systemd/system/roonbridge.service
fi
if To_Install 119 # CAVA
@@ -5260,8 +5256,8 @@ _EOF_
else
[[ -f '/etc/apt/preferences.d/dietpi-kodi' ]] && G_EXEC rm /etc/apt/preferences.d/dietpi-kodi
- # 32-bit Buster: Apply missing dir workaround: https://github.com/RPi-Distro/repo/issues/153
- [[ $G_DISTRO == 5 && $(dpkg --print-architecture) == 'armhf' && ! -d '/etc/polkit-1/localauthority/50-local.d' ]] && G_EXEC mkdir -p /etc/polkit-1/localauthority/50-local.d
+ # 32-bit Buster and Bookworm: Apply missing dir workaround: https://github.com/RPi-Distro/repo/issues/153, https://github.com/MichaIng/DietPi/issues/6703
+ [[ $G_DISTRO == 5 && $(dpkg --print-architecture) == 'armhf' || $G_DISTRO == [78] ]] && G_EXEC mkdir -p /etc/polkit-1/localauthority/50-local.d
# Buster: fbset required to recover desktop with custom resolution and fix startup warning
# Bullseye: Enable hardware codecs
@@ -5499,7 +5495,7 @@ _EOF_
G_EXEC cp etc/raspimjpeg/raspimjpeg.1 /etc/raspimjpeg
G_EXEC ln -sf /etc/raspimjpeg /var/www/rpicam/raspimjpeg
# - Web base dir
- grep -q '/rpicam' /etc/raspimjpeg || G_EXEC sed -i 's|/var/www|/var/www/rpicam|g' /etc/raspimjpeg
+ grep -q '/rpicam' /etc/raspimjpeg || G_EXEC sed --follow-symlinks -i 's|/var/www|/var/www/rpicam|g' /etc/raspimjpeg
# - Service
dps_index=$software_id Download_Install 'raspimjpeg.sh' /var/lib/dietpi/dietpi-software/installed/raspimjpeg.sh
G_EXEC chmod +x /var/lib/dietpi/dietpi-software/installed/raspimjpeg.sh
@@ -5581,7 +5577,7 @@ _EOF_
local id=$(tr -dc '0-9a-f' < /dev/random | head -c32)
G_EXEC chmod 0600 /mnt/dietpi_userdata/deluge/.config/deluge/hostlist.conf
G_CONFIG_INJECT '"[0-9a-f]{32}"' " \"$id\"," /mnt/dietpi_userdata/deluge/.config/deluge/hostlist.conf
- sed -i "/\"[0-9a-f]\{40\}\"/c\ \"$localpass\"" /mnt/dietpi_userdata/deluge/.config/deluge/hostlist.conf
+ sed --follow-symlinks -i "/\"[0-9a-f]\{40\}\"/c\ \"$localpass\"" /mnt/dietpi_userdata/deluge/.config/deluge/hostlist.conf
G_CONFIG_INJECT '"default_daemon":' " \"default_daemon\": \"$id\"," /mnt/dietpi_userdata/deluge/.config/deluge/web.conf
unset -v localpass id
RESTART_DELUGE_WEB=1
@@ -5632,15 +5628,15 @@ _EOF_
# RISC-V workaround until arch has been added to repo: https://download.webmin.com/download/repository/dists/sarge/contrib/
if (( $G_HW_ARCH == 11 ))
then
- Download_Install "https://download.webmin.com/download/repository/pool/contrib/w/webmin/$(curl -sSf 'https://download.webmin.com/download/repository/pool/contrib/w/webmin/' | grep -o 'webmin_[^_]*_all.deb' | tail -1)"
+ Download_Install "https://download.webmin.com/download/newkey/repository/pool/contrib/w/webmin/$(curl -sSf 'https://download.webmin.com/download/newkey/repository/pool/contrib/w/webmin/' | grep -o 'webmin_[^_]*_all.deb' | tail -1)"
else
# APT key
- local url='https://webmin.com/jcameron-key.asc'
+ local url='https://webmin.com/developers-key.asc'
G_CHECK_URL "$url"
G_EXEC eval "curl -sSfL '$url' | gpg --dearmor -o /etc/apt/trusted.gpg.d/dietpi-webmin.gpg --yes"
# APT list
- G_EXEC eval "echo 'deb https://download.webmin.com/download/repository/ sarge contrib' > /etc/apt/sources.list.d/webmin.list"
+ G_EXEC eval 'echo '\''deb https://download.webmin.com/download/newkey/repository stable contrib'\'' > /etc/apt/sources.list.d/webmin.list'
G_AGUP
# APT package
@@ -5715,9 +5711,9 @@ _EOF_
G_EXEC systemctl stop darkice icecast2
# IceCast: Set passwords if not yet done (default found)
- sed -i "/hackme/c\ $GLOBAL_PW" /etc/icecast2/icecast.xml
- sed -i "/hackme/c\ $GLOBAL_PW" /etc/icecast2/icecast.xml
- sed -i "/hackme/c\ $GLOBAL_PW" /etc/icecast2/icecast.xml
+ sed --follow-symlinks -i "/hackme/c\ $GLOBAL_PW" /etc/icecast2/icecast.xml
+ sed --follow-symlinks -i "/hackme/c\ $GLOBAL_PW" /etc/icecast2/icecast.xml
+ sed --follow-symlinks -i "/hackme/c\ $GLOBAL_PW" /etc/icecast2/icecast.xml
# - Remove default service config
[[ -f '/etc/default/icecast2' ]] && G_EXEC rm /etc/default/icecast2
@@ -5960,7 +5956,7 @@ ExitPolicy reject *:*
_EOF_
[[ $ipv6 ]] && echo 'IPv6Exit 1' >> /etc/tor/torrc
# Apply Unbound as local DNS resolver for privacy reasons
- command -v resolvconf > /dev/null && G_EXEC sed -i 's/dns-nameservers.*$/dns-nameservers 127.0.0.1/' /etc/network/interfaces
+ command -v resolvconf > /dev/null && G_EXEC sed --follow-symlinks -i 's/dns-nameservers.*$/dns-nameservers 127.0.0.1/' /etc/network/interfaces
G_EXEC eval "echo 'nameserver 127.0.0.1' > /etc/resolv.conf" # Unbound is running and configured in the very next config step, so it is safe to switch the DNS nameserver right now.
fi
@@ -6018,14 +6014,14 @@ _EOF_
G_DIETPI-NOTIFY 2 'Configuring Pi-hole to use Unbound'
if [[ -f '/etc/dnsmasq.d/01-pihole.conf' ]]
then
- G_EXEC sed -i '/^[[:blank:]]*server=/d' /etc/dnsmasq.d/01-pihole.conf
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*server=/d' /etc/dnsmasq.d/01-pihole.conf
G_CONFIG_INJECT 'server=' 'server=127.0.0.1#5335' /etc/dnsmasq.d/01-pihole.conf
systemctl -q is-active pihole-FTL && G_EXEC systemctl restart pihole-FTL
fi
if [[ -f '/etc/pihole/setupVars.conf' ]]
then
G_CONFIG_INJECT 'PIHOLE_DNS_1=' 'PIHOLE_DNS_1=127.0.0.1#5335' /etc/pihole/setupVars.conf
- G_EXEC sed -i '/^[[:blank:]]*PIHOLE_DNS_2=/d' /etc/pihole/setupVars.conf
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*PIHOLE_DNS_2=/d' /etc/pihole/setupVars.conf
fi
fi
@@ -6078,8 +6074,8 @@ _EOF_
# - Skip supported OS check. We do not support Debian testing but we are testing it already now.
# - Workaround "dialog" issues with "xterm" by faking "linux" terminal
# - Skip web server install, since we allow to choose and install it prior to Pi-hole
- G_EXEC sed -Ei '/^[[:blank:]]*set(AdminFla|Loggin)g$/d' install.sh
- G_EXEC sed -i 's/QUERY_LOGGING=true/QUERY_LOGGING=false/' install.sh
+ G_EXEC sed --follow-symlinks -Ei '/^[[:blank:]]*set(AdminFla|Loggin)g$/d' install.sh
+ G_EXEC sed --follow-symlinks -i 's/QUERY_LOGGING=true/QUERY_LOGGING=false/' install.sh
export PIHOLE_SKIP_OS_CHECK=true
local retry TERM_old=
[[ $TERM == 'xterm' ]] && { TERM_old=$TERM; export TERM=linux; }
@@ -6106,11 +6102,11 @@ _EOF_
if (( ${aSOFTWARE_INSTALL_STATE[182]} > 0 ))
then
G_DIETPI-NOTIFY 2 'Configuring Pi-hole to use Unbound'
- G_EXEC sed -i '/^[[:blank:]]*server=/d' /etc/dnsmasq.d/01-pihole.conf
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*server=/d' /etc/dnsmasq.d/01-pihole.conf
G_CONFIG_INJECT 'server=' 'server=127.0.0.1#5335' /etc/dnsmasq.d/01-pihole.conf
systemctl -q is-active pihole-FTL && G_EXEC systemctl restart pihole-FTL
G_CONFIG_INJECT 'PIHOLE_DNS_1=' 'PIHOLE_DNS_1=127.0.0.1#5335' /etc/pihole/setupVars.conf
- G_EXEC sed -i '/^[[:blank:]]*PIHOLE_DNS_2=/d' /etc/pihole/setupVars.conf
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*PIHOLE_DNS_2=/d' /etc/pihole/setupVars.conf
fi
# Enable required PHP modules: https://github.com/pi-hole/pi-hole/blob/development/automated%20install/basic-install.sh#L250
@@ -6348,7 +6344,7 @@ _EOF_
*) local arch='amd64';;
esac
- local fallback_url="https://github.com/navidrome/navidrome/releases/download/v0.50.0/navidrome_0.50.0_linux_$arch.tar.gz"
+ local fallback_url="https://github.com/navidrome/navidrome/releases/download/v0.50.2/navidrome_0.50.2_linux_$arch.tar.gz"
Download_Install "$(curl -sSfL 'https://api.github.com/repos/navidrome/navidrome/releases/latest' | mawk -F\" "/^ *\"browser_download_url\": \".*\/navidrome_[0-9.]*_linux_$arch\.tar\.gz\"$/{print \$4}")" /opt/navidrome
# Data dir
@@ -6444,7 +6440,7 @@ _EOF_
*) local arch='x64';;
esac
- local fallback_url="https://github.com/Kareadita/Kavita/releases/download/v0.7.10.2/kavita-linux-$arch.tar.gz"
+ local fallback_url="https://github.com/Kareadita/Kavita/releases/download/v0.7.11.2/kavita-linux-$arch.tar.gz"
Download_Install "$(curl -sSfL 'https://api.github.com/repos/Kareadita/Kavita/releases/latest' | mawk -F\" "/^ *\"browser_download_url\": \".*\/kavita-linux-$arch\.tar\.gz\"$/{print \$4}")"
G_EXEC chmod +x Kavita/Kavita
@@ -6652,7 +6648,7 @@ _EOF_
esac
# Download
- local fallback_url="https://github.com/fatedier/frp/releases/download/v0.52.3/frp_0.52.3_linux_$arch.tar.gz"
+ local fallback_url="https://github.com/fatedier/frp/releases/download/v0.53.0/frp_0.53.0_linux_$arch.tar.gz"
Download_Install "$(curl -sSfL 'https://api.github.com/repos/fatedier/frp/releases/latest' | mawk -F\" "/\"browser_download_url\": .*\/frp_[0-9.]*_linux_$arch\.tar\.gz\"/{print \$4}")"
G_EXEC cd frp_*
@@ -6860,10 +6856,10 @@ _EOF_
# Config: /etc/mosquitto/conf.d exists, but doubled settings do not override each other and lead to a startup failure instead, which breaks the purpose we want to use it for.
# - Disable PID file, not required for systemd handling
- G_EXEC sed -i '/^[[:blank:]]*pid_file[[:blank:]]/d' /etc/mosquitto/mosquitto.conf
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*pid_file[[:blank:]]/d' /etc/mosquitto/mosquitto.conf
[[ -d '/run/mosquitto' ]] && G_EXEC rm -R /run/mosquitto
# - Log to default STDERR > systemd-journald
- G_EXEC sed -i '/^[[:blank:]]*log_dest[[:blank:]]/d' /etc/mosquitto/mosquitto.conf
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*log_dest[[:blank:]]/d' /etc/mosquitto/mosquitto.conf
[[ -d '/var/log/mosquitto' ]] && G_EXEC rm -R /var/log/mosquitto
# - Add default password file for authenticated requests: https://github.com/MichaIng/DietPi/issues/4133
GCI_PRESERVE=1 G_CONFIG_INJECT 'password_file[[:blank:]]' 'password_file /etc/mosquitto/passwd' /etc/mosquitto/mosquitto.conf
@@ -6926,7 +6922,7 @@ _EOF_
if [[ ! -f '/mnt/dietpi_userdata/blynk/client-tcp-local.js' ]]
then
G_EXEC curl -sSfL 'https://raw.githubusercontent.com/vshymanskyy/blynk-library-js/master/examples/nodejs/client-tcp-local.js' -o /mnt/dietpi_userdata/blynk/client-tcp-local.js
- G_EXEC sed -i "s|require('blynk-library')|require('/usr/local/lib/node_modules/blynk-library')|" /mnt/dietpi_userdata/blynk/client-tcp-local.js
+ G_EXEC sed --follow-symlinks -i "s|require('blynk-library')|require('/usr/local/lib/node_modules/blynk-library')|" /mnt/dietpi_userdata/blynk/client-tcp-local.js
G_EXEC chmod +x /mnt/dietpi_userdata/blynk/client-tcp-local.js
fi
@@ -7000,10 +6996,10 @@ _EOF_
G_EXEC_OUTPUT=1 G_EXEC patch -p1 -i webiopi-pi2bplus.patch
# Install for Python 3 only
- G_EXEC sed -i '/SEARCH="python python3"/c\SEARCH="python3"' setup.sh
+ G_EXEC sed --follow-symlinks -i '/SEARCH="python python3"/c\SEARCH="python3"' setup.sh
# Skip Weaved install prompt
- G_EXEC sed -i '/read response/c\response="n"' setup.sh
+ G_EXEC sed --follow-symlinks -i '/read response/c\response="n"' setup.sh
# Run setup script, skipping APT installs
G_EXEC_OUTPUT=1 G_EXEC ./setup.sh skip-apt
@@ -7014,7 +7010,7 @@ _EOF_
G_EXEC rm -R WebIOPi-master
# On fresh installs, change port to 8002 to avoid conflict with IceCast
- (( $reinstall )) || G_EXEC sed -i 's/^port = 8000$/port = 8002/' /etc/webiopi/config
+ (( $reinstall )) || G_EXEC sed --follow-symlinks -i 's/^port = 8000$/port = 8002/' /etc/webiopi/config
# Service
Remove_SysV webiopi 1
@@ -7573,7 +7569,7 @@ _EOF_
then
Download_Install 'https://github.com/gotson/komga/releases/download/v0.165.0/komga-0.165.0.jar' /mnt/dietpi_userdata/komga/komga.jar
else
- local fallback_url='https://github.com/gotson/komga/releases/download/1.7.2/komga-1.7.2.jar'
+ local fallback_url='https://github.com/gotson/komga/releases/download/1.8.4/komga-1.8.4.jar'
Download_Install "$(curl -sSfL 'https://api.github.com/repos/gotson/komga/releases/latest' | mawk -F\" '/^ *"browser_download_url": ".*\/komga-[^"\/]*\.jar"$/{print $4}')" /mnt/dietpi_userdata/komga/komga.jar
fi
@@ -7668,7 +7664,7 @@ _EOF_
local json=()
[[ $PHP_VERSION == 8* ]] || aDEPS+=("php$PHP_VERSION-json") json=('json')
- # Bullseye+
+ # Bullseye and above
if (( $G_DISTRO > 5 ))
then
local fallback_url="https://github.com/ampache/ampache/releases/download/6.1.0/ampache-6.1.0_all_php$PHP_VERSION.zip"
@@ -7676,7 +7672,7 @@ _EOF_
# Ampache is installed to /mnt/dietpi_userdata/ampache and the "public" directory linked to /var/www/ampache: https://github.com/MichaIng/DietPi/pull/5205
local fp_install='/mnt/dietpi_userdata' fp_public='ampache/public'
- # Ampache v5 requires PHP7.4, hence pull latest Ampache v4 on Buster: https://github.com/ampache/ampache/wiki/Ampache-Next-Changes
+ # Buster: Ampache v5 requires PHP7.4, hence pull latest Ampache v4: https://github.com/ampache/ampache/wiki/Ampache-Next-Changes
else
Download_Install 'https://github.com/ampache/ampache/releases/download/4.4.3/ampache-4.4.3_all.zip' ampache
# Ampache is installed to /var/www/ampache.
@@ -7702,30 +7698,20 @@ _EOF_
# Enable required PHP modules: https://github.com/ampache/ampache/wiki/Installation#prerequisites
G_EXEC phpenmod curl intl xml "${json[@]}"
- # Import our pre-made Ampache database, if not existent already
- if [[ ! -d '/mnt/dietpi_userdata/mysql/ampache' ]]
- then
- /boot/dietpi/func/create_mysql_db ampache ampache "$GLOBAL_PW"
- Download_Install 'https://dietpi.com/downloads/mysql_databases/ampache_mysql_3.8.2-v6.0.zip'
- G_EXEC mysql ampache < ampache.sql
- G_EXEC rm ampache.sql
- # Also update password here for rare but possible case that database was lost but config file still exists
- [[ -f $fp_install/ampache/config/ampache.cfg.php ]] && G_CONFIG_INJECT 'database_password[[:blank:]]+=' "database_password = \"$GLOBAL_PW\"" "$fp_install/ampache/config/ampache.cfg.php"
- fi
+ # Create random temporary alphanumeric 30 characters database password
+ local password=$(tr -dc '[:alnum:]' < /dev/random | head -c30)
- # Create new config, if not existent already
+ # Fresh install: Create new config
if [[ ! -f $fp_install/ampache/config/ampache.cfg.php ]]
then
- G_EXEC mv "$fp_install/ampache/config/ampache.cfg.php"{.dist,}
+ G_EXEC cp "$fp_install/ampache/config/ampache.cfg.php"{.dist,}
G_CONFIG_INJECT 'web_path[[:blank:]]+=' 'web_path = "/ampache"' "$fp_install/ampache/config/ampache.cfg.php"
G_CONFIG_INJECT 'database_hostname[[:blank:]]+=' 'database_hostname = /run/mysqld/mysqld.sock' "$fp_install/ampache/config/ampache.cfg.php"
G_CONFIG_INJECT 'database_name[[:blank:]]+=' 'database_name = ampache' "$fp_install/ampache/config/ampache.cfg.php"
G_CONFIG_INJECT 'database_username[[:blank:]]+=' 'database_username = ampache' "$fp_install/ampache/config/ampache.cfg.php"
- G_CONFIG_INJECT 'database_password[[:blank:]]+=' "database_password = \"$GLOBAL_PW\"" "$fp_install/ampache/config/ampache.cfg.php"
- G_CONFIG_INJECT 'waveform[[:blank:]]+=' 'waveform = "true"' "$fp_install/ampache/config/ampache.cfg.php"
+ GCI_PASSWORD=1 G_CONFIG_INJECT 'database_password[[:blank:]]+=' "database_password = \"$password\"" "$fp_install/ampache/config/ampache.cfg.php"
G_CONFIG_INJECT 'tmp_dir_path[[:blank:]]+=' 'tmp_dir_path = "/tmp"' "$fp_install/ampache/config/ampache.cfg.php"
- G_CONFIG_INJECT 'generate_video_preview[[:blank:]]+=' 'generate_video_preview = "true"' "$fp_install/ampache/config/ampache.cfg.php"
- G_CONFIG_INJECT 'channel[[:blank:]]+=' 'channel = "true"' "$fp_install/ampache/config/ampache.cfg.php"
+ G_CONFIG_INJECT 'transcode_cmd[[:blank:]]+=' 'transcode_cmd = "ffmpeg"' "$fp_install/ampache/config/ampache.cfg.php"
G_CONFIG_INJECT 'transcode_m4a[[:blank:]]+=' 'transcode_m4a = "required"' "$fp_install/ampache/config/ampache.cfg.php"
G_CONFIG_INJECT 'transcode_flac[[:blank:]]+=' 'transcode_flac = "required"' "$fp_install/ampache/config/ampache.cfg.php"
G_CONFIG_INJECT 'transcode_mpc[[:blank:]]+=' 'transcode_mpc = "required"' "$fp_install/ampache/config/ampache.cfg.php"
@@ -7736,11 +7722,55 @@ _EOF_
G_CONFIG_INJECT 'transcode_mpg[[:blank:]]+=' 'transcode_mpg = "allowed"' "$fp_install/ampache/config/ampache.cfg.php"
G_CONFIG_INJECT 'encode_target[[:blank:]]+=' 'encode_target = mp3' "$fp_install/ampache/config/ampache.cfg.php"
G_CONFIG_INJECT 'encode_video_target[[:blank:]]+=' 'encode_video_target = webm' "$fp_install/ampache/config/ampache.cfg.php"
- G_CONFIG_INJECT 'transcode_cmd[[:blank:]]+=' 'transcode_cmd = "ffmpeg"' "$fp_install/ampache/config/ampache.cfg.php"
+ G_CONFIG_INJECT 'generate_video_preview[[:blank:]]+=' 'generate_video_preview = "true"' "$fp_install/ampache/config/ampache.cfg.php"
+ G_CONFIG_INJECT 'waveform[[:blank:]]+=' 'waveform = "true"' "$fp_install/ampache/config/ampache.cfg.php"
+
+ # Update password as well in rare but possible case that config file still exists but database was lost
+ elif [[ ! -d '/mnt/dietpi_userdata/mysql/ampache' ]]
+ then
+ GCI_PASSWORD=1 G_CONFIG_INJECT 'database_password[[:blank:]]+=' "database_password = \"$password\"" "$fp_install/ampache/config/ampache.cfg.php"
fi
- # Permissions: Ampache can automatically migrate old configs to the new config file
- G_EXEC chown www-data "$fp_install/ampache/config/ampache.cfg.php"
+ # Permissions: Permit config file updates via web UI
+ G_EXEC chown www-data "$fp_install/ampache/config/ampache.cfg.php"{.dist,}
+
+ # Fresh install: Generate database
+ G_EXEC systemctl start mariadb
+ if [[ ! -d '/mnt/dietpi_userdata/mysql/ampache' ]]
+ then
+ /boot/dietpi/func/create_mysql_db ampache ampache "$password"
+ if (( $G_DISTRO > 5 ))
+ then
+ # Import template
+ G_EXEC mysql ampache < /mnt/dietpi_userdata/ampache/resources/sql/ampache.sql
+ # Generate admin user: Replace password string internally to avoid printing it to console
+ G_EXEC_PRE_FUNC(){ acommand[6]=$GLOBAL_PW; }
+ G_EXEC php /mnt/dietpi_userdata/ampache/bin/cli admin:addUser -l 100 -p "${GLOBAL_PW//?/X}" dietpi
+ # Generate local music catalogue
+ G_EXEC_OUTPUT=1 G_EXEC php /mnt/dietpi_userdata/ampache/bin/cli run:addCatalog Music /mnt/dietpi_userdata/Music music
+ # Scan for music files
+ G_EXEC_OUTPUT=1 G_EXEC php /mnt/dietpi_userdata/ampache/bin/cli run:updateCatalog
+ else
+ # Import template
+ G_EXEC mysql ampache < /var/www/ampache/sql/ampache.sql
+ # Generate admin user: Replace password string internally to avoid printing it to console
+ G_EXEC_PRE_FUNC(){ acommand[7]=$GLOBAL_PW; }
+ G_EXEC php /var/www/ampache/bin/install/add_user.inc -u dietpi -l 100 -p "${GLOBAL_PW//?/X}"
+ # Generate local music catalogue
+ # shellcheck disable=SC2016
+ G_EXEC_OUTPUT=1 G_EXEC mysql -e 'use ampache; insert into `catalog` values (1,'\''Music'\'','\''local'\'',0,null,0,1,'\''%T - %t'\'','\''%a/%A'\'','\''music'\''); insert into `catalog_local` values (1,'\''/mnt/dietpi_userdata/Music'\'',1)'
+ # Scan for music files
+ G_EXEC_OUTPUT=1 G_EXEC php /var/www/ampache/bin/catalog_update.inc
+ fi
+
+ # Reinstall: Update database
+ elif (( $G_DISTRO > 5 ))
+ then
+ G_EXEC_OUTPUT=1 G_EXEC php /mnt/dietpi_userdata/ampache/bin/cli admin:updateDatabase
+ else
+ G_EXEC_OUTPUT=1 G_EXEC php /var/www/ampache/bin/install/update_db.inc
+ fi
+ unset -v password
fi
if To_Install 58 tailscaled # Tailscale
@@ -7893,12 +7923,12 @@ _EOF_
G_EXEC curl -sSfL 'https://raw.githubusercontent.com/pivpn/pivpn/master/auto_install/install.sh' -o install.bash
G_EXEC chmod +x install.bash
G_DIETPI-NOTIFY 2 'Preventing reboot from within PiVPN installer'
- G_EXEC sed -i '/^Thank you for using PiVPN./a\exit 0' install.bash
+ G_EXEC sed --follow-symlinks -i '/^Thank you for using PiVPN./a\exit 0' install.bash
G_DIETPI-NOTIFY 2 'Preventing install of unattended-upgrades'
- G_EXEC sed -i '/^[[:blank:]]*askUnattendedUpgrades$/c\UNATTUPG=0' install.bash
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*askUnattendedUpgrades$/c\UNATTUPG=0' install.bash
G_DIETPI-NOTIFY 2 'Prevent dhcpcd from being installed'
- G_EXEC sed -i '/^checkStaticIpSupported() {$/,/^}$/d' install.bash
- G_EXEC sed -i '/^####### FUNCTIONS ##########$/a\checkStaticIpSupported(){ return 1; }' install.bash
+ G_EXEC sed --follow-symlinks -i '/^checkStaticIpSupported() {$/,/^}$/d' install.bash
+ G_EXEC sed --follow-symlinks -i '/^####### FUNCTIONS ##########$/a\checkStaticIpSupported(){ return 1; }' install.bash
# Unattended install
local options=()
@@ -7988,7 +8018,7 @@ _EOF_
echo "INTERFACESv4=\"$wifi_iface\"" > /etc/default/isc-dhcp-server
# Remove all entries below wlan, so we can recreate them
- G_EXEC sed -Ei '/(allow-hotplug|auto)[[:blank:]]+wlan/q0' /etc/network/interfaces
+ G_EXEC sed --follow-symlinks -Ei '/(allow-hotplug|auto)[[:blank:]]+wlan/q0' /etc/network/interfaces
# Enable up wlan
G_CONFIG_INJECT 'allow-hotplug wlan' "allow-hotplug $wifi_iface" /etc/network/interfaces
@@ -8009,7 +8039,7 @@ up ip6tables-restore < /etc/iptables.ipv6.nat
_EOF_
# Remove wireless-power setting if not supported by adapter/firmware
# shellcheck disable=SC2015
- iw dev "$wifi_iface" set power_save on 2> /dev/null && iw dev "$wifi_iface" set power_save off 2> /dev/null || G_EXEC sed -i '/ iw dev .* set power_save /d' /etc/network/interfaces
+ iw dev "$wifi_iface" set power_save on 2> /dev/null && iw dev "$wifi_iface" set power_save off 2> /dev/null || G_EXEC sed --follow-symlinks -i '/ iw dev .* set power_save /d' /etc/network/interfaces
# Access point config
# - Parse dietpi.txt
@@ -8163,7 +8193,7 @@ _EOF_
G_CONFIG_INJECT 'SOFTWARE_SHAIRPORT_SYNC_AIRPLAY=' 'SOFTWARE_SHAIRPORT_SYNC_AIRPLAY=2' /boot/dietpi.txt
airplay2='-airplay2'
else
- G_EXEC sed -i '/^[[:blank:]]*SOFTWARE_SHAIRPORT_SYNC_AIRPLAY=/c\#SOFTWARE_SHAIRPORT_SYNC_AIRPLAY=2' /boot/dietpi.txt
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*SOFTWARE_SHAIRPORT_SYNC_AIRPLAY=/c\#SOFTWARE_SHAIRPORT_SYNC_AIRPLAY=2' /boot/dietpi.txt
airplay2=
fi
@@ -8308,7 +8338,7 @@ web.statistics.1.content.9.ds_graph_options.usbhdd_used.label=USB HDD used space
web.statistics.1.content.9.ds_graph_options.usbhdd_used.lines={ fill: true }
web.statistics.1.content.9.ds_graph_options.usbhdd_used.color="#7777FF"
_EOF_
- G_EXEC sed -i '\|include=/etc/rpimonitor/template/sdcard.conf|a\include=/etc/rpimonitor/template/usb_hdd.conf' /etc/rpimonitor/data.conf
+ G_EXEC sed --follow-symlinks -i '\|include=/etc/rpimonitor/template/sdcard.conf|a\include=/etc/rpimonitor/template/usb_hdd.conf' /etc/rpimonitor/data.conf
fi
fi
@@ -8386,13 +8416,13 @@ location = /.well-known/caldav { return 301 /baikal/html/dav.php; }' > /etc/ngi
# Cap total connections
local max_users=$(( $G_HW_CPU_CORES * 8 ))
- G_EXEC sed -i "/users=/c\users=$max_users" /etc/mumble-server.ini
+ G_EXEC sed --follow-symlinks -i "/users=/c\users=$max_users" /etc/mumble-server.ini
# Name the root channel
- G_EXEC sed -i '/registerName=/c\registerName=DietPi Mumble Server' /etc/mumble-server.ini
+ G_EXEC sed --follow-symlinks -i '/registerName=/c\registerName=DietPi Mumble Server' /etc/mumble-server.ini
# Disable DB logging
- G_EXEC sed -i '/logdays=/c\logdays=-1' /etc/mumble-server.ini
+ G_EXEC sed --follow-symlinks -i '/logdays=/c\logdays=-1' /etc/mumble-server.ini
# Set Superuser passwd: https://dietpi.com/forum/t/mumble-murmur-server-superuser-error/1371
murmurd -ini /etc/mumble-server.ini -supw "$GLOBAL_PW"
@@ -8699,7 +8729,7 @@ _EOF_
fi
# Since v4.2.0, PBKDF2 needs to be used: https://github.com/MichaIng/DietPi/issues/4711
- (( $G_DISTRO < 6 )) || G_EXEC sed -i '/^WebUI\\Password_ha1/c\WebUI\\Password_PBKDF2="@ByteArray(tpgNK76AcpP14rjOZP9vwg==:rQNtOB0P4HfNj20pJtxiTBi9miduS6L1Xqqazc4Y6Gpm3Rn02jMXnPPT3KH2JMDKhFQjAaTGVJz0dz5JVw2QUQ==)"' /home/qbittorrent/.config/qBittorrent/qBittorrent.conf
+ (( $G_DISTRO < 6 )) || G_EXEC sed --follow-symlinks -i '/^WebUI\\Password_ha1/c\WebUI\\Password_PBKDF2="@ByteArray(tpgNK76AcpP14rjOZP9vwg==:rQNtOB0P4HfNj20pJtxiTBi9miduS6L1Xqqazc4Y6Gpm3Rn02jMXnPPT3KH2JMDKhFQjAaTGVJz0dz5JVw2QUQ==)"' /home/qbittorrent/.config/qBittorrent/qBittorrent.conf
# Service
cat << _EOF_ > /etc/systemd/system/qbittorrent.service
@@ -8805,7 +8835,7 @@ _EOF_
[[ -f '/etc/.rutorrent-htaccess' ]] || echo "root:rtorrent:$(echo -n "root:rtorrent:$GLOBAL_PW" | md5sum | mawk '{print $1}')" > /etc/.rutorrent-htaccess
# Pre-v7.2: Remove obsolete entries from /etc/lighttpd/lighttpd.conf
- grep -q '^#RUTORRENT_DIETPI' /etc/lighttpd/lighttpd.conf && G_EXEC sed -i '/#RUTORRENT_DIETPI/,/#RUTORRENT_DIETPI/d' /etc/lighttpd/lighttpd.conf
+ grep -q '^#RUTORRENT_DIETPI' /etc/lighttpd/lighttpd.conf && G_EXEC sed --follow-symlinks -i '/#RUTORRENT_DIETPI/,/#RUTORRENT_DIETPI/d' /etc/lighttpd/lighttpd.conf
cat << '_EOF_' > /etc/lighttpd/conf-available/98-dietpi-rtorrent.conf
server.modules += ( "mod_auth", "mod_authn_file", "mod_scgi" )
@@ -8903,7 +8933,7 @@ _EOF_
# In case dist-upgraded systems, assure that daemon mode is enabled
G_CONFIG_INJECT 'system.daemon.set[[:blank:]=]' 'system.daemon.set = true' /mnt/dietpi_userdata/rtorrent/.rtorrent.rc
# Reinstall: Assure that rpi.socket is used, else ruTorrent connection would fail
- G_EXEC sed -i '/^[[:blank:]]*network.scgi.open_port[[:blank:]=]/d' /mnt/dietpi_userdata/rtorrent/.rtorrent.rc
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*network.scgi.open_port[[:blank:]=]/d' /mnt/dietpi_userdata/rtorrent/.rtorrent.rc
G_CONFIG_INJECT 'network.scgi.open_local[[:blank:]=]' 'network.scgi.open_local = /mnt/dietpi_userdata/downloads/.session/rpc.socket' /mnt/dietpi_userdata/rtorrent/.rtorrent.rc
G_CONFIG_INJECT 'execute.nothrow[[:blank:]]*=[[:blank:]]*chmod,666,/mnt/dietpi_userdata/downloads/.session/rpc.socket' 'execute.nothrow = chmod,666,/mnt/dietpi_userdata/downloads/.session/rpc.socket' /mnt/dietpi_userdata/rtorrent/.rtorrent.rc 'network.scgi.open_local[[:blank:]=]'
else
@@ -9095,7 +9125,7 @@ _EOF_
G_CONFIG_INJECT 'StartLimitIntervalSec=' 'StartLimitIntervalSec=600' /etc/systemd/system/medusa.service '\[Unit\]'
G_CONFIG_INJECT 'StartLimitBurst=' 'StartLimitBurst=3' /etc/systemd/system/medusa.service 'StartLimitIntervalSec='
# - Remove "Group=medusa" which does not exist, instead fallback to primary group "dietpi"
- G_EXEC sed -i '/^[[:blank:]]*Group=/d' /etc/systemd/system/medusa.service
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*Group=/d' /etc/systemd/system/medusa.service
# - Launch from our install and data directory
G_CONFIG_INJECT 'ExecStart=' 'ExecStart=/usr/bin/python3 /mnt/dietpi_userdata/medusa/start.py -q --nolaunch --datadir=/mnt/dietpi_userdata/medusa' /etc/systemd/system/medusa.service
@@ -9120,7 +9150,7 @@ _EOF_
*) local arch='arm';;
esac
- local fallback_url="https://github.com/syncthing/syncthing/releases/download/v1.26.1/syncthing-linux-$arch-v1.26.1.tar.gz"
+ local fallback_url="https://github.com/syncthing/syncthing/releases/download/v1.27.1/syncthing-linux-$arch-v1.27.1.tar.gz"
Download_Install "$(curl -sSfL 'https://api.github.com/repos/syncthing/syncthing/releases/latest' | mawk -F\" "/\"browser_download_url\": .*\/syncthing-linux-$arch-[^\"\/]*\.tar\.gz\"/{print \$4}")"
G_EXEC mv syncthing-* /opt/syncthing
fi
@@ -9138,13 +9168,13 @@ _EOF_
G_EXEC_OUTPUT=1 G_EXEC sudo -u dietpi /opt/syncthing/syncthing -generate=/mnt/dietpi_userdata/syncthing
# Allow remote access: https://docs.syncthing.net/users/faq.html#how-do-i-access-the-web-gui-from-another-computer
- G_EXEC sed -i '\|:8384|c\ 0.0.0.0:8384' /mnt/dietpi_userdata/syncthing/config.xml
+ G_EXEC sed --follow-symlinks -i '\|:8384|c\ 0.0.0.0:8384' /mnt/dietpi_userdata/syncthing/config.xml
# Set default data directory
G_EXEC mkdir -p /mnt/dietpi_userdata/syncthing_data
G_EXEC chown -R dietpi:dietpi /mnt/dietpi_userdata/syncthing_data
- G_EXEC sed -i '\|[0-9]+<\/Port>/{s/^.*([0-9]+)<\/Port>.*$/\1/p;q}' /mnt/dietpi_userdata/sonarr/config.xml)
local apikey=$(sed -nE '/.+<\/ApiKey>/{s/^.*(.+)<\/ApiKey>.*$/\1/p;q}' /mnt/dietpi_userdata/sonarr/config.xml)
- G_EXEC sed -i '/\[sonarr\]/,/^$/s/^ip = .*$/ip = 127.0.0.1/' /mnt/dietpi_userdata/bazarr/config/config.ini
- G_EXEC sed -i "/\[sonarr\]/,/^$/s/^port = .*$/port = $port/" /mnt/dietpi_userdata/bazarr/config/config.ini
- G_EXEC sed -i '/\[sonarr\]/,/^$/s/^base_url = .*$/base_url = \//' /mnt/dietpi_userdata/bazarr/config/config.ini
- G_EXEC sed -i "/\[sonarr\]/,/^$/s/^apikey = .*$/apikey = $apikey/" /mnt/dietpi_userdata/bazarr/config/config.ini
+ G_EXEC sed --follow-symlinks -i '/\[sonarr\]/,/^$/s/^ip = .*$/ip = 127.0.0.1/' /mnt/dietpi_userdata/bazarr/config/config.ini
+ G_EXEC sed --follow-symlinks -i "/\[sonarr\]/,/^$/s/^port = .*$/port = $port/" /mnt/dietpi_userdata/bazarr/config/config.ini
+ G_EXEC sed --follow-symlinks -i '/\[sonarr\]/,/^$/s/^base_url = .*$/base_url = \//' /mnt/dietpi_userdata/bazarr/config/config.ini
+ G_EXEC sed --follow-symlinks -i "/\[sonarr\]/,/^$/s/^apikey = .*$/apikey = $apikey/" /mnt/dietpi_userdata/bazarr/config/config.ini
G_CONFIG_INJECT 'use_sonarr[[:blank:]]*=' 'use_sonarr = True' /mnt/dietpi_userdata/bazarr/config/config.ini '\[general\]'
fi
# Radarr
@@ -9968,10 +9998,10 @@ _EOF_
then
local port=$(sed -nE '/[0-9]+<\/Port>/{s/^.*([0-9]+)<\/Port>.*$/\1/p;q}' /mnt/dietpi_userdata/radarr/config.xml)
local apikey=$(sed -nE '/.+<\/ApiKey>/{s/^.*(.+)<\/ApiKey>.*$/\1/p;q}' /mnt/dietpi_userdata/radarr/config.xml)
- G_EXEC sed -i '/\[radarr\]/,/^$/s/^ip = .*$/ip = 127.0.0.1/' /mnt/dietpi_userdata/bazarr/config/config.ini
- G_EXEC sed -i "/\[radarr\]/,/^$/s/^port = .*$/port = $port/" /mnt/dietpi_userdata/bazarr/config/config.ini
- G_EXEC sed -i '/\[radarr\]/,/^$/s/^base_url = .*$/base_url = \//' /mnt/dietpi_userdata/bazarr/config/config.ini
- G_EXEC sed -i "/\[radarr\]/,/^$/s/^apikey = .*$/apikey = $apikey/" /mnt/dietpi_userdata/bazarr/config/config.ini
+ G_EXEC sed --follow-symlinks -i '/\[radarr\]/,/^$/s/^ip = .*$/ip = 127.0.0.1/' /mnt/dietpi_userdata/bazarr/config/config.ini
+ G_EXEC sed --follow-symlinks -i "/\[radarr\]/,/^$/s/^port = .*$/port = $port/" /mnt/dietpi_userdata/bazarr/config/config.ini
+ G_EXEC sed --follow-symlinks -i '/\[radarr\]/,/^$/s/^base_url = .*$/base_url = \//' /mnt/dietpi_userdata/bazarr/config/config.ini
+ G_EXEC sed --follow-symlinks -i "/\[radarr\]/,/^$/s/^apikey = .*$/apikey = $apikey/" /mnt/dietpi_userdata/bazarr/config/config.ini
G_CONFIG_INJECT 'use_radarr[[:blank:]]*=' 'use_radarr = True' /mnt/dietpi_userdata/bazarr/config/config.ini '\[general\]'
fi
fi
@@ -10101,25 +10131,26 @@ _EOF_
then
local reinstall=0
[[ -f '/mnt/dietpi_userdata/nzbget/nzbget.conf' ]] && reinstall=1
- G_EXEC curl -sSfL 'https://nzbget.net/download/nzbget-latest-bin-linux.run' -o package.run
+
+ local fallback_url='https://github.com/nzbgetcom/nzbget/releases/download/v22.0/nzbget-22.0-bin-linux.run'
+ Download_Install "$(curl -sSfL 'https://api.github.com/repos/nzbgetcom/nzbget/releases/latest' | mawk -F\" '/^ *"browser_download_url": ".*\/nzbget-[^"/]*-bin-linux.run"$/{print $4}')" nzbget.run
G_EXEC mkdir -p /mnt/dietpi_userdata/nzbget
- G_EXEC_OUTPUT=1 G_EXEC dash package.run --destdir /mnt/dietpi_userdata/nzbget
- G_EXEC rm package.run
+ G_EXEC_OUTPUT=1 G_EXEC dash nzbget.run --destdir /mnt/dietpi_userdata/nzbget
+ G_EXEC rm nzbget.run
# User
Create_User -g dietpi -d /mnt/dietpi_userdata/nzbget nzbget
# Permissions
- G_EXEC touch /var/log/nzbget.log
- G_EXEC chown -R nzbget:root /mnt/dietpi_userdata/nzbget /var/log/nzbget.log
G_EXEC chmod 0600 /mnt/dietpi_userdata/nzbget/nzbget.conf
+ G_EXEC chown -R nzbget:root /mnt/dietpi_userdata/nzbget
# Config
if (( ! $reinstall ))
then
G_CONFIG_INJECT 'MainDir=' 'MainDir=/mnt/dietpi_userdata/downloads' /mnt/dietpi_userdata/nzbget/nzbget.conf
G_CONFIG_INJECT 'DestDir=' 'DestDir=/mnt/dietpi_userdata/downloads/complete' /mnt/dietpi_userdata/nzbget/nzbget.conf
- G_CONFIG_INJECT 'LogFile=' 'LogFile=/var/log/nzbget.log' /mnt/dietpi_userdata/nzbget/nzbget.conf
+ G_CONFIG_INJECT 'WriteLog=' 'WriteLog=none' /mnt/dietpi_userdata/nzbget/nzbget.conf
G_CONFIG_INJECT 'ControlUsername=' 'ControlUsername=admin' /mnt/dietpi_userdata/nzbget/nzbget.conf
GCI_PASSWORD=1 G_CONFIG_INJECT 'ControlPassword=' "ControlPassword=$GLOBAL_PW" /mnt/dietpi_userdata/nzbget/nzbget.conf
@@ -10127,13 +10158,13 @@ _EOF_
G_CONFIG_INJECT 'UMask=' 'UMask=0002' /mnt/dietpi_userdata/nzbget/nzbget.conf
# Optimisations
- G_CONFIG_INJECT 'Server1.Cipher=' 'Server1.Cipher=RC4-MD5' /mnt/dietpi_userdata/nzbget/nzbget.conf
+ G_CONFIG_INJECT 'Server1.Cipher=' 'Server1.Cipher=RC4-MD5' /mnt/dietpi_userdata/nzbget/nzbget.conf # RC4-MD5 is fastest: https://nzbget.com/documentation/choosing-cipher/
G_CONFIG_INJECT 'CrcCheck=' 'CrcCheck=no' /mnt/dietpi_userdata/nzbget/nzbget.conf
G_CONFIG_INJECT 'ParScan=' 'ParScan=limited' /mnt/dietpi_userdata/nzbget/nzbget.conf
G_CONFIG_INJECT 'ParThreads=' "ParThreads=$G_HW_CPU_CORES" /mnt/dietpi_userdata/nzbget/nzbget.conf
G_CONFIG_INJECT 'DebugTarget=' 'DebugTarget=none' /mnt/dietpi_userdata/nzbget/nzbget.conf
- G_CONFIG_INJECT 'CrashTrace=' 'CrashTrace=no' /mnt/dietpi_userdata/nzbget/nzbget.conf
G_CONFIG_INJECT 'DetailTarget=' 'DetailTarget=none' /mnt/dietpi_userdata/nzbget/nzbget.conf
+ G_CONFIG_INJECT 'CrashTrace=' 'CrashTrace=no' /mnt/dietpi_userdata/nzbget/nzbget.conf
G_CONFIG_INJECT 'ParBuffer=' "ParBuffer=$(Optimise_BitTorrent 0)" /mnt/dietpi_userdata/nzbget/nzbget.conf
G_CONFIG_INJECT 'ArticleCache=' "ArticleCache=$(Optimise_BitTorrent 0)" /mnt/dietpi_userdata/nzbget/nzbget.conf
G_CONFIG_INJECT 'WriteBuffer=' "WriteBuffer=$(Optimise_BitTorrent 0)" /mnt/dietpi_userdata/nzbget/nzbget.conf
@@ -10147,10 +10178,9 @@ Wants=network-online.target
After=network-online.target remote-fs.target
[Service]
-Type=forking
User=nzbget
WorkingDirectory=/mnt/dietpi_userdata/nzbget
-ExecStart=/mnt/dietpi_userdata/nzbget/nzbget -D
+ExecStart=/mnt/dietpi_userdata/nzbget/nzbget -so OutputMode=log
[Install]
WantedBy=multi-user.target
@@ -10182,7 +10212,7 @@ _EOF_
*) local arch='x64';;
esac
- local fallback_url="https://github.com/Prowlarr/Prowlarr/releases/download/v1.9.4.4039/Prowlarr.master.1.9.4.4039.linux-core-$arch.tar.gz"
+ local fallback_url="https://github.com/Prowlarr/Prowlarr/releases/download/v1.10.5.4116/Prowlarr.master.1.10.5.4116.linux-core-$arch.tar.gz"
Download_Install "$(curl -sSfL 'https://api.github.com/repos/Prowlarr/Prowlarr/releases/latest' | mawk -F\" "/^ *\"browser_download_url\": \".*linux-core-$arch\.tar\.gz\"$/{print \$4}")"
G_EXEC mv Prowlarr /opt/prowlarr
fi
@@ -10257,7 +10287,7 @@ _EOF_
*) local arch='x64';;
esac
- local fallback_url="https://github.com/Readarr/Readarr/releases/download/v0.3.10.2287/Readarr.develop.0.3.10.2287.linux-core-$arch.tar.gz"
+ local fallback_url="https://github.com/Readarr/Readarr/releases/download/v0.3.11.2319/Readarr.develop.0.3.11.2319.linux-core-$arch.tar.gz"
Download_Install "$(curl -sSfL 'https://api.github.com/repos/Readarr/Readarr/releases' | mawk -F\" "/^ *\"browser_download_url\": \".*linux-core-$arch\.tar\.gz\"$/{print \$4}" | head -1)"
G_EXEC mv Readarr /opt/readarr
fi
@@ -10757,7 +10787,7 @@ _EOF_
*) local arch='arm-6';;
esac
- local fallback_url="https://github.com/go-gitea/gitea/releases/download/v1.21.0/gitea-1.21.0-linux-$arch.xz"
+ local fallback_url="https://github.com/go-gitea/gitea/releases/download/v1.21.2/gitea-1.21.2-linux-$arch.xz"
Download_Install "$(curl -sSfL 'https://api.github.com/repos/go-gitea/gitea/releases/latest' | mawk -F\" "/\"browser_download_url\": \".*\/gitea-[^\"\/]*-linux-$arch\.xz\"/{print \$4}")" /mnt/dietpi_userdata/gitea/gitea
# User
@@ -10836,7 +10866,7 @@ _EOF_
unset -v db_password
# Apply new app key
- GCI_PASSWORD=1 G_CONFIG_INJECT 'APP_KEY=' "APP_KEY=base64:$(base64 < <(tr -dc '[:graph:]' < /dev/urandom | head -c32))" allo/.env
+ GCI_PASSWORD=1 G_CONFIG_INJECT 'APP_KEY=' "APP_KEY=base64:$(base64 < <(tr -dc '[:graph:]' < /dev/random | head -c32))" allo/.env
# Install cleanly
[[ -d '/opt/allo' ]] && G_EXEC rm -R /opt/allo
@@ -10954,7 +10984,7 @@ _EOF_
(( $G_HW_ARCH == 2 )) && G_EXEC_OUTPUT=1 G_EXEC env/bin/pip install 'google-assistant-library~=1.0'
# Services
- G_EXEC sed -i 's|/home/pi|/mnt/dietpi_userdata|g' systemd/voice-recognizer.service
+ G_EXEC sed --follow-symlinks -i 's|/home/pi|/mnt/dietpi_userdata|g' systemd/voice-recognizer.service
G_CONFIG_INJECT 'User=' 'User=dietpi' systemd/voice-recognizer.service '\[Service\]'
G_EXEC cp systemd/{alsa-init,voice-recognizer}.service /etc/systemd/system/
@@ -11014,7 +11044,7 @@ _EOF_
G_EXEC cd /mnt/dietpi_userdata/mycroft-core
# -sm: Skip mimic build which is time intense and can be manually done any time later.
# - Remove PulseAudio from dependencies, we use ALSA
- G_EXEC sed -Ei 's/[^[:blank:]"'\'']*pulseaudio[^[:blank:]"'\'']*//g' ./dev_setup.sh
+ G_EXEC sed --follow-symlinks -Ei 's/[^[:blank:]"'\'']*pulseaudio[^[:blank:]"'\'']*//g' ./dev_setup.sh
G_EXEC_OUTPUT=1 G_EXEC sudo -u mycroft ./dev_setup.sh -sm
G_EXEC cd "$G_WORKING_DIR"
@@ -11292,7 +11322,7 @@ _EOF_
# v3 drops PHP 7.4 support: https://github.com/TasmoAdmin/TasmoAdmin/releases/tag/v3.0.0
if (( $G_DISTRO > 6 ))
then
- local fallback_url='https://github.com/TasmoAdmin/TasmoAdmin/releases/download/v3.2.0/tasmoadmin_v3.2.0.tar.gz'
+ local fallback_url='https://github.com/TasmoAdmin/TasmoAdmin/releases/download/v3.3.0/tasmoadmin_v3.3.0.tar.gz'
Download_Install "$(curl -sSfL 'https://api.github.com/repos/TasmoAdmin/TasmoAdmin/releases/latest' | mawk -F\" '/^ *"browser_download_url": ".*\/tasmoadmin_v[^"\/]*\.tar\.gz"$/{print $4}')"
# v2 drops PHP <7.4 support: https://github.com/TasmoAdmin/TasmoAdmin/releases/tag/v2.0.0
@@ -11379,12 +11409,12 @@ _EOF_
G_CONFIG_INJECT 'OPENHAB_HTTP_PORT=' 'OPENHAB_HTTP_PORT=0' /etc/default/openhab
# Do all logs to STDOUT => journalctl -u openhab
- G_EXEC sed -i 's|||' /var/lib/openhab/etc/log4j2.xml
+ G_EXEC sed --follow-symlinks -i 's|||' /var/lib/openhab/etc/log4j2.xml
local line='' last=''
grep -n '' /var/lib/openhab/etc/log4j2.xml | while read -r line
do
line=${line%%:*}
- (( $line == ${last:-$line} + 1 )) && G_EXEC sed -i "${last}d" /var/lib/openhab/etc/log4j2.xml
+ (( $line == ${last:-$line} + 1 )) && G_EXEC sed --follow-symlinks -i "${last}d" /var/lib/openhab/etc/log4j2.xml
last=$line
done
G_EXEC rm -f /var/log/openhab/*
@@ -11679,7 +11709,7 @@ _EOF_
G_EXEC systemctl stop snapserver
# Disable JSON RPC by default if setting was never touched yet
- [[ -f '/etc/snapserver.conf' ]] && G_EXEC sed -i '/^\[tcp\]/,/^\[/s/^#enabled = true$/enabled = false/' /etc/snapserver.conf
+ [[ -f '/etc/snapserver.conf' ]] && G_EXEC sed --follow-symlinks -i '/^\[tcp\]/,/^\[/s/^#enabled = true$/enabled = false/' /etc/snapserver.conf
fi
if To_Install 192 snapclient # Snapcast Client
@@ -11743,7 +11773,7 @@ _EOF_
*) local arch='amd64';;
esac
- local fallback_url="https://github.com/rclone/rclone/releases/download/v1.64.2/rclone-v1.64.2-linux-$arch.deb"
+ local fallback_url="https://github.com/rclone/rclone/releases/download/v1.65.0/rclone-v1.65.0-linux-$arch.deb"
Download_Install "$(curl -sSfL 'https://api.github.com/repos/rclone/rclone/releases/latest' | mawk -F\" "/^ *\"browser_download_url\": \".*\/rclone-v[^\"\/]*-linux-$arch.deb\"$/{print \$4}")"
fi
fi
@@ -13231,7 +13261,7 @@ If no WireGuard (auto)start is included, but you require it, please do the follo
G_DIETPI-NOTIFY 2 'Reconfiguring Unbound to work on its own'
G_CONFIG_INJECT 'port:[[:blank:]]' ' port: 53' /etc/unbound/unbound.conf.d/dietpi.conf
G_CONFIG_INJECT 'interface:[[:blank:]]' ' interface: 0.0.0.0' /etc/unbound/unbound.conf.d/dietpi.conf
- grep -E '^[[:blank:]]*nameserver[[:blank:]]+127.0.0.1:5335$' /etc/resolv.conf && sed -Ei '/^[[:blank:]]*nameserver[[:blank:]]+127.0.0.1:5335$/c\nameserver 127.0.0.1' /etc/resolv.conf # Failsafe
+ grep -E '^[[:blank:]]*nameserver[[:blank:]]+127.0.0.1:5335$' /etc/resolv.conf && sed --follow-symlinks -Ei '/^[[:blank:]]*nameserver[[:blank:]]+127.0.0.1:5335$/c\nameserver 127.0.0.1' /etc/resolv.conf # Failsafe
G_EXEC_NOEXIT=1 G_EXEC systemctl restart unbound
else
grep '^[[:blank:]]*nameserver[[:blank:]]' /etc/resolv.conf | grep -qvE '[[:blank:]]127.0.0.1(:53)?$' || echo 'nameserver 9.9.9.9' >> /etc/resolv.conf # Failsafe
@@ -13251,7 +13281,7 @@ If no WireGuard (auto)start is included, but you require it, please do the follo
G_DIETPI-NOTIFY 2 'Reconfiguring Unbound to work on its own'
G_CONFIG_INJECT 'port:[[:blank:]]' ' port: 53' /etc/unbound/unbound.conf.d/dietpi.conf
G_CONFIG_INJECT 'interface:[[:blank:]]' ' interface: 0.0.0.0' /etc/unbound/unbound.conf.d/dietpi.conf
- grep -E '^[[:blank:]]*nameserver[[:blank:]]+127.0.0.1:5335$' /etc/resolv.conf && sed -Ei '/^[[:blank:]]*nameserver[[:blank:]]+127.0.0.1:5335$/c\nameserver 127.0.0.1' /etc/resolv.conf # Failsafe
+ grep -E '^[[:blank:]]*nameserver[[:blank:]]+127.0.0.1:5335$' /etc/resolv.conf && sed --follow-symlinks -Ei '/^[[:blank:]]*nameserver[[:blank:]]+127.0.0.1:5335$/c\nameserver 127.0.0.1' /etc/resolv.conf # Failsafe
G_EXEC_NOEXIT=1 G_EXEC systemctl restart unbound
else
grep '^[[:blank:]]*nameserver[[:blank:]]' /etc/resolv.conf | grep -qvE '[[:blank:]]127.0.0.1(:53)?$' || echo 'nameserver 9.9.9.9' >> /etc/resolv.conf # Failsafe
@@ -13382,7 +13412,7 @@ If no WireGuard (auto)start is included, but you require it, please do the follo
if To_Uninstall 117 # PiVPN
then
- [[ -f '/opt/pivpn/uninstall.sh' ]] && G_EXEC sed -i 's/ askreboot;//' /opt/pivpn/uninstall.sh
+ [[ -f '/opt/pivpn/uninstall.sh' ]] && G_EXEC sed --follow-symlinks -i 's/ askreboot;//' /opt/pivpn/uninstall.sh
command -v pivpn > /dev/null && G_EXEC_OUTPUT=1 G_EXEC pivpn -u
getent passwd pivpn > /dev/null && G_EXEC userdel pivpn
getent group pivpn > /dev/null && G_EXEC groupdel pivpn
@@ -13504,9 +13534,9 @@ If no WireGuard (auto)start is included, but you require it, please do the follo
# Set WiFi interface back to inactive and ready for use with dietpi-config.
local wifi_iface=$(G_GET_NET -t wlan iface)
# - Remove WLAN block, so we can recreate it
- G_EXEC sed -Ei '/(allow-hotplug|auto)[[:blank:]]+wlan/q0' /etc/network/interfaces
+ G_EXEC sed --follow-symlinks -Ei '/(allow-hotplug|auto)[[:blank:]]+wlan/q0' /etc/network/interfaces
# - Disable
- G_EXEC sed -i "/allow-hotplug wlan/c\#allow-hotplug $wifi_iface" /etc/network/interfaces
+ G_EXEC sed --follow-symlinks -i "/allow-hotplug wlan/c\#allow-hotplug $wifi_iface" /etc/network/interfaces
# - Add default WiFi settings to network interfaces config
cat << _EOF_ >> /etc/network/interfaces
iface $wifi_iface inet dhcp
@@ -13519,7 +13549,7 @@ post-down iw dev $wifi_iface set power_save on
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
_EOF_
# shellcheck disable=SC2015
- iw dev "$wifi_iface" set power_save on 2> /dev/null && iw dev "$wifi_iface" set power_save off 2> /dev/null || G_EXEC sed -i '/ iw dev .* set power_save /d' /etc/network/interfaces
+ iw dev "$wifi_iface" set power_save on 2> /dev/null && iw dev "$wifi_iface" set power_save off 2> /dev/null || G_EXEC sed --follow-symlinks -i '/ iw dev .* set power_save /d' /etc/network/interfaces
# - Flush iptables
iptables -F
iptables -t nat -F
@@ -13673,7 +13703,7 @@ _EOF_
[[ -f '/etc/.rutorrent-htaccess' ]] && G_EXEC rm /etc/.rutorrent-htaccess
# - Lighttpd
# Pre-v7.2: Remove from #RUTORRENT_DIETPI to #RUTORRENT_DIETPI in /etc/lighttpd/lighttpd.conf if exist
- [[ -f '/etc/lighttpd/lighttpd.conf' ]] && grep -q '^#RUTORRENT_DIETPI' /etc/lighttpd/lighttpd.conf && G_EXEC sed -i '/#RUTORRENT_DIETPI/,/#RUTORRENT_DIETPI/d' /etc/lighttpd/lighttpd.conf
+ [[ -f '/etc/lighttpd/lighttpd.conf' ]] && grep -q '^#RUTORRENT_DIETPI' /etc/lighttpd/lighttpd.conf && G_EXEC sed --follow-symlinks -i '/#RUTORRENT_DIETPI/,/#RUTORRENT_DIETPI/d' /etc/lighttpd/lighttpd.conf
# Remove rTorrent config from Lighttpd
[[ -f '/etc/lighttpd/conf-enabled/98-dietpi-rtorrent.conf' ]] && G_EXEC lighty-disable-mod dietpi-rtorrent
@@ -13766,7 +13796,7 @@ _EOF_
Remove_Service pi-spc
[[ -d '/var/lib/dietpi/dietpi-software/installed/pi-spc' ]] && G_EXEC rm -R /var/lib/dietpi/dietpi-software/installed/pi-spc
- G_EXEC sed -Ei '/^[[:blank:]]*dtoverlay=gpio-(shutdown|poweroff)/d' /boot/config.txt
+ G_EXEC sed --follow-symlinks -Ei '/^[[:blank:]]*dtoverlay=gpio-(shutdown|poweroff)/d' /boot/config.txt
fi
if To_Uninstall 167 # Raspotify
@@ -14072,7 +14102,7 @@ _EOF_
findmnt /mnt/samba > /dev/null && G_EXEC umount -Rfl /mnt/samba
# Remove from fstab
- G_EXEC sed -i '\|/mnt/samba|d' /etc/fstab
+ G_EXEC sed --follow-symlinks -i '\|/mnt/samba|d' /etc/fstab
G_AGP cifs-utils smbclient
@@ -14085,7 +14115,7 @@ _EOF_
findmnt /mnt/nfs_client > /dev/null && G_EXEC umount -Rfl /mnt/nfs_client
# Remove from fstab
- G_EXEC sed -i '\|/mnt/nfs_client|d' /etc/fstab
+ G_EXEC sed --follow-symlinks -i '\|/mnt/nfs_client|d' /etc/fstab
# nfs-kernel-server depends on nfs-common
dpkg-query -s 'nfs-common' &> /dev/null && G_EXEC apt-mark auto nfs-common
@@ -14205,7 +14235,7 @@ _EOF_
if To_Uninstall 103 # DietPi-RAMlog
then
- G_EXEC sed -i '/[[:blank:]]\/var\/log[[:blank:]]/d' /etc/fstab
+ G_EXEC sed --follow-symlinks -i '/[[:blank:]]\/var\/log[[:blank:]]/d' /etc/fstab
G_EXEC mkdir -p /var/lib/dietpi/dietpi-ramlog
cat << '_EOF_' > /var/lib/dietpi/dietpi-ramlog/disable.sh
@@ -14216,9 +14246,9 @@ _EOF_
rm -R /var/tmp/dietpi/logs/dietpi-ramlog_store
if systemctl -q is-enabled rsyslog 2> /dev/null
then
- sed -i '/^[[:blank:]]*INDEX_LOGGING=/c\INDEX_LOGGING=-3' /boot/dietpi/.installed
+ sed --follow-symlinks -i '/^[[:blank:]]*INDEX_LOGGING=/c\INDEX_LOGGING=-3' /boot/dietpi/.installed
else
- sed -i '/^[[:blank:]]*INDEX_LOGGING=/c\INDEX_LOGGING=0' /boot/dietpi/.installed
+ sed --follow-symlinks -i '/^[[:blank:]]*INDEX_LOGGING=/c\INDEX_LOGGING=0' /boot/dietpi/.installed
fi
systemctl --no-reload disable dietpi-ramlog_disable
rm /etc/systemd/system/dietpi-ramlog_disable.service
@@ -14667,9 +14697,9 @@ _EOF_
then
if [[ $( /dev/null && G_EXEC mount -o remount /var/log
# Set time sync mode if no container system
@@ -14812,9 +14842,9 @@ _EOF_
# Apply current network settings statically
G_CONFIG_INJECT "iface[[:blank:]]+eth$eth_index" "iface eth$eth_index inet static" /etc/network/interfaces
- sed -i "0,\|^.*address[[:blank:]].*\$|s||address $eth_ip|" /etc/network/interfaces
- sed -i "0,\|^.*netmask[[:blank:]].*\$|s||netmask $eth_mask|" /etc/network/interfaces
- sed -i "0,\|^.*gateway[[:blank:]].*\$|s||gateway $eth_gateway|" /etc/network/interfaces
+ sed --follow-symlinks -i "0,\|^.*address[[:blank:]].*\$|s||address $eth_ip|" /etc/network/interfaces
+ sed --follow-symlinks -i "0,\|^.*netmask[[:blank:]].*\$|s||netmask $eth_mask|" /etc/network/interfaces
+ sed --follow-symlinks -i "0,\|^.*gateway[[:blank:]].*\$|s||gateway $eth_gateway|" /etc/network/interfaces
fi
# Get WiFi index
@@ -14832,9 +14862,9 @@ _EOF_
# Apply current network settings statically
G_CONFIG_INJECT "iface[[:blank:]]+wlan$wlan_index" "iface wlan$wlan_index inet static" /etc/network/interfaces
- sed -i "\|^iface wlan|,\$s|^.*address[[:blank:]].*\$|address $wlan_ip|" /etc/network/interfaces
- sed -i "\|^iface wlan|,\$s|^.*netmask[[:blank:]].*\$|netmask $wlan_mask|" /etc/network/interfaces
- sed -i "\|^iface wlan|,\$s|^.*gateway[[:blank:]].*\$|gateway $wlan_gateway|" /etc/network/interfaces
+ sed --follow-symlinks -i "\|^iface wlan|,\$s|^.*address[[:blank:]].*\$|address $wlan_ip|" /etc/network/interfaces
+ sed --follow-symlinks -i "\|^iface wlan|,\$s|^.*netmask[[:blank:]].*\$|netmask $wlan_mask|" /etc/network/interfaces
+ sed --follow-symlinks -i "\|^iface wlan|,\$s|^.*gateway[[:blank:]].*\$|gateway $wlan_gateway|" /etc/network/interfaces
fi
unset -f cidr2mask
@@ -14845,9 +14875,9 @@ _EOF_
if command -v resolvconf > /dev/null
then
- sed -i "/dns-nameservers[[:blank:]]/c\dns-nameservers ${nameservers% }" /etc/network/interfaces
+ sed --follow-symlinks -i "/dns-nameservers[[:blank:]]/c\dns-nameservers ${nameservers% }" /etc/network/interfaces
else
- sed -i "/dns-nameservers[[:blank:]]/c\#dns-nameservers ${nameservers% }" /etc/network/interfaces
+ sed --follow-symlinks -i "/dns-nameservers[[:blank:]]/c\#dns-nameservers ${nameservers% }" /etc/network/interfaces
> /etc/resolv.conf
for i in $nameservers; do echo "nameserver $i" >> /etc/resolv.conf; done
fi
diff --git a/dietpi/dietpi-vpn b/dietpi/dietpi-vpn
index a2a8563dc7..9c052ca47a 100755
--- a/dietpi/dietpi-vpn
+++ b/dietpi/dietpi-vpn
@@ -232,7 +232,7 @@ _EOF_
G_CONFIG_INJECT 'ca[[:blank:]]' "ca $FP_IPVANISH/ca.ipvanish.com.crt" "$FP_CLIENT_OVPN"
# Set protocol and port: UDP port 443 is default, but TCP 1194 and UDP 1194 are supported as well.
G_CONFIG_INJECT 'proto[[:blank:]]' "proto $PROTOCOL" "$FP_CLIENT_OVPN"
- G_EXEC sed -i '/^[[:blank:]]*remote[[:blank:]]/s/[[:blank:]][0-9][0-9]*$/ 1194/' "$FP_CLIENT_OVPN"
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*remote[[:blank:]]/s/[[:blank:]][0-9][0-9]*$/ 1194/' "$FP_CLIENT_OVPN"
elif [[ $VPN_PROVIDER == 'PIA' ]]
then
@@ -240,7 +240,7 @@ _EOF_
# Set protocol and port: UDP on 1197 is default but TCP on 501 is supported as well.
G_CONFIG_INJECT 'proto[[:blank:]]' "proto $PROTOCOL" "$FP_CLIENT_OVPN"
[[ $PROTOCOL == 'udp' ]] && VPN_PORT=1197 || VPN_PORT=501
- G_EXEC sed -i "/^[[:blank:]]*remote[[:blank:]]/s/[[:blank:]][0-9][0-9]*\$/ $VPN_PORT/" "$FP_CLIENT_OVPN"
+ G_EXEC sed --follow-symlinks -i "/^[[:blank:]]*remote[[:blank:]]/s/[[:blank:]][0-9][0-9]*\$/ $VPN_PORT/" "$FP_CLIENT_OVPN"
fi
cat << _EOF_ > "$FP_SETTINGS_OVPN"
@@ -269,9 +269,9 @@ _EOF_
# Apply or remove custom up/down scripts from client config
# shellcheck disable=SC2015
- [[ -f $FP_CUSTOM_UP ]] && G_CONFIG_INJECT 'route-up[[:blank:]]' "route-up $FP_CUSTOM_UP" "$FP_CLIENT_OVPN" 'up[[:blank:]]' || G_EXEC sed -i '/^[[:blank:]]*route-up[[:blank:]]/d' "$FP_CLIENT_OVPN"
+ [[ -f $FP_CUSTOM_UP ]] && G_CONFIG_INJECT 'route-up[[:blank:]]' "route-up $FP_CUSTOM_UP" "$FP_CLIENT_OVPN" 'up[[:blank:]]' || G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*route-up[[:blank:]]/d' "$FP_CLIENT_OVPN"
# shellcheck disable=SC2015
- [[ -f $FP_CUSTOM_DOWN ]] && G_CONFIG_INJECT 'route-pre-down[[:blank:]]' "route-pre-down $FP_CUSTOM_DOWN" "$FP_CLIENT_OVPN" 'down[[:blank:]]' || G_EXEC sed -i '/^[[:blank:]]*route-pre-down[[:blank:]]/d' "$FP_CLIENT_OVPN"
+ [[ -f $FP_CUSTOM_DOWN ]] && G_CONFIG_INJECT 'route-pre-down[[:blank:]]' "route-pre-down $FP_CUSTOM_DOWN" "$FP_CLIENT_OVPN" 'down[[:blank:]]' || G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*route-pre-down[[:blank:]]/d' "$FP_CLIENT_OVPN"
# Establish and test connection
G_AG_CHECK_INSTALL_PREREQ openvpn
diff --git a/dietpi/func/create_mysql_db b/dietpi/func/create_mysql_db
index e395dd1832..21a7ad1ad7 100755
--- a/dietpi/func/create_mysql_db
+++ b/dietpi/func/create_mysql_db
@@ -37,7 +37,7 @@
# Generate DB
# - 'identified by' overwrites unix_socket authentication, thus use this for non-root users only.
- # - Database names can only be quotes via backticks, passwords only via single quotes.
+ # - Database names can only be quoted via backticks, passwords only via single quotes.
grant_privileges="grant all privileges on \`$DATABASE_NAME\`.* to '$DATABASE_USER'@localhost identified by '$DATABASE_PW';flush privileges"
[[ $DATABASE_USER != 'root' ]] || grant_privileges=
mysql -e "create database \`$DATABASE_NAME\`;$grant_privileges"
diff --git a/dietpi/func/dietpi-globals b/dietpi/func/dietpi-globals
index 886f2ca1f3..81d096da91 100644
--- a/dietpi/func/dietpi-globals
+++ b/dietpi/func/dietpi-globals
@@ -54,8 +54,8 @@
[[ -f '/boot/dietpi/.version' ]] && . /boot/dietpi/.version
# - Assign defaults/code version as fallback
[[ $G_DIETPI_VERSION_CORE ]] || G_DIETPI_VERSION_CORE=8
- [[ $G_DIETPI_VERSION_SUB ]] || G_DIETPI_VERSION_SUB=24
- [[ $G_DIETPI_VERSION_RC ]] || G_DIETPI_VERSION_RC=1
+ [[ $G_DIETPI_VERSION_SUB ]] || G_DIETPI_VERSION_SUB=25
+ [[ $G_DIETPI_VERSION_RC ]] || G_DIETPI_VERSION_RC=0
[[ $G_GITBRANCH ]] || G_GITBRANCH='master'
[[ $G_GITOWNER ]] || G_GITOWNER='MichaIng'
# - Save current version and Git branch
@@ -825,7 +825,8 @@ $grey─────────────────────────
# - $G_EXEC_ARRAY_ACTION[] | Associative array, containing uneven $G_EXEC_ARRAY_TEXT[] values as keys and related commands as values
G_EXEC(){
- local exit_code fp_log='/tmp/G_EXEC_LOG' attempt=1 acommand=("$@") ecommand
+ local exit_code fp_log='/tmp/G_EXEC_LOG' attempt=1 acommand=("$@")
+ local ecommand=${acommand[*]//\\/\\\\}
# Enter retry loop
while :
@@ -835,7 +836,6 @@ $grey─────────────────────────
[[ $exit_code == 0 ]] && break
# Execute command, store output to $fp_log file and store exit code to $exit_code variable
- ecommand=${acommand[*]//\\/\\\\}
# - Print full command output if $G_EXEC_OUTPUT=1 is given
if [[ $G_EXEC_OUTPUT == 1 ]]; then
@@ -899,7 +899,7 @@ $grey─────────────────────────
- Hardware | $G_HW_MODEL_NAME (ID=$G_HW_MODEL)
- Kernel version | \`$(uname -a)\`
- Distro | $G_DISTRO_NAME (ID=$G_DISTRO${G_RASPBIAN:+,RASPBIAN=$G_RASPBIAN})
-- Command | \`${acommand[*]}\`
+- Command | \`$ecommand\`
- Exit code | $exit_code
- Software title | $G_PROGRAM_NAME
#### Steps to reproduce:
@@ -1002,7 +1002,7 @@ Press any key to continue...'
if [[ -f $fp_error_report ]]; then
# Add bug report ID if it was sent
- [[ $sent_bug_report == 1 ]] && sed -i "/^- Date | /a\- Bug report | $G_HW_UUID" "$fp_error_report"
+ [[ $sent_bug_report == 1 ]] && sed --follow-symlinks -i "/^- Date | /a\- Bug report | $G_HW_UUID" "$fp_error_report"
cat "$fp_error_report"
fi
@@ -2089,7 +2089,7 @@ Please retry with more specific parameter \$1 or apply the setting manually:
[[ $error ]] && { syntax_error; return 1; }
[[ $GCI_BACKUP == 1 && ! -f $file.bak ]] && cp -a "$file" "$file.bak" && G_DIETPI-NOTIFY 2 "Config file backup created: $yellow$file.bak$reset"
- error=$(sed -Ei "0,/^[[:blank:]]*$pattern.*$/s//$setting/" "$file" 2>&1) || { syntax_error; return 1; }
+ error=$(sed --follow-symlinks -Ei "0,/^[[:blank:]]*$pattern.*$/s//$setting/" "$file" 2>&1) || { syntax_error; return 1; }
G_DIETPI-NOTIFY 0 "Setting in $yellow$file$reset adjusted: $yellow${setting_raw//\\/\\\\}$reset"
fi
@@ -2098,7 +2098,7 @@ Please retry with more specific parameter \$1 or apply the setting manually:
[[ $error ]] && { syntax_error; return 1; }
[[ $GCI_BACKUP == 1 && ! -f $file.bak ]] && cp -a "$file" "$file.bak" && G_DIETPI-NOTIFY 2 "Config file backup created: $yellow$file.bak$reset"
- error=$(sed -Ei "0,/^[[:blank:]#;]*$pattern.*$/s//$setting/" "$file" 2>&1) || { syntax_error; return 1; }
+ error=$(sed --follow-symlinks -Ei "0,/^[[:blank:]#;]*$pattern.*$/s//$setting/" "$file" 2>&1) || { syntax_error; return 1; }
G_DIETPI-NOTIFY 0 "Comment in $yellow$file$reset converted to setting: $yellow${setting_raw//\\/\\\\}$reset"
else
@@ -2109,7 +2109,7 @@ Please retry with more specific parameter \$1 or apply the setting manually:
if error=$(grep -Eq "^[[:blank:]]*$after" "$file" 2>&1); then
[[ $GCI_BACKUP == 1 && ! -f $file.bak ]] && cp -a "$file" "$file.bak" && G_DIETPI-NOTIFY 2 "Config file backup created: $yellow$file.bak$reset"
- error=$(sed -Ei "0,/^[[:blank:]]*$after.*$/s//&\n$setting/" "$file" 2>&1) || { syntax_error; return 1; }
+ error=$(sed --follow-symlinks -Ei "0,/^[[:blank:]]*$after.*$/s//&\n$setting/" "$file" 2>&1) || { syntax_error; return 1; }
G_DIETPI-NOTIFY 0 "Added setting $yellow${setting_raw//\\/\\\\}$reset to $yellow$file$reset after line $yellow$(grep -Em1 "^[[:blank:]]*$after" "$file" | sed 's|\\|\\\\|g')$reset"
else
@@ -2130,7 +2130,7 @@ could not be found in file \$3
[[ $GCI_BACKUP == 1 && ! -f $file.bak ]] && cp -a "$file" "$file.bak" && G_DIETPI-NOTIFY 2 "Config file backup created: $yellow$file.bak$reset"
# The following sed does not work on empty files:
[[ ! -s $file ]] && echo '# Added by DietPi:' >> "$file"
- error=$(sed -Ei "\$a\\$setting" "$file" 2>&1) || { syntax_error; return 1; }
+ error=$(sed --follow-symlinks -Ei "\$a\\$setting" "$file" 2>&1) || { syntax_error; return 1; }
G_DIETPI-NOTIFY 0 "Added setting $yellow${setting_raw//\\/\\\\}$reset to end of file $yellow$file$reset"
fi
diff --git a/dietpi/func/dietpi-set_hardware b/dietpi/func/dietpi-set_hardware
index b68e6b9343..01bf7165fa 100755
--- a/dietpi/func/dietpi-set_hardware
+++ b/dietpi/func/dietpi-set_hardware
@@ -129,7 +129,7 @@ $FP_SCRIPT qemu-guest-agent|qga enable/disable
elif [[ $INPUT_DEVICE_VALUE == 'disable' ]]; then
# Comment extended start setting
- G_EXEC sed -i '/^[[:blank:]]*start_x=/c\#start_x=1' /boot/config.txt
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*start_x=/c\#start_x=1' /boot/config.txt
# Add modules blacklist, which are otherwise loaded by default since kernel 4.19/5.10
G_EXEC eval "echo -e 'blacklist bcm2835_v4l2\nblacklist bcm2835_isp' > /etc/modprobe.d/dietpi-disable_rpi_camera.conf"
@@ -163,7 +163,7 @@ $FP_SCRIPT qemu-guest-agent|qga enable/disable
G_EXEC eval "echo 'blacklist bcm2835_codec' > /etc/modprobe.d/dietpi-disable_rpi_codec.conf"
# Disable HEVC decoder
- grep -q '^[[:blank:]]*dtoverlay=rpivid-v4l2$' /boot/config.txt && G_EXEC sed -i '/^[[:blank:]]*dtoverlay=rpivid-v4l2$/d' /boot/config.txt
+ grep -q '^[[:blank:]]*dtoverlay=rpivid-v4l2$' /boot/config.txt && G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*dtoverlay=rpivid-v4l2$/d' /boot/config.txt
else
Unknown_Input_Mode
fi
@@ -187,7 +187,7 @@ Description=DietPi-rm_program_usb_boot_mode.service
[Service]
Type=oneshot
RemainAfterExit=yes
-ExecStartPre=/bin/sed -i '/^[[:blank:]]*program_usb_boot_mode=/d' /boot/config.txt
+ExecStartPre=/bin/sed --follow-symlinks -i '/^[[:blank:]]*program_usb_boot_mode=/d' /boot/config.txt
ExecStartPre=/bin/systemctl disable dietpi-rm_program_usb_boot_mode
ExecStart=/bin/rm /etc/systemd/system/dietpi-rm_program_usb_boot_mode.service
@@ -199,7 +199,7 @@ _EOF_
elif [[ $INPUT_DEVICE_VALUE == 'disable' ]]; then
- G_EXEC sed -i '/^[[:blank:]]*program_usb_boot_mode=/d' /boot/config.txt
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*program_usb_boot_mode=/d' /boot/config.txt
if [[ -f '/etc/systemd/system/dietpi-rm_program_usb_boot_mode.service' ]]; then
@@ -271,7 +271,7 @@ _EOF_
if disable_error=1 G_CHECK_VALIDINT "$INPUT_DEVICE_VALUE" 16 944
then
# Remove overridden "gpu_mem" setting
- grep -q '^[[:blank:]]*gpu_mem=' /boot/config.txt && G_EXEC sed -i '/^[[:blank:]]*gpu_mem=/d' /boot/config.txt
+ grep -q '^[[:blank:]]*gpu_mem=' /boot/config.txt && G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*gpu_mem=/d' /boot/config.txt
local gpu_mem=$INPUT_DEVICE_VALUE
G_CONFIG_INJECT 'gpu_mem_1024=' "gpu_mem_1024=$gpu_mem" /boot/config.txt
@@ -313,7 +313,7 @@ _EOF_
# Disable HDMI hotplug detection, which requires it to be generally responsive/active
G_CONFIG_INJECT 'hdmi_ignore_hotplug=' 'hdmi_ignore_hotplug=1' /boot/config.txt
# Disable SDTV on RPi4 (default)
- G_EXEC sed -i '/^[[:blank:]]*enable_tvout=/c\#enable_tvout=0' /boot/config.txt
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*enable_tvout=/c\#enable_tvout=0' /boot/config.txt
# Odroid C2 legacy image, provided until December 2021
elif [[ $G_HW_MODEL == 12 && -f '/boot/boot.ini' ]]; then
@@ -333,11 +333,11 @@ _EOF_
# RPi
if (( $G_HW_MODEL < 10 )); then
- G_EXEC sed -i '/^[[:blank:]]*max_framebuffers=/c\#max_framebuffers=2' /boot/config.txt
- #G_EXEC sed -i '/^[[:blank:]]*disable_splash=/c\#disable_splash=0' /boot/config.txt
- #G_EXEC sed -i '/^[[:blank:]]*hdmi_blanking=/c\#hdmi_blanking=0' /boot/config.txt
- G_EXEC sed -i '/^[[:blank:]]*hdmi_ignore_hotplug=/c\#hdmi_ignore_hotplug=0' /boot/config.txt
- G_EXEC sed -i '/^[[:blank:]]*enable_tvout=/c\#enable_tvout=0' /boot/config.txt
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*max_framebuffers=/c\#max_framebuffers=2' /boot/config.txt
+ #G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*disable_splash=/c\#disable_splash=0' /boot/config.txt
+ #G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*hdmi_blanking=/c\#hdmi_blanking=0' /boot/config.txt
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*hdmi_ignore_hotplug=/c\#hdmi_ignore_hotplug=0' /boot/config.txt
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*enable_tvout=/c\#enable_tvout=0' /boot/config.txt
# Odroid C2 legacy image, provided until December 2021
elif [[ $G_HW_MODEL == 12 && -f '/boot/boot.ini' ]]; then
@@ -378,7 +378,7 @@ _EOF_
fi
[[ -d '/etc/systemd/system/justboom-ir-mpd.service.d' ]] && G_EXEC rm -R /etc/systemd/system/justboom-ir-mpd.service.d
- G_EXEC sed -i '/^[[:blank:]]*dtoverlay=gpio-ir/d' /boot/config.txt
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*dtoverlay=gpio-ir/d' /boot/config.txt
# Disable Odroids
elif (( $G_HW_MODEL < 20 )); then
@@ -648,7 +648,7 @@ _EOF_
local params=$(sed -En '/^[[:blank:]]*dtoverlay=vc4-f?kms-v3d(-pi4)?,/{s/^[^,]*//p;q}' /boot/config.txt)
# Always remove previous VC4 overlay entry
- G_EXEC sed -Ei '/^[[:blank:]]*dtoverlay=vc4-f?kms-v3d/d' /boot/config.txt
+ G_EXEC sed --follow-symlinks -Ei '/^[[:blank:]]*dtoverlay=vc4-f?kms-v3d/d' /boot/config.txt
if [[ $INPUT_DEVICE_VALUE == 'vc4-kms-v3d' || $INPUT_DEVICE_VALUE == 'vc4-fkms-v3d' ]]; then
@@ -728,11 +728,11 @@ _EOF_
(( $G_HW_MODEL > 9 )) && return 0 # Skip on non-RPi
- G_EXEC sed -i '/^[[:blank:]]*hdmi_force_hotplug=/c\#hdmi_force_hotplug=1' /boot/config.txt
- G_EXEC sed -i '/^[[:blank:]]*hdmi_group=/c\#hdmi_group=2' /boot/config.txt
- G_EXEC sed -i '/^[[:blank:]]*hdmi_mode=/c\#hdmi_mode=87' /boot/config.txt
- G_EXEC sed -i '/^[[:blank:]]*hdmi_cvt=/c\#hdmi_cvt=1024 600 60 6 0 0 0' /boot/config.txt
- G_EXEC sed -i '/^[[:blank:]]*hdmi_drive=/c\#hdmi_drive=1' /boot/config.txt
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*hdmi_force_hotplug=/c\#hdmi_force_hotplug=1' /boot/config.txt
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*hdmi_group=/c\#hdmi_group=2' /boot/config.txt
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*hdmi_mode=/c\#hdmi_mode=87' /boot/config.txt
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*hdmi_cvt=/c\#hdmi_cvt=1024 600 60 6 0 0 0' /boot/config.txt
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*hdmi_drive=/c\#hdmi_drive=1' /boot/config.txt
}
@@ -776,7 +776,7 @@ _EOF_
G_EXEC curl -sSfL 'https://raw.githubusercontent.com/waveshare/LCD-show/master/waveshare32b-overlay.dtb' -o /boot/overlays/waveshare32b.dtbo
#consoleblank=0 no effect
- G_EXEC sed -i 's/rootwait/rootwait fbcon=map:10 fbcon=font:ProFont6x11 logo.nologo/' /boot/cmdline.txt
+ G_EXEC sed --follow-symlinks -i 's/rootwait/rootwait fbcon=map:10 fbcon=font:ProFont6x11 logo.nologo/' /boot/cmdline.txt
G_CONFIG_INJECT 'dtparam=i2c_arm=' 'dtparam=i2c_arm=on' /boot/config.txt
G_CONFIG_INJECT 'dtparam=spi=' 'dtparam=spi=on' /boot/config.txt
@@ -849,16 +849,16 @@ _EOF_
if (( $G_HW_MODEL < 10 )); then
[[ -f '/boot/overlays/waveshare32b.dtbo' ]] && G_EXEC rm /boot/overlays/waveshare32b.dtbo
- G_EXEC sed -i 's/ fbcon=map:10 fbcon=font:ProFont6x11 logo.nologo//' /boot/cmdline.txt
+ G_EXEC sed --follow-symlinks -i 's/ fbcon=map:10 fbcon=font:ProFont6x11 logo.nologo//' /boot/cmdline.txt
- G_EXEC sed -i '/Waveshare 32 LCD/d' /boot/config.txt
- G_EXEC sed -i '/^[[:blank:]]*dtoverlay=waveshare32b/d' /boot/config.txt
- G_EXEC sed -i '/^[[:blank:]]*dtoverlay=ads7846,cs=1,penirq=17/d' /boot/config.txt
- G_EXEC sed -i '/^[[:blank:]]*dtoverlay=w1-gpio-pullup,gpiopin=4,extpullup=1/d' /boot/config.txt
+ G_EXEC sed --follow-symlinks -i '/Waveshare 32 LCD/d' /boot/config.txt
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*dtoverlay=waveshare32b/d' /boot/config.txt
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*dtoverlay=ads7846,cs=1,penirq=17/d' /boot/config.txt
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*dtoverlay=w1-gpio-pullup,gpiopin=4,extpullup=1/d' /boot/config.txt
# Leave these enabled, just in case the user has other hardware that may use them.
- #G_EXEC sed -i '/^[[:blank:]]*dtparam=i2c_arm=/c\dtparam=i2c_arm=on' /boot/config.txt
- #G_EXEC sed -i '/^[[:blank:]]*dtparam=spi=/c\dtparam=spi=on' /boot/config.txt
+ #G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*dtparam=i2c_arm=/c\dtparam=i2c_arm=on' /boot/config.txt
+ #G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*dtparam=spi=/c\dtparam=spi=on' /boot/config.txt
# Move fb0 xorg.conf back: https://github.com/MichaIng/DietPi/issues/767
[[ -f '/usr/share/X11/99-fbturbo.conf' && ! -f '/usr/share/X11/xorg.conf.d/99-fbturbo.conf' ]] && G_EXEC mv /usr/share/X11/99-fbturbo.conf /usr/share/X11/xorg.conf.d/99-fbturbo.conf
@@ -873,8 +873,8 @@ _EOF_
fi
[[ -d '/etc/systemd/system/con2fbmap.service.d' ]] && G_EXEC rm -R /etc/systemd/system/con2fbmap.service.d
[[ -f '/etc/modprobe.d/waveshare32.conf' ]] && G_EXEC rm /etc/modprobe.d/waveshare32.conf
- G_EXEC sed -i '/^[[:blank:]]*spicc/d' /etc/modules
- G_EXEC sed -i '/^[[:blank:]]*fbtft_device/d' /etc/modules
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*spicc/d' /etc/modules
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*fbtft_device/d' /etc/modules
fi
@@ -894,8 +894,8 @@ _EOF_
Lcd_Panel_Odroidcloudshell_Disable(){
[[ -f '/etc/modprobe.d/odroid-cloudshell.conf' ]] && G_EXEC rm /etc/modprobe.d/odroid-cloudshell.conf
- G_EXEC sed -i '/^[[:blank:]]*spi_s3c64xx/d' /etc/modules
- G_EXEC sed -i '/^[[:blank:]]*fbtft_device/d' /etc/modules
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*spi_s3c64xx/d' /etc/modules
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*fbtft_device/d' /etc/modules
}
@@ -1106,16 +1106,16 @@ _EOF_
G_CONFIG_INJECT 'dtparam=i2c_arm=' 'dtparam=i2c_arm=on' /boot/config.txt
# DietPi-Software, set installed
- [[ -f '/boot/dietpi/.installed' ]] && G_EXEC sed -i '/^aSOFTWARE_INSTALL_STATE\[72\]=/c\aSOFTWARE_INSTALL_STATE\[72\]=2' /boot/dietpi/.installed
+ [[ -f '/boot/dietpi/.installed' ]] && G_EXEC sed --follow-symlinks -i '/^aSOFTWARE_INSTALL_STATE\[72\]=/c\aSOFTWARE_INSTALL_STATE\[72\]=2' /boot/dietpi/.installed
elif [[ $INPUT_DEVICE_VALUE == 'disable' ]]; then
# Kernel modules
- G_EXEC sed -i '/^[[:blank:]]*i2c-bcm2708/d' /etc/modules
- G_EXEC sed -i '/^[[:blank:]]*i2c-dev/d' /etc/modules
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*i2c-bcm2708/d' /etc/modules
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*i2c-dev/d' /etc/modules
# config.txt
- G_EXEC sed -Ei 's/^[[:blank:]]*(dtparam=i2c.*)$/#\1/' /boot/config.txt
+ G_EXEC sed --follow-symlinks -Ei 's/^[[:blank:]]*(dtparam=i2c.*)$/#\1/' /boot/config.txt
# Set baudrate (kHz) | valid int
elif disable_error=1 G_CHECK_VALIDINT "$INPUT_DEVICE_VALUE" 2 10000000; then
@@ -1153,7 +1153,7 @@ _EOF_
then
# config.txt
G_CONFIG_INJECT 'dtparam=spi=' 'dtparam=spi=off' /boot/config.txt
- G_EXEC sed -i '/^[[:blank:]]*dtoverlay=spi[0-9]-[0-9]cs/d' /boot/config.txt # Alternative SPI interfaces and chip select lines
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*dtoverlay=spi[0-9]-[0-9]cs/d' /boot/config.txt # Alternative SPI interfaces and chip select lines
# Disable in runtime seems to be possible?
#dtparam spi=off
@@ -1167,12 +1167,12 @@ _EOF_
if [[ $INPUT_DEVICE_VALUE == 'enable' ]]
then
# Add overlay to dietpiEnv.txt
- grep -Eq '^[[:blank:]]*overlays=(.*[[:blank:]])?spi1-cs1-spidev([[:blank:]]|$)' "$FP_UENV" || G_EXEC sed -i '/^[[:blank:]]*overlays=/s/[[:blank:]]*$/ spi1-cs1-spidev/' "$FP_UENV"
+ grep -Eq '^[[:blank:]]*overlays=(.*[[:blank:]])?spi1-cs1-spidev([[:blank:]]|$)' "$FP_UENV" || G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*overlays=/s/[[:blank:]]*$/ spi1-cs1-spidev/' "$FP_UENV"
elif [[ $INPUT_DEVICE_VALUE == 'disable' ]]
then
# Remove overlay from dietpiEnv.txt
- grep -Eq '^[[:blank:]]*overlays=(.*[[:blank:]])?spi1-cs1-spidev([[:blank:]]|$)' "$FP_UENV" && G_EXEC sed -Ei '/^[[:blank:]]*overlays=/s/[[:blank:]]*spi1-cs1-spidev([[:blank:]]*$)?//g' "$FP_UENV"
+ grep -Eq '^[[:blank:]]*overlays=(.*[[:blank:]])?spi1-cs1-spidev([[:blank:]]|$)' "$FP_UENV" && G_EXEC sed --follow-symlinks -Ei '/^[[:blank:]]*overlays=/s/[[:blank:]]*spi1-cs1-spidev([[:blank:]]*$)?//g' "$FP_UENV"
else
Unknown_Input_Mode
fi
@@ -1258,7 +1258,7 @@ Do you want to continue and disable the serial login console?' || return 1
fi
# Remove dtoverlay
- G_EXEC sed -i '/^[[:blank:]]*dtoverlay=disable-bt/d' /boot/config.txt
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*dtoverlay=disable-bt/d' /boot/config.txt
G_AG_CHECK_INSTALL_PREREQ pi-bluetooth
else
@@ -1337,9 +1337,9 @@ Do you want to continue and disable the serial login console?' || return 1
echo -e 'net.ipv6.conf.all.disable_ipv6=1\nnet.ipv6.conf.default.disable_ipv6=1' > /etc/sysctl.d/dietpi-disable_ipv6.conf
sysctl -qp /etc/sysctl.d/dietpi-disable_ipv6.conf
# - Comment IPv6 specific host entries
- sed -i 's/^::1[[:blank:]]/#::1 /' /etc/hosts
- sed -i 's/^ff02::1[[:blank:]]/#ff02::1 /' /etc/hosts
- sed -i 's/^ff02::2[[:blank:]]/#ff02::2 /' /etc/hosts
+ sed --follow-symlinks -i 's/^::1[[:blank:]]/#::1 /' /etc/hosts
+ sed --follow-symlinks -i 's/^ff02::1[[:blank:]]/#ff02::1 /' /etc/hosts
+ sed --follow-symlinks -i 's/^ff02::2[[:blank:]]/#ff02::2 /' /etc/hosts
# - dietpi.txt entry
G_CONFIG_INJECT 'CONFIG_ENABLE_IPV6=' 'CONFIG_ENABLE_IPV6=0' /boot/dietpi.txt
@@ -1357,7 +1357,7 @@ Do you want to continue and disable the serial login console?' || return 1
[[ $i != '/etc/sysctl.d/dietpi-disable_ipv6.conf' && -f $i ]] || continue
grep -q '^[[:blank:]]*net.ipv6.conf.[^[:blank:]]*.disable_ipv6[[:blank:]]*=' "$i" || continue
i=$(readlink -f "$i") # https://github.com/MichaIng/DietPi/issues/3003#issuecomment-669464255
- sed -i 's/^[[:blank:]]*net.ipv6.conf.[^[:blank:]]*.disable_ipv6[[:blank:]]*=/#&/' "$i"
+ sed --follow-symlinks -i 's/^[[:blank:]]*net.ipv6.conf.[^[:blank:]]*.disable_ipv6[[:blank:]]*=/#&/' "$i"
done
}
@@ -1469,7 +1469,7 @@ Do you want to continue and disable the serial login console?' || return 1
(( $G_HW_ONBOARD_WIFI )) || { Unsupported_Input_Mode; return 1; }
# Remove dtoverlay
- sed -i '/^[[:blank:]]*dtoverlay=disable-wifi/d' /boot/config.txt
+ sed --follow-symlinks -i '/^[[:blank:]]*dtoverlay=disable-wifi/d' /boot/config.txt
elif [[ $INPUT_DEVICE_VALUE == 'onboard_disable' ]]; then
@@ -1542,7 +1542,7 @@ Do you want to continue and disable the serial login console?' || return 1
# - RPi
elif (( $G_HW_MODEL < 10 ))
then
- grep -q "console=$INPUT_ADDITIONAL" /boot/cmdline.txt || sed -i "/root=/s/$/ console=$INPUT_ADDITIONAL,115200/" /boot/cmdline.txt
+ grep -q "console=$INPUT_ADDITIONAL" /boot/cmdline.txt || sed --follow-symlinks -i "/root=/s/$/ console=$INPUT_ADDITIONAL,115200/" /boot/cmdline.txt
# - Odroid C1/C2 legacy
elif [[ $G_HW_MODEL == 1[02] && -f '/boot/boot.ini' ]]
@@ -1578,7 +1578,7 @@ $(sed -n '/^ExecStart=/s/ 115200/ 1500000,115200/p' '/lib/systemd/system/serial-
_EOF_
G_EXEC systemctl daemon-reload
fi
- (( $DIETPIENV )) && ! grep -q "^consoleargs=.*console=$INPUT_ADDITIONAL" "$FP_UENV" && sed -i "/^consoleargs=/s/[[:blank:]]*$/ console=$INPUT_ADDITIONAL,$baudrate/" "$FP_UENV"
+ (( $DIETPIENV )) && ! grep -q "^consoleargs=.*console=$INPUT_ADDITIONAL" "$FP_UENV" && sed --follow-symlinks -i "/^consoleargs=/s/[[:blank:]]*$/ console=$INPUT_ADDITIONAL,$baudrate/" "$FP_UENV"
# - Armbian: armbianEnv.txt only allows to toggle a fixed serial console depending on device
elif (( $ARMBIAN )) && grep -q "console=$INPUT_ADDITIONAL" /boot/boot.*
@@ -1637,17 +1637,17 @@ _EOF_
# - RPi
if (( $G_HW_MODEL < 10 ))
then
- sed -Ei "/root=/s/[[:blank:]]*console=${INPUT_ADDITIONAL}[^[:blank:]]*([[:blank:]]*$)?//g" /boot/cmdline.txt
+ sed --follow-symlinks -Ei "/root=/s/[[:blank:]]*console=${INPUT_ADDITIONAL}[^[:blank:]]*([[:blank:]]*$)?//g" /boot/cmdline.txt
# - Odroid C1/C2/XU4 legacy
elif [[ $G_HW_MODEL -le 12 && -f '/boot/boot.ini' ]]
then
- sed -i "s/[[:blank:]]*console=${INPUT_ADDITIONAL}[^\"[:blank:]]*//g" /boot/boot.ini
+ sed --follow-symlinks -i "s/[[:blank:]]*console=${INPUT_ADDITIONAL}[^\"[:blank:]]*//g" /boot/boot.ini
# - dietpiEnv.txt, Quartz64, NanoPi R5S, NanoPi R6S
elif (( $DIETPIENV || $G_HW_MODEL == 49 || $G_HW_MODEL == 76 || $G_HW_MODEL == 79 ))
then
- (( $DIETPIENV )) && grep -q "^consoleargs=.*console=$INPUT_ADDITIONAL" "$FP_UENV" && sed -Ei -e "/^consoleargs=/s/[[:blank:]]*console=${INPUT_ADDITIONAL}[^[:blank:]]*([[:blank:]]*$)?//g" -e 's/^consoleargs=[[:blank:]]+/consoleargs=/' "$FP_UENV"
+ (( $DIETPIENV )) && grep -q "^consoleargs=.*console=$INPUT_ADDITIONAL" "$FP_UENV" && sed --follow-symlinks -Ei -e "/^consoleargs=/s/[[:blank:]]*console=${INPUT_ADDITIONAL}[^[:blank:]]*([[:blank:]]*$)?//g" -e 's/^consoleargs=[[:blank:]]+/consoleargs=/' "$FP_UENV"
[[ -f /etc/systemd/system/serial-getty@$INPUT_ADDITIONAL.service.d/dietpi-baudrate.conf ]] && G_EXEC rm "/etc/systemd/system/serial-getty@$INPUT_ADDITIONAL.service.d/dietpi-baudrate.conf"
[[ -d /etc/systemd/system/serial-getty@$INPUT_ADDITIONAL.service.d ]] && G_EXEC rmdir --ignore-fail-on-non-empty "/etc/systemd/system/serial-getty@$INPUT_ADDITIONAL.service.d"
@@ -1764,7 +1764,7 @@ _EOF_
Soundcard_Reset_RPi()
{
# Remove device tree overlays which disable HDMI audio and 3.5mm jack and those for known sound card, disable I2S and HDMI drive
- G_EXEC sed -Ei -e '/^[[:blank:]]*(dtoverlay=(allo-|applepi-dac|dionaudio-|googlevoicehat-soundcard|hifiberry-|i-sabre-q2m|iqaudio-|justboom-|rpi-dac)|dtparam=i2s)/d' -e 's/^[[:blank:]]*(hdmi_drive(:[01])?=.*$)/#\1/' /boot/config.txt
+ G_EXEC sed --follow-symlinks -Ei -e '/^[[:blank:]]*(dtoverlay=(allo-|applepi-dac|dionaudio-|googlevoicehat-soundcard|hifiberry-|i-sabre-q2m|iqaudio-|justboom-|rpi-dac)|dtparam=i2s)/d' -e 's/^[[:blank:]]*(hdmi_drive(:[01])?=.*$)/#\1/' /boot/config.txt
# Disable onboard sound
G_CONFIG_INJECT 'dtparam=audio=' 'dtparam=audio=off' /boot/config.txt
@@ -1773,11 +1773,11 @@ _EOF_
G_EXEC eval 'echo '\''blacklist snd_bcm2835'\'' > /etc/modprobe.d/dietpi-disable_rpi_audio.conf'
# Remove kernel module options
- G_EXEC sed -Ei '/root=/s/[[:blank:]]*snd_bcm2835.enable_[^[:blank:]]*([[:blank:]]*$)?//g' /boot/cmdline.txt
+ G_EXEC sed --follow-symlinks -Ei '/root=/s/[[:blank:]]*snd_bcm2835.enable_[^[:blank:]]*([[:blank:]]*$)?//g' /boot/cmdline.txt
# Disable full KMS HDMI audio
local kms=$(grep -Em1 '^[[:blank:]]*dtoverlay=vc4-kms-v3d(-pi4)?(,|$)' /boot/config.txt)
- [[ $kms && ! $kms =~ ',noaudio'(,|$) ]] && G_EXEC sed -Ei '/^[[:blank:]]*dtoverlay=vc4-kms-v3d(-pi4)?(,|$)/s/$/,noaudio/' /boot/config.txt
+ [[ $kms && ! $kms =~ ',noaudio'(,|$) ]] && G_EXEC sed --follow-symlinks -Ei '/^[[:blank:]]*dtoverlay=vc4-kms-v3d(-pi4)?(,|$)/s/$/,noaudio/' /boot/config.txt
# Use "auto" as default
[[ $INPUT_DEVICE_VALUE == 'default' ]] && INPUT_DEVICE_VALUE='rpi-bcm2835-auto'
@@ -1797,7 +1797,7 @@ _EOF_
[[ -d '/etc/systemd/system/odroid-hifishield2.service.d' ]] && G_EXEC rm -R /etc/systemd/system/odroid-hifishield2.service.d
# HiFi Shield Plus and 2 kernel modules
- G_EXEC sed -Ei '/^[[:blank:]]*snd-soc-(odroid-dac|pcm51)/d' /etc/modules
+ G_EXEC sed --follow-symlinks -Ei '/^[[:blank:]]*snd-soc-(odroid-dac|pcm51)/d' /etc/modules
}
Soundcard_Reset_OdroidN2()
@@ -1818,10 +1818,10 @@ _EOF_
Soundcard_Reset_SparkySBC()
{
# Allo Piano DAC
- G_EXEC sed -i '/^[[:blank:]]*snd-soc-allo-piano-dac/d' /etc/modules
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*snd-soc-allo-piano-dac/d' /etc/modules
# Disable USB 1.1 compat
- G_EXEC sed -i 's/aotg.aotg1_speed=1/aotg.aotg1_speed=0/' "$FP_UENV"
+ G_EXEC sed --follow-symlinks -i 's/aotg.aotg1_speed=1/aotg.aotg1_speed=0/' "$FP_UENV"
# Set HDMI
SOUNDCARD_TARGET_DEVICE=1
@@ -1842,7 +1842,7 @@ _EOF_
if (( $ARMBIAN || $DIETPIENV ))
then
# Remove analogue 3.5mm jack device tree overlay
- grep -Eq '^[[:blank:]]*overlays=(.*[[:blank:]])?analog-codec([[:blank:]]|$)' "$FP_UENV" && G_EXEC sed -Ei '/^[[:blank:]]*overlays=/s/[[:blank:]]*analog-codec([[:blank:]]*$)?//g' "$FP_UENV"
+ grep -Eq '^[[:blank:]]*overlays=(.*[[:blank:]])?analog-codec([[:blank:]]|$)' "$FP_UENV" && G_EXEC sed --follow-symlinks -Ei '/^[[:blank:]]*overlays=/s/[[:blank:]]*analog-codec([[:blank:]]*$)?//g' "$FP_UENV"
# Legacy
else
@@ -1914,7 +1914,7 @@ _EOF_
if (( $G_HW_MODEL == 70 )); then
# USB 1.1 compat mode
- [[ $INPUT_DEVICE_VALUE == *'1.1' ]] && G_EXEC sed -i 's/aotg\.aotg1_speed=0/aotg.aotg1_speed=1/' "$FP_UENV"
+ [[ $INPUT_DEVICE_VALUE == *'1.1' ]] && G_EXEC sed --follow-symlinks -i 's/aotg\.aotg1_speed=0/aotg.aotg1_speed=1/' "$FP_UENV"
# Odroid C2: https://github.com/MichaIng/DietPi/issues/2101
elif (( $G_HW_MODEL == 12 )) && grep -q '^[[:blank:]]*63:.*dwc_otg' /proc/interrupts; then
@@ -2009,13 +2009,13 @@ _EOF_
if [[ $INPUT_DEVICE_VALUE == *'3.5mm' ]]
then
# Disable HDMI audio via kernel module option
- G_EXEC sed -i '/root=/s/$/ snd_bcm2835.enable_hdmi=0/' /boot/cmdline.txt
+ G_EXEC sed --follow-symlinks -i '/root=/s/$/ snd_bcm2835.enable_hdmi=0/' /boot/cmdline.txt
# Force HDMI output?
elif [[ $INPUT_DEVICE_VALUE == *'hdmi' ]]
then
# Disable headphones via kernel module option
- G_EXEC sed -i '/root=/s/$/ snd_bcm2835.enable_headphones=0/' /boot/cmdline.txt
+ G_EXEC sed --follow-symlinks -i '/root=/s/$/ snd_bcm2835.enable_headphones=0/' /boot/cmdline.txt
# Force HDMI audio via config.txt option
G_CONFIG_INJECT 'hdmi_drive=' 'hdmi_drive=2' /boot/config.txt
(( $G_HW_MODEL == 4 )) && G_CONFIG_INJECT 'hdmi_drive:1=' 'hdmi_drive:1=2' /boot/config.txt 'hdmi_drive='
@@ -2025,7 +2025,7 @@ _EOF_
if [[ $INPUT_DEVICE_VALUE != *'3.5mm' ]]
then
local kms=$(grep -Em1 '^[[:blank:]]*dtoverlay=vc4-kms-v3d(-pi4)?,(noaudio|.+,noaudio)(,|$)' /boot/config.txt)
- [[ $kms ]] && G_EXEC sed -Ei '/^[[:blank:]]*dtoverlay=vc4-kms-v3d(-pi4)?,/s/,noaudio(,|$)/\1/' /boot/config.txt
+ [[ $kms ]] && G_EXEC sed --follow-symlinks -Ei '/^[[:blank:]]*dtoverlay=vc4-kms-v3d(-pi4)?,/s/,noaudio(,|$)/\1/' /boot/config.txt
fi
;;
@@ -2172,7 +2172,7 @@ _EOF_
if (( $ARMBIAN || $DIETPIENV ))
then
# Add analogue 3.5mm jack device tree overlay
- G_EXEC sed -i '/^[[:blank:]]*overlays=/s/[[:blank:]]*$/ analog-codec/' "$FP_UENV"
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*overlays=/s/[[:blank:]]*$/ analog-codec/' "$FP_UENV"
# Legacy
else
@@ -2381,16 +2381,16 @@ _EOF_
[[ $INPUT_DEVICE_VALUE == 'enable' ]] || { Unknown_Input_Mode; return 1; }
- [[ -e '/dev/virtio-ports/org.qemu.guest_agent.0' ]] || { G_DIETPI-NOTIFY 2 'No QEMU Guest Agent node detected, skipping daemon installation ...'; return 1; } # Exit if node is missing
+ # shellcheck disable=SC2015
+ modprobe 'virtio_console' &> /dev/null && [[ -e '/dev/virtio-ports/org.qemu.guest_agent.0' ]] || { G_DIETPI-NOTIFY 2 'No QEMU Guest Agent node detected, skipping daemon installation ...'; return 1; } # Exit if node is missing
+
+ # Enable logind for required ACPI functionality
+ G_AG_CHECK_INSTALL_PREREQ dbus
+ G_EXEC systemctl unmask systemd-logind
+ G_EXEC systemctl start systemd-logind
- # Bullseye: logind and hence dbus required
- if (( $G_DISTRO == 6 ))
- then
- G_AG_CHECK_INSTALL_PREREQ dbus
- G_EXEC systemctl unmask systemd-logind
- G_EXEC systemctl start systemd-logind
- fi
G_AG_CHECK_INSTALL_PREREQ qemu-guest-agent
+ G_EXEC systemctl start qemu-guest-agent
}
#/////////////////////////////////////////////////////////////////////////////////////
diff --git a/dietpi/func/dietpi-set_software b/dietpi/func/dietpi-set_software
index c2c9baa77a..4198589182 100755
--- a/dietpi/func/dietpi-set_software
+++ b/dietpi/func/dietpi-set_software
@@ -129,10 +129,10 @@ deb https://deb.debian.org/debian-security/ $G_DISTRO_NAME/updates main contrib
deb $INPUT_MODE_VALUE $G_DISTRO_NAME-backports main contrib non-free' > /etc/apt/sources.list"
# Since Bullseye, dir structure has changed: https://deb.debian.org/debian-security/dists/
- (( $G_DISTRO > 5 )) && G_EXEC sed -i '3s|/updates|-security|' /etc/apt/sources.list
+ (( $G_DISTRO > 5 )) && G_EXEC sed --follow-symlinks -i '3s|/updates|-security|' /etc/apt/sources.list
# Since Bookworm, non-free firmware has been moved to new component: https://deb.debian.org/debian/pool/
- (( $G_DISTRO > 6 )) && G_EXEC sed -i 's/$/ non-free-firmware/' /etc/apt/sources.list
+ (( $G_DISTRO > 6 )) && G_EXEC sed --follow-symlinks -i 's/$/ non-free-firmware/' /etc/apt/sources.list
# Update dietpi.txt entry
G_CONFIG_INJECT 'CONFIG_APT_DEBIAN_MIRROR=' "CONFIG_APT_DEBIAN_MIRROR=$INPUT_MODE_VALUE" /boot/dietpi.txt
@@ -178,12 +178,12 @@ deb $INPUT_MODE_VALUE $G_DISTRO_NAME-backports main contrib non-free' > /etc/apt
G_CONFIG_INJECT 'Dir::Cache[[:blank:]]' 'Dir::Cache "/tmp/apt";' "$fp"
GCI_PRESERVE=1 G_CONFIG_INJECT 'Dir::Cache::archives[[:blank:]]' 'Dir::Cache::archives "/var/cache/apt/archives";' "$fp"
- sed -i '/pkgcache[[:blank:]]/d' "$fp"
+ sed --follow-symlinks -i '/pkgcache[[:blank:]]/d' "$fp"
[[ -d '/var/cache/apt' ]] && G_EXEC rm -R /var/cache/apt
elif [[ $INPUT_ADDITIONAL_1 == 'disk' ]]; then
- sed -i '/^Dir::Cache/d' "$fp"
+ sed --follow-symlinks -i '/^Dir::Cache/d' "$fp"
[[ -d '/tmp/apt' ]] && G_EXEC rm -R /tmp/apt
fi
@@ -199,7 +199,7 @@ deb $INPUT_MODE_VALUE $G_DISTRO_NAME-backports main contrib non-free' > /etc/apt
elif [[ $INPUT_ADDITIONAL_1 == 'disk' ]]; then
- sed -i '/^Dir::State/d' "$fp"
+ sed --follow-symlinks -i '/^Dir::State/d' "$fp"
[[ -d '/tmp/apt' ]] && G_EXEC rm -R /tmp/apt
fi
@@ -354,20 +354,20 @@ deb $INPUT_MODE_VALUE $G_DISTRO_NAME-backports main contrib non-free' > /etc/apt
if [[ $INPUT_MODE_VALUE == 'eth_dhcp' ]]; then
G_CONFIG_INJECT 'iface eth' 'iface eth0 inet dhcp' /etc/network/interfaces
- sed -i '0,/^.*dns-nameservers[[:blank:]].*$/s//#dns-nameservers 9.9.9.9 149.112.112.112/' /etc/network/interfaces
+ sed --follow-symlinks -i '0,/^.*dns-nameservers[[:blank:]].*$/s//#dns-nameservers 9.9.9.9 149.112.112.112/' /etc/network/interfaces
elif [[ $INPUT_MODE_VALUE == 'eth_static' ]]; then
G_CONFIG_INJECT 'iface eth' 'iface eth0 inet static' /etc/network/interfaces
- [[ $INPUT_ADDITIONAL_1 ]] && sed -i "0,\|^.*address[[:blank:]].*\$|s||address $INPUT_ADDITIONAL_1|" /etc/network/interfaces
- [[ $INPUT_ADDITIONAL_2 ]] && sed -i "0,\|^.*gateway[[:blank:]].*\$|s||gateway $INPUT_ADDITIONAL_2|" /etc/network/interfaces
- [[ $INPUT_ADDITIONAL_3 ]] && sed -i "0,\|^.*netmask[[:blank:]].*\$|s||netmask $INPUT_ADDITIONAL_3|" /etc/network/interfaces
+ [[ $INPUT_ADDITIONAL_1 ]] && sed --follow-symlinks -i "0,\|^.*address[[:blank:]].*\$|s||address $INPUT_ADDITIONAL_1|" /etc/network/interfaces
+ [[ $INPUT_ADDITIONAL_2 ]] && sed --follow-symlinks -i "0,\|^.*gateway[[:blank:]].*\$|s||gateway $INPUT_ADDITIONAL_2|" /etc/network/interfaces
+ [[ $INPUT_ADDITIONAL_3 ]] && sed --follow-symlinks -i "0,\|^.*netmask[[:blank:]].*\$|s||netmask $INPUT_ADDITIONAL_3|" /etc/network/interfaces
[[ $INPUT_ADDITIONAL_4 ]] || return 0
if command -v resolvconf > /dev/null
then
- sed -i "0,\|^.*dns-nameservers[[:blank:]].*\$|s||dns-nameservers $INPUT_ADDITIONAL_4|" /etc/network/interfaces
+ sed --follow-symlinks -i "0,\|^.*dns-nameservers[[:blank:]].*\$|s||dns-nameservers $INPUT_ADDITIONAL_4|" /etc/network/interfaces
else
- sed -i "0,\|^.*dns-nameservers[[:blank:]].*\$|s||#dns-nameservers $INPUT_ADDITIONAL_4|" /etc/network/interfaces
+ sed --follow-symlinks -i "0,\|^.*dns-nameservers[[:blank:]].*\$|s||#dns-nameservers $INPUT_ADDITIONAL_4|" /etc/network/interfaces
> /etc/resolv.conf
local i
for i in $INPUT_ADDITIONAL_4; do echo "nameserver $i" >> /etc/resolv.conf; done
@@ -444,7 +444,7 @@ deb $INPUT_MODE_VALUE $G_DISTRO_NAME-backports main contrib non-free' > /etc/apt
G_EXEC_DESC='Downloading current dietpi.txt' G_EXEC curl -sSfL "https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH/dietpi.txt" -o dietpi.txt_patch
# Remove empty and commented lines, and do not re-add the password setting, which is intended to stay commented after first boot
- sed -Ei '/^[[:blank:]]*(#|$|AUTO_SETUP_GLOBAL_PASSWORD=)/d' dietpi.txt_patch
+ sed --follow-symlinks -Ei '/^[[:blank:]]*(#|$|AUTO_SETUP_GLOBAL_PASSWORD=)/d' dietpi.txt_patch
local line entry value
while read -r line
@@ -504,7 +504,7 @@ deb $INPUT_MODE_VALUE $G_DISTRO_NAME-backports main contrib non-free' > /etc/apt
if [[ $pw_dietpi_software ]]
then
# Remove plain text password from dietpi.txt
- grep -q '^[[:blank:]]*AUTO_SETUP_GLOBAL_PASSWORD=' /boot/dietpi.txt && G_EXEC sed -i '/^[[:blank:]]*AUTO_SETUP_GLOBAL_PASSWORD=/c\#AUTO_SETUP_GLOBAL_PASSWORD= # Password has been encrypted and saved to rootfs' /boot/dietpi.txt
+ grep -q '^[[:blank:]]*AUTO_SETUP_GLOBAL_PASSWORD=' /boot/dietpi.txt && G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*AUTO_SETUP_GLOBAL_PASSWORD=/c\#AUTO_SETUP_GLOBAL_PASSWORD= # Password has been encrypted and saved to rootfs' /boot/dietpi.txt
[[ -d '/var/lib/dietpi/dietpi-software' ]] || G_EXEC mkdir -p /var/lib/dietpi/dietpi-software # Should already exist, failsafe
diff --git a/dietpi/func/dietpi-set_swapfile b/dietpi/func/dietpi-set_swapfile
index 0709d1b21d..700175d0bc 100755
--- a/dietpi/func/dietpi-set_swapfile
+++ b/dietpi/func/dietpi-set_swapfile
@@ -84,7 +84,7 @@
G_DIETPI-NOTIFY 2 'Disabling and deleting all existing swap files'
(( $G_HW_MODEL == 75 )) || grep -zaq '^container=' /proc/1/environ || G_EXEC swapoff -a
rm -fv "${SWAP_FILES_ACTIVE[@]}"
- sed -i '/[[:blank:]]swap[[:blank:]]/d' /etc/fstab
+ sed --follow-symlinks -i '/[[:blank:]]swap[[:blank:]]/d' /etc/fstab
# zram-swap
[[ -f '/etc/modules-load.d/dietpi-zram-swap.conf' ]] && rm -v /etc/modules-load.d/dietpi-zram-swap.conf
[[ -f '/etc/udev/rules.d/98-dietpi-zram-swap.rules' ]] && rm -v /etc/udev/rules.d/98-dietpi-zram-swap.rules
diff --git a/dietpi/misc/dietpi-justboom b/dietpi/misc/dietpi-justboom
index 36494f79b0..4f3d5d3c3c 100755
--- a/dietpi/misc/dietpi-justboom
+++ b/dietpi/misc/dietpi-justboom
@@ -146,29 +146,29 @@ Please select a sound card via 'dietpi-config' or install ALSA, or ideally an au
if (( $MPD_INSTALLED )); then
# Output format: Apply only if any value is enforced
- G_EXEC sed -Ei '/^[[:blank:]]*type[[:blank:]]+"alsa"/,/^[[:blank:]]*}$/{/^[[:blank:]#]*format[[:blank:]]/d}' "$FP_MPD_CONF"
- [[ $OUTPUT_FREQ$OUTPUT_BITRATE$OUTPUT_CHANNELS == '***' ]] || G_EXEC sed -Ei "/^[[:blank:]]*type[[:blank:]]+\"alsa\"/a\ format \"$OUTPUT_FREQ:$OUTPUT_BITRATE:$OUTPUT_CHANNELS\"" "$FP_MPD_CONF"
+ G_EXEC sed --follow-symlinks -Ei '/^[[:blank:]]*type[[:blank:]]+"alsa"/,/^[[:blank:]]*}$/{/^[[:blank:]#]*format[[:blank:]]/d}' "$FP_MPD_CONF"
+ [[ $OUTPUT_FREQ$OUTPUT_BITRATE$OUTPUT_CHANNELS == '***' ]] || G_EXEC sed --follow-symlinks -Ei "/^[[:blank:]]*type[[:blank:]]+\"alsa\"/a\ format \"$OUTPUT_FREQ:$OUTPUT_BITRATE:$OUTPUT_CHANNELS\"" "$FP_MPD_CONF"
if (( $SOXR_ENABLED )); then
G_CONFIG_INJECT 'samplerate_converter[[:blank:]]' "samplerate_converter \"soxr $SOXR_QUALITY\"" "$FP_MPD_CONF"
if [[ $OUTPUT_FREQ$OUTPUT_BITRATE$OUTPUT_CHANNELS == '***' ]]
then
- G_EXEC sed -i '/audio_output_format[[:blank:]]/d' "$FP_MPD_CONF"
+ G_EXEC sed --follow-symlinks -i '/audio_output_format[[:blank:]]/d' "$FP_MPD_CONF"
else
G_CONFIG_INJECT 'audio_output_format[[:blank:]]' "audio_output_format \"$OUTPUT_FREQ:$OUTPUT_BITRATE:$OUTPUT_CHANNELS\"" "$FP_MPD_CONF"
fi
else
- G_EXEC sed -i '/samplerate_converter[[:blank:]]/d' "$FP_MPD_CONF"
- G_EXEC sed -i '/audio_output_format[[:blank:]]/d' "$FP_MPD_CONF"
+ G_EXEC sed --follow-symlinks -i '/samplerate_converter[[:blank:]]/d' "$FP_MPD_CONF"
+ G_EXEC sed --follow-symlinks -i '/audio_output_format[[:blank:]]/d' "$FP_MPD_CONF"
fi
# Buffer
if [[ $MPD_AUDIO_BUFFER_SIZE == '*' ]]
then
- G_EXEC sed -i '/audio_buffer_size[[:blank:]]/d' "$FP_MPD_CONF"
+ G_EXEC sed --follow-symlinks -i '/audio_buffer_size[[:blank:]]/d' "$FP_MPD_CONF"
else
G_CONFIG_INJECT 'audio_buffer_size[[:blank:]]' "audio_buffer_size \"$MPD_AUDIO_BUFFER_SIZE\"" "$FP_MPD_CONF"
fi
diff --git a/dietpi/patch_file b/dietpi/patch_file
index 3d790605fc..ed32c869e8 100755
--- a/dietpi/patch_file
+++ b/dietpi/patch_file
@@ -28,7 +28,7 @@
# Disable and remove service and mount
systemctl disable dietpi-ramdisk
umount -Rl /DietPi
- sed -i '/[[:blank:]]\/DietPi[[:blank:]]/d' /etc/fstab
+ sed --follow-symlinks -i '/[[:blank:]]\/DietPi[[:blank:]]/d' /etc/fstab
rm -Rf /DietPi /boot/dietpi/{,func/}dietpi-ramdisk /etc/systemd/system/dietpi-ramdisk.service
# Create symlink for backwards compatibility
@@ -42,11 +42,11 @@
[[ -d '/run/dietpi' ]] || { mkdir -p /run/dietpi; chmod 777 /run/dietpi; }
# Pre-v6.22: Update Git owner due to official lead transfer from Fourdee to MichaIng: https://github.com/MichaIng/DietPi/issues/2589
- grep -q '^[[:blank:]]*DEV_GITOWNER=Fourdee' /boot/dietpi.txt && sed -i '/^[[:blank:]]*DEV_GITOWNER=/c\DEV_GITOWNER=MichaIng' /boot/dietpi.txt
+ grep -q '^[[:blank:]]*DEV_GITOWNER=Fourdee' /boot/dietpi.txt && sed --follow-symlinks -i '/^[[:blank:]]*DEV_GITOWNER=/c\DEV_GITOWNER=MichaIng' /boot/dietpi.txt
if [[ -f '/boot/dietpi/.version' ]] && grep -q '^G_GITOWNER=Fourdee' /boot/dietpi/.version; then
- sed -i '/^G_GITOWNER=/c\G_GITOWNER=MichaIng' /boot/dietpi/.version
+ sed --follow-symlinks -i '/^G_GITOWNER=/c\G_GITOWNER=MichaIng' /boot/dietpi/.version
# Pre-v6.17: New ".version" system
# - As loaded pre-v6.17 dietpi-update will overwrite ".version" to previous 2/3 line system, we need to rerun dietpi-update.
@@ -242,7 +242,7 @@ _EOF_
#-------------------------------------------------------------------------------
# Fix rare WiFi interface start issue: https://github.com/MichaIng/DietPi/issues/2074
# shellcheck disable=SC2016
- [[ -f '/etc/network/if-pre-up.d/wireless-tools' ]] && sed -i '\|^[[:blank:]]ifconfig "$IFACE" up$|c\\t/sbin/ip link set dev "$IFACE" up' /etc/network/if-pre-up.d/wireless-tools
+ [[ -f '/etc/network/if-pre-up.d/wireless-tools' ]] && sed --follow-symlinks -i '\|^[[:blank:]]ifconfig "$IFACE" up$|c\\t/sbin/ip link set dev "$IFACE" up' /etc/network/if-pre-up.d/wireless-tools
#-------------------------------------------------------------------------------
elif (( $G_DIETPI_VERSION_SUB == 16 )); then
@@ -253,8 +253,8 @@ _EOF_
# - On v6.15 this was missing in PREP, thus images created meanwhile, so redo with v6.17 patch:
[[ -d '/root/.ssh' ]] || G_EXEC mkdir /root/.ssh
[[ -f '/root/.ssh/known_hosts' ]] || > /root/.ssh/known_hosts
- G_EXEC sed -i '/^dietpi.com/d' /root/.ssh/known_hosts
- G_EXEC sed -i '/^185.101.93.93/d' /root/.ssh/known_hosts
+ G_EXEC sed --follow-symlinks -i '/^dietpi.com/d' /root/.ssh/known_hosts
+ G_EXEC sed --follow-symlinks -i '/^185.101.93.93/d' /root/.ssh/known_hosts
if (( $G_DISTRO < 7 ))
then
G_CONFIG_INJECT '\[?ssh.dietpi.com(]:29248)?[[:blank:]]' '[ssh.dietpi.com]:29248 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDE6aw3r6aOEqendNu376iiCHr9tGBIWPgfrLkzjXjEsHGyVSUFNnZt6pftrDeK7UX+qX4FxOwQlugG4fymOHbimRCFiv6cf7VpYg1Ednquq9TLb7/cIIbX8a6AuRmX4fjdGuqwmBq3OG7ZksFcYEFKt5U4mAJIaL8hXiM2iXjgY02LqiQY/QWATsHI4ie9ZOnwrQE+Rr6mASN1BVFuIgyHIbwX54jsFSnZ/7CdBMkuAd9B8JkxppWVYpYIFHE9oWNfjh/epdK8yv9Oo6r0w5Rb+4qaAc5g+RAaknHeV6Gp75d2lxBdCm5XknKKbGma2+/DfoE8WZTSgzXrYcRlStYN' /root/.ssh/known_hosts
@@ -266,7 +266,7 @@ _EOF_
[[ $G_HW_MODEL == 43 && -f '/etc/X11/xorg.conf.d/20-armsoc.conf' ]] && G_EXEC rm /etc/X11/xorg.conf.d/20-armsoc.conf
#-------------------------------------------------------------------------------
# Convert and remove old dietpi.txt entry (this includes the comment)
- grep -q 'CONFIG_PREFER_IPVERSION' /boot/dietpi.txt && G_EXEC sed -i '/CONFIG_PREFER_IPVERSION/d' /boot/dietpi.txt
+ grep -q 'CONFIG_PREFER_IPVERSION' /boot/dietpi.txt && G_EXEC sed --follow-symlinks -i '/CONFIG_PREFER_IPVERSION/d' /boot/dietpi.txt
#-------------------------------------------------------------------------------
# Update IPv6 handling: https://github.com/MichaIng/DietPi/issues/2027
# - Advice user to re-enable IPv6 on kernel level
@@ -290,7 +290,7 @@ We strongly recommend you select "0 : Re-enable IPv6 on kernel level". By doing
local i
for i in /etc/modprobe.d/*
do
- [[ -f $i ]] && sed -i 's/^[[:blank:]]*blacklist[[:blank:]]ipv6/#&/' "$i"
+ [[ -f $i ]] && sed --follow-symlinks -i 's/^[[:blank:]]*blacklist[[:blank:]]ipv6/#&/' "$i"
done
# Remove boot cmd line entry
@@ -298,20 +298,20 @@ We strongly recommend you select "0 : Re-enable IPv6 on kernel level". By doing
if (( $G_HW_MODEL < 10 )); then
# Separately remove with leading and trailing blank, since we don't know, if it's first or last argument and we must not remove both blanks
- sed -i '/^[[:blank:]]*root=/s/[[:blank:]]ipv6.disable=1//' /boot/cmdline.txt
- sed -i '/^[[:blank:]]*root=/s/ipv6.disable=1[[:blank:]]//' /boot/cmdline.txt
+ sed --follow-symlinks -i '/^[[:blank:]]*root=/s/[[:blank:]]ipv6.disable=1//' /boot/cmdline.txt
+ sed --follow-symlinks -i '/^[[:blank:]]*root=/s/ipv6.disable=1[[:blank:]]//' /boot/cmdline.txt
# - Odroid
elif (( $G_HW_MODEL < 20 )); then
- sed -i '/^[[:blank:]]*setenv boot/s/[[:blank:]]ipv6.disable=1//' /boot/boot.ini
- sed -i '/^[[:blank:]]*setenv boot/s/ipv6.disable=1[[:blank:]]//' /boot/boot.ini
+ sed --follow-symlinks -i '/^[[:blank:]]*setenv boot/s/[[:blank:]]ipv6.disable=1//' /boot/boot.ini
+ sed --follow-symlinks -i '/^[[:blank:]]*setenv boot/s/ipv6.disable=1[[:blank:]]//' /boot/boot.ini
# - x86
elif (( $G_HW_ARCH == 10 )); then
- sed -i '/^[[:blank:]]*GRUB_CMDLINE_LINUX_DEFAULT="/s/[[:blank:]]ipv6.disable=1//' /etc/default/grub
- sed -i '/^[[:blank:]]*GRUB_CMDLINE_LINUX_DEFAULT="/s/ipv6.disable=1[[:blank:]]//' /etc/default/grub
+ sed --follow-symlinks -i '/^[[:blank:]]*GRUB_CMDLINE_LINUX_DEFAULT="/s/[[:blank:]]ipv6.disable=1//' /etc/default/grub
+ sed --follow-symlinks -i '/^[[:blank:]]*GRUB_CMDLINE_LINUX_DEFAULT="/s/ipv6.disable=1[[:blank:]]//' /etc/default/grub
update-grub
fi
@@ -353,7 +353,7 @@ We strongly recommend you select "0 : Re-enable IPv6 on kernel level". By doing
G_EXEC rm -Rf /boot/dietpi/{.patch_emr,dietpi-{obtain_hw_model,cpu_set,ramlog,logclear,banner}}
#-------------------------------------------------------------------------------
# Remove www-data under sudo without PW: https://github.com/MichaIng/DietPi/issues/2121
- G_EXEC sed -i '/^www-data ALL=NOPASSWD: ALL/d' /etc/sudoers
+ G_EXEC sed --follow-symlinks -i '/^www-data ALL=NOPASSWD: ALL/d' /etc/sudoers
#-------------------------------------------------------------------------------
elif (( $G_DIETPI_VERSION_SUB == 17 )); then
@@ -550,15 +550,15 @@ We strongly recommend you select "0 : Re-enable IPv6 on kernel level". By doing
(( $G_DIETPI_INSTALL_STAGE == 2 )) && grep -q '^aSOFTWARE_INSTALL_STATE\[168\]=2' /boot/dietpi/.installed && G_CONFIG_INJECT 'DAEMON_ARGS=' "DAEMON_ARGS='-c /etc/turnserver.conf -o -l stdout --no-stdout-log --simple-log'" /etc/default/coturn
#-------------------------------------------------------------------------------
# Remove nofail and x-systemd.automount option from /boot mount: https://github.com/MichaIng/DietPi/pull/2357#issuecomment-449177715
- G_EXEC sed -i '\|[[:blank:]]/boot[[:blank:]]|s|,x-systemd.automount||' /etc/fstab
- G_EXEC sed -i '\|[[:blank:]]/boot[[:blank:]]|s|,nofail||' /etc/fstab
+ G_EXEC sed --follow-symlinks -i '\|[[:blank:]]/boot[[:blank:]]|s|,x-systemd.automount||' /etc/fstab
+ G_EXEC sed --follow-symlinks -i '\|[[:blank:]]/boot[[:blank:]]|s|,nofail||' /etc/fstab
#-------------------------------------------------------------------------------
# Re-enable owncloud/Nextcloud Apache configs, to fix faulty v6.19 installs: https://github.com/MichaIng/DietPi/pull/2361/commits/e33ca150cf29a4f278f5df2defc495053700a91e
[[ -f '/etc/apache2/sites-available/dietpi-owncloud.conf' ]] && G_EXEC a2ensite dietpi-owncloud
[[ -f '/etc/apache2/sites-available/dietpi-nextcloud.conf' ]] && G_EXEC a2ensite dietpi-nextcloud
#-------------------------------------------------------------------------------
# Clear install state for Medusa
- [[ $G_DIETPI_INSTALL_STAGE == 2 && ! -d '/mnt/dietpi_userdata/medusa' ]] && sed -i '/^aSOFTWARE_INSTALL_STATE\[116\]=/d' /boot/dietpi/.installed
+ [[ $G_DIETPI_INSTALL_STAGE == 2 && ! -d '/mnt/dietpi_userdata/medusa' ]] && sed --follow-symlinks -i '/^aSOFTWARE_INSTALL_STATE\[116\]=/d' /boot/dietpi/.installed
# - Inform user about SickRage being replaced by Medusa
if [[ -d '/etc/sickrage' || -d '/mnt/dietpi_userdata/sickrage' ]]; then
@@ -579,16 +579,16 @@ Also have a look at "Sonarr", another alternative TV show manager, available for
if (( $G_HW_MODEL < 10 )); then
# Remove/Replace obsolete config.txt settings
- G_EXEC sed -i 's/display_rotate/display_hdmi_rotate/' /boot/config.txt
- G_EXEC sed -i '/disable_pvt/d' /boot/config.txt
- G_EXEC sed -i '/avoid_pwm_pll/d' /boot/config.txt
+ G_EXEC sed --follow-symlinks -i 's/display_rotate/display_hdmi_rotate/' /boot/config.txt
+ G_EXEC sed --follow-symlinks -i '/disable_pvt/d' /boot/config.txt
+ G_EXEC sed --follow-symlinks -i '/avoid_pwm_pll/d' /boot/config.txt
# Remove doubled AUTO_SETUP_HEADLESS entry, introduced with Beta v6.20.2
if (( $(grep -c '^[[:blank:]]*AUTO_SETUP_HEADLESS=' /boot/dietpi.txt) > 1 )); then
# Last match is the correct one, added by "dietpi-set_hardware headless 1"
local current=$(grep '^[[:blank:]]*AUTO_SETUP_HEADLESS=' /boot/dietpi.txt | tail -1 | sed 's/^[^=]*=//')
- G_EXEC sed -i '/^[[:blank:]]*AUTO_SETUP_HEADLESS=/d' /boot/dietpi.txt
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*AUTO_SETUP_HEADLESS=/d' /boot/dietpi.txt
G_EXEC eval "echo 'AUTO_SETUP_HEADLESS=$current' >> /boot/dietpi.txt"
fi
@@ -597,7 +597,7 @@ Also have a look at "Sonarr", another alternative TV show manager, available for
grep -q '^[[:blank:]]*CONFIG_HDMI_OUTPUT=0' /boot/dietpi.txt && /boot/dietpi/func/dietpi-set_hardware headless 1
# Renamed to: AUTO_SETUP_HEADLESS (added by verify_dietpi.txt automatically)
- G_EXEC sed -i '/CONFIG_HDMI_OUTPUT/d' /boot/config.txt
+ G_EXEC sed --follow-symlinks -i '/CONFIG_HDMI_OUTPUT/d' /boot/config.txt
fi
#-------------------------------------------------------------------------------
@@ -605,7 +605,7 @@ Also have a look at "Sonarr", another alternative TV show manager, available for
G_AGI procps
#-------------------------------------------------------------------------------
# Remove wireless-power setting from /etc/network/interfaces, if not supported by adapter/firmware: https://github.com/MichaIng/DietPi/issues/2198
- iwconfig "$(G_GET_NET -q -t wlan iface)" power off &> /dev/null || sed -i '/^wireless-power/d' /etc/network/interfaces
+ iwconfig "$(G_GET_NET -q -t wlan iface)" power off &> /dev/null || sed --follow-symlinks -i '/^wireless-power/d' /etc/network/interfaces
#-------------------------------------------------------------------------------
# Remove Armbian banner/profiles left on ASUS TB image
G_EXEC rm -f /etc/profile.d/armbian-*
@@ -627,7 +627,7 @@ Also have a look at "Sonarr", another alternative TV show manager, available for
#-------------------------------------------------------------------------------
# Redo our /etc/bash.bashrc entry, user confirmed 4 entries: https://github.com/MichaIng/DietPi/issues/2529
# As well allow ".bash" file ending and remove obsolete dietpi-*.sh scripts: https://github.com/MichaIng/DietPi/pull/2636
- G_EXEC sed -i '\#for i in /etc/bashrc#d' /etc/bash.bashrc
+ G_EXEC sed --follow-symlinks -i '\#for i in /etc/bashrc#d' /etc/bash.bashrc
# shellcheck disable=SC2016
G_CONFIG_INJECT '.*/etc/bashrc\.d/.*' 'for i in /etc/bashrc.d/*.sh /etc/bashrc.d/*.bash; do [ -r "$i" ] && . $i; done' /etc/bash.bashrc
G_EXEC rm -f /etc/bashrc.d/dietpi-*.sh
@@ -662,8 +662,8 @@ Do you still want to keep "p7zip-full"?'; then
# MPD: Fix permissions issue: https://github.com/MichaIng/DietPi/issues/2462
if [[ -f '/etc/mpd.conf' ]]; then
- G_EXEC sed -Ei '/^(user|group)[[:blank:]]/d' /etc/mpd.conf
- G_EXEC sed -i '/^Group=/d' /lib/systemd/system/mpd.service
+ G_EXEC sed --follow-symlinks -Ei '/^(user|group)[[:blank:]]/d' /etc/mpd.conf
+ G_EXEC sed --follow-symlinks -i '/^Group=/d' /lib/systemd/system/mpd.service
G_CONFIG_INJECT 'User=' 'User=mpd' /lib/systemd/system/mpd.service '\[Service\]'
G_CONFIG_INJECT 'PermissionsStartOnly=' 'PermissionsStartOnly=true' /lib/systemd/system/mpd.service '^User=mpd'
getent passwd mpd > /dev/null && G_EXEC usermod -aG audio,dietpi mpd
@@ -707,7 +707,7 @@ _EOF_
fi
#-------------------------------------------------------------------------------
# RPi | Remove "framebuffer_depth" handling: https://github.com/MichaIng/DietPi/pull/2635
- (( $G_HW_MODEL < 10 )) && G_EXEC sed -i '/framebuffer_depth/d' /boot/config.txt
+ (( $G_HW_MODEL < 10 )) && G_EXEC sed --follow-symlinks -i '/framebuffer_depth/d' /boot/config.txt
#-------------------------------------------------------------------------------
# Nextcloud: Add OCM/OCS provider redirects as this is checked and printed as warning on admin panel: https://github.com/MichaIng/DietPi/issues/2638
if [[ -f '/etc/apache2/sites-available/dietpi-nextcloud.conf' ]] &&
@@ -805,12 +805,12 @@ NB: When accessing "deluge-console" you need to do that as user "debian-deluged"
done
#-------------------------------------------------------------------------------
# Patch proxy settings changes: https://github.com/MichaIng/DietPi/pull/2716
- sed -i '/^[[:blank:]]*CONFIG_PROXY_ENABLED=/d' /boot/dietpi.txt
+ sed --follow-symlinks -i '/^[[:blank:]]*CONFIG_PROXY_ENABLED=/d' /boot/dietpi.txt
local proxy=''
if proxy=$(grep '^[[:blank:]]*export {http,https,ftp}_proxy=' /etc/bash.bashrc); then
[[ -f '/etc/bashrc.d/dietpi-proxy.sh' ]] || echo "$proxy" > /etc/bashrc.d/dietpi-proxy.sh
- G_EXEC sed -i '/^[[:blank:]]*export {http,https,ftp}_proxy=/d' /etc/bash.bashrc
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*export {http,https,ftp}_proxy=/d' /etc/bash.bashrc
fi
#-------------------------------------------------------------------------------
@@ -832,11 +832,11 @@ Further info and usage: https://dietpi.com/forum/t/dietpi-arr-to-ram-link-sonarr
if [[ -f '/etc/wireguard/wg0.conf' ]] && ! grep -q 'sysctl' /etc/wireguard/wg0.conf; then
[[ -f '/etc/sysctl.d/dietpi-wireguard.conf' ]] && G_EXEC rm /etc/sysctl.d/dietpi-wireguard.conf
- sed -i "/^ListenPort/a\PostUp = sysctl net.ipv4.conf.%i.forwarding=1 net.ipv4.conf.\$(ip r l 0/0 | mawk '{print \$5;exit}').forwarding=1" /etc/wireguard/wg0.conf
- sed -i "/^ListenPort/a\PostUp = sysctl net.ipv6.conf.\$(ip r l 0/0 | mawk '{print \$5;exit}').accept_ra=2" /etc/wireguard/wg0.conf
- sed -i "/^ListenPort/a\PostUp = sysctl net.ipv6.conf.%i.forwarding=1 net.ipv6.conf.\$(ip r l 0/0 | mawk '{print \$5;exit}').forwarding=1" /etc/wireguard/wg0.conf
- sed -i "/^ListenPort/a\PostUp = ip6tables -A FORWARD -i %i -j ACCEPT; ip6tables -t nat -A POSTROUTING -o \$(ip r l 0/0 | mawk '{print \$5;exit}') -j MASQUERADE" /etc/wireguard/wg0.conf
- sed -i "/^ListenPort/a\PostDown = ip6tables -D FORWARD -i %i -j ACCEPT; ip6tables -t nat -D POSTROUTING -o \$(ip r l 0/0 | mawk '{print \$5;exit}') -j MASQUERADE" /etc/wireguard/wg0.conf
+ sed --follow-symlinks -i "/^ListenPort/a\PostUp = sysctl net.ipv4.conf.%i.forwarding=1 net.ipv4.conf.\$(ip r l 0/0 | mawk '{print \$5;exit}').forwarding=1" /etc/wireguard/wg0.conf
+ sed --follow-symlinks -i "/^ListenPort/a\PostUp = sysctl net.ipv6.conf.\$(ip r l 0/0 | mawk '{print \$5;exit}').accept_ra=2" /etc/wireguard/wg0.conf
+ sed --follow-symlinks -i "/^ListenPort/a\PostUp = sysctl net.ipv6.conf.%i.forwarding=1 net.ipv6.conf.\$(ip r l 0/0 | mawk '{print \$5;exit}').forwarding=1" /etc/wireguard/wg0.conf
+ sed --follow-symlinks -i "/^ListenPort/a\PostUp = ip6tables -A FORWARD -i %i -j ACCEPT; ip6tables -t nat -A POSTROUTING -o \$(ip r l 0/0 | mawk '{print \$5;exit}') -j MASQUERADE" /etc/wireguard/wg0.conf
+ sed --follow-symlinks -i "/^ListenPort/a\PostDown = ip6tables -D FORWARD -i %i -j ACCEPT; ip6tables -t nat -D POSTROUTING -o \$(ip r l 0/0 | mawk '{print \$5;exit}') -j MASQUERADE" /etc/wireguard/wg0.conf
fi
#-----------------------------------------------------------------------
@@ -848,7 +848,7 @@ Further info and usage: https://dietpi.com/forum/t/dietpi-arr-to-ram-link-sonarr
. /var/lib/dietpi/dietpi-software/installed/dietpi-nordvpn/settings_dietpi.conf
if [[ -f /etc/openvpn/ovpn_$PROTOCOL/$NORDVPN_SERVER && $(grep -c '^auth-user-pass' "/etc/openvpn/ovpn_$PROTOCOL/$NORDVPN_SERVER") == 2 ]]; then
- sed -i '/^auth-user-pass$/d' "/etc/openvpn/ovpn_$PROTOCOL/$NORDVPN_SERVER"
+ sed --follow-symlinks -i '/^auth-user-pass$/d' "/etc/openvpn/ovpn_$PROTOCOL/$NORDVPN_SERVER"
fi
unset -v NORDVPN_USERNAME NORDVPN_PASSWORD NORDVPN_SERVER PROTOCOL
@@ -865,7 +865,7 @@ Further info and usage: https://dietpi.com/forum/t/dietpi-arr-to-ram-link-sonarr
fi
#-----------------------------------------------------------------------
# Add /etc/network/interfaces.d/ drop-in config support
- grep -q 'interfaces\.d' /etc/network/interfaces || sed -i '1i\source interfaces.d/*' /etc/network/interfaces
+ grep -q 'interfaces\.d' /etc/network/interfaces || sed --follow-symlinks -i '1i\source interfaces.d/*' /etc/network/interfaces
#-----------------------------------------------------------------------
# Blynk: Fix logging and move to RAMlog: https://github.com/MichaIng/DietPi/pull/2779
if [[ -f '/etc/systemd/system/blynkserver.service' && -f '/mnt/dietpi_userdata/blynk/server.properties' ]]; then
@@ -907,9 +907,9 @@ NBB: Reinstall manually installed PHP modules via: G_AGI $PHP_NAME-"
# Update PHP socket
# - Lighttpd
- [[ -f '/etc/lighttpd/conf-available/15-fastcgi-php.conf' ]] && sed -i "s@\"socket\".*\$@\"socket\" => \"/run/php/$PHP_NAME-fpm.sock\",@" /etc/lighttpd/conf-available/15-fastcgi-php.conf
+ [[ -f '/etc/lighttpd/conf-available/15-fastcgi-php.conf' ]] && sed --follow-symlinks -i "s@\"socket\".*\$@\"socket\" => \"/run/php/$PHP_NAME-fpm.sock\",@" /etc/lighttpd/conf-available/15-fastcgi-php.conf
# - Nginx
- [[ -f '/etc/nginx/nginx.conf' ]] && sed -i "s#/run/php.*-fpm.sock#/run/php/$PHP_NAME-fpm.sock#g" /etc/nginx/nginx.conf
+ [[ -f '/etc/nginx/nginx.conf' ]] && sed --follow-symlinks -i "s#/run/php.*-fpm.sock#/run/php/$PHP_NAME-fpm.sock#g" /etc/nginx/nginx.conf
# Mark old PHP packages for autoremoval
local apackages=()
@@ -958,7 +958,7 @@ NBB: Reinstall manually installed PHP modules via: G_AGI $PHP_NAME-"
# Patch Lighttpd config file on ARMv6 (Buster version installed): https://github.com/MichaIng/DietPi/issues/2808
if [[ -f '/etc/lighttpd/lighttpd.conf' && ! -f '/usr/share/lighttpd/create-mime.assign.pl' && -f '/usr/share/lighttpd/create-mime.conf.pl' ]]; then
- sed -i 's|/usr/share/lighttpd/create-mime\.assign\.pl|/usr/share/lighttpd/create-mime.conf.pl|g' /etc/lighttpd/lighttpd.conf
+ sed --follow-symlinks -i 's|/usr/share/lighttpd/create-mime\.assign\.pl|/usr/share/lighttpd/create-mime.conf.pl|g' /etc/lighttpd/lighttpd.conf
fi
#-------------------------------------------------------------------------------
@@ -1012,17 +1012,17 @@ Use "dietpi-config" to adjust these settings to your needs.'
#-------------------------------------------------------------------------------
# Remove obsolete dietpi.txt entries
# - https://github.com/MichaIng/DietPi/commit/b330594f0e63a40a75484647033c3b393ecd05b3#diff-aca2a37c06074a66f2588f7c9e84d07a
- G_EXEC sed -i '/AUTO_SETUP_NET_WIFI/{/AUTO_SETUP_NET_WIFI_ENABLED/!d}' /boot/dietpi.txt
+ G_EXEC sed --follow-symlinks -i '/AUTO_SETUP_NET_WIFI/{/AUTO_SETUP_NET_WIFI_ENABLED/!d}' /boot/dietpi.txt
# - https://github.com/MichaIng/DietPi/commit/814823899667e896291ed240281cfd39971463d9#diff-aca2a37c06074a66f2588f7c9e84d07a
- G_EXEC sed -i '/CONFIG_SMBCLIENT/d' /boot/dietpi.txt
- G_EXEC sed -i '/CONFIG_CURLFTPFS/d' /boot/dietpi.txt
- G_EXEC sed -i '/CONFIG_NFSCLIENT/d' /boot/dietpi.txt
+ G_EXEC sed --follow-symlinks -i '/CONFIG_SMBCLIENT/d' /boot/dietpi.txt
+ G_EXEC sed --follow-symlinks -i '/CONFIG_CURLFTPFS/d' /boot/dietpi.txt
+ G_EXEC sed --follow-symlinks -i '/CONFIG_NFSCLIENT/d' /boot/dietpi.txt
#-------------------------------------------------------------------------------
# Transmission: Fix web UI settings not being applied to settings file: https://github.com/MichaIng/DietPi/issues/2793
[[ -f '/etc/systemd/system/transmission-daemon.service.d/dietpi-group.conf' ]] && echo -e '[Service]\nGroup=dietpi\nSupplementaryGroups=debian-transmission' > /etc/systemd/system/transmission-daemon.service.d/dietpi-group.conf
#-------------------------------------------------------------------------------
# RPi I-Sabre-Q2M: Switch systems to use the new integrated "i-sabre-q2m" overlay + remove obsolete "snd-bcm2835" module blacklisting (instead disable dtparam if blacklist found)
- [[ -f '/boot/config.txt' ]] && sed -i 's/i-sabre-k2m/i-sabre-q2m/g' /boot/config.txt
+ [[ -f '/boot/config.txt' ]] && sed --follow-symlinks -i 's/i-sabre-k2m/i-sabre-q2m/g' /boot/config.txt
if [[ -f '/etc/modprobe.d/rpi-bcm2708.conf' ]]; then
G_CONFIG_INJECT 'dtparam=audio=' 'dtparam=audio=off' /boot/config.txt
@@ -1071,7 +1071,7 @@ _EOF_
local current=$(grep '^[[:blank:]]*temp_limit=' /boot/config.txt | sed 's/^[^=]*=//' | tail -1) # Get current effective (last) value
disable_error=1 G_CHECK_VALIDINT "$current" || current=75 # If none, use 75'c as DietPi default on RPi3
- G_EXEC sed -i '/^[[:blank:]#]*temp_limit=/d' /boot/config.txt # Remove all entries, including comments
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]#]*temp_limit=/d' /boot/config.txt # Remove all entries, including comments
G_CONFIG_INJECT 'temp_limit=' "temp_limit=$current" /boot/config.txt # Re-add current effective value or default
fi
@@ -1083,7 +1083,7 @@ _EOF_
# MPD: Remove obsolete and wrong RuntimeDirectory definition: https://github.com/MichaIng/DietPi/commit/882ddfb533fdc1fa597231824810909770a910c9
if (( $G_DIETPI_INSTALL_STAGE == 2 )); then
- [[ -f '/lib/systemd/system/mpd.service' ]] && sed -i '/^[[:blank:]]*RuntimeDirectory=/d' /lib/systemd/system/mpd.service
+ [[ -f '/lib/systemd/system/mpd.service' ]] && sed --follow-symlinks -i '/^[[:blank:]]*RuntimeDirectory=/d' /lib/systemd/system/mpd.service
[[ -f '/var/www/ompd/include/config.inc.php' && ! -f '/var/www/ompd/include/config.local.inc.php' ]] && mv /var/www/ompd/include/config.inc.php /var/www/ompd/include/config.local.inc.php
if grep -q '^aSOFTWARE_INSTALL_STATE\[148\]=2' /boot/dietpi/.installed; then
@@ -1120,19 +1120,19 @@ A backup will be created to "/etc/mympd/mympd.conf.bak_DDMMYYY_N" from where you
[[ -f '/etc/systemd/system/rpi-bcm2835_forced_3.5mm.service' ]] && rm /etc/systemd/system/rpi-bcm2835_forced_3.5mm.service
if (( $G_HW_MODEL < 10 )); then
- G_EXEC sed -i '/dtoverlay=i2s-mmap/d' /boot/config.txt
- G_EXEC sed -i '/dtoverlay=i2s=/d' /boot/config.txt
- G_EXEC sed -i '/dtoverlay=lirc-rpi/d' /boot/config.txt
- G_EXEC sed -i '/^[[:blank:]#]*dtparam=gpio_in_pin=25/d' /boot/config.txt
- G_EXEC sed -i '/^[[:blank:]#]*i2c_arm_baudrate=/d' /boot/config.txt
- G_EXEC sed -i '/^[[:blank:]#]*bcm2835-v4l2/d' /etc/modules
+ G_EXEC sed --follow-symlinks -i '/dtoverlay=i2s-mmap/d' /boot/config.txt
+ G_EXEC sed --follow-symlinks -i '/dtoverlay=i2s=/d' /boot/config.txt
+ G_EXEC sed --follow-symlinks -i '/dtoverlay=lirc-rpi/d' /boot/config.txt
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]#]*dtparam=gpio_in_pin=25/d' /boot/config.txt
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]#]*i2c_arm_baudrate=/d' /boot/config.txt
+ G_EXEC sed --follow-symlinks -i '/^[[:blank:]#]*bcm2835-v4l2/d' /etc/modules
grep -q '^[[:blank:]]*start_x=1' /boot/config.txt || /boot/dietpi/func/dietpi-set_hardware rpi-camera disable
[[ -f '/etc/modprobe.d/disable_bt.conf' ]] && G_CONFIG_INJECT 'dtoverlay=disable-bt' 'dtoverlay=disable-bt' /boot/config.txt
[[ -f '/etc/modprobe.d/disable_wifi_rpi3_onboard.conf' ]] && G_CONFIG_INJECT 'dtoverlay=disable-wifi' 'dtoverlay=disable-wifi' /boot/config.txt
# Offer re-adding of "initial_turbo" on RPi: https://github.com/MichaIng/DietPi/issues/3147
if ! grep -q '^[[:blank:]]*initial_turbo' /boot/config.txt; then
- G_EXEC sed -i '\|issues/1836|d' /boot/config.txt # Remove obsolete comment
+ G_EXEC sed --follow-symlinks -i '\|issues/1836|d' /boot/config.txt # Remove obsolete comment
G_WHIP_BUTTON_OKAY_TEXT='Yes' G_WHIP_BUTTON_CANCEL_TEXT='No' G_WHIP_YESNO 'Re-adding "initial_turbo" option\n
The firmware issues with the "initial_turbo" option have been fixed a recent update: https://github.com/raspberrypi/firmware/issues/1005\n
This option allows you to force highest CPU frequency for a set amount of seconds during boot. This significantly reduces boot time on RPi since it by default boots with lowest frequencies, until a systemd unit sets the chosen CPU governor at later boot stage. You can now set this setting again via:
@@ -1183,7 +1183,7 @@ Do you want to have the recommended "initial_turbo=20" re-added to your config.t
tvservice -o
fi
- G_EXEC sed -i '/hdmi_ignore_composite/d' /boot/config.txt
+ G_EXEC sed --follow-symlinks -i '/hdmi_ignore_composite/d' /boot/config.txt
G_EXEC rm -f /etc/apt/sources.list.d/{dietpi-kodi,pipplware,kodi}.list
if dpkg-query -s kodi-rpi4 &> /dev/null; then
@@ -1207,7 +1207,7 @@ Do you want to have the recommended "initial_turbo=20" re-added to your config.t
if (( $G_DIETPI_INSTALL_STAGE == 2 )); then
# Remove obsolete install states: TightVPN and SDL2
- G_EXEC sed -Ei '/^aSOFTWARE_INSTALL_STATE\[(27|140)\]=/d' /boot/dietpi/.installed
+ G_EXEC sed --follow-symlinks -Ei '/^aSOFTWARE_INSTALL_STATE\[(27|140)\]=/d' /boot/dietpi/.installed
# Gogs: Remove /etc/__MACOSX that comes from our archive on ARMv6
if grep -q '^aSOFTWARE_INSTALL_STATE\[49\]=2' /boot/dietpi/.installed; then
@@ -1318,7 +1318,7 @@ Would you like to switch back to the Nginx authentication method now?' && certbo
fi
# Mono: Use new Buster repo on Buster/Bullseye systems
- (( $G_DISTRO > 4 )) && [[ -f '/etc/apt/sources.list.d/mono-xamarin.list' ]] && sed -i 's/stretch/buster/g' /etc/apt/sources.list.d/mono-xamarin.list
+ (( $G_DISTRO > 4 )) && [[ -f '/etc/apt/sources.list.d/mono-xamarin.list' ]] && sed --follow-symlinks -i 's/stretch/buster/g' /etc/apt/sources.list.d/mono-xamarin.list
# Aria2: https://github.com/MichaIng/DietPi/pull/3139
if [[ -f '/var/lib/dietpi/dietpi-software/installed/aria2.conf' ]]; then
@@ -1507,7 +1507,7 @@ _EOF_
G_DIETPI-NOTIFY 2 'Removing obsolete flag files'
G_EXEC rm -f /boot/dietpi/.{update_available,timesync_exit_status,network} /var/lib/dietpi/.ntpd_override /tmp/.dietpi_motd
#-------------------------------------------------------------------------------
- [[ -f '/boot/dietpi/.dietpi-backup_settings' ]] && l_message='Adjusting changed DietPi-Backup variable name' G_EXEC sed -i 's/^FP_TARGET_BACKUP=/FP_TARGET=/' /boot/dietpi/.dietpi-backup_settings
+ [[ -f '/boot/dietpi/.dietpi-backup_settings' ]] && l_message='Adjusting changed DietPi-Backup variable name' G_EXEC sed --follow-symlinks -i 's/^FP_TARGET_BACKUP=/FP_TARGET=/' /boot/dietpi/.dietpi-backup_settings
#-------------------------------------------------------------------------------
if [[ -f '/etc/default/crda' ]]; then
@@ -1516,21 +1516,21 @@ _EOF_
G_CONFIG_INJECT 'REGDOMAIN=' "REGDOMAIN=$country_code" /etc/default/crda
G_CONFIG_INJECT 'AUTO_SETUP_NET_WIFI_COUNTRY_CODE=' "AUTO_SETUP_NET_WIFI_COUNTRY_CODE=$country_code" /boot/dietpi.txt
# Remove from wpa_supplicant.conf
- [[ -f '/etc/wpa_supplicant/wpa_supplicant.conf' ]] && sed -i '/^[[:blank:]]*country=/d' /etc/wpa_supplicant/wpa_supplicant.conf
+ [[ -f '/etc/wpa_supplicant/wpa_supplicant.conf' ]] && sed --follow-symlinks -i '/^[[:blank:]]*country=/d' /etc/wpa_supplicant/wpa_supplicant.conf
fi
#-------------------------------------------------------------------------------
G_DIETPI-NOTIFY 2 'Removing obsolete dietpi.txt entries'
- G_EXEC sed -i '/CONFIG_AUTO_DIETPI_UPDATES=/d' /boot/dietpi.txt
- G_EXEC sed -i '/CONFIG_WIFI_COUNTRY_CODE=/d' /boot/dietpi.txt
+ G_EXEC sed --follow-symlinks -i '/CONFIG_AUTO_DIETPI_UPDATES=/d' /boot/dietpi.txt
+ G_EXEC sed --follow-symlinks -i '/CONFIG_WIFI_COUNTRY_CODE=/d' /boot/dietpi.txt
#-------------------------------------------------------------------------------
G_DIETPI-NOTIFY 2 'Removing obsolete dietpi-software config directory'
[[ -d '/var/lib/dietpi/dietpi-software/conf' ]] && G_EXEC rm -R /var/lib/dietpi/dietpi-software/conf
#-------------------------------------------------------------------------------
G_DIETPI-NOTIFY 2 'Removing obsolete hint about /DietPi RAMdisk from /boot config files'
- [[ -f '/boot/dietpi.txt' ]] && sed -Ei '/^# - (Modifications to \/boot\/dietpi\.txt|Please ensure you edit from the DietPi-RAMdisk)/d' /boot/dietpi.txt
- [[ -f '/boot/config.txt' ]] && sed -Ei '/^# - (Modifications to \/boot\/config\.txt|Please ensure you edit from the DietPi-RAMdisk)/d' /boot/config.txt
- [[ -f '/boot/boot.ini' ]] && sed -Ei '/^# - (Modifications to \/boot\/boot\.ini|Please ensure you edit from the DietPi-RAMdisk)/d' /boot/boot.ini
+ [[ -f '/boot/dietpi.txt' ]] && sed --follow-symlinks -Ei '/^# - (Modifications to \/boot\/dietpi\.txt|Please ensure you edit from the DietPi-RAMdisk)/d' /boot/dietpi.txt
+ [[ -f '/boot/config.txt' ]] && sed --follow-symlinks -Ei '/^# - (Modifications to \/boot\/config\.txt|Please ensure you edit from the DietPi-RAMdisk)/d' /boot/config.txt
+ [[ -f '/boot/boot.ini' ]] && sed --follow-symlinks -Ei '/^# - (Modifications to \/boot\/boot\.ini|Please ensure you edit from the DietPi-RAMdisk)/d' /boot/boot.ini
#-------------------------------------------------------------------------------
# Sparky SBC: Update kernel/drivers
if (( $G_HW_MODEL == 70 )); then
@@ -1697,8 +1697,8 @@ To reinstall now, run: "dietpi-software reinstall 106 144 145"
# Fix default RPi3+ overclocking defaults: https://dietpi.com/phpbb/viewtopic.php?t=7804
if [[ $G_HW_MODEL == 3 && $G_HW_MODEL_NAME == *'+'* ]]; then
- G_EXEC sed -i '/#arm_freq=/c\#arm_freq=1400' /boot/config.txt
- G_EXEC sed -i '/#sdram_freq=/c\#sdram_freq=500' /boot/config.txt
+ G_EXEC sed --follow-symlinks -i '/#arm_freq=/c\#arm_freq=1400' /boot/config.txt
+ G_EXEC sed --follow-symlinks -i '/#sdram_freq=/c\#sdram_freq=500' /boot/config.txt
fi
#-------------------------------------------------------------------------------
@@ -1708,7 +1708,7 @@ To reinstall now, run: "dietpi-software reinstall 106 144 145"
if (( $G_DIETPI_INSTALL_STAGE == 2 )); then
# Reset QuiteRSS install state if the package has not actually been installed: https://github.com/MichaIng/DietPi/commit/49f960a7953f44e5571ff2dde68a93efca37ec03
- dpkg-query -s quiterss &> /dev/null || sed -i '/^aSOFTWARE_INSTALL_STATE\[22\]=2/d' /boot/dietpi/.installed
+ dpkg-query -s quiterss &> /dev/null || sed --follow-symlinks -i '/^aSOFTWARE_INSTALL_STATE\[22\]=2/d' /boot/dietpi/.installed
if grep -q '^aSOFTWARE_INSTALL_STATE\[36\]=2' /boot/dietpi/.installed; then
@@ -1738,7 +1738,7 @@ To reinstall now, run: "dietpi-software reinstall 106 144 145"
# APT configs have been merged into a single file, contained in update archive
rm -fv /etc/apt/apt.conf.d/{99-dietpi-norecommends,98-dietpi-no_translations,99-dietpi-forceconf}
#-------------------------------------------------------------------------------
- [[ -f '/boot/config.txt' ]] && G_EXEC_DESC='Removing deprecated "max_usb_current" from config.txt' G_EXEC_NOHALT=1 G_EXEC sed -i '/^[[:blank:]#]*max_usb_current=/d' /boot/config.txt
+ [[ -f '/boot/config.txt' ]] && G_EXEC_DESC='Removing deprecated "max_usb_current" from config.txt' G_EXEC_NOHALT=1 G_EXEC sed --follow-symlinks -i '/^[[:blank:]#]*max_usb_current=/d' /boot/config.txt
#-----------------------------------------------------------------------
# Recreate /etc/sysctl.d/99-sysctl.conf -> ../sysctl.conf symlink if not existent: https://github.com/MichaIng/DietPi/issues/3003#issuecomment-669464255
if [[ ! -L '/etc/sysctl.d/99-sysctl.conf' ]]; then
@@ -1799,8 +1799,8 @@ To reinstall now, run: "dietpi-software reinstall 106 144 145"
G_EXEC mv /opt/{plexpy,tautulli}
[[ -d '/mnt/dietpi_userdata/plexpy' ]] && G_EXEC mv /mnt/dietpi_userdata/{plexpy,tautulli}
[[ -f '/opt/tautulli/config.ini' ]] && G_EXEC mv /{opt,mnt/dietpi_userdata}/tautulli/config.ini
- G_EXEC sed -i 's|/opt/plexpy|/opt/tautulli|' /mnt/dietpi_userdata/tautulli/config.ini
- G_EXEC sed -i 's|/mnt/dietpi_userdata/plexpy|/mnt/dietpi_userdata/tautulli|' /mnt/dietpi_userdata/tautulli/config.ini
+ G_EXEC sed --follow-symlinks -i 's|/opt/plexpy|/opt/tautulli|' /mnt/dietpi_userdata/tautulli/config.ini
+ G_EXEC sed --follow-symlinks -i 's|/mnt/dietpi_userdata/plexpy|/mnt/dietpi_userdata/tautulli|' /mnt/dietpi_userdata/tautulli/config.ini
[[ -f '/etc/systemd/system/plexpy.service' ]] && G_EXEC mv /etc/systemd/system/{plexpy,tautulli}.service
[[ -d '/etc/systemd/system/plexpy.service.d' ]] && G_EXEC mv /etc/systemd/system/{plexpy,tautulli}.service.d
getent passwd plexpy > /dev/null && G_EXEC userdel plexpy
@@ -1814,7 +1814,7 @@ To reinstall now, run: "dietpi-software reinstall 106 144 145"
[[ -f '/etc/lighttpd/conf-available/99-dietpi-nextcloud.conf' ]] && grep -q opcache /etc/lighttpd/conf-available/99-dietpi-nextcloud.conf; then
G_DIETPI-NOTIFY 2 'Removing obsolete directive from Lighttpd Nextcloud config file'
- G_EXEC sed -i '/opcache/d' /etc/lighttpd/conf-available/99-dietpi-nextcloud.conf
+ G_EXEC sed --follow-symlinks -i '/opcache/d' /etc/lighttpd/conf-available/99-dietpi-nextcloud.conf
for i in /etc/php/7.[234]/mods-available
do
@@ -1865,7 +1865,7 @@ opcache.max_accelerated_files=10000\nopcache.memory_consumption=128\nopcache.sav
(( $G_DIETPI_INSTALL_STAGE == 2 )) && grep -q '^aSOFTWARE_INSTALL_STATE\[28\]=2' /boot/dietpi/.installed && grep -q '^aSOFTWARE_INSTALL_STATE\[23\]=2' /boot/dietpi/.installed && G_AGI dbus-user-session
#-------------------------------------------------------------------------------
# Fail2Ban: https://github.com/MichaIng/DietPi/pull/3813
- [[ ! -f '/etc/fail2ban/jail.conf' ]] || sed -n '/^\[DEFAULT\]/,/^\[/p' /etc/fail2ban/jail.conf | grep -q '^[[:blank:]]*mode[[:blank:]]*=' || sed -i '/^\[DEFAULT\]/a\mode = normal' /etc/fail2ban/jail.conf
+ [[ ! -f '/etc/fail2ban/jail.conf' ]] || sed -n '/^\[DEFAULT\]/,/^\[/p' /etc/fail2ban/jail.conf | grep -q '^[[:blank:]]*mode[[:blank:]]*=' || sed --follow-symlinks -i '/^\[DEFAULT\]/a\mode = normal' /etc/fail2ban/jail.conf
#-------------------------------------------------------------------------------
elif (( $G_DIETPI_VERSION_SUB == 33 )); then
@@ -1874,16 +1874,16 @@ opcache.max_accelerated_files=10000\nopcache.memory_consumption=128\nopcache.sav
# Remove Tonido install flag
if [[ -f '/boot/dietpi/.installed' ]] && grep -q '^aSOFTWARE_INSTALL_STATE\[134\]=2' /boot/dietpi/.installed
then
- G_EXEC sed -i '/^aSOFTWARE_INSTALL_STATE\[134\]=2/d' /boot/dietpi/.installed
+ G_EXEC sed --follow-symlinks -i '/^aSOFTWARE_INSTALL_STATE\[134\]=2/d' /boot/dietpi/.installed
# Add service to custom includes if it has not been excluded, since it has been removed from the static DietPi-Services list
grep -q '^- tonido$' /boot/dietpi/.dietpi-services_include_exclude || G_CONFIG_INJECT '+ tonido' '+ tonido' /boot/dietpi/.dietpi-services_include_exclude
fi
#-------------------------------------------------------------------------------
# Remove CloudPrint install flag
- [[ -f '/boot/dietpi/.installed' ]] && grep -q '^aSOFTWARE_INSTALL_STATE\[137\]=2' /boot/dietpi/.installed && sed -i '/^aSOFTWARE_INSTALL_STATE\[137\]=2/d' /boot/dietpi/.installed
+ [[ -f '/boot/dietpi/.installed' ]] && grep -q '^aSOFTWARE_INSTALL_STATE\[137\]=2' /boot/dietpi/.installed && sed --follow-symlinks -i '/^aSOFTWARE_INSTALL_STATE\[137\]=2/d' /boot/dietpi/.installed
#-------------------------------------------------------------------------------
# Remove DietPi-CloudShell install flag
- [[ -f '/boot/dietpi/.installed' ]] && grep -q '^aSOFTWARE_INSTALL_STATE\[62\]=2' /boot/dietpi/.installed && sed -i '/^aSOFTWARE_INSTALL_STATE\[62\]=2/d' /boot/dietpi/.installed
+ [[ -f '/boot/dietpi/.installed' ]] && grep -q '^aSOFTWARE_INSTALL_STATE\[62\]=2' /boot/dietpi/.installed && sed --follow-symlinks -i '/^aSOFTWARE_INSTALL_STATE\[62\]=2/d' /boot/dietpi/.installed
#-------------------------------------------------------------------------------
if [[ -f '/boot/dietpi/.installed' ]] && grep -q '^aSOFTWARE_INSTALL_STATE\[29\]=2' /boot/dietpi/.installed && ! dpkg-query -s xorgxrdp &> /dev/null
then
@@ -2012,7 +2012,7 @@ _EOF_
# Beta 6.34.0+1
[[ -f '/mnt/dietpi_userdata/octoprint/pip2' ]] && G_EXEC rm /mnt/dietpi_userdata/octoprint/pip2
[[ -f '/mnt/dietpi_userdata/octoprint/pip3' ]] && G_EXEC rm /mnt/dietpi_userdata/octoprint/pip3
- [[ -f '/mnt/dietpi_userdata/octoprint/.octoprint/config.yaml' ]] && G_EXEC sed -i '/localPipCommand/d' /mnt/dietpi_userdata/octoprint/.octoprint/config.yaml
+ [[ -f '/mnt/dietpi_userdata/octoprint/.octoprint/config.yaml' ]] && G_EXEC sed --follow-symlinks -i '/localPipCommand/d' /mnt/dietpi_userdata/octoprint/.octoprint/config.yaml
# shellcheck disable=SC2046
command -v pip2 > /dev/null && pip2 uninstall -y $(pip2 freeze | mawk '/[Oo]cto[Pp]rint/{print $1}') 2> /dev/null
# shellcheck disable=SC2046
@@ -2069,7 +2069,7 @@ _EOF_
fi
#-------------------------------------------------------------------------------
# ReadyMedia: Fix database rebuild on service start
- [[ -f '/etc/systemd/system/minidlna.service' ]] && G_EXEC sed -i '/^ExecStart=/s/ -SR / -S -R /' /etc/systemd/system/minidlna.service
+ [[ -f '/etc/systemd/system/minidlna.service' ]] && G_EXEC sed --follow-symlinks -i '/^ExecStart=/s/ -SR / -S -R /' /etc/systemd/system/minidlna.service
#-------------------------------------------------------------------------------
# Raspberry Pi Microsoft VS Code repo: https://github.com/MichaIng/DietPi/issues/4083
[[ $G_HW_MODEL -le 9 && -f '/etc/apt/sources.list.d/vscode.list' ]] && { G_WHIP_BUTTON_OK_TEXT='Keep it' G_WHIP_BUTTON_CANCEL_TEXT='Remove it' G_WHIP_YESNO 'The Microsoft Visual Studio Code APT repository has been found on your system.
diff --git a/dietpi/pre-patch_file b/dietpi/pre-patch_file
index f5f79078a2..2e826ae479 100755
--- a/dietpi/pre-patch_file
+++ b/dietpi/pre-patch_file
@@ -63,8 +63,8 @@
if (( $G_DIETPI_VERSION_SUB < 21 )) && [[ -f '/etc/mysql/mariadb.conf.d/99-dietpi-4byte.cnf' ]] && grep -qi 'buster' /etc/os-release; then
echo -e '\e[90m[\e[0m INFO \e[90m]\e[0m Pre-patch 2 | Patching /etc/mysql/mariadb.conf.d/99-dietpi-4byte.cnf for MariaDB v10.3/Buster support'
- sed -i '/innodb_large_prefix/d' /etc/mysql/mariadb.conf.d/99-dietpi-4byte.cnf || exit 2
- sed -i '/innodb_file_format/d' /etc/mysql/mariadb.conf.d/99-dietpi-4byte.cnf || exit 2
+ sed --follow-symlinks -i '/innodb_large_prefix/d' /etc/mysql/mariadb.conf.d/99-dietpi-4byte.cnf || exit 2
+ sed --follow-symlinks -i '/innodb_file_format/d' /etc/mysql/mariadb.conf.d/99-dietpi-4byte.cnf || exit 2
fi
#-------------------------------------------------------------------------------
@@ -91,7 +91,7 @@
echo -e '\e[90m[\e[0m INFO \e[90m]\e[0m Pre-patch 6 | Migrating Jessie systems to "jessie-support" update branch'
if grep -q '^[[:blank:]]*DEV_GITBRANCH=' /DietPi/dietpi.txt; then
- sed -i '/^[[:blank:]]*DEV_GITBRANCH=/c\DEV_GITBRANCH=jessie-support' /DietPi/dietpi.txt || exit 6
+ sed --follow-symlinks -i '/^[[:blank:]]*DEV_GITBRANCH=/c\DEV_GITBRANCH=jessie-support' /DietPi/dietpi.txt || exit 6
else
@@ -238,7 +238,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=bullseye\nPin-
if (( $G_DIETPI_VERSION_SUB < 33 && $G_HW_MODEL > 10 && $G_HW_MODEL < 20 )); then
echo -e "\e[90m[\e[0m INFO \e[90m]\e[0m Pre-patch 22 | Switch to our new Meveric's Odroid repo mirror on https://dietpi.com/meveric/"
- sed -Ei 's@(http://fuzon\.co\.uk|https?://oph\.mdrjr\.net)@https://dietpi.com@' /etc/apt/sources.list{,.d/*.list} || exit 22
+ sed --follow-symlinks -Ei 's@(http://fuzon\.co\.uk|https?://oph\.mdrjr\.net)@https://dietpi.com@' /etc/apt/sources.list{,.d/*.list} || exit 22
fi
#-------------------------------------------------------------------------------
@@ -249,13 +249,13 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=bullseye\nPin-
if grep -q '/dev/disk/by-id/ata-VBOX_HARDDISK_VBeda89797-79ca820f' /var/cache/debconf/config.dat; then
echo -e '\e[90m[\e[0m INFO \e[90m]\e[0m Pre-patch 23 | Fixing the grub debconf drive ID'
- sed -i 's|/dev/disk/by-id/ata-VBOX_HARDDISK_VBeda89797-79ca820f|/dev/sda|' /var/cache/debconf/config.dat || exit 23
+ sed --follow-symlinks -i 's|/dev/disk/by-id/ata-VBOX_HARDDISK_VBeda89797-79ca820f|/dev/sda|' /var/cache/debconf/config.dat || exit 23
# Native PC BIOS
elif grep -q '/dev/disk/by-id/ata-M4-CT128M4SSD2_000000001151090024A1' /var/cache/debconf/config.dat; then
echo -e '\e[90m[\e[0m INFO \e[90m]\e[0m Pre-patch 23 | Fixing the grub debconf drive ID'
- sed -i 's|/dev/disk/by-id/ata-M4-CT128M4SSD2_000000001151090024A1|/dev/sda|' /var/cache/debconf/config.dat || exit 23
+ sed --follow-symlinks -i 's|/dev/disk/by-id/ata-M4-CT128M4SSD2_000000001151090024A1|/dev/sda|' /var/cache/debconf/config.dat || exit 23
fi
diff --git a/rootfs/var/lib/dietpi/services/dietpi-firstboot.bash b/rootfs/var/lib/dietpi/services/dietpi-firstboot.bash
index 6f7b29b118..152d127a95 100755
--- a/rootfs/var/lib/dietpi/services/dietpi-firstboot.bash
+++ b/rootfs/var/lib/dietpi/services/dietpi-firstboot.bash
@@ -32,58 +32,58 @@
# RPi Zero/Zero 2 W
if [[ $G_HW_MODEL_NAME == *'Zero'* ]]
then
- sed -i '/^#over_voltage=/c\#over_voltage=0' /boot/config.txt
- sed -i '/^#arm_freq=/c\#arm_freq=1000' /boot/config.txt
- sed -i '/^#core_freq=/c\#core_freq=400' /boot/config.txt
- sed -i '/^#sdram_freq=/c\#sdram_freq=450' /boot/config.txt
+ sed --follow-symlinks -i '/^#over_voltage=/c\#over_voltage=0' /boot/config.txt
+ sed --follow-symlinks -i '/^#arm_freq=/c\#arm_freq=1000' /boot/config.txt
+ sed --follow-symlinks -i '/^#core_freq=/c\#core_freq=400' /boot/config.txt
+ sed --follow-symlinks -i '/^#sdram_freq=/c\#sdram_freq=450' /boot/config.txt
# RPi 1: Apply safe overclock mode
elif (( $G_HW_MODEL < 2 ))
then
GCI_PRESERVE=1 G_CONFIG_INJECT 'arm_freq=' 'arm_freq=900' /boot/config.txt
grep -q '^arm_freq=900$' /boot/config.txt && G_CONFIG_INJECT 'over_voltage=' 'over_voltage=2' /boot/config.txt
- sed -i '/^#core_freq=/c\#core_freq=250' /boot/config.txt
- sed -i '/^#sdram_freq=/c\#sdram_freq=400' /boot/config.txt
+ sed --follow-symlinks -i '/^#core_freq=/c\#core_freq=250' /boot/config.txt
+ sed --follow-symlinks -i '/^#sdram_freq=/c\#sdram_freq=400' /boot/config.txt
# RPi 2
elif (( $G_HW_MODEL == 2 ))
then
- sed -i '/^#over_voltage=/c\#over_voltage=0' /boot/config.txt
- sed -i '/^#arm_freq=/c\#arm_freq=900' /boot/config.txt
- sed -i '/^#core_freq=/c\#core_freq=250' /boot/config.txt
- sed -i '/^#sdram_freq=/c\#sdram_freq=450' /boot/config.txt
+ sed --follow-symlinks -i '/^#over_voltage=/c\#over_voltage=0' /boot/config.txt
+ sed --follow-symlinks -i '/^#arm_freq=/c\#arm_freq=900' /boot/config.txt
+ sed --follow-symlinks -i '/^#core_freq=/c\#core_freq=250' /boot/config.txt
+ sed --follow-symlinks -i '/^#sdram_freq=/c\#sdram_freq=450' /boot/config.txt
# RPi 3
elif (( $G_HW_MODEL == 3 ))
then
- sed -i '/^#over_voltage=/c\#over_voltage=0' /boot/config.txt
- sed -i '/^#core_freq=/c\#core_freq=400' /boot/config.txt
+ sed --follow-symlinks -i '/^#over_voltage=/c\#over_voltage=0' /boot/config.txt
+ sed --follow-symlinks -i '/^#core_freq=/c\#core_freq=400' /boot/config.txt
grep -q '^temp_limit=65$' /boot/config.txt && G_CONFIG_INJECT 'temp_limit=' 'temp_limit=75' /boot/config.txt # https://github.com/MichaIng/DietPi/issues/356
# A+/B+
if [[ $G_HW_MODEL_NAME == *'+'* ]]
then
- sed -i '/^#arm_freq=/c\#arm_freq=1400' /boot/config.txt
- sed -i '/^#sdram_freq=/c\#sdram_freq=500' /boot/config.txt
+ sed --follow-symlinks -i '/^#arm_freq=/c\#arm_freq=1400' /boot/config.txt
+ sed --follow-symlinks -i '/^#sdram_freq=/c\#sdram_freq=500' /boot/config.txt
else
- sed -i '/^#arm_freq=/c\#arm_freq=1200' /boot/config.txt
- sed -i '/^#sdram_freq=/c\#sdram_freq=450' /boot/config.txt
+ sed --follow-symlinks -i '/^#arm_freq=/c\#arm_freq=1200' /boot/config.txt
+ sed --follow-symlinks -i '/^#sdram_freq=/c\#sdram_freq=450' /boot/config.txt
fi
# RPi 4
elif (( $G_HW_MODEL == 4 ))
then
- sed -i '/^#over_voltage=/c\#over_voltage=0' /boot/config.txt
- sed -i '/^#core_freq=/c\#core_freq=500' /boot/config.txt
- sed -i '/^#sdram_freq=/d' /boot/config.txt # Not supported on RPi4, defaults to 3200 MHz
+ sed --follow-symlinks -i '/^#over_voltage=/c\#over_voltage=0' /boot/config.txt
+ sed --follow-symlinks -i '/^#core_freq=/c\#core_freq=500' /boot/config.txt
+ sed --follow-symlinks -i '/^#sdram_freq=/d' /boot/config.txt # Not supported on RPi4, defaults to 3200 MHz
grep -q '^temp_limit=65$' /boot/config.txt && G_CONFIG_INJECT 'temp_limit=' 'temp_limit=75' /boot/config.txt # https://github.com/MichaIng/DietPi/issues/3019
# 400
if [[ $G_HW_MODEL_NAME == *'400'* ]]
then
- sed -i '/^#arm_freq=/c\#arm_freq=1800' /boot/config.txt
+ sed --follow-symlinks -i '/^#arm_freq=/c\#arm_freq=1800' /boot/config.txt
else
- sed -i '/^#arm_freq=/c\#arm_freq=1500' /boot/config.txt
+ sed --follow-symlinks -i '/^#arm_freq=/c\#arm_freq=1500' /boot/config.txt
fi
fi
}
@@ -276,8 +276,8 @@ _EOF_
[[ $iface_wlan ]] || iface_wlan='wlan0'
# - Replace interface names with the ones obtained above
- sed -i "s/eth[0-9]/$iface_eth/g" /etc/network/interfaces
- sed -i "s/wlan[0-9]/$iface_wlan/g" /etc/network/interfaces
+ sed --follow-symlinks -i "s/eth[0-9]/$iface_eth/g" /etc/network/interfaces
+ sed --follow-symlinks -i "s/wlan[0-9]/$iface_wlan/g" /etc/network/interfaces
# - Grab user requested settings from dietpi.txt
local ethernet_enabled=$(grep -cm1 '^[[:blank:]]*AUTO_SETUP_NET_ETHERNET_ENABLED=1' /boot/dietpi.txt)
@@ -293,8 +293,8 @@ _EOF_
# Enable WiFi, disable Ethernet
ethernet_enabled=0
- sed -Ei "/(allow-hotplug|auto)[[:blank:]]+wlan/c\allow-hotplug $iface_wlan" /etc/network/interfaces
- sed -Ei "/(allow-hotplug|auto)[[:blank:]]+eth/c\#allow-hotplug $iface_eth" /etc/network/interfaces
+ sed --follow-symlinks -Ei "/(allow-hotplug|auto)[[:blank:]]+wlan/c\allow-hotplug $iface_wlan" /etc/network/interfaces
+ sed --follow-symlinks -Ei "/(allow-hotplug|auto)[[:blank:]]+eth/c\#allow-hotplug $iface_eth" /etc/network/interfaces
# Apply global SSID/keys from dietpi.txt to wpa_supplicant
/boot/dietpi/func/dietpi-wifidb 1
@@ -307,8 +307,8 @@ _EOF_
# Enable Ethernet, disable WiFi
wifi_enabled=0
- sed -Ei "/(allow-hotplug|auto)[[:blank:]]+eth/c\allow-hotplug $iface_eth" /etc/network/interfaces
- sed -Ei "/(allow-hotplug|auto)[[:blank:]]+wlan/c\#allow-hotplug $iface_wlan" /etc/network/interfaces
+ sed --follow-symlinks -Ei "/(allow-hotplug|auto)[[:blank:]]+eth/c\allow-hotplug $iface_eth" /etc/network/interfaces
+ sed --follow-symlinks -Ei "/(allow-hotplug|auto)[[:blank:]]+wlan/c\#allow-hotplug $iface_wlan" /etc/network/interfaces
# Disable WiFi kernel modules
/boot/dietpi/func/dietpi-set_hardware wifimodules disable
@@ -323,25 +323,25 @@ _EOF_
if (( $wifi_enabled )); then
- sed -i "/iface wlan/c\iface $iface_wlan inet static" /etc/network/interfaces
+ sed --follow-symlinks -i "/iface wlan/c\iface $iface_wlan inet static" /etc/network/interfaces
elif (( $ethernet_enabled )); then
- sed -i "/iface eth/c\iface $iface_eth inet static" /etc/network/interfaces
+ sed --follow-symlinks -i "/iface eth/c\iface $iface_eth inet static" /etc/network/interfaces
fi
- sed -i "/address/c\address $static_ip" /etc/network/interfaces
- sed -i "/netmask/c\netmask $static_mask" /etc/network/interfaces
- sed -i "/gateway/c\gateway $static_gateway" /etc/network/interfaces
+ sed --follow-symlinks -i "/address/c\address $static_ip" /etc/network/interfaces
+ sed --follow-symlinks -i "/netmask/c\netmask $static_mask" /etc/network/interfaces
+ sed --follow-symlinks -i "/gateway/c\gateway $static_gateway" /etc/network/interfaces
if command -v resolvconf > /dev/null; then
- sed -i "/dns-nameservers/c\dns-nameservers $static_dns" /etc/network/interfaces
+ sed --follow-symlinks -i "/dns-nameservers/c\dns-nameservers $static_dns" /etc/network/interfaces
else
> /etc/resolv.conf
for i in $static_dns; do echo "nameserver $i" >> /etc/resolv.conf; done
- sed -i "/dns-nameservers/c\#dns-nameservers $static_dns" /etc/network/interfaces
+ sed --follow-symlinks -i "/dns-nameservers/c\#dns-nameservers $static_dns" /etc/network/interfaces
fi