diff --git a/.build/images/Quartz64/quartz64_defconfig b/.build/images/Quartz64/quartz64_defconfig index adea7ecf51..c2190049f6 100644 --- a/.build/images/Quartz64/quartz64_defconfig +++ b/.build/images/Quartz64/quartz64_defconfig @@ -142,6 +142,7 @@ CONFIG_CRYPTO_SHA2_ARM64_CE=y CONFIG_CRYPTO_SHA3_ARM64=m CONFIG_CRYPTO_SHA512_ARM64_CE=m CONFIG_CRYPTO_SM3_ARM64_CE=m +CONFIG_CRYPTO_USER_API_HASH=m CONFIG_CRYPTO_USER_API_RNG=m CONFIG_CUSE=m CONFIG_DEBUG_FS=y @@ -209,6 +210,7 @@ CONFIG_ENERGY_MODEL=y CONFIG_EXT2_FS=y CONFIG_EXT3_FS=y CONFIG_EXT4_FS_POSIX_ACL=y +CONFIG_EXT4_FS_SECURITY=y CONFIG_EXTCON_ADC_JACK=y CONFIG_EXTCON_GPIO=y CONFIG_EXTCON_USB_GPIO=y @@ -544,6 +546,7 @@ CONFIG_NET_ACT_GACT=m CONFIG_NET_ACT_GATE=m CONFIG_NET_ACT_MIRRED=m CONFIG_NET_CLS_ACT=y +CONFIG_NET_CLS_BPF=m CONFIG_NET_CLS_BASIC=m CONFIG_NET_CLS_FLOWER=m CONFIG_NET_DSA=m @@ -843,6 +846,7 @@ CONFIG_SATA_AHCI=y CONFIG_SATA_AHCI_PLATFORM=y CONFIG_SATA_MV=y CONFIG_SATA_SIL24=y +CONFIG_SCHEDSTATS=y CONFIG_SCHED_AUTOGROUP=y # CONFIG_SCHED_DEBUG is not set CONFIG_SCHED_MC=y diff --git a/.build/images/dietpi-build b/.build/images/dietpi-build index 72b10d7ef1..1490dc7f6a 100755 --- a/.build/images/dietpi-build +++ b/.build/images/dietpi-build @@ -20,6 +20,9 @@ else '13.'*|'trixie/sid') G_DISTRO=8;; *) G_DIETPI-NOTIFY 1 "Unsupported distro version \"$debian_version\". Aborting ..."; exit 1;; esac + # Ubuntu ships with /etc/debian_version from Debian testing, hence we assume one version lower. + grep -q '^ID=ubuntu' /etc/os-release && ((G_DISTRO--)) + (( $G_DISTRO < 6 )) && { G_DIETPI-NOTIFY 1 'Unsupported Ubuntu version. Aborting ...'; exit 1; } fi case $G_HW_ARCH_NAME in 'armv6l') export G_HW_ARCH=1;; @@ -91,29 +94,29 @@ case $HW_MODEL in 4) iname='RPi234' HW_ARCH=3 boot_size=128 root_size=895;; 5) iname='RPi5' HW_ARCH=3 boot_size=128 root_size=895;; 10) iname='OdroidC1' HW_ARCH=2 partition_start=4 boot_size=128 root_size=700 boot_fstype='fat16';; - 11) iname='OdroidXU4' HW_ARCH=2 partition_start=4 root_size=764;; + 11) iname='OdroidXU4' HW_ARCH=2 partition_start=4 root_size=800;; 12) iname='OdroidC2' HW_ARCH=3 partition_start=4 root_size=1148;; 15) iname='OdroidN2' HW_ARCH=3 partition_start=4 root_size=1148;; 16) iname='OdroidC4' HW_ARCH=3 partition_start=4 root_size=1148;; 20) iname='VM' HW_ARCH=${HW_ARCH:-10} VMTYPE=${VMTYPE:-raw};; 21) iname='NativePC-BIOS' HW_ARCH=10 root_size=1663;; 40) iname='PINEA64' HW_ARCH=3 partition_start=4 root_size=1020;; - 42) iname='ROCKPro64' HW_ARCH=3 partition_start=16 root_size=1008;; - 43) iname='ROCK64' HW_ARCH=3 partition_start=16 root_size=1008;; + 42) iname='ROCKPro64' HW_ARCH=3 partition_start=16 root_size=1100;; + 43) iname='ROCK64' HW_ARCH=3 partition_start=16 root_size=1100;; 44) iname='Pinebook' HW_ARCH=3 partition_start=4 root_size=1020;; 45) iname='PINEH64' HW_ARCH=3 partition_start=4 root_size=1020;; - 46) iname='PinebookPro' HW_ARCH=3 partition_start=16 root_size=1008;; - 47) iname='NanoPiR4S' HW_ARCH=3 partition_start=16 root_size=1008;; + 46) iname='PinebookPro' HW_ARCH=3 partition_start=16 root_size=1100;; + 47) iname='NanoPiR4S' HW_ARCH=3 partition_start=16 root_size=1100;; 48) iname='NanoPiR1' HW_ARCH=2 partition_start=4 root_size=800;; '49.1') iname='Quartz64A' HW_ARCH=3 partition_start=16 root_size=752;; '49.2') iname='Quartz64B' HW_ARCH=3 partition_start=16 root_size=752;; '49.3') iname='SOQuartz' HW_ARCH=3 partition_start=16 root_size=752;; 52) iname='ASUSTB' HW_ARCH=2 partition_start=4 root_size=764;; 54) iname='NanoPiK2' HW_ARCH=3 partition_start=4 root_size=1148;; - 55) iname='NanoPiR2S' HW_ARCH=3 partition_start=16 root_size=1008;; + 55) iname='NanoPiR2S' HW_ARCH=3 partition_start=16 root_size=1100;; 56) iname='NanoPiNEO3' HW_ARCH=3 partition_start=16 root_size=1100;; 57) iname='NanoPiNEOPlus2' HW_ARCH=3 partition_start=4 root_size=1000;; - 58) iname='NanoPiM4V2' HW_ARCH=3 partition_start=16 root_size=1008;; + 58) iname='NanoPiM4V2' HW_ARCH=3 partition_start=16 root_size=1100;; 59) iname='ZeroPi' HW_ARCH=2 partition_start=4 root_size=800;; 60) iname='NanoPiNEO' HW_ARCH=2 partition_start=4 root_size=800;; 61) iname='NanoPiM2' HW_ARCH=2 partition_start=4 boot_size=64 root_size=700 boot_fstype='ext4';; @@ -125,30 +128,30 @@ case $HW_MODEL in '65.2') iname='NanoPiNEO2Black' HW_ARCH=3 partition_start=4 root_size=1020;; 66) iname='NanoPiM1Plus' HW_ARCH=2 partition_start=4 root_size=800;; 67) iname='NanoPiK1Plus' HW_ARCH=3 partition_start=4 root_size=1020;; - '68.1') iname='NanoPiM4' HW_ARCH=3 partition_start=16 root_size=1008;; - '68.2') iname='NanoPCT4' HW_ARCH=3 partition_start=16 root_size=1008;; - '68.3') iname='NanoPiNEO4' HW_ARCH=3 partition_start=16 root_size=1008;; + '68.1') iname='NanoPiM4' HW_ARCH=3 partition_start=16 root_size=1100;; + '68.2') iname='NanoPCT4' HW_ARCH=3 partition_start=16 root_size=1100;; + '68.3') iname='NanoPiNEO4' HW_ARCH=3 partition_start=16 root_size=1100;; 70) iname='SparkySBC' HW_ARCH=2 partition_start=8 boot_size=48 root_size=712 boot_fstype='fat16';; - '72.1') iname='ROCKPi4' HW_ARCH=3 partition_start=16 root_size=1008;; - '72.2') iname='ROCK4SE' HW_ARCH=3 partition_start=16 root_size=1008;; - '72.3') iname='ROCK4CPlus' HW_ARCH=3 partition_start=16 root_size=1008;; - 73) iname='ROCKPiS' HW_ARCH=3 partition_start=16 root_size=1008;; + '72.1') iname='ROCKPi4' HW_ARCH=3 partition_start=16 root_size=1100;; + '72.2') iname='ROCK4SE' HW_ARCH=3 partition_start=16 root_size=1100;; + '72.3') iname='ROCK4CPlus' HW_ARCH=3 partition_start=16 root_size=1100;; + 73) iname='ROCKPiS' HW_ARCH=3 partition_start=16 root_size=1100;; 74) iname='RadxaZero' HW_ARCH=3 partition_start=4 root_size=1148;; 75) iname='Container' HW_ARCH=${HW_ARCH:-10} root_size=575;; '76.1') iname='NanoPiR5S' HW_ARCH=3 PTTYPE='gpt' partition_start=16 root_size=1136;; '76.2') iname='NanoPiR5C' HW_ARCH=3 PTTYPE='gpt' partition_start=16 root_size=1136;; 77) iname='ROCK3A' HW_ARCH=3 PTTYPE='gpt' partition_start=16 root_size=1136;; - 78) iname='ROCK5B' HW_ARCH=3 PTTYPE='gpt' partition_start=16 root_size=1008;; - '79.1') iname='NanoPiR6S' HW_ARCH=3 PTTYPE='gpt' partition_start=16 root_size=1008;; - '79.2') iname='NanoPiR6C' HW_ARCH=3 PTTYPE='gpt' partition_start=16 root_size=1008;; - '79.3') iname='NanoPCT6' HW_ARCH=3 PTTYPE='gpt' partition_start=16 root_size=1008;; + 78) iname='ROCK5B' HW_ARCH=3 PTTYPE='gpt' partition_start=16 root_size=1100;; + '79.1') iname='NanoPiR6S' HW_ARCH=3 PTTYPE='gpt' partition_start=16 root_size=1100;; + '79.2') iname='NanoPiR6C' HW_ARCH=3 PTTYPE='gpt' partition_start=16 root_size=1100;; + '79.3') iname='NanoPCT6' HW_ARCH=3 PTTYPE='gpt' partition_start=16 root_size=1100;; 80) iname='OrangePi5' HW_ARCH=3 PTTYPE='gpt' partition_start=16 root_size=1136;; 81) iname='VisionFive2' HW_ARCH=11 root_size=639;; - 82) iname='OrangePi5Plus' HW_ARCH=3 PTTYPE='gpt' partition_start=16 root_size=1008;; + 82) iname='OrangePi5Plus' HW_ARCH=3 PTTYPE='gpt' partition_start=16 root_size=1100;; 83) iname='OrangePiZero3' HW_ARCH=3 partition_start=4 root_size=1148;; 84) iname='Star64' HW_ARCH=11 root_size=639;; - 85) iname='ROCK5A' HW_ARCH=3 PTTYPE='gpt' partition_start=16 root_size=1008;; - 86) iname='ASUSTB2' HW_ARCH=3 partition_start=16 root_size=1008;; + 85) iname='ROCK5A' HW_ARCH=3 PTTYPE='gpt' partition_start=16 root_size=1100;; + 86) iname='ASUSTB2' HW_ARCH=3 partition_start=16 root_size=1100;; 87) iname='OrangePi3B' HW_ARCH=3 PTTYPE='gpt' partition_start=16 root_size=1136;; 88) iname='OrangePiZero2W' HW_ARCH=3 partition_start=4 root_size=1148;; 89) iname='OrangePi3LTS' HW_ARCH=3 partition_start=4 root_size=1000;; @@ -223,15 +226,28 @@ fi (( $efi_size )) || [[ $boot_size -gt 0 && $boot_fstype == 'fat'* ]] && apackages+=('dosfstools') # Emulation support in case of incompatible architecture -(( ( $G_HW_ARCH < 10 && $G_HW_ARCH < $HW_ARCH ) || ( ( $G_HW_ARCH == 10 || $G_HW_ARCH == 11 ) && $G_HW_ARCH != $HW_ARCH ) )) && apackages+=('qemu-user-static') +emulation=0 +(( $G_HW_ARCH == $HW_ARCH || ( $G_HW_ARCH < 10 && $G_HW_ARCH > $HW_ARCH ) )) || emulation=1 + +# Bullseye/Jammy: binfmt-support still required for emulation. With systemd-binfmt only, mmdebstrap throws "E: can neither be executed natively nor via qemu user emulation with binfmt_misc" +(( $emulation )) && { apackages+=('qemu-user-static'); (( $G_DISTRO < 7 )) && apackages+=('binfmt-support'); } # Virtual machine disk conversion [[ $VMTYPE && $VMTYPE != 'raw' ]] && apackages+=('qemu-utils') -G_AG_CHECK_INSTALL_PREREQ parted mmdebstrap dbus systemd-container xz-utils "${apackages[@]}" +G_AG_CHECK_INSTALL_PREREQ --no-install-recommends parted mmdebstrap dbus systemd-container xz-utils "${apackages[@]}" # Register QEMU binfmt configs -dpkg-query -s 'qemu-user-static' &> /dev/null && G_EXEC systemctl restart systemd-binfmt +if (( $emulation )) +then + if (( $G_DISTRO < 7 )) + then + G_EXEC systemctl disable --now systemd-binfmt + G_EXEC systemctl restart binfmt-support + else + G_EXEC systemctl restart systemd-binfmt + fi +fi # Bootstrap archive keyring if missing if [[ ! -f $keyring ]] @@ -395,7 +411,9 @@ packages='apt,bash-completion,bzip2,ca-certificates,cron,curl,fdisk,gpg,htop,ipu (( $DISTRO > 7 )) && packages+='7zip,' || packages+='p7zip,' [[ $HW_MODEL == 75 ]] && packages+='iproute2' || packages+='console-setup,dropbear,ethtool,fake-hwclock,ifupdown,isc-dhcp-client,kmod,rfkill,systemd-timesyncd,usbutils' # - "--skip=check/empty" to ignore /etc/fstab, boot and tmpfs mounts we added above -G_EXEC_OUTPUT=1 G_EXEC mmdebstrap --skip=check/empty --variant=minbase --include="$packages" --arch="$parch" --keyring="$keyring" "$distro" ./rootfs "$repo" +# - "--skip=check/qemu" to skip arch test, which requires the "arch-test" package. We however assure emulation support out end. +# - Bullseye/Jammy host mmdebstrap does not support "--skip=check/empty,check/qemu". +G_EXEC_OUTPUT=1 G_EXEC mmdebstrap --mode=root --format=dir --skip=check/empty --skip=check/qemu --variant=minbase --include="$packages" --arch="$parch" --keyring="$keyring" "$distro" ./rootfs "$repo" G_EXEC umount rootfs/dev rootfs/run rootfs/var/cache/apt rootfs/var/lib/apt/lists rootfs/var/log ########################################## @@ -413,15 +431,15 @@ _EOF_ cat << _EOF_ >> rootfs/etc/rc.local export GITOWNER='$GITOWNER' GITBRANCH='$GITBRANCH' HW_MODEL='$HW_MODEL' IMAGE_CREATOR=0 PREIMAGE_INFO=0 WIFI_REQUIRED=1 DISTRO_TARGET=$DISTRO TEST_KERNEL=$TEST_KERNEL TEST_UBOOT=$TEST_UBOOT echo '[ INFO ] Running DietPi-Installer for $G_GITOWNER/$G_GITBRANCH' -bash -c "\$(curl -sSf 'https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH/.build/images/dietpi-installer')" || poweroff +bash -c "\$(curl -sSf 'https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH/.build/images/dietpi-installer')" || { echo '[FAILED] DietPi-Installer failed, shutting down ...'; journalctl -n 25; df -h; free -h; poweroff; exit 1; } _EOF_ # - VM: Generate tiny-initramfs with explicit kernel modules, as auto-detection doesn't work correctly within container and loop devices [[ $HW_MODEL == 20 ]] && cat << _EOF_ >> rootfs/etc/rc.local echo '[ INFO ] Rebuilding virtual machine initramfs to support all virtualizers...' -version=\$(dpkg --get-selections | mawk '\$1~/^linux-image-.*-$parch\$/{print \$1;exit}') || poweroff +version=\$(dpkg --get-selections | mawk '\$1~/^linux-image-.*-$parch\$/{print \$1;exit}') || { echo '[FAILED] Obtaining kernel version failed, shutting down ...'; journalctl -n 25; df -h; free -h; poweroff; exit 1; } version=\${version#linux-image-} -mktirfs -m no -M no --include-modules='ahci,sd_mod,vmw_pvscsi,hv_storvsc,virtio_scsi,virtio_pci,BusLogic,$FSTYPE' -o "/boot/initrd.img-\$version" "\$version" || poweroff +mktirfs -m no -M no --include-modules='ahci,sd_mod,vmw_pvscsi,hv_storvsc,virtio_scsi,virtio_pci,BusLogic,$FSTYPE' -o "/boot/initrd.img-\$version" "\$version" || { echo '[FAILED] Generating initramfs failed, shutting down ...'; journalctl -n 25; df -h; free -h; poweroff; exit 1; } _EOF_ cat << '_EOF_' >> rootfs/etc/rc.local @@ -441,9 +459,9 @@ then abind=("--bind=$FP_LOOP" '--bind=/dev/disk') for i in "${FP_LOOP}p"*; do abind+=("--bind=$i"); done fi -systemd-nspawn -bD rootfs "${abind[@]}" || exit 1 +systemd-nspawn -bD rootfs "${abind[@]}" || { G_DIETPI-NOTIFY 1 'systemd-nspawn failed, aborting ...'; journalctl -n 25; ss -tlpn; df -h; free -h; exit 1; } -[[ -f 'rootfs/success' ]] || { G_DIETPI-NOTIFY 1 'The container setup did not finish successfully, aborting...'; exit 1; } +[[ -f 'rootfs/success' ]] || { G_DIETPI-NOTIFY 1 'The container setup did not finish successfully, aborting ...'; journalctl -n 25; ss -tlpn; df -h; free -h; exit 1; } G_EXEC rm rootfs/success G_EXEC rm -Rf rootfs/{dev,proc,run,sys,tmp,var/log}/{,.??,.[^.]}* # Failsafe: /var/log/journal was found despite tmpfs mount! G_EXEC sync diff --git a/.build/images/dietpi-imager b/.build/images/dietpi-imager index 153565d5be..e4369281e0 100755 --- a/.build/images/dietpi-imager +++ b/.build/images/dietpi-imager @@ -33,6 +33,9 @@ '13.'*|'trixie/sid') G_DISTRO=8;; *) G_DIETPI-NOTIFY 1 "Unsupported distro version \"$debian_version\". Aborting ..."; exit 1;; esac + # Ubuntu ships with /etc/debian_version from Debian testing, hence we assume one version lower. + grep -q '^ID=ubuntu' /etc/os-release && ((G_DISTRO--)) + (( $G_DISTRO < 6 )) && { G_DIETPI-NOTIFY 1 'Unsupported Ubuntu version. Aborting ...'; exit 1; } fi readonly G_PROGRAM_NAME='DietPi-Imager' G_CHECK_ROOT_USER diff --git a/.build/images/dietpi-installer b/.build/images/dietpi-installer index 71d6d33933..c2fd0f14d5 100755 --- a/.build/images/dietpi-installer +++ b/.build/images/dietpi-installer @@ -60,7 +60,7 @@ # Assure that /tmp is a tmpfs of at least 512 MiB if findmnt -M /tmp > /dev/null then - (( $(findmnt -Ufnrbo SIZE -M /tmp) < 536870912 )) && mount -o 'remount,size=512M,noatime,lazytime,nodev,nosuid,mode=1777' /tmp + (( $(findmnt -Ufnrbo SIZE -M /tmp) < 512*1024**2 )) && mount -o 'remount,size=512M,noatime,lazytime,nodev,nosuid,mode=1777' /tmp else mount -t tmpfs -o 'size=512M,noatime,lazytime,nodev,nosuid,mode=1777' tmpfs /tmp fi @@ -598,7 +598,7 @@ _EOF_ G_DIETPI-NOTIFY 2 'Moving kernel and boot configuration to /boot' # Hardware specific boot configs - local armbian_repo=0 + local armbian_packages=0 if (( $G_HW_MODEL < 10 )) then if findmnt -M /boot/firmware &> /dev/null @@ -615,7 +615,7 @@ _EOF_ elif [[ $G_HW_MODEL =~ ^(10|11)$ ]] then - armbian_repo=1 + armbian_packages=1 local model='OdroidC1' (( $G_HW_MODEL == 11 )) && model='OdroidXU4' G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/$model/boot.ini" /boot/boot.ini @@ -629,7 +629,7 @@ _EOF_ 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|76|77|78|79|80|82|83|85|86|87|88|89|90)$ ]] then - armbian_repo=1 + armbian_packages=1 G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/boot.cmd" /boot/boot.cmd G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/dietpiEnv.txt" /boot/dietpiEnv.txt G_CONFIG_INJECT 'rootdev=' "rootdev=UUID=$(findmnt -Ufnro UUID -M /)" /boot/dietpiEnv.txt @@ -673,11 +673,7 @@ setenv rootuuid "true"' /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 - 73) G_CONFIG_INJECT 'overlay_prefix=' 'overlay_prefix=rk3308' /boot/dietpiEnv.txt;; - 78|79|80|82|85) G_CONFIG_INJECT 'overlay_prefix=' 'overlay_prefix=rk3588' /boot/dietpiEnv.txt;; # ToDo: There are multiple other prefixes used in the kernel package, "rock-5b", "rock-5ab", "rockchip" (for fixup), so the boot.cmd need heavy adjustments (eliminate the prefix entirely) to work with all overlays. - *) G_CONFIG_INJECT 'overlay_prefix=' 'overlay_prefix=rockchip' /boot/dietpiEnv.txt;; - esac + # Device tree case $G_HW_MODEL in 46) G_CONFIG_INJECT 'fdtfile=' 'fdtfile=rockchip/rk3399-pinebook-pro.dtb' /boot/dietpiEnv.txt;; 55) G_CONFIG_INJECT 'fdtfile=' 'fdtfile=rockchip/rk3328-nanopi-r2-rev00.dtb' /boot/dietpiEnv.txt;; # Not necessarily needed as rk3328-nanopi-r2s.dtb is automatically chosen, but provides more consistent /sys/class/leds/{wan,lan}_led interface and blinking instead of steady lid power LED @@ -697,6 +693,13 @@ setenv rootuuid "true"' /boot/boot.cmd 87) G_CONFIG_INJECT 'fdtfile=' 'fdtfile=rockchip/rk3566-orangepi-3b.dtb' /boot/dietpiEnv.txt;; *) :;; esac + # Overlay prefix + case $G_HW_MODEL in + 73) G_CONFIG_INJECT 'overlay_prefix=' 'overlay_prefix=rk3308' /boot/dietpiEnv.txt;; + 78|79|80|82|85) G_CONFIG_INJECT 'overlay_prefix=' 'overlay_prefix=rk3588' /boot/dietpiEnv.txt;; # ToDo: There are multiple other prefixes used in the kernel package, "rock-5b", "rock-5ab", "rockchip" (for fixup), so the boot.cmd need heavy adjustments (eliminate the prefix entirely) to work with all overlays. + *) G_CONFIG_INJECT 'overlay_prefix=' 'overlay_prefix=rockchip' /boot/dietpiEnv.txt;; + esac + # Console args 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 @@ -761,12 +764,14 @@ setenv rootuuid "true"' /boot/boot.cmd 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 + # Overlays case $G_HW_MODEL in 48) G_CONFIG_INJECT 'overlays=' 'overlays=usbhost1 usbhost2 uart1' /boot/dietpiEnv.txt;; 59|60) G_CONFIG_INJECT 'overlays=' 'overlays=usbhost1 usbhost2' /boot/dietpiEnv.txt;; 64) G_CONFIG_INJECT 'overlays=' 'overlays=usbhost2 usbhost3' /boot/dietpiEnv.txt;; *) :;; esac + # Console args 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 @@ -809,6 +814,8 @@ setenv rootuuid "true"' /boot/boot.cmd G_DIETPI-NOTIFY 2 'Applying DietPi live patches to fix known bugs in this version' for i in "${!G_LIVE_PATCH[@]}" do + # ToDo: Temporarily skip live patch 0 on NanoPi R6C, which cannot succeed here, but will be applied later in this script + (( $G_HW_MODEL == 79 && $HW_VARIANT == 2 && $i == 0 )) && [[ ${G_LIVE_PATCH_DESC[i]} == *'NanoPi R6C' ]] && continue if eval "${G_LIVE_PATCH_COND[$i]}" then G_DIETPI-NOTIFY 2 "Applying live patch $i" @@ -830,6 +837,13 @@ setenv rootuuid "true"' /boot/boot.cmd G_DIETPI-NOTIFY 3 "$G_PROGRAM_NAME" "[$SETUP_STEP] APT configuration"; ((SETUP_STEP++)) #------------------------------------------------------------------------------------------------ + G_DIETPI-NOTIFY 2 'Disabling apt-daily services to prevent random APT cache lock' + for i in apt-daily{,-upgrade}.{service,timer} + do + G_EXEC systemctl disable --now "$i" + G_EXEC systemctl mask "$i" + done + G_DIETPI-NOTIFY 2 "Setting APT sources.list: $DISTRO_TARGET_NAME $DISTRO_TARGET" # We need to forward $DISTRO_TARGET* to dietpi-set_software, as well as $G_HW_MODEL + $G_RASPBIAN for Debian vs Raspbian decision. @@ -1024,10 +1038,19 @@ setenv rootuuid "true"' /boot/boot.cmd [[ -f '/etc/apt/trusted.gpg~' ]] && G_EXEC rm '/etc/apt/trusted.gpg~' # DietPi-Build with Armbian kernel/bootloader/firmware - elif (( $armbian_repo )) + elif (( $armbian_packages )) then - # Prevent any unintended packages from being installed from Armbian's APT repository, like base-files: https://github.com/MichaIng/DietPi/issues/6227#issuecomment-1713688577 - cat << '_EOF_' > /etc/apt/preferences.d/dietpi-armbian + # Remove obsolete combined keyring + [[ -f '/etc/apt/trusted.gpg' ]] && G_EXEC rm /etc/apt/trusted.gpg + [[ -f '/etc/apt/trusted.gpg~' ]] && G_EXEC rm '/etc/apt/trusted.gpg~' + + # Remove obsolete lists + find /etc/apt/sources.list.d -mindepth 1 ! -name 'dietpi.list' -exec rm -Rf {} + + + if [[ $G_GITBRANCH == 'master' ]] + then + # Prevent any unintended packages from being installed from Armbian's APT repository, like base-files: https://github.com/MichaIng/DietPi/issues/6227#issuecomment-1713688577 + cat << '_EOF_' > /etc/apt/preferences.d/dietpi-armbian Package: * Pin: origin apt.armbian.com Pin-Priority: -1 @@ -1036,28 +1059,25 @@ Package: armbian-firmware* linux-* Pin: origin apt.armbian.com Pin-Priority: 500 _EOF_ - if dpkg --compare-versions "$(dpkg-query -Wf '${Version}' base-files)" gt 20 - then - G_DIETPI-NOTIFY 2 'Enforcing downgrade of Armbian'\''s base-files package to Debian'\''s' - cat << '_EOF_' > /etc/apt/preferences.d/dietpi-armbian-tmp + if dpkg --compare-versions "$(dpkg-query -Wf '${Version}' base-files)" gt 20 + then + G_DIETPI-NOTIFY 2 'Enforcing downgrade of Armbian'\''s base-files package to Debian'\''s' + cat << '_EOF_' > /etc/apt/preferences.d/dietpi-armbian-tmp Package: base-files Pin: release o=Debian Pin-Priority: 1000 _EOF_ - G_EXEC eval 'echo '\''APT::Get::Allow-Downgrades "1";'\'' > /etc/apt/apt.conf.d/dietpi-armbian' + G_EXEC eval 'echo '\''APT::Get::Allow-Downgrades "1";'\'' > /etc/apt/apt.conf.d/dietpi-armbian' + fi + + # Bootstrap Armbian repository + G_EXEC_RETRIES=2 G_EXEC eval 'curl -sSfL '\''https://apt.armbian.com/armbian.key'\'' | gpg --dearmor -o /etc/apt/trusted.gpg.d/dietpi-armbian.gpg --yes' + + # Add Armbian repository + G_EXEC eval "echo 'deb https://apt.armbian.com ${DISTRO_TARGET_NAME/bullseye/bookworm} main' > /etc/apt/sources.list.d/dietpi-armbian.list" fi - # Bootstrap Armbian repository - G_EXEC_RETRIES=2 G_EXEC eval 'curl -sSfL '\''https://apt.armbian.com/armbian.key'\'' | gpg --dearmor -o /etc/apt/trusted.gpg.d/dietpi-armbian.gpg --yes' - # Remove obsolete combined keyring - [[ -f '/etc/apt/trusted.gpg' ]] && G_EXEC rm /etc/apt/trusted.gpg - [[ -f '/etc/apt/trusted.gpg~' ]] && G_EXEC rm '/etc/apt/trusted.gpg~' - # Remove obsolete lists - find /etc/apt/sources.list.d -mindepth 1 ! -name 'dietpi.list' -exec rm -Rf {} + - # Add Armbian repository - G_EXEC eval "echo 'deb https://apt.armbian.com ${DISTRO_TARGET_NAME/bullseye/bookworm} main' > /etc/apt/sources.list.d/dietpi-armbian.list" - # Update APT lists - G_AGUP - # Install kernel, device tree, U-Boot, firmware and initramfs packages + + # Select kernel, device tree and U-Boot packages local model='odroidn2' kernel='meson64' arch='arm64' branch='current' zstd=() case $G_HW_MODEL in 10) model='odroidc1' kernel='meson' arch='arm';; @@ -1117,6 +1137,7 @@ _EOF_ 78) model='rock-5b' kernel='rk35xx' branch='legacy';; 79) kernel='rk35xx' branch='legacy' case $HW_VARIANT in + 2) model='nanopi-r6c'; G_EXEC sed -i 's/r6s/r6c/' /etc/apt/sources.list.d/dietpi.list;; # ToDo: Temporarily assure correct APT component, until DietPi v9.6 release 3) model='nanopct6';; *) model='nanopi-r6s';; esac;; @@ -1132,19 +1153,8 @@ _EOF_ *) :;; esac - # Odroid C1: https://dietpi.com/forum/t/odroid-c1-not-booting-after-kernel-upgrade/17818 - if (( $G_HW_MODEL == 10 )) - then - G_DIETPI-NOTIFY 2 'Pinning Odroid C1 "current" and "edge" kernel packages to latest known functional version and in case enforcing automated downgrade' - cat << '_EOF_' > /etc/apt/preferences.d/00-dietpi-odroidc1 -Package: linux-image-current-meson linux-dtb-current-meson linux-headers-current-meson linux-image-edge-meson linux-dtb-edge-meson linux-headers-edge-meson -Pin: version 23.02.2 -Pin-Priority: 1000 -_EOF_ - G_EXEC eval 'echo '\''APT::Get::Allow-Downgrades "1";'\'' > /etc/apt/apt.conf.d/dietpi-armbian' - # NanoPi R2S/NEO3 - elif [[ $G_HW_MODEL =~ ^(55|56)$ ]] + if [[ $G_HW_MODEL =~ ^(55|56)$ ]] then G_DIETPI-NOTIFY 2 'Blacklisting video related kernel modules' cat << '_EOF_' > /etc/modprobe.d/dietpi-headless.conf @@ -1155,10 +1165,18 @@ blacklist rockchip_rga blacklist rockchip_vdec _EOF_ fi + + # Update APT lists cleanly + find /tmp -exec ls -dl {} + # debug + df -h /tmp # debug + /boot/dietpi/func/dietpi-set_software apt clean + G_EXEC_NOHALT=1 G_AGUP || { free -m; find /tmp -exec ls -dl {} +; df -h /tmp; exit 1; } + # Install initramfs-tools first to have an initramfs generated on kernel install, and configure it to use zstd if supported for better compression and faster decompression - [[ $kernel == 'rockchip64' || $kernel == 'rk35xx' || $kernel == 'meson64' || $kernel == 'sunxi64' || $kernel == 'sunxi' || $kernel == 'rockchip' ]] && zstd=('zstd') + [[ $kernel == 's5p6818' ]] || zstd=('zstd') G_AGI initramfs-tools u-boot-tools armbian-firmware "${zstd[@]}" [[ ${zstd[0]} ]] && G_CONFIG_INJECT 'COMPRESS=' 'COMPRESS=zstd' /etc/initramfs-tools/initramfs.conf + # Download and pre-install kernel hosted on dietpi.com where the Armbian APT repo provides a too old version or is not available if (( $TEST_KERNEL )) then @@ -1167,6 +1185,7 @@ _EOF_ G_EXEC_OUTPUT=1 G_EXEC dpkg -i package[12].deb G_EXEC rm package[12].deb fi + # Download and pre-install U-Boot hosted on dietpi.com where the Armbian APT repo provides a too old version or is not available if (( $TEST_UBOOT )) then @@ -1174,27 +1193,25 @@ _EOF_ G_EXEC_OUTPUT=1 G_EXEC dpkg -i package.deb G_EXEC rm package.deb fi + # Install kernel and bootloader G_AGI linux-{image,dtb}-"$branch-$kernel" "linux-u-boot-$model-$branch" + # Cleanup [[ $G_HW_MODEL != 10 && -f '/boot/uImage' ]] && G_EXEC rm /boot/uImage [[ -f '/boot/.next' ]] && G_EXEC rm /boot/.next [[ -f '/boot/armbianEnv.txt' ]] && G_EXEC rm /boot/armbianEnv.txt [[ -f '/boot/orangepiEnv.txt' ]] && G_EXEC rm /boot/orangepiEnv.txt [[ -f '/boot/uEnv.txt' ]] && G_EXEC rm /boot/uEnv.txt + # Compile U-Boot script [[ -f '/boot/boot.cmd' ]] && G_EXEC mkimage -C none -A "$arch" -T script -d /boot/boot.cmd /boot/boot.scr + # Flash U-Boot /boot/dietpi/func/dietpi-set_hardware flash-u-boot-mmc "$BOOT_DEVICE" - # Odroid C1 cleanup: https://dietpi.com/forum/t/odroid-c1-not-booting-after-kernel-upgrade/17818 - if (( $G_HW_MODEL == 10 )) - then - G_DIETPI-NOTIFY 2 'Setting Odroid C1 "current" and "edge" kernel packages on hold' - G_EXEC apt-mark hold linux-image-current-meson linux-dtb-current-meson linux-headers-current-meson linux-image-edge-meson linux-dtb-edge-meson linux-headers-edge-meson - # Radxa Zero: Enable USB OTG OOTB: https://github.com/MichaIng/DietPi/issues/5931 - elif (( $G_HW_MODEL == 74 )) + if (( $G_HW_MODEL == 74 )) then G_AGI device-tree-compiler G_EXEC mkdir -p /boot/overlay-user @@ -1358,14 +1375,7 @@ _EOF_ systemctl stop armbian-* # Keep currently installed kernel and bootloader packages - local apackages=( - - 'linux-image-' - 'linux-dtb-' - 'linux-u-boot-' - ) - - for i in "${apackages[@]}" + for i in linux-{image,dtb,u-boot}- do while read -r line do @@ -1374,7 +1384,6 @@ _EOF_ done < <(dpkg-query -Wf '${Package}\n' | mawk -v pat="^$i" '$0~pat') done - unset -v apackages # Add initramfs-tools and u-boot-tools, required to convert initramfs images into u-boot format aPACKAGES_REQUIRED_INSTALL+=('initramfs-tools' 'u-boot-tools') @@ -1426,6 +1435,21 @@ _EOF_ G_EXEC rm -f /{initrd.img,vmlinuz}{,.old} fi + if [[ -f '/boot/armbianEnv.txt' ]] + then + # Force legacy network interface names + G_CONFIG_INJECT 'extraargs=' 'extraargs=net.ifnames=0' /boot/armbianEnv.txt + + # Disable bootsplash logo, as we removed the file above: https://github.com/MichaIng/DietPi/issues/3932#issuecomment-852376681 + G_CONFIG_INJECT 'bootlogo=' 'bootlogo=false' /boot/armbianEnv.txt + + # Reset default kernel log verbosity, reduced to "1" on most Armbian images + G_CONFIG_INJECT 'verbosity=' 'verbosity=4' /boot/armbianEnv.txt + + # Disable Docker optimisations, since this has some performance drawbacks, enable on Docker install instead + G_CONFIG_INJECT 'docker_optimizations=' 'docker_optimizations=off' /boot/armbianEnv.txt + fi + # Generic kernel, device tree, bootloader and firmware package auto detect + initramfs-tools elif (( $G_HW_MODEL != 75 )) then @@ -1823,13 +1847,6 @@ _EOF_' #----------------------------------------------------------------------------------- # MISC - G_DIETPI-NOTIFY 2 'Disabling apt-daily services to prevent random APT cache lock' - for i in apt-daily{,-upgrade}.{service,timer} - do - G_EXEC systemctl disable --now "$i" - G_EXEC systemctl mask "$i" - done - if command -v e2scrub > /dev/null then G_DIETPI-NOTIFY 2 'Disabling e2scrub services which are for LVM and require lvm2/lvcreate being installed' @@ -2178,22 +2195,6 @@ _EOF_ G_EXEC eval 'echo '\''sprdwl_ng'\'' > /etc/modules-load.d/dietpi-enable_wifi.conf' fi - # Armbian - if [[ -f '/boot/armbianEnv.txt' ]] - then - # Force legacy network interface names - G_CONFIG_INJECT 'extraargs=' 'extraargs=net.ifnames=0' /boot/armbianEnv.txt - - # Disable bootsplash logo, as we removed the file above: https://github.com/MichaIng/DietPi/issues/3932#issuecomment-852376681 - G_CONFIG_INJECT 'bootlogo=' 'bootlogo=false' /boot/armbianEnv.txt - - # Reset default kernel log verbosity, reduced to "1" on most Armbian images - G_CONFIG_INJECT 'verbosity=' 'verbosity=4' /boot/armbianEnv.txt - - # Disable Docker optimisations, since this has some performance drawbacks, enable on Docker install instead - G_CONFIG_INJECT 'docker_optimizations=' 'docker_optimizations=off' /boot/armbianEnv.txt - fi - #------------------------------------------------------------------------------------------------ G_DIETPI-NOTIFY 3 "$G_PROGRAM_NAME" "[$SETUP_STEP] Finalise system for first boot of DietPi"; ((SETUP_STEP++)) #------------------------------------------------------------------------------------------------ diff --git a/.build/software/Amiberry/build.bash b/.build/software/Amiberry/build.bash index 61379b0115..7db831b63f 100755 --- a/.build/software/Amiberry/build.bash +++ b/.build/software/Amiberry/build.bash @@ -111,6 +111,8 @@ fi v_ami=$(curl -sSf 'https://api.github.com/repos/BlitterStudio/amiberry/releases/latest' | mawk -F\" '/^ "tag_name"/{print $4}') [[ $v_ami ]] || { G_DIETPI-NOTIFY 1 'No latest Amiberry version found, aborting ...'; exit 1; } v_ami=${v_ami#v} +# - ARMv6: v5.7.2 dropped support for Raspberry Pi 1, hence use v5.7.1 +[[ $PLATFORM == 'rpi1'* ]] && v_ami='5.7.1' G_DIETPI-NOTIFY 2 "Building Amiberry version \e[33m$v_ami\e[90m for platform: \e[33m$PLATFORM" G_EXEC cd /tmp G_EXEC curl -sSfLO "https://github.com/BlitterStudio/amiberry/archive/v$v_ami.tar.gz" diff --git a/.build/software/Amiberry/container_build.bash b/.build/software/Amiberry/container_build.bash index 18b95af376..c2c8cd7d8e 100755 --- a/.build/software/Amiberry/container_build.bash +++ b/.build/software/Amiberry/container_build.bash @@ -14,6 +14,16 @@ else . /tmp/dietpi-globals G_EXEC_NOHALT=1 G_EXEC rm /tmp/dietpi-globals export G_GITOWNER G_GITBRANCH G_HW_ARCH_NAME=$(uname -m) + read -r debian_version < /etc/debian_version + case $debian_version in + '11.'*|'bullseye/sid') G_DISTRO=6;; + '12.'*|'bookworm/sid') G_DISTRO=7;; + '13.'*|'trixie/sid') G_DISTRO=8;; + *) G_DIETPI-NOTIFY 1 "Unsupported distro version \"$debian_version\". Aborting ..."; exit 1;; + esac + # Ubuntu ships with /etc/debian_version from Debian testing, hence we assume one version lower. + grep -q '^ID=ubuntu' /etc/os-release && ((G_DISTRO--)) + (( $G_DISTRO < 6 )) && { G_DIETPI-NOTIFY 1 'Unsupported Ubuntu version. Aborting ...'; exit 1; } fi case $G_HW_ARCH_NAME in 'armv6l') export G_HW_ARCH=1;; @@ -59,11 +69,27 @@ image="DietPi_Container-$image.img" # Dependencies ########################################## apackages=('xz-utils' 'parted' 'fdisk' 'systemd-container') -(( $G_HW_ARCH == $arch || ( $G_HW_ARCH < 10 && $G_HW_ARCH > $arch ) )) || apackages+=('qemu-user-static') + +# Emulation support in case of incompatible architecture +emulation=0 +(( $G_HW_ARCH == $arch || ( $G_HW_ARCH < 10 && $G_HW_ARCH > $arch ) )) || emulation=1 + +# Bullseye/Jammy: binfmt-support still required for emulation. With systemd-binfmt only, mmdebstrap throws "E: can neither be executed natively nor via qemu user emulation with binfmt_misc" +(( $emulation )) && { apackages+=('qemu-user-static'); (( $G_DISTRO < 7 )) && apackages+=('binfmt-support'); } + G_AG_CHECK_INSTALL_PREREQ "${apackages[@]}" # Register QEMU binfmt configs -dpkg-query -s 'qemu-user-static' &> /dev/null && G_EXEC systemctl restart systemd-binfmt +if (( $emulation )) +then + if (( $G_DISTRO < 7 )) + then + G_EXEC systemctl disable --now systemd-binfmt + G_EXEC systemctl restart binfmt-support + else + G_EXEC systemctl restart systemd-binfmt + fi +fi ########################################## # Prepare container diff --git a/.build/software/dietpi-software-build.bash b/.build/software/dietpi-software-build.bash index de37c10ab5..554c274e1f 100644 --- a/.build/software/dietpi-software-build.bash +++ b/.build/software/dietpi-software-build.bash @@ -14,6 +14,16 @@ else . /tmp/dietpi-globals G_EXEC rm /tmp/dietpi-globals export G_GITOWNER G_GITBRANCH G_HW_ARCH_NAME=$(uname -m) + read -r debian_version < /etc/debian_version + case $debian_version in + '11.'*|'bullseye/sid') G_DISTRO=6;; + '12.'*|'bookworm/sid') G_DISTRO=7;; + '13.'*|'trixie/sid') G_DISTRO=8;; + *) G_DIETPI-NOTIFY 1 "Unsupported distro version \"$debian_version\". Aborting ..."; exit 1;; + esac + # Ubuntu ships with /etc/debian_version from Debian testing, hence we assume one version lower. + grep -q '^ID=ubuntu' /etc/os-release && ((G_DISTRO--)) + (( $G_DISTRO < 6 )) && { G_DIETPI-NOTIFY 1 'Unsupported Ubuntu version. Aborting ...'; exit 1; } fi case $G_HW_ARCH_NAME in 'armv6l') export G_HW_ARCH=1;; @@ -63,11 +73,27 @@ image="DietPi_Container-$image.img" # Dependencies ########################################## apackages=('xz-utils' 'parted' 'fdisk' 'systemd-container') -(( $G_HW_ARCH == $arch || ( $G_HW_ARCH < 10 && $G_HW_ARCH > $arch ) )) || apackages+=('qemu-user-static') + +# Emulation support in case of incompatible architecture +emulation=0 +(( $G_HW_ARCH == $arch || ( $G_HW_ARCH < 10 && $G_HW_ARCH > $arch ) )) || emulation=1 + +# Bullseye/Jammy: binfmt-support still required for emulation. With systemd-binfmt only, mmdebstrap throws "E: can neither be executed natively nor via qemu user emulation with binfmt_misc" +(( $emulation )) && { apackages+=('qemu-user-static'); (( $G_DISTRO < 7 )) && apackages+=('binfmt-support'); } + G_AG_CHECK_INSTALL_PREREQ "${apackages[@]}" # Register QEMU binfmt configs -dpkg-query -s 'qemu-user-static' &> /dev/null && G_EXEC systemctl restart systemd-binfmt +if (( $emulation )) +then + if (( $G_DISTRO < 7 )) + then + G_EXEC systemctl disable --now systemd-binfmt + G_EXEC systemctl restart binfmt-support + else + G_EXEC systemctl restart systemd-binfmt + fi +fi ########################################## # Prepare container diff --git a/.github/workflows/dietpi-software.bash b/.github/workflows/dietpi-software.bash index 518c360924..28882c83ad 100644 --- a/.github/workflows/dietpi-software.bash +++ b/.github/workflows/dietpi-software.bash @@ -13,6 +13,16 @@ else . /tmp/dietpi-globals G_EXEC rm /tmp/dietpi-globals export G_GITOWNER G_GITBRANCH G_HW_ARCH_NAME=$(uname -m) + read -r debian_version < /etc/debian_version + case $debian_version in + '11.'*|'bullseye/sid') G_DISTRO=6;; + '12.'*|'bookworm/sid') G_DISTRO=7;; + '13.'*|'trixie/sid') G_DISTRO=8;; + *) G_DIETPI-NOTIFY 1 "Unsupported distro version \"$debian_version\". Aborting ..."; exit 1;; + esac + # Ubuntu ships with /etc/debian_version from Debian testing, hence we assume one version lower. + grep -q '^ID=ubuntu' /etc/os-release && ((G_DISTRO--)) + (( $G_DISTRO < 6 )) && { G_DIETPI-NOTIFY 1 'Unsupported Ubuntu version. Aborting ...'; exit 1; } fi case $G_HW_ARCH_NAME in 'armv6l') export G_HW_ARCH=1;; @@ -230,6 +240,7 @@ Process_Software() 209) aCOMMANDS[i]='restic version';; 211) aCOMMANDS[i]='hb-service status' aSERVICES[i]='homebridge' aTCP[i]='8581'; (( $arch < 10 )) && aDELAY[i]=30; (( $arch == 3 )) && aDELAY[i]=120;; 212) aSERVICES[i]='kavita' aTCP[i]='2036'; (( $arch < 10 )) && aDELAY[i]=180; (( $arch == 10 )) && aDELAY[i]=30;; + 213) aSERVICES[i]='soju' aTCP[i]='6667';; *) :;; esac done @@ -251,6 +262,8 @@ do #86|134|185) Process_Software 162;; # Docker does not start in systemd containers (without dedicated network) 166) Process_Software 70;; 180) (( $arch == 10 || $arch == 3 )) || Process_Software 170;; + 188) Process_Software 17;; + 213) Process_Software 17 188;; *) :;; esac Process_Software "$i" @@ -260,11 +273,27 @@ done # Dependencies ########################################## apackages=('xz-utils' 'parted' 'fdisk' 'systemd-container') -(( $G_HW_ARCH == $arch || ( $G_HW_ARCH < 10 && $G_HW_ARCH > $arch ) )) || apackages+=('qemu-user-static') + +# Emulation support in case of incompatible architecture +emulation=0 +(( $G_HW_ARCH == $arch || ( $G_HW_ARCH < 10 && $G_HW_ARCH > $arch ) )) || emulation=1 + +# Bullseye/Jammy: binfmt-support still required for emulation. With systemd-binfmt only, mmdebstrap throws "E: can neither be executed natively nor via qemu user emulation with binfmt_misc" +(( $emulation )) && { apackages+=('qemu-user-static'); (( $G_DISTRO < 7 )) && apackages+=('binfmt-support'); } + G_AG_CHECK_INSTALL_PREREQ "${apackages[@]}" # Register QEMU binfmt configs -dpkg-query -s 'qemu-user-static' &> /dev/null && G_EXEC systemctl restart systemd-binfmt +if (( $emulation )) +then + if (( $G_DISTRO < 7 )) + then + G_EXEC systemctl disable --now systemd-binfmt + G_EXEC systemctl restart binfmt-support + else + G_EXEC systemctl restart systemd-binfmt + fi +fi ########################################## # Prepare container @@ -311,8 +340,12 @@ then fi # Install test builds from dietpi.com if requested -# shellcheck disable=SC2016 -[[ $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 +if [[ $TEST == 'true' ]] +then + # shellcheck disable=SC2016 + 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 + G_CONFIG_INJECT 'SOFTWARE_DIETPI_DASHBOARD_VERSION=' 'SOFTWARE_DIETPI_DASHBOARD_VERSION=Nightly' rootfs/boot/dietpi.txt +fi # Workaround invalid TERM on login # shellcheck disable=SC2016 @@ -321,6 +354,7 @@ G_EXEC eval 'echo '\''infocmp "$TERM" > /dev/null 2>&1 || { echo "[ INFO ] Unsup # Enable automated setup G_CONFIG_INJECT 'AUTO_SETUP_AUTOMATED=' 'AUTO_SETUP_AUTOMATED=1' rootfs/boot/dietpi.txt # - Workaround for skipped autologin in emulated Trixie/Sid containers: https://gitlab.com/qemu-project/qemu/-/issues/1962 +# - Set HOME path, required e.g. go builds, which is otherwise missing when started from a systemd unit. if [[ $DISTRO == 'trixie' ]] && (( $G_HW_ARCH != $arch && ( $G_HW_ARCH > 9 || $G_HW_ARCH < $arch ) )) then cat << '_EOF_' > rootfs/etc/systemd/system/dietpi-automation.service @@ -331,6 +365,7 @@ After=dietpi-postboot.service [Service] Type=idle StandardOutput=tty +Environment=HOME=/root ExecStart=/bin/dash -c 'infocmp "$TERM" > /dev/null 2>&1 || export TERM=dumb; exec /boot/dietpi/dietpi-login' ExecStop=/sbin/poweroff @@ -426,5 +461,5 @@ G_EXEC sed --follow-symlinks -i 's|Prompt_on_Failure$|{ journalctl -n 50; ss -tu # Boot container ########################################## systemd-nspawn -bD rootfs -[[ -f 'rootfs/success' ]] || { journalctl -n 25; ss -tulpn; df -h; free -h; exit 1; } +[[ -f 'rootfs/success' ]] || { journalctl -n 25; ss -tlpn; df -h; free -h; exit 1; } } diff --git a/.meta/dietpi-survey_report b/.meta/dietpi-survey_report index 8328fd9b53..c13944aa27 100755 --- a/.meta/dietpi-survey_report +++ b/.meta/dietpi-survey_report @@ -721,8 +721,15 @@ shopt -s extglob done aSOFTWARE_NAME9_5[177]='Forgejo' + aSOFTWARE_NAME9_6=() + for i in "${!aSOFTWARE_NAME9_5[@]}" + do + aSOFTWARE_NAME9_6[i]=${aSOFTWARE_NAME9_5[i]} + done + aSOFTWARE_NAME9_6[213]='soju' + # Pre-create software counter array so that we can see also software (available in newest version) with 0 installs - for i in "${aSOFTWARE_NAME9_5[@]}" + for i in "${aSOFTWARE_NAME9_6[@]}" do aSOFTWARE[$i]=0 done diff --git a/.update/patches b/.update/patches index 348747baa3..fdb8a26263 100755 --- a/.update/patches +++ b/.update/patches @@ -1291,16 +1291,8 @@ Patch_8_22() [[ -f '/etc/apt/preferences.d/dietpi-armbian-tmp' ]] && G_EXEC rm /etc/apt/preferences.d/dietpi-armbian-tmp [[ -f '/etc/apt/apt.conf.d/dietpi-armbian' ]] && G_EXEC rm /etc/apt/apt.conf.d/dietpi-armbian - # Odroid C1: Set kernel packages on hold. We pin them in pre-patches and enforce an automated downgrade, in case, but since v23.02.2 might not be available forever, we should also set them on hold, until we know there is a compatble newer version available: - # - https://dietpi.com/forum/t/odroid-c1-not-booting-after-kernel-upgrade/17818 - # - https://github.com/MichaIng/DietPi/issues/6616#issuecomment-1730900296 - if (( $G_HW_MODEL == 10 )) - then - G_DIETPI-NOTIFY 2 'Setting Odroid C1 "current" and "edge" kernel packages on hold' - G_EXEC apt-mark hold linux-image-current-meson linux-dtb-current-meson linux-headers-current-meson linux-image-edge-meson linux-dtb-edge-meson linux-headers-edge-meson - # NanoPi R4S: Fix Ethernet LEDs: https://github.com/MichaIng/DietPi/issues/6342#issuecomment-1697669420 - elif (( $G_HW_MODEL == 47 )) + if (( $G_HW_MODEL == 47 )) then G_DIETPI-NOTIFY 2 'Updating udev rule for NanoPi R4S Ethernet LEDs' G_EXEC eval 'echo '\''ledtrig-netdev'\'' > /etc/modules-load.d/dietpi-eth-leds.conf' @@ -1657,6 +1649,69 @@ Patch_9_5() fi } +Patch_9_6() +{ + # Update DietPi APT list for several SBCs we added components to our repo for + if [[ $PATCH_9_3_RAN == 0 && $G_HW_MODEL =~ ^(42|43|46|47|52|55|58|68|72|73|76|77|86|87)$ ]] + then + /boot/dietpi/func/dietpi-set_software apt-mirror dietpi + G_AGUP + G_AGUG + + # Orange Pi 5: Offer to flash new U-Boot image to solve random Ethernet MAC address: https://github.com/MichaIng/DietPi/issues/6663 + elif (( $G_HW_MODEL == 80 )) + then + if G_WHIP_YESNO '[ INFO ] U-Boot update available to solve random Ethernet MAC address +\nIn case you are affected by a random Ethernet MAC address, which changes every boot, flashing the latest U-Boot image has shown to solve it: https://github.com/MichaIng/DietPi/issues/6663 +\nDo you want to flash the latest U-Boot image now? +\nNB: This can be done any time later via dietpi-config > Advanced Options.' + then + if [[ $G_ROOTFS_DEV == '/dev/mmcblk'* || $G_ROOTFS_DEV == '/dev/loop'* ]] + then + /boot/dietpi/func/dietpi-set_hardware flash-u-boot-mmc + + elif [[ -b '/dev/mtdblock0' ]] + then + # shellcheck disable=SC1091 + . /usr/lib/u-boot/platform_install.sh + # shellcheck disable=SC2154 + G_EXEC_OUTPUT=1 G_EXEC dd if="$DIR/rkspi_loader.img" of=/dev/mtdblock0 oflag=direct conv=notrunc status=progress + else + G_WHIP_MSG '[FAILED] SPI block device /dev/mtdblock0 not found +\nWe expect the SPI block device /dev/mtdblock0 to be the target for the U-Boot image. It however does not exist. +\nPlease report this to our forum or GitHub site, so we can check back: +- https://dietpi.com/forum/c/troubleshooting/10 +- https://github.com/MichaIng/DietPi/issues' + fi + fi + + # NanoPi R6C: Migrate to dedicated APT component and U-Boot package: https://github.com/MichaIng/DietPi/issues/7109 + elif (( $G_HW_MODEL == 79 )) && grep -q '^[[:blank:]]*fdtfile=rockchip/rk3588s-nanopi-r6c.dtb$' /boot/dietpiEnv.txt + then + HW_VARIANT=2 /boot/dietpi/func/dietpi-set_software apt-mirror dietpi + G_AGUP + G_AGI linux-u-boot-nanopi-r6c-legacy + + # Odroid XU4/Meson: Install zstd for better compressed initramfs images + elif dpkg-query -s 'linux-image-current-odroidxu4' &> /dev/null || dpkg-query -s 'linux-image-edge-odroidxu4' &> /dev/null || dpkg-query -s 'linux-image-current-meson' &> /dev/null || dpkg-query -s 'linux-image-edge-meson' &> /dev/null + then + G_AGI zstd + fi + + # Remove Armbian APT repository from all systems which have an "all" component for kernel/bootloader/firmware packages form our APT repository + if [[ -f '/etc/apt/sources.list.d/dietpi-armbian.list' && -f '/etc/apt/sources.list.d/dietpi.list' ]] && grep -q 'dietpi.com/apt all' /etc/apt/sources.list.d/dietpi.list + then + G_DIETPI-NOTIFY 2 'Removing obsolete Armbian APT repository' + G_EXEC rm /etc/apt/sources.list.d/dietpi-armbian.list + [[ -f '/etc/apt/preferences.d/dietpi-armbian' ]] && G_EXEC rm /etc/apt/preferences.d/dietpi-armbian + [[ -f '/etc/apt/trusted.gpg.d/dietpi-armbian.gpg' ]] && G_EXEC rm /etc/apt/trusted.gpg.d/dietpi-armbian.gpg + fi + + # Remove obsolete drop-in config: https://github.com/MichaIng/DietPi/issues/7104 + [[ -f '/etc/systemd/system/ifup@.service.d/dietpi.conf' ]] && G_EXEC rm -R /etc/systemd/system/ifup@.service.d/dietpi.conf + [[ -d '/etc/systemd/system/ifup@.service.d' ]] && G_EXEC rmdir --ignore-fail-on-non-empty /etc/systemd/system/ifup@.service.d +} + # v6.35 => v7 migration if (( $G_DIETPI_VERSION_CORE == 6 && $G_DIETPI_VERSION_SUB > 34 )) then diff --git a/.update/pre-patches b/.update/pre-patches index 11fbb5afe4..a7715faad7 100755 --- a/.update/pre-patches +++ b/.update/pre-patches @@ -211,12 +211,6 @@ then G_DIETPI-NOTIFY 2 'Adding new non-free-firmware component to APT lists, to re-enable firmware upgrades' G_EXEC sed --follow-symlinks -i '/non-free/s/$/ non-free-firmware/' /etc/apt/sources.list fi - if (( $G_DISTRO > 6 )) && [[ -f '/etc/apt/sources.list.d/dietpi-armbian.list' || -f '/etc/apt/sources.list.d/armbian.list' ]] - then - G_DIETPI-NOTIFY 2 'Updating Armbian APT repo list with Bookworm suite' - [[ -f '/etc/apt/sources.list.d/dietpi-armbian.list' ]] && G_EXEC sed --follow-symlinks -i 's/bullseye/bookworm/' /etc/apt/sources.list.d/dietpi-armbian.list - [[ -f '/etc/apt/sources.list.d/armbian.list' ]] && G_EXEC sed --follow-symlinks -i 's/bullseye/bookworm/' /etc/apt/sources.list.d/armbian.list - fi fi # v8.21 @@ -240,7 +234,7 @@ then if [[ -f '/etc/apt/sources.list.d/dietpi-armbian.list' ]] then G_DIETPI-NOTIFY 2 'Preventing any unintended packages from being installed from Armbian'\''s APT repository' - cat << '_EOF_' > /etc/apt/preferences.d/dietpi-armbian + cat << '_EOF_' > /etc/apt/preferences.d/dietpi-armbian || exit 1 Package: * Pin: origin apt.armbian.com Pin-Priority: -1 @@ -257,20 +251,6 @@ _EOF_ Package: base-files Pin: release o=Debian Pin-Priority: 1000 -_EOF_ - G_EXEC eval 'echo '\''APT::Get::Allow-Downgrades "1";'\'' > /etc/apt/apt.conf.d/dietpi-armbian' - fi - - # Odroid C1: Pin "current" and "edge" kernel versions to Armbian 23.02.2, which are the latest currently known functional versions for C1: - # - https://dietpi.com/forum/t/odroid-c1-not-booting-after-kernel-upgrade/17818 - # - https://github.com/MichaIng/DietPi/issues/6616#issuecomment-1730900296 - if (( $G_HW_MODEL == 10 )) - then - G_DIETPI-NOTIFY 2 'Pinning Odroid C1 "current" and "edge" kernel packages to latest known functional version and in case enforcing automated downgrade' - cat << '_EOF_' > /etc/apt/preferences.d/00-dietpi-odroidc1 -Package: linux-image-current-meson linux-dtb-current-meson linux-headers-current-meson linux-image-edge-meson linux-dtb-edge-meson linux-headers-edge-meson -Pin: version 23.02.2 -Pin-Priority: 1000 _EOF_ G_EXEC eval 'echo '\''APT::Get::Allow-Downgrades "1";'\'' > /etc/apt/apt.conf.d/dietpi-armbian' fi @@ -396,7 +376,7 @@ fi if (( $G_DIETPI_VERSION_CORE < 9 || ( $G_DIETPI_VERSION_CORE == 9 && $G_DIETPI_VERSION_SUB < 3 ) )) then # Update APT repo on Bullseye systems to Bookworm, but re-assure only kernel and firmware packages are pulled form it. Armbian dropped Bullseye support. - if [[ $G_DISTRO == 6 && -f '/etc/apt/sources.list.d/dietpi-armbian.list' ]] + if [[ -f '/etc/apt/sources.list.d/dietpi-armbian.list' ]] && grep -q 'bullseye' /etc/apt/sources.list.d/dietpi-armbian.list then G_DIETPI-NOTIFY 2 'Moving EOL Armbian Bullseye repo to Bookworm for Debian-version-agnostic firmware and kernel upgrades' cat << '_EOF_' > /etc/apt/preferences.d/dietpi-armbian || exit 1 @@ -426,5 +406,28 @@ then fi fi +# v9.6 +if (( $G_DIETPI_VERSION_CORE < 9 || ( $G_DIETPI_VERSION_CORE == 9 && $G_DIETPI_VERSION_SUB < 6 ) )) +then + # https://github.com/MichaIng/DietPi/issues/6332#issuecomment-2162959873 + if (( $G_HW_MODEL == 10 )) + then + G_DIETPI-NOTIFY 2 'Re-allowing kernel upgrades on Odroid C1' + [[ -f '/etc/apt/preferences.d/00-dietpi-odroidc1' ]] && G_EXEC rm /etc/apt/preferences.d/00-dietpi-odroidc1 + mapfile -t apackages < <(apt-mark showhold | grep -E '^linux-(image|dtb|headers}-(current|edge)-meson$') + [[ ${apackages[0]} ]] && G_EXEC apt-mark unhold "${apackages[@]}" + unset -v apackages + fi + + # Remove Armbian APT repository from all systems which have an "all" component for kernel/bootloader/firmware packages form our APT repository + if [[ -f '/etc/apt/sources.list.d/dietpi-armbian.list' && -f '/etc/apt/sources.list.d/dietpi.list' ]] && grep -q 'dietpi.com/apt all' /etc/apt/sources.list.d/dietpi.list + then + G_DIETPI-NOTIFY 2 'Removing obsolete Armbian APT repository' + G_EXEC rm /etc/apt/sources.list.d/dietpi-armbian.list + [[ -f '/etc/apt/preferences.d/dietpi-armbian' ]] && G_EXEC rm /etc/apt/preferences.d/dietpi-armbian + [[ -f '/etc/apt/trusted.gpg.d/dietpi-armbian.gpg' ]] && G_EXEC rm /etc/apt/trusted.gpg.d/dietpi-armbian.gpg + fi +fi + exit 0 } diff --git a/.update/version b/.update/version index 3058b8362e..6c2285e750 100644 --- a/.update/version +++ b/.update/version @@ -2,8 +2,8 @@ # shellcheck disable=SC2034 # Available DietPi version G_REMOTE_VERSION_CORE=9 -G_REMOTE_VERSION_SUB=5 -G_REMOTE_VERSION_RC=1 +G_REMOTE_VERSION_SUB=6 +G_REMOTE_VERSION_RC=0 # Minimum DietPi version to allow update G_MIN_VERSION_CORE=7 G_MIN_VERSION_SUB=0 diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 398da0455d..f94024d1ce 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,32 @@ +v9.6 +(2024-07-06) + +New software: +- soju | This IRC bouncer has been added to our software catalogue. Many thanks to @subnut for implementing it: https://github.com/MichaIng/DietPi/pull/7124 + +Enhancements: +- General | Since we provide all kernel, bootloader and firmware packages from our own APT repository now, the Armbian APT repository is removed form all systems. In case you use an SBC which is not officially supported by DietPi, as generic device, it is however preserved. +- Quartz64/Star64/VisionFive 2 | The extended attribute handler for ext4 security labels "CONFIG_EXT4_FS_SECURITY" has been enabled for these SBCs, required for some Docker containers. Many thanks to @gxsw for reporting this missing feature: https://github.com/MichaIng/DietPi/issues/7102 +- Quartz64/Star64/VisionFive 2 | eBPF functionality for firewall and network monitoring software like Cilium has been added to our kernel builds for these SBCs. Many thanks to @kbrighton for reporting these missing features: https://github.com/MichaIng/DietPi/issues/6834 +- Orange Pi 5 | Older U-Boot builds caused the Ethernet MAC address to be random and change on every boot. Recent U-Boot builds solve this, but they are not flashed automatically on package upgrades. We hence inform users and offer to flash the latest U-Boot image during the DietPi update. Many thanks to @thuehlinger for reporting and testing the case: https://github.com/MichaIng/DietPi/issues/6663 +- DietPi-Config | Legacy Odroid C2 resolution and GPU memory options have been removed. +- DietPi-Config | The static DNS server menu now contains entries to select the default gateway/router or locally running DNS resolver (Pi-hole, AdGuard Home, Unbound, systemd-resolvd, ...), if detected. + +Bug fixes: +- Network | Resolved a rare issue, where shutdowns could hang, when networking.service and ifup@.service instances try to bring down the same network interface concurrently. Many thanks to @ioctl2 for reporting this issue: https://github.com/MichaIng/DietPi/issues/7104 +- Odroid C1 | Resolved an issue, where the kernel upgrade did not apply as intended. Many thanks to @th2j for reporting this issue: https://github.com/MichaIng/DietPi/issues/6332#issuecomment-2162959873 +- VisionFive 2 | Resolved an issue where our new image did not boot, because of a false device tree name in /boot/extlinux/extlinux.conf. +- NanoPi R6C | Resolved an issue where our new images did not boot, since the latest mainline U-Boot for R6S does not support the R6C anymore. Many thanks to @labmaster for reporting this issue: https://github.com/MichaIng/DietPi/issues/7109 +- DietPi-Banner | Resolved an issue where incorrect RAM usage was printed with German and potentially other locales. Many thanks to @jwgn for reporting this issue: https://github.com/MichaIng/DietPi/issues/7107 +- DietPi-Banner | Resolved an issue where logins as non-root user printed "No certificate found" if the Let's Encrypt cert status option was enabled, since non-root users have no permission to see the certificate files. In such cases, sudo is now used automatically, if the user has NOPASSWD permissions, else a meaningful info is shown. Many thanks to @FrapiFrance for implementing this fix: https://github.com/MichaIng/DietPi/pull/7121 +- DietPi-Drive_Manager | Resolved an issue, where network drives and potentially mounts in general could be attempted to be unmounted on shutdown, before services which can access them are stopped, leading to hanging shutdown sequences and potentially even data loss. Many thanks to @polite-garlic for reporting this issue: https://dietpi.com/forum/t/20542 +- DietPi-Dashboard | Resolved an issue where the installation on RISC-V systems failed. +- DietPi-Software | Node-RED: Resolved an issue where reinstalls/updates failed because of incompatibilities between latest Node.js or global modules with older local instances. Many thanks to @thinkbig1979 for reporting this issue: https://github.com/MichaIng/DietPi/issues/7128 + +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 + +----------------------------------------------------------------------------------------------------------- + v9.5 (2024-06-09) @@ -21,6 +50,7 @@ Bug fixes: - DietPi-Software | Shairport Sync: Resolved a DietPi v9.4 regression, where the AirPlay 2 choice did not have an effect, but the AirPlay 1 package was always installed. Additionally, uninstalling Shairport Sync will now also purge the AirPlay 2 package. Many thanks to @pulpe for fixing this bug: https://github.com/MichaIng/DietPi/pull/7082 - DietPi-Software | Box64: Resolved an issue where an invalid build target was used on Raspberry Pi 5 with 16k page size kernel. This target was removed with latest Box64, as page size handling is now done at runtime. - DietPi-Software | Jellyfin: Resolved an issue where the intended HTTP port change could not be applied, since the network config file is not created anymore at service start. We do now pre-create a minimal one, which is complemented with defaults automatically. +- DietPi-Software | ADS-B Feeder: Resolved an issue where the service start could have failed because of a missing Python module. Many thanks to @moonraka for reporting the issue and @dirkhh sending a fix quickly: https://dietpi.com/forum/t/ads-b-feeder-not-working/20601 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/7098 diff --git a/README.md b/README.md index a6805bf5bf..95022d1050 100644 --- a/README.md +++ b/README.md @@ -340,6 +340,7 @@ Links to hardware and software manufacturers, sources and build instructions use - [ADS-B Feeder](https://github.com/dirkhh/adsb-feeder-image) - [Kavita](https://github.com/Kareadita/Kavita) - [Forgejo](https://codeberg.org/forgejo/forgejo) +- [soju](https://github.com/emersion/soju) --- diff --git a/dietpi/dietpi-backup b/dietpi/dietpi-backup index 733b6d3bda..ce894b9d0f 100755 --- a/dietpi/dietpi-backup +++ b/dietpi/dietpi-backup @@ -489,7 +489,7 @@ _EOF_ 'Help') G_WHIP_MSG 'DietPi-Backup is a program that allows you to Backup and Restore your DietPi system. \nIf you have broken your system, or want to reset your system to an earlier date, this can all be done with DietPi-Backup. \nSimply choose a location where you want to save and restore your backups from, then, select Backup or Restore. -\nEnable a daily system backup to run it once a day via daily cron job. The execution time can be changed in "dietpi-cron". Note that this temporarily stops server services. Also we recommend to configure and test the backup with a manual call before enabling this feature. +\nEnable a daily system backup to run it once a day via daily cron job. The execution time can be changed in "dietpi-cron". Note that this temporarily stops software services. Also we recommend to configure and test the backup with a manual call before enabling this feature. \nMore information: https://dietpi.com/docs/dietpi_tools/#dietpi-backup-backuprestore';; 'Last log') log=1 G_WHIP_VIEWFILE "$FP_TARGET/$FP_LOG";; @@ -506,7 +506,7 @@ _EOF_ 'Delete') G_WHIP_YESNO "Do you wish to DELETE the following backup?\n - $FP_TARGET" && G_EXEC_NOEXIT=1 G_EXEC rm -R "$FP_TARGET";; - 'Backup') G_WHIP_YESNO "The system will be backed up to:\n - $FP_TARGET\n\nDo you wish to continue and start the backup?" && Run_Backup;; + 'Backup') G_WHIP_YESNO "The system will be backed up to:\n - $FP_TARGET\n\nThis will temporarily stop software services! \n\nDo you wish to continue and start the backup?" && Run_Backup;; 'Restore') if (( $AMOUNT > 1 )) diff --git a/dietpi/dietpi-config b/dietpi/dietpi-config index 0fd4369391..97b81a64c4 100755 --- a/dietpi/dietpi-config +++ b/dietpi/dietpi-config @@ -58,14 +58,12 @@ Menu_Main() { G_WHIP_MENU_ARRAY=( - '1' ': Display Options' '2' ': Audio Options' ) # Hide performance options on VM and container (( $G_HW_MODEL == 20 || $G_HW_MODEL == 75 )) || G_WHIP_MENU_ARRAY+=('3' ': Performance Options') G_WHIP_MENU_ARRAY+=( - '4' ': Advanced Options' '5' ': Language/Regional Options' '6' ': Security Options' @@ -92,23 +90,22 @@ esac } + # $1: 0=landscape 1=portrait Display_Rotation_Calc_XY_Invert() { - # 0=landscape 1=portrait - local input=$1 - local framebuffer_x=$(grep -m1 '^[[:blank:]]*framebuffer_width=' /boot/config.txt || vcgencmd get_config framebuffer_width) framebuffer_x=${framebuffer_x#*=}; framebuffer_x=${framebuffer_x:-0} local framebuffer_y=$(grep -m1 '^[[:blank:]]*framebuffer_height=' /boot/config.txt || vcgencmd get_config framebuffer_height) framebuffer_y=${framebuffer_y#*=}; framebuffer_y=${framebuffer_y:-0} + # 0/180 landscape - if (( $input == 0 && $framebuffer_x < $framebuffer_y )) + if (( $1 == 0 && $framebuffer_x < $framebuffer_y )) then G_CONFIG_INJECT 'framebuffer_width=' "framebuffer_width=$framebuffer_y" /boot/config.txt G_CONFIG_INJECT 'framebuffer_height=' "framebuffer_height=$framebuffer_x" /boot/config.txt # 90/270 portrait - elif (( $input == 1 && $framebuffer_x > $framebuffer_y )) + elif (( $1 == 1 && $framebuffer_x > $framebuffer_y )) then G_CONFIG_INJECT 'framebuffer_width=' "framebuffer_width=$framebuffer_y" /boot/config.txt G_CONFIG_INJECT 'framebuffer_height=' "framebuffer_height=$framebuffer_x" /boot/config.txt @@ -118,34 +115,35 @@ # TARGETMENUID=1 Menu_DisplayOptions() { - if (( $G_HW_MODEL == 21 )); then - + # Driver/Resolution + if (( $G_HW_MODEL == 21 )) + then G_WHIP_MENU_ARRAY=('1' ': Display Driver') - else - G_WHIP_MENU_ARRAY=('1' ': Display Resolution') - (( $G_HW_MODEL < 10 || $G_HW_MODEL == 12 )) && G_WHIP_MENU_ARRAY+=('2' ': GPU/RAM Memory Split') - if (( $G_HW_MODEL < 20 )) then local lcdpanel_text=$(sed -n '/^[[:blank:]]*CONFIG_LCDPANEL=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) G_WHIP_MENU_ARRAY+=('3' ": LCD/OLED Panel addon: [${lcdpanel_text:=none}]") fi - fi - # Display brightness + # Brightness G_WHIP_MENU_ARRAY+=('16' ': Display Brightness') + # X11 DPI local xorg_dpi_current=$(sed -n '/^[[:blank:]]*SOFTWARE_XORG_DPI=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) G_WHIP_MENU_ARRAY+=('17' ": X.Org DPI: [${xorg_dpi_current:-N/A}]") - (( $G_HW_MODEL == 20 )) || G_WHIP_MENU_ARRAY+=('14' ': LED Control') + # LED control: Hide on VM/container + (( $G_HW_MODEL == 20 || $G_HW_MODEL == 75 )) || G_WHIP_MENU_ARRAY+=('14' ': LED Control') # RPi only - if (( $G_HW_MODEL < 10 )); then + if (( $G_HW_MODEL < 10 )) + then + # GPU memory split + G_WHIP_MENU_ARRAY+=('2' ': GPU/RAM memory split') # HDMI rotation local rotation_hdmi_current=$(sed -n '/^[[:blank:]]*display_hdmi_rotate=/{s/^[^=]*=//p;q}' /boot/config.txt) @@ -161,23 +159,21 @@ (( $overscan_disabled )) && overscan_text='Off' G_WHIP_MENU_ARRAY+=('6' ": Overscan : [$overscan_text]") # - Overscan sizes - if (( ! $overscan_disabled )); then - + if (( ! $overscan_disabled )) + then local overscan_options=('overscan_left' 'overscan_right' 'overscan_top' 'overscan_bottom') local overscan_left=$(grep -m1 '^[[:blank:]]*overscan_left=' /boot/config.txt || vcgencmd get_config overscan_left); overscan_left=${overscan_left#*=} local overscan_right=$(grep -m1 '^[[:blank:]]*overscan_right=' /boot/config.txt || vcgencmd get_config overscan_right); overscan_right=${overscan_right#*=} local overscan_top=$(grep -m1 '^[[:blank:]]*overscan_top=' /boot/config.txt || vcgencmd get_config overscan_top); overscan_top=${overscan_top#*=} local overscan_bottom=$(grep -m1 '^[[:blank:]]*overscan_bottom=' /boot/config.txt || vcgencmd get_config overscan_bottom); overscan_bottom=${overscan_bottom#*=} G_WHIP_MENU_ARRAY+=('15' ": Overscan Compensation [L:${overscan_left:-N/A}] [R:${overscan_right:-N/A}] [T:${overscan_top:-N/A}] [B:${overscan_bottom:-N/A}]") - fi # HDMI signal boost, RPi up to 3 only - if (( $G_HW_MODEL < 4 )); then - + if (( $G_HW_MODEL < 4 )) + then local hdmi_boost_current=$(grep -m1 '^[[:blank:]]*config_hdmi_boost=' /boot/config.txt || vcgencmd get_config config_hdmi_boost); hdmi_boost_current=${hdmi_boost_current#*=} G_WHIP_MENU_ARRAY+=('7' ": HDMI Boost : [${hdmi_boost_current:-N/A}]") - fi # RPi codecs @@ -211,8 +207,8 @@ G_WHIP_MENU_ARRAY+=('13' ": MPEG2 Key : [${mpeg2_key_current:-none}]") # Odroids only - elif (( $G_HW_MODEL < 13 )); then - + elif (( $G_HW_MODEL < 13 )) + then # Remote local odroid_remote_text='Off' local odroid_remote_enabled=0 @@ -222,17 +218,14 @@ odroid_remote_enabled=1 fi G_WHIP_MENU_ARRAY+=('10' ": Odroid remote : [$odroid_remote_text]") - fi G_WHIP_DEFAULT_ITEM=$WHIP_SELECTION_PREVIOUS - G_WHIP_MENU 'Please select an option:' || { Back_or_Exit 0; return 0; } # Main menu - WHIP_SELECTION_PREVIOUS=$G_WHIP_RETURNED_VALUE - if (( $G_WHIP_RETURNED_VALUE == 15 )); then - + if (( $G_WHIP_RETURNED_VALUE == 15 )) + then for i in "${overscan_options[@]}" do G_WHIP_DEFAULT_ITEM=${!i} @@ -242,25 +235,22 @@ REBOOT_REQUIRED=1 done - elif (( $G_WHIP_RETURNED_VALUE == 1 )); then - + elif (( $G_WHIP_RETURNED_VALUE == 1 )) + then TARGETMENUID=2 - elif (( $G_WHIP_RETURNED_VALUE == 3 )); then - + elif (( $G_WHIP_RETURNED_VALUE == 3 )) + then G_WHIP_MENU_ARRAY=('none' ': Uninstall all panels') G_WHIP_MENU_ARRAY+=('waveshare32' ': 320x240 panel with touch input') - if (( $G_HW_MODEL < 10 )); then - + if (( $G_HW_MODEL < 10 )) + then G_WHIP_MENU_ARRAY+=('esp01215e' ': Elecrow 1024x600 7" IPS HDMI panel with touch input') G_WHIP_MENU_ARRAY+=('allo-boss2-oled' ': Allo Boss2 DAC OLED display') - else - G_WHIP_MENU_ARRAY+=('odroid-lcd35' ': 480x320 panel with touch input') (( $G_HW_MODEL == 11 )) && G_WHIP_MENU_ARRAY+=('odroid-cloudshell' ': 320x240 panel' 'odroid-cloudshell2' ': Odroid XU4 CloudShell 2 LCD') - fi G_WHIP_DEFAULT_ITEM=$lcdpanel_text @@ -268,32 +258,27 @@ /boot/dietpi/func/dietpi-set_hardware lcdpanel "$G_WHIP_RETURNED_VALUE" && REBOOT_REQUIRED=1 - elif (( $G_WHIP_RETURNED_VALUE == 2 )); then - - G_WHIP_MSG 'GPU/RAM Memory splits are pre-configured and applied during DietPi-Software setup.\n\nThe split value is optimized based on your software installs, however, feel free to tweak them.' + elif (( $G_WHIP_RETURNED_VALUE == 2 )) + then TARGETMENUID=6 - elif (( $G_WHIP_RETURNED_VALUE == 6 )); then - - if (( $overscan_disabled )); then - + elif (( $G_WHIP_RETURNED_VALUE == 6 )) + then + if (( $overscan_disabled )) + then G_CONFIG_INJECT 'disable_overscan=' 'disable_overscan=0' /boot/config.txt - else - G_CONFIG_INJECT 'disable_overscan=' 'disable_overscan=1' /boot/config.txt for i in "${overscan_options[@]}" do sed --follow-symlinks -i "/^[[:blank:]]*$i=/c\#$i=0" /boot/config.txt done - fi REBOOT_REQUIRED=1 - elif (( $G_WHIP_RETURNED_VALUE == 7 )); then - + elif (( $G_WHIP_RETURNED_VALUE == 7 )) + then G_WHIP_MENU_ARRAY=( - '0' ': Disabled' '2' ': RPi 1 A/B Default' '5' ': RPi 1+/2/3 Default' @@ -311,49 +296,47 @@ A long (or insufficiently manufactured) cable may required a higher boost settin G_CONFIG_INJECT 'config_hdmi_boost=' "config_hdmi_boost=$G_WHIP_RETURNED_VALUE" /boot/config.txt && REBOOT_REQUIRED=1 - elif (( $G_WHIP_RETURNED_VALUE == 18 )); then - + elif (( $G_WHIP_RETURNED_VALUE == 18 )) + then /boot/dietpi/func/dietpi-set_hardware rpi-codec $(( ! $rpi_codecs_enabled )) && REBOOT_REQUIRED=1 - elif (( $G_WHIP_RETURNED_VALUE == 8 )); then - + elif (( $G_WHIP_RETURNED_VALUE == 8 )) + then /boot/dietpi/func/dietpi-set_hardware rpi-camera $(( ! $rpi_camera_module_enabled )) && REBOOT_REQUIRED=1 - elif (( $G_WHIP_RETURNED_VALUE == 9 )); then - + elif (( $G_WHIP_RETURNED_VALUE == 9 )) + then G_CONFIG_INJECT 'disable_camera_led=' "disable_camera_led=$(( ! $rpi_camera_led_disabled ))" /boot/config.txt && REBOOT_REQUIRED=1 - elif (( $G_WHIP_RETURNED_VALUE == 10 )); then - - if (( $odroid_remote_enabled )); then - + elif (( $G_WHIP_RETURNED_VALUE == 10 )) + then + if (( $odroid_remote_enabled )) + then /boot/dietpi/func/dietpi-set_hardware remoteir none && REBOOT_REQUIRED=1 elif G_WHIP_YESNO 'This will enable the IR modules, setup Lirc and the Odroid Remote for Odroid C1, C2 and XU4 CloudShell. -\nNB: Other remotes can be configured by running "irrecord" and applying the codes to "/etc/lirc/lircd.conf"\n\nDo you wish to continue?'; then - +\nNB: Other remotes can be configured by running "irrecord" and applying the codes to "/etc/lirc/lircd.conf"\n\nDo you wish to continue?' + then /boot/dietpi/func/dietpi-set_hardware remoteir odroid_remote && REBOOT_REQUIRED=1 - fi - elif (( $G_WHIP_RETURNED_VALUE == 11 )); then - - if (( $justboom_ir_remote_enabled )); then - + elif (( $G_WHIP_RETURNED_VALUE == 11 )) + then + if (( $justboom_ir_remote_enabled )) + then /boot/dietpi/func/dietpi-set_hardware remoteir none && REBOOT_REQUIRED=1 elif G_WHIP_YESNO 'Got a JustBoom IR Remote? Excellent! -\nDietPi will enable the IR modules, setup Lirc and enable support for MPD controls by default:\n\nDo you wish to continue?'; then - +\nDietPi will enable the IR modules, setup Lirc and enable support for MPD controls by default:\n\nDo you wish to continue?' + then /boot/dietpi/func/dietpi-set_hardware remoteir justboom_ir_remote && REBOOT_REQUIRED=1 - fi - elif (( $G_WHIP_RETURNED_VALUE == 12 )); then - + elif (( $G_WHIP_RETURNED_VALUE == 12 )) + then G_WHIP_DEFAULT_ITEM=$vc1_key_current - if G_WHIP_INPUTBOX 'Please enter your key for VC1:\n - EG: 0x00000000'; then - + if G_WHIP_INPUTBOX 'Please enter your key for VC1:\n - EG: 0x00000000' + then G_CONFIG_INJECT 'decode_WVC1=' "decode_WVC1=$G_WHIP_RETURNED_VALUE" /boot/config.txt # https://github.com/MichaIng/DietPi/issues/1487 @@ -361,14 +344,13 @@ A long (or insufficiently manufactured) cable may required a higher boost settin (( ${current_gpu_mem:=76} < 96 )) && /boot/dietpi/func/dietpi-set_hardware gpumemsplit 96 REBOOT_REQUIRED=1 - fi - elif (( $G_WHIP_RETURNED_VALUE == 13 )); then - + elif (( $G_WHIP_RETURNED_VALUE == 13 )) + then G_WHIP_DEFAULT_ITEM=$mpeg2_key_current - if G_WHIP_INPUTBOX 'Please enter your key for MPEG2:\n - EG: 0x00000000'; then - + if G_WHIP_INPUTBOX 'Please enter your key for MPEG2:\n - EG: 0x00000000' + then G_CONFIG_INJECT 'decode_MPG2=' "decode_MPG2=$G_WHIP_RETURNED_VALUE" /boot/config.txt # https://github.com/MichaIng/DietPi/issues/1487 @@ -376,13 +358,11 @@ A long (or insufficiently manufactured) cable may required a higher boost settin (( ${current_gpu_mem:=76} < 96 )) && /boot/dietpi/func/dietpi-set_hardware gpumemsplit 96 REBOOT_REQUIRED=1 - fi - elif (( $G_WHIP_RETURNED_VALUE == 4 )); then - + elif (( $G_WHIP_RETURNED_VALUE == 4 )) + then G_WHIP_MENU_ARRAY=( - '0' ': Disabled (default)' '1' ': 90 degrees' '2' ': 180 degrees' @@ -408,8 +388,8 @@ A long (or insufficiently manufactured) cable may required a higher boost settin fi REBOOT_REQUIRED=1 - elif (( $G_WHIP_RETURNED_VALUE == 5 )); then - + elif (( $G_WHIP_RETURNED_VALUE == 5 )) + then G_WHIP_MENU_ARRAY=( '0' ': Disabled (default)' @@ -417,18 +397,17 @@ A long (or insufficiently manufactured) cable may required a higher boost settin ) G_WHIP_DEFAULT_ITEM=$rotation_lcd_current - if G_WHIP_MENU 'Please select an option:\n\nNB: This option is for RPi touchscreen.'; then - + if G_WHIP_MENU 'Please select an option:\n\nNB: This option is for RPi touchscreen.' + then G_CONFIG_INJECT 'lcd_rotate=' "lcd_rotate=$G_WHIP_RETURNED_VALUE" /boot/config.txt && REBOOT_REQUIRED=1 - fi - elif (( $G_WHIP_RETURNED_VALUE == 14 )); then - + elif (( $G_WHIP_RETURNED_VALUE == 14 )) + then /boot/dietpi/dietpi-led_control - elif (( $G_WHIP_RETURNED_VALUE == 16 )); then - + elif (( $G_WHIP_RETURNED_VALUE == 16 )) + then # Find and obtain values for all backlight devices local fp_brightness iTotalAvailable=0 aFp_Brightness_Available=() aBrightness_Name=() aBrightness_Current=() aBrightness_Max=() for fp_brightness in /sys/class/backlight/* @@ -494,10 +473,9 @@ A long (or insufficiently manufactured) cable may required a higher boost settin Info_HW_OptionNotSupported fi - elif (( $G_WHIP_RETURNED_VALUE == 17 )); then - + elif (( $G_WHIP_RETURNED_VALUE == 17 )) + then G_WHIP_MENU_ARRAY=( - '96' ': Default' '120' ": +25% larger" '144' ": +50% larger" @@ -509,31 +487,28 @@ A long (or insufficiently manufactured) cable may required a higher boost settin if G_WHIP_MENU "Please select a DPI value for Xorg: - A higher value will make text and windows larger - Has no effect on local terminal (eg: no desktop installed) - \nNB: Setting will only take effect, once system is restarted."; then - + \nNB: Setting will only take effect, once system is restarted." + then G_CONFIG_INJECT 'SOFTWARE_XORG_DPI=' "SOFTWARE_XORG_DPI=$G_WHIP_RETURNED_VALUE" /boot/dietpi.txt G_EXEC mkdir -p /etc/X11/Xsession.d echo "xrandr --dpi $G_WHIP_RETURNED_VALUE" > /etc/X11/Xsession.d/99-dietpi-dpi REBOOT_REQUIRED=1 - fi - fi } # TARGETMENUID=2 - Menu_DisplayOptions_Driver_Resolution(){ - + Menu_DisplayOptions_Driver_Resolution() + { G_WHIP_BUTTON_CANCEL_TEXT='Cancel' # VM - if (( $G_HW_MODEL == 20 )); then - + if (( $G_HW_MODEL == 20 )) + then local current=$(sed -n '/^[[:blank:]]*GRUB_GFXMODE=/{s/^[^=]*=//p;q}' /etc/default/grub) [[ $current ]] || current='System default' G_WHIP_MENU_ARRAY=( - 'System default' '' '1600x1200' '' '1280x1024' '' @@ -547,23 +522,20 @@ A long (or insufficiently manufactured) cable may required a higher boost settin \nNB: This only affects the virtual screen resolution, not the SSH session. You might need to increase the maximum guest screen resolution within your VM software." || { Back_or_Exit 1; return 0; } # Display Options - if [[ $G_WHIP_RETURNED_VALUE == 'System default' ]]; then - + if [[ $G_WHIP_RETURNED_VALUE == 'System default' ]] + then 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 - G_CONFIG_INJECT 'GRUB_GFXMODE=' "GRUB_GFXMODE=$G_WHIP_RETURNED_VALUE" /etc/default/grub G_CONFIG_INJECT 'GRUB_GFXPAYLOAD_LINUX=' 'GRUB_GFXPAYLOAD_LINUX=keep' /etc/default/grub 'GRUB_GFXMODE=' - fi update-grub # Native PC - elif (( $G_HW_MODEL == 21 )); then - + elif (( $G_HW_MODEL == 21 )) + then local gpu_current=$(sed -n '/^[[:blank:]]*CONFIG_GPU_DRIVER=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) gpu_current=${gpu_current,,} local driver_installed=() @@ -596,7 +568,6 @@ A long (or insufficiently manufactured) cable may required a higher boost settin fi G_WHIP_MENU_ARRAY=( - 'Nvidia' ": ${driver_installed[0]} | Proprietary GPU driver" 'Intel' ": ${driver_installed[1]} | Open-Source VA-API GPU drivers" 'AMD' ": ${driver_installed[2]} | Proprietary GPU driver" @@ -625,25 +596,23 @@ A long (or insufficiently manufactured) cable may required a higher boost settin fi # RPi - elif (( $G_HW_MODEL < 10 )); then - + elif (( $G_HW_MODEL < 10 )) + then local framebuffer_x=$(grep -m1 '^[[:blank:]]*framebuffer_width=' /boot/config.txt || vcgencmd get_config framebuffer_width) framebuffer_x=${framebuffer_x#*=}; framebuffer_x=${framebuffer_x:-0} local framebuffer_y=$(grep -m1 '^[[:blank:]]*framebuffer_height=' /boot/config.txt || vcgencmd get_config framebuffer_height) framebuffer_y=${framebuffer_y#*=}; framebuffer_y=${framebuffer_y:-0} local current_value=$(sed -n '/^[[:blank:]]*dtoverlay=vc4-/{s/^[^=]*=//p;q}' /boot/config.txt) # OpenGL check 1st - if [[ ! $current_value ]]; then - + if [[ ! $current_value ]] + then # Framebuffer current_value="$framebuffer_x X $framebuffer_y" # Check for headless grep -q '^[[:blank:]]*AUTO_SETUP_HEADLESS=1' /boot/dietpi.txt && current_value='Headless' - fi G_WHIP_MENU_ARRAY=( - 'vc4-kms-v3d' ': OpenGL | 1920 x 1080' 'vc4-fkms-v3d' ': OpenGL | 1920 x 1080' '1080p' ': 1920 x 1080' @@ -667,8 +636,8 @@ A long (or insufficiently manufactured) cable may required a higher boost settin REBOOT_REQUIRED=1 # Enable headless if chosen, else always disable - if [[ $G_WHIP_RETURNED_VALUE == 'Headless' ]]; then - + if [[ $G_WHIP_RETURNED_VALUE == 'Headless' ]] + then G_WHIP_YESNO 'Using the Headless option will: - Disable HDMI and composite output - Disable the framebuffer @@ -680,91 +649,42 @@ Re-enabling HDMI requires a reboot. If you need emergency HDMI output, edit the - In dietpi.txt, set "AUTO_SETUP_HEADLESS=0".' || { REBOOT_REQUIRED=0; return; } /boot/dietpi/func/dietpi-set_hardware headless 1 - else - /boot/dietpi/func/dietpi-set_hardware headless 0 - fi # Disable composite if not chosen - if [[ $G_WHIP_RETURNED_VALUE != 'sdtv_mode'* ]]; then - + if [[ $G_WHIP_RETURNED_VALUE != 'sdtv_mode'* ]] + then 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 # Disable OpenGL if not chosen [[ $G_WHIP_RETURNED_VALUE == 'vc4-'* ]] || /boot/dietpi/func/dietpi-set_hardware rpi-opengl disable - if [[ $G_WHIP_RETURNED_VALUE == 'vc4-'* ]]; then - + if [[ $G_WHIP_RETURNED_VALUE == 'vc4-'* ]] + then /boot/dietpi/func/dietpi-set_hardware rpi-opengl "$G_WHIP_RETURNED_VALUE" - elif [[ $G_WHIP_RETURNED_VALUE != 'Headless' ]]; then - + elif [[ $G_WHIP_RETURNED_VALUE != 'Headless' ]] + then case "$G_WHIP_RETURNED_VALUE" in - 'sdtv_mode'*) - # Enable SDTV on RPi4, apply to all RPi to allow SD card switch G_CONFIG_INJECT 'enable_tvout=' 'enable_tvout=1' /boot/config.txt G_CONFIG_INJECT 'sdtv_mode=' "$G_WHIP_RETURNED_VALUE" /boot/config.txt - framebuffer_x=720 - framebuffer_y=576 - ;; - - 'DietPi-CloudShell') - - framebuffer_x=320 - framebuffer_y=240 + framebuffer_x=720 framebuffer_y=576 ;; - - '1080p') - - framebuffer_x=1920 - framebuffer_y=1080 - ;; - - '720p') - - framebuffer_x=1280 - framebuffer_y=720 - ;; - - '480p') - - framebuffer_x=854 - framebuffer_y=480 - ;; - - 'RPi Touchscreen') - - framebuffer_x=800 - framebuffer_y=480 - ;; - - 'PC1') - - framebuffer_x=1024 - framebuffer_y=768 - ;; - - 'PC2') - - framebuffer_x=800 - framebuffer_y=640 - ;; - - 'PC3') - - framebuffer_x=640 - framebuffer_y=480 - ;; - + 'DietPi-CloudShell') framebuffer_x=320 framebuffer_y=240;; + '1080p') framebuffer_x=1920 framebuffer_y=1080;; + '720p') framebuffer_x=1280 framebuffer_y=720;; + '480p') framebuffer_x=854 framebuffer_y=480;; + 'RPi Touchscreen') framebuffer_x=800 framebuffer_y=480;; + 'PC1') framebuffer_x=1024 framebuffer_y=768;; + 'PC2') framebuffer_x=800 framebuffer_y=640;; + 'PC3') framebuffer_x=640 framebuffer_y=480;; *) :;; - esac # Apply framebuffer size and Chromium autostart resolution @@ -772,30 +692,22 @@ Re-enabling HDMI requires a reboot. If you need emergency HDMI output, edit the G_CONFIG_INJECT 'framebuffer_height=' "framebuffer_height=$framebuffer_y" /boot/config.txt G_CONFIG_INJECT 'SOFTWARE_CHROMIUM_RES_X=' "SOFTWARE_CHROMIUM_RES_X=$framebuffer_x" /boot/dietpi.txt G_CONFIG_INJECT 'SOFTWARE_CHROMIUM_RES_Y=' "SOFTWARE_CHROMIUM_RES_Y=$framebuffer_y" /boot/dietpi.txt - fi # Odroid XU4 - elif (( $G_HW_MODEL == 11 )); then - + elif (( $G_HW_MODEL == 11 )) + then # Get Current Values local current_resolution=$(grep -Em1 'setenv[[:blank:]]+videoconfig[[:blank:]]' /boot/boot.ini) - if [[ $current_resolution == *'1920x1080'* ]]; then - - current_resolution='1080p' - - elif [[ $current_resolution == *'1280x720'* ]]; then - - current_resolution='720p' - - elif [[ $current_resolution == *'720x480'* ]]; then - - current_resolution='480p' - - fi + case $current_resolution in + *'1920x1080'*) current_resolution='1920x1080';; + *'1280x720'*) current_resolution='1280x720';; + *'720x480'*) current_resolution='720x480';; + *'1024x600'*) current_resolution='1024x600';; + *) :;; + esac G_WHIP_MENU_ARRAY=( - '1920x1080' ': 1080p' '1280x720' ': 720p' '720x480' ': 480p' @@ -805,8 +717,6 @@ Re-enabling HDMI requires a reboot. If you need emergency HDMI output, edit the G_WHIP_DEFAULT_ITEM=$current_resolution G_WHIP_MENU "Hardware : $G_HW_MODEL_NAME\nCurrent: $current_resolution" || { Back_or_Exit 1; return 0; } # Display Options - REBOOT_REQUIRED=1 - # DVI or HDMI if [[ $G_WHIP_RETURNED_VALUE == '1024x600' ]] then @@ -817,56 +727,11 @@ Re-enabling HDMI requires a reboot. If you need emergency HDMI output, edit the G_CONFIG_INJECT 'setenv[[:blank:]]+videoconfig[[:blank:]]' "setenv videoconfig \"drm_kms_helper.edid_firmware=edid/$G_WHIP_RETURNED_VALUE.bin\"" /boot/boot.ini 'ODROIDXU-UBOOT-CONFIG' - # Odroid C2 legacy - elif [[ $G_HW_MODEL == 12 && -f '/boot/boot.ini' ]]; then - - # Get Current Values - local current_resolution=$(mawk -F '"' '/setenv m "/{print $2;exit}' /boot/boot.ini | sed 's/p/p /') - # - NB: also added space after xxxp, so its easier to read, and selects default item. - - G_WHIP_MENU_ARRAY=( - - '2160p 60hz' ': 4K (Recommended)' - '2160p 50hz' ': 4K' - '2160p 30hz' ': 4K' - '2160p 25hz' ': 4K' - '2160p 24hz' ': 4K' - '1080p 60hz' ': 1080p (Recommended)' - '1080p 50hz' ': 1080p' - '1080p 24hz' ': 1080p' - '720p 60hz' ': 720p (Recommended)' - '720p 50hz' ': 720p' - '480p 60hz' ': 480p' - '1024x600p 60hz' ': VU7+' - '1024x768p 60hz' ': 4:3' - '800x600p 60hz' ': 4:3' - ) - - G_WHIP_DEFAULT_ITEM=$current_resolution - G_WHIP_MENU "Hardware : $G_HW_MODEL_NAME\nCurrent: $current_resolution" || { Back_or_Exit 1; return 0; } # Display Options - - [[ $current_resolution != "$G_WHIP_RETURNED_VALUE" ]] && REBOOT_REQUIRED=1 - - # Always reset vga/dvi options - sed --follow-symlinks -Ei 's/^[[:blank:]]*(setenv[[:blank:]]+vout[[:blank:]].*$)/#\1/' /boot/boot.ini - - # DVI / VU7+ - if [[ $G_WHIP_RETURNED_VALUE == '1024x600p 60hz' ]]; then - - # DVI mode - G_CONFIG_INJECT 'setenv[[:blank:]]+vout[[:blank:]]' 'setenv vout "dvi"' /boot/boot.ini 'ODROIDC2-UBOOT-CONFIG' - - fi - - # Remove the space from option - local temp_string=${G_WHIP_RETURNED_VALUE//[[:blank:]]/} - - G_CONFIG_INJECT 'setenv[[:blank:]]+m[[:blank:]]' "setenv m \"$temp_string\"" /boot/boot.ini 'ODROIDC2-UBOOT-CONFIG' + REBOOT_REQUIRED=1 else Info_HW_OptionNotSupported Back_or_Exit 1 # Display Options fi - } # TARGETMENUID=19 @@ -1725,79 +1590,30 @@ If unsure, set any value, 'Ondemand Down Factor' option on the next screen will # TARGETMENUID=6 Menu_GpumemoryOptions() { - G_WHIP_BUTTON_CANCEL_TEXT='Cancel' - - # RPi - if (( $G_HW_MODEL < 10 )); then - - # Get current memory split - # - Get override setting: gpu_mem_1024 is effective for all models with >= 1 GiB - local value=1024 - (( $value < 1024 )) && value=$G_HW_MEMORY_SIZE - local gpu_mem_current=$(sed -n "/^[[:blank:]]*gpu_mem_$value=/{s/^[^=]*=//p;q}" /boot/config.txt) # override setting - [[ $gpu_mem_current ]] || gpu_mem_current=$(sed -n "/^[[:blank:]]*gpu_mem=/{s/^[^=]*=//p;q}" /boot/config.txt) # base setting - [[ $gpu_mem_current ]] || { (( $value < 1024 )) && gpu_mem_current=64 || gpu_mem_current=76; } # default value - local ram_mem_current=$((G_HW_MEMORY_SIZE-gpu_mem_current)) - - # Create array for storing menu selectable options. - G_WHIP_MENU_ARRAY=( - - 16 ': Server' - 64 ': Desktop' - 96 ': Camera' - 128 ': Gaming' - ) - - if (( $G_HW_MEMORY_SIZE >= 512 )); then - - G_WHIP_MENU_ARRAY+=(192 '') - G_WHIP_MENU_ARRAY+=(256 ': Video de/encoding') - - if (( $G_HW_MEMORY_SIZE >= 1024 )); then - - G_WHIP_MENU_ARRAY+=(384 '') - G_WHIP_MENU_ARRAY+=(512 ': You are insane!') - - fi - - fi - - G_WHIP_DEFAULT_ITEM=$gpu_mem_current - G_WHIP_MENU "Hardware : $G_HW_MODEL_NAME\nCurrent: $gpu_mem_current MiB GPU | $ram_mem_current MiB RAM" || { Back_or_Exit 1; return 0; } # Display Options - - /boot/dietpi/func/dietpi-set_hardware gpumemsplit "$G_WHIP_RETURNED_VALUE" && REBOOT_REQUIRED=1 - - # Odroid C2 legacy - elif [[ $G_HW_MODEL == 12 && -f '/boot/boot.ini' ]]; then - - # Get current memory split - local ram_mem_current=$(free -m | mawk '/Mem:/{print $2;exit}') - local gpu_mem_current=$((2048-ram_mem_current)) - - # HDMI/headless extra data - local display_output_enabled=$(grep -Ecm1 '^[[:blank:]]*setenv[[:blank:]]+nographics[[:blank:]]+"0"' /boot/boot.ini) - local display_output_text='On' - (( $display_output_enabled )) || display_output_text='Off' - - G_WHIP_MENU_ARRAY=( - - 'Headless' ': HDMI: Disabled | VPU: Disabled | +300 MiB RAM' - 'Default' ': HDMI: Enabled | VPU: Enabled | -300 MiB RAM' - ) - - G_WHIP_MENU "Hardware : $G_HW_MODEL_NAME\nCurrent : HDMI: [$display_output_text] | VPU: [$display_output_text]\nMemory : $gpu_mem_current MiB GPU | $ram_mem_current MiB RAM\nNB: GPU/RAM figures require a reboot after a change is made." || { Back_or_Exit 1; return 0; } # Display Options + # Get current memory split + # - Get override setting: gpu_mem_1024 is effective for all models with >= 1 GiB RAM + local size=1024 default=76 + (( $G_HW_MEMORY_SIZE < 1024 )) && size=$G_HW_MEMORY_SIZE default=64 + local gpu_mem_current=$(sed -n "/^[[:blank:]]*gpu_mem_$size=/{s/^[^=]*=//p;q}" /boot/config.txt) # override setting + [[ $gpu_mem_current ]] || gpu_mem_current=$(sed -n "/^[[:blank:]]*gpu_mem=/{s/^[^=]*=//p;q}" /boot/config.txt) # base setting + [[ $gpu_mem_current ]] || gpu_mem_current=$default # default value + local ram_mem_current=$((G_HW_MEMORY_SIZE-gpu_mem_current)) + + # Create array for storing menu selectable options. + G_WHIP_MENU_ARRAY=( - case $G_WHIP_RETURNED_VALUE in + 16 ': Server/Console/Headless' + 32 ': Minimal GUI' + "$default" ': Full GUI/Desktop/Default' + 96 ': Camera/Legacy GPU' + ) - 'Headless') /boot/dietpi/func/dietpi-set_hardware headless 1 && REBOOT_REQUIRED=1;; - 'Default') /boot/dietpi/func/dietpi-set_hardware headless 0 && REBOOT_REQUIRED=1;; - *) G_DIETPI-NOTIFY 1 'An invalid "case" option was used. This is a bug, please report at: https://github.com/MichaIng/DietPi/issues'; exit 1;; - esac + G_WHIP_BUTTON_CANCEL_TEXT='Cancel' + G_WHIP_DEFAULT_ITEM=$gpu_mem_current + G_WHIP_MENU "GPU/RAM memory splits are pre-configured and optimized by DietPi-Software based on your software installs. However, feel free to tweak them. +\nCurrent: $gpu_mem_current MiB GPU | $ram_mem_current MiB RAM" || { Back_or_Exit 1; return 0; } # Display Options - else - Info_HW_OptionNotSupported - Back_or_Exit 1 # Display Options - fi + /boot/dietpi/func/dietpi-set_hardware gpumemsplit "$G_WHIP_RETURNED_VALUE" && REBOOT_REQUIRED=1 } # TARGETMENUID=7 @@ -1853,7 +1669,7 @@ If unsure, set any value, 'Ondemand Down Factor' option on the next screen will NET_RX_MB='N/A' NET_TX_MB='N/A' - # $1 = device+index + # $1 = interface Net_Update_UsageStats() { local input=$1 @@ -1910,7 +1726,7 @@ If unsure, set any value, 'Ondemand Down Factor' option on the next screen will Network_ETH_CopyCurrentToStatic() { # Apply if we have a connection - (( $ETH_CONNECTED )) || return + (( $ETH_CONNECTED )) || return 0 ETH_IP_STATIC=$ETH_IP ETH_GATEWAY_STATIC=$ETH_GATEWAY @@ -1921,7 +1737,7 @@ If unsure, set any value, 'Ondemand Down Factor' option on the next screen will Network_WIFI_CopyCurrentToStatic() { # Apply if we have a connection - (( $WIFI_CONNECTED )) || return + (( $WIFI_CONNECTED )) || return 0 WIFI_IP_STATIC=$WIFI_IP WIFI_GATEWAY_STATIC=$WIFI_GATEWAY @@ -1981,20 +1797,18 @@ If unsure, set any value, 'Ondemand Down Factor' option on the next screen will # Check if resolvconf is available, else apply static DNS server via /etc/resolv.conf directly instead of /etc/network/interfaces entry local i resolvconf=0 command -v resolvconf > /dev/null && resolvconf=1 - if (( ! $resolvconf )); then - - if (( ! $ETH_DISABLED && $ETH_MODE_TARGET == 0 )); then - + if (( ! $resolvconf )) + then + if (( ! $ETH_DISABLED && $ETH_MODE_TARGET == 0 )) + then > /etc/resolv.conf for i in $ETH_DNS_STATIC; do echo "nameserver $i" >> /etc/resolv.conf; done - elif (( ! $WIFI_DISABLED && $WIFI_MODE_TARGET == 0 )); then - + elif (( ! $WIFI_DISABLED && $WIFI_MODE_TARGET == 0 )) + then > /etc/resolv.conf for i in $WIFI_DNS_STATIC; do echo "nameserver $i" >> /etc/resolv.conf; done - fi - fi # Eth @@ -2092,67 +1906,72 @@ _EOF_ Network_Restart } + # $1: Adapter type | 0=Eth, 1=WiFi Change_StaticIp() { # Ethernet - if (( $1 == 0 )); then - + if (( ! $1 )) + then G_WHIP_DEFAULT_ITEM=$ETH_IP_STATIC G_WHIP_INPUTBOX 'Please enter a new static Ethernet IP address:' && ETH_IP_STATIC=$G_WHIP_RETURNED_VALUE # WiFi - elif (( $1 == 1 )); then - + else G_WHIP_DEFAULT_ITEM=$WIFI_IP_STATIC G_WHIP_INPUTBOX 'Please enter a new static WiFi IP address:' && WIFI_IP_STATIC=$G_WHIP_RETURNED_VALUE - fi } + # $1: Adapter type | 0=Eth, 1=WiFi Change_StaticGateway() { # Ethernet - if (( $1 == 0 )); then - + if (( ! $1 )) + then G_WHIP_DEFAULT_ITEM=$ETH_GATEWAY_STATIC G_WHIP_INPUTBOX 'Please enter a new static Ethernet gateway address:' && ETH_GATEWAY_STATIC=$G_WHIP_RETURNED_VALUE # WiFi - elif (( $1 == 1 )); then - + else G_WHIP_DEFAULT_ITEM=$WIFI_GATEWAY_STATIC G_WHIP_INPUTBOX 'Please enter a new static WiFi gateway address:' && WIFI_GATEWAY_STATIC=$G_WHIP_RETURNED_VALUE - fi } + # $1: Adapter type | 0=Eth, 1=WiFi Change_StaticMask() { # Ethernet - if (( $1 == 0 )); then - + if (( ! $1 )) + then G_WHIP_DEFAULT_ITEM=$ETH_MASK_STATIC G_WHIP_INPUTBOX 'Please enter a new static Ethernet network mask:' && ETH_MASK_STATIC=$G_WHIP_RETURNED_VALUE # WiFi - elif (( $1 == 1 )); then - + else G_WHIP_DEFAULT_ITEM=$WIFI_MASK_STATIC G_WHIP_INPUTBOX 'Please enter a new static WiFi network mask:' && WIFI_MASK_STATIC=$G_WHIP_RETURNED_VALUE - fi } + # $1: Adapter type | 0=Eth, 1=WiFi Change_StaticDns() { - # $1 = Adapater type | 0=Eth, 1=WiFi - # Current value => default choice (( $1 )) && G_WHIP_DEFAULT_ITEM=$WIFI_DNS_STATIC || G_WHIP_DEFAULT_ITEM=$ETH_DNS_STATIC + G_WHIP_MENU_ARRAY=("$G_WHIP_DEFAULT_ITEM" ': Your current DNS server') - G_WHIP_MENU_ARRAY=( + # Auto detect local gateway(s)/router(s) to offer as DNS server(s). + local gateway=$(ip r l 0/0 | mawk '{print $3}' ORS=' ') + while [[ $gateway == *' '*' '* ]]; do gateway=${gateway% *}; done + [[ $gateway ]] && G_WHIP_MENU_ARRAY+=("$gateway" ': Use local router as DNS server (recommended)') + # Auto detect local DNS resolver to offer as system DNS + ss -uln | grep -q ':53[[:blank:]]' && G_WHIP_MENU_ARRAY+=('127.0.0.1' ': Use local Pi-hole/AdGuard Home/Unbound (not recommended)') + + G_WHIP_MENU_ARRAY+=( 'Custom' ': Manually enter your DNS server' + '' '●─ Public DNS providers ' '1.1.1.1 1.0.0.1' ': Cloudflare' '9.9.9.9 149.112.112.112' ': Quad9' '8.8.8.8 8.8.4.4' ': Google' @@ -2164,12 +1983,14 @@ _EOF_ '84.200.69.80 84.200.70.40' ': DNS.WATCH' ) - G_WHIP_MENU 'Please select a DNS server, or choose "Custom" for manual entry:' || return - if [[ $G_WHIP_RETURNED_VALUE == 'Custom' ]]; then + G_WHIP_MENU 'Please select a DNS server, or choose "Custom" for manual entry:' || return 0 + if [[ $G_WHIP_RETURNED_VALUE == 'Custom' ]] + then (( $1 )) && G_WHIP_DEFAULT_ITEM=$WIFI_DNS_STATIC || G_WHIP_DEFAULT_ITEM=$ETH_DNS_STATIC - G_WHIP_INPUTBOX 'Please enter a new DNS server address\n - 2 maximum, seperated by a space.\n - E.g.: 9.9.9.9 149.112.112.112' || return - + G_WHIP_INPUTBOX "Please enter one or two space-separated DNS server addresses + - E.g.: 9.9.9.9 149.112.112.112 + - Current: $G_WHIP_DEFAULT_ITEM" || return 0 fi # Apply new value @@ -2427,20 +2248,16 @@ NB: All Ethernet connections will be temporarily dropped!' && Network_ApplyChang # Onboard WiFi # - RPi 3/4/Zero W - if (( $G_HW_ONBOARD_WIFI )); then - + if (( $G_HW_ONBOARD_WIFI )) + then local onboard_wifi_enabled=1 - if grep -q '^[[:blank:]]*dtoverlay=disable-wifi' /boot/config.txt; then - + if grep -q '^[[:blank:]]*dtoverlay=disable-wifi' /boot/config.txt + then onboard_wifi_enabled=0 G_WHIP_MENU_ARRAY+=('Onboard WiFi' ': [Off]') - else - G_WHIP_MENU_ARRAY+=('Onboard WiFi' ': [On]') - fi - fi G_WHIP_MENU_ARRAY+=('' '●─ Additional Options ') @@ -2574,14 +2391,13 @@ NB: All Ethernet connections will be temporarily dropped!' && Network_ApplyChang G_WHIP_MENU_ARRAY+=('Change Mode' ": [$mode_text]") # Show static options - if (( $ETH_MODE_TARGET == 0 )); then - + if (( $ETH_MODE_TARGET == 0 )) + then G_WHIP_MENU_ARRAY+=('Copy' ': Copy current address to "Static"') G_WHIP_MENU_ARRAY+=('Static IP' ": [$ETH_IP_STATIC]") G_WHIP_MENU_ARRAY+=('Static Mask' ": [$ETH_MASK_STATIC]") G_WHIP_MENU_ARRAY+=('Static Gateway' ": [$ETH_GATEWAY_STATIC]") G_WHIP_MENU_ARRAY+=('Static DNS' ": [$ETH_DNS_STATIC]") - fi G_WHIP_MENU_ARRAY+=('' '●─ Additional Options ') diff --git a/dietpi/dietpi-drive_manager b/dietpi/dietpi-drive_manager index 7a18cd438f..00e10d6ab5 100755 --- a/dietpi/dietpi-drive_manager +++ b/dietpi/dietpi-drive_manager @@ -267,7 +267,7 @@ $swap_mounts else - options+=',nofail,noauto,x-systemd.automount' + options+=',noauto,x-systemd.automount' fi @@ -369,7 +369,7 @@ $swap_mounts # - Container: Assume host supports it (relevant for network drives) if (( $G_HW_MODEL != 75 )) && ! modprobe -nq autofs4 then - sed --follow-symlinks -Ei '/x-systemd\.automount/s/,(noauto|x-systemd\.automount)//g' "$fp_fstab_tmp" + sed --follow-symlinks -i -e '/,x-systemd\.automount/s/noauto/nofail/' -e 's/,x-systemd\.automount//' "$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 @@ -1757,7 +1757,7 @@ _EOF_ # Apply to 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 + 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,noauto,x-systemd.automount" >> /etc/fstab MENU_DRIVE_TARGET=$samba_fp_mount_target Init_Drives_and_Refresh @@ -1870,7 +1870,7 @@ _EOF_ then # Apply to 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 + echo "$nfs_server_ip:$nfs_fp_server_share $nfs_fp_mount_target nfs noauto,x-systemd.automount" >> /etc/fstab MENU_DRIVE_TARGET=$nfs_fp_mount_target Init_Drives_and_Refresh diff --git a/dietpi/dietpi-services b/dietpi/dietpi-services index 07d9a13610..2c267a3045 100755 --- a/dietpi/dietpi-services +++ b/dietpi/dietpi-services @@ -230,6 +230,7 @@ _EOF_ 'openbazaar' 'synapse' 'microblog-pub' + 'soju' # - Hardware Projects 'pi-spc' diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index c723ca8201..50e323539f 100755 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -1047,6 +1047,13 @@ Available commands: aSOFTWARE_CATX[$software_id]=6 aSOFTWARE_DOCS[$software_id]='https://dietpi.com/docs/software/social/#mediawiki' aSOFTWARE_DEPS[$software_id]='88 89 webserver' + #------------------ + software_id=213 + aSOFTWARE_NAME[$software_id]='soju' + aSOFTWARE_DESC[$software_id]='A user-friendly IRC bouncer' + aSOFTWARE_CATX[$software_id]=6 + aSOFTWARE_DOCS[$software_id]='https://dietpi.com/docs/software/social/#soju' + aSOFTWARE_DEPS[$software_id]='188' # Camera & Surveillance #-------------------------------------------------------------------------------- @@ -3285,27 +3292,21 @@ _EOF_ [[ $backend == 'Yes' ]] && backend='-backend' || backend= # Download binary and set config URL - local url - if (( $G_HW_ARCH == 11 )) - then - url="https://dietpi.com/downloads/binaries/dietpi-dashboard-$G_HW_ARCH_NAME$backend.zip" - - elif [[ $version == 'Stable' ]] - then - Download_Install "$(curl -sSfL 'https://api.github.com/repos/ravenclaw900/dietpi-dashboard/releases/latest' | mawk -F\" "/^ *\"browser_download_url\": \".*dietpi-dashboard-$G_HW_ARCH_NAME$backend\"$/{print \$4}")" /opt/dietpi-dashboard/dietpi-dashboard - url="https://raw.githubusercontent.com/ravenclaw900/DietPi-Dashboard/$(curl -sSfL 'https://api.github.com/repos/ravenclaw900/dietpi-dashboard/releases/latest' | mawk -F\" '/^ *"tag_name": "[^"]*",$/{print $4}')/config.toml" - - elif [[ $version == 'Nightly' ]] + local config_url + if [[ $G_HW_ARCH == 11 || $version == 'Nightly' ]] then Download_Install "https://nightly.link/ravenclaw900/DietPi-Dashboard/workflows/push-build/main/dietpi-dashboard-$G_HW_ARCH_NAME$backend.zip" /opt/dietpi-dashboard - url='https://raw.githubusercontent.com/ravenclaw900/DietPi-Dashboard/main/config.toml' + config_url='https://raw.githubusercontent.com/ravenclaw900/DietPi-Dashboard/main/config.toml' + else + Download_Install "$(curl -sSfL 'https://api.github.com/repos/ravenclaw900/dietpi-dashboard/releases/latest' | mawk -F\" "/^ *\"browser_download_url\": \".*dietpi-dashboard-$G_HW_ARCH_NAME$backend\"$/{print \$4}")" /opt/dietpi-dashboard/dietpi-dashboard + config_url="https://raw.githubusercontent.com/ravenclaw900/DietPi-Dashboard/$(curl -sSfL 'https://api.github.com/repos/ravenclaw900/dietpi-dashboard/releases/latest' | mawk -F\" '/^ *"tag_name": "[^"]*",$/{print $4}')/config.toml" fi G_EXEC chmod +x /opt/dietpi-dashboard/dietpi-dashboard # Config if [[ ! -f '/opt/dietpi-dashboard/config.toml' ]] then - G_EXEC curl -sSfL "$url" -o /opt/dietpi-dashboard/config.toml + G_EXEC curl -sSfL "$config_url" -o /opt/dietpi-dashboard/config.toml # Enable password protection with global software password by default G_CONFIG_INJECT 'pass[[:blank:]]' 'pass = true' /opt/dietpi-dashboard/config.toml G_CONFIG_INJECT 'hash[[:blank:]]' "hash = \"$(echo -n "$GLOBAL_PW" | sha512sum | mawk '{print $1}')\"" /opt/dietpi-dashboard/config.toml @@ -3938,15 +3939,15 @@ _EOF_ # Database G_EXEC systemctl start postgresql local synapse_pass=$(tr -dc '[:alnum:]' < /dev/random | head -c30) - if [[ $(sudo -u postgres psql -tAc "SELECT 1 FROM pg_roles WHERE rolname='synapse'") != 1 ]] + if [[ $(runuser -u postgres -- psql -tAc "SELECT 1 FROM pg_roles WHERE rolname='synapse'") != 1 ]] then - G_EXEC sudo -u postgres psql -c "CREATE ROLE synapse WITH LOGIN PASSWORD '$synapse_pass';" + G_EXEC runuser -u postgres -- psql -c "CREATE ROLE synapse WITH LOGIN PASSWORD '$synapse_pass';" else - G_EXEC sudo -u postgres psql -c "ALTER ROLE synapse WITH PASSWORD '$synapse_pass';" + G_EXEC runuser -u postgres -- psql -c "ALTER ROLE synapse WITH PASSWORD '$synapse_pass';" fi - if [[ $(sudo -u postgres psql -tAc "SELECT 1 FROM pg_database WHERE datname='synapse'") != 1 ]] + if [[ $(runuser -u postgres -- psql -tAc "SELECT 1 FROM pg_database WHERE datname='synapse'") != 1 ]] then - G_EXEC sudo -u postgres createdb --encoding=UTF8 --locale=C --template=template0 --owner=synapse synapse + G_EXEC runuser -u postgres -- createdb --encoding=UTF8 --locale=C --template=template0 --owner=synapse synapse fi # Pre-create drop-in config for database access details @@ -4242,7 +4243,7 @@ _EOF_ G_EXEC curl -sSf 'https://sh.rustup.rs/' -o rustup-init.sh G_EXEC chmod +x rustup-init.sh # RPi with 64-bit kernel on 32-bit image: Enforce 32-bit toolchain: https://github.com/MichaIng/DietPi/issues/6306 - G_EXEC_OUTPUT=1 G_EXEC sudo -u "$micro_name" ./rustup-init.sh -y --profile minimal ${RPI_64KERNEL_32OS:+'--default-host' 'armv7-unknown-linux-gnueabihf'} + G_EXEC_OUTPUT=1 G_EXEC runuser -u "$micro_name" -- ./rustup-init.sh -y --profile minimal ${RPI_64KERNEL_32OS:+'--default-host' 'armv7-unknown-linux-gnueabihf'} G_EXEC rm rustup-init.sh fi @@ -4267,7 +4268,7 @@ PS1=\"(microblog.pub) \$PS1\"" > "$micro_pyenv_activate_file" # Install Python 3.10 and Poetry G_EXEC chown -R "$micro_name:$micro_name" "$micro_pyenv_dir" G_EXEC_DESC='Installing Python with Poetry into pyenv' - G_EXEC_OUTPUT=1 G_EXEC sudo -u "$micro_name" dash -c " + G_EXEC_OUTPUT=1 G_EXEC runuser -u "$micro_name" -- dash -c " . $micro_pyenv_activate_file || exit 1 pyenv install $micro_python_version || exit 1 pyenv local $micro_python_version || exit 1 @@ -4460,7 +4461,7 @@ location = /.well-known/caldav { return 301 /owncloud/remote.php/dav/; }' > /et G_EXEC systemctl restart redis-server # Initially add occ command shortcut, will be added as alias by /etc/bashrc.d/dietpi.bash if occ file exist: - occ(){ sudo -u www-data php /var/www/owncloud/occ "$@"; } + occ(){ runuser -u www-data -- php /var/www/owncloud/occ "$@"; } # Adjusting config file: local config_php='/var/www/owncloud/config/config.php' @@ -4691,7 +4692,7 @@ location = /.well-known/caldav { return 301 /nextcloud/remote.php/dav/; }' > /e G_EXEC systemctl restart redis-server # Initially add occ command shortcut, will be added as alias by /etc/bashrc.d/dietpi.bash if occ file exist: - ncc(){ sudo -u www-data php /var/www/nextcloud/occ "$@"; } + ncc(){ runuser -u www-data -- php /var/www/nextcloud/occ "$@"; } # Adjusting config file: local config_php='/var/www/nextcloud/config/config.php' @@ -6674,7 +6675,17 @@ _EOF_ # Install as local instance for "nodered" user G_EXEC cd /mnt/dietpi_userdata/node-red - G_EXEC_OUTPUT=1 G_EXEC sudo -u nodered npm i --no-audit node-red + # - Disable cache + local cache=$(runuser -u nodered -- mktemp -d) + # - Reinstall: Remove all locally installed modules, to work around update issues, but preserve installed plugins from package.json: https://github.com/MichaIng/DietPi/issues/7128 + if [[ -f 'package.json' ]] + then + G_EXEC rm -Rf node_modules .npm/_cacache + G_EXEC_OUTPUT=1 G_EXEC runuser -u nodered -- npm up --cache "$cache" --no-audit + else + G_EXEC_OUTPUT=1 G_EXEC runuser -u nodered -- npm i --cache "$cache" --no-audit node-red + fi + G_EXEC rm -R "$cache" G_EXEC cd "$G_WORKING_DIR" # Service @@ -6775,10 +6786,10 @@ _EOF_ fi # RPi: Install "onoff" for GPIO access - (( $G_HW_MODEL > 9 )) || G_EXEC_OUTPUT=1 G_EXEC npm i -g --no-audit onoff + (( $G_HW_MODEL > 9 )) || G_EXEC_OUTPUT=1 G_EXEC npm i -g --no-audit onoff@latest # Install Blynk JS library - G_EXEC_OUTPUT=1 G_EXEC npm i -g --no-audit blynk-library + G_EXEC_OUTPUT=1 G_EXEC npm i -g --no-audit blynk-library@latest # Preserve existing config if [[ ! -f '/mnt/dietpi_userdata/blynk/server.properties' ]] @@ -7098,12 +7109,12 @@ _EOF_ # CLI install: https://github.com/FreshRSS/FreshRSS/blob/master/cli/README.md#commands G_EXEC cd /opt/FreshRSS - sudo -u www-data php ./cli/prepare.php - sudo -u www-data php ./cli/do-install.php --default_user dietpi --auth_type form --environment production --title FreshRSS --db-type mysql --db-host localhost --db-user freshrss --db-password "$password" --db-base freshrss --db-prefix freshrss + runuser -u www-data -- php ./cli/prepare.php + runuser -u www-data -- php ./cli/do-install.php --default_user dietpi --auth_type form --environment production --title FreshRSS --db-type mysql --db-host localhost --db-user freshrss --db-password "$password" --db-base freshrss --db-prefix freshrss unset -v password - sudo -u www-data php ./cli/create-user.php --user dietpi --password "$GLOBAL_PW" --api_password "$GLOBAL_PW" - sudo -u www-data php ./cli/actualize-user.php --user dietpi - sudo -u www-data php ./cli/db-optimize.php --user dietpi + runuser -u www-data -- php ./cli/create-user.php --user dietpi --password "$GLOBAL_PW" --api_password "$GLOBAL_PW" + runuser -u www-data -- php ./cli/actualize-user.php --user dietpi + runuser -u www-data -- php ./cli/db-optimize.php --user dietpi G_EXEC cd "$G_WORKING_DIR" # Link web interface to webroot @@ -7541,7 +7552,7 @@ _EOF_ local json=() [[ $PHP_VERSION == 8* ]] || aDEPS+=("php$PHP_VERSION-json") json=('json') - local fallback_url="https://github.com/ampache/ampache/releases/download/6.4.0/ampache-6.4.0_all_php$PHP_VERSION.zip" + local fallback_url="https://github.com/ampache/ampache/releases/download/6.5.0/ampache-6.5.0_all_php$PHP_VERSION.zip" Download_Install "$(curl -sSfL 'https://api.github.com/repos/ampache/ampache/releases/latest' | mawk -F\" "/^ *\"browser_download_url\": \".*\/ampache-[0-9\.]*_all_php$PHP_VERSION.zip\"$/{print \$4}")" ampache # Reinstall: Preserve configs from old and new paths @@ -8389,7 +8400,7 @@ _EOF_ G_EXEC chmod +x mineos_console.js webui.js update_webui.sh reset_webui.sh generate-sslcert.sh # Workaround: Node.js posix needs to be installed alone first: https://github.com/MichaIng/DietPi/issues/5181 - G_EXEC_OUTPUT=1 G_EXEC npm i --no-audit --no-package-lock posix + G_EXEC_OUTPUT=1 G_EXEC npm i --no-audit --no-package-lock posix@latest # Install MineOS G_EXEC_OUTPUT=1 G_EXEC npm i --no-audit @@ -8507,7 +8518,7 @@ _EOF_ fi # Service - cat << _EOF_ > /etc/systemd/system/qbittorrent.service + cat << '_EOF_' > /etc/systemd/system/qbittorrent.service [Unit] Description=qBittorrent (DietPi) Documentation=man:qbittorrent-nox(1) @@ -8518,7 +8529,7 @@ After=network-online.target remote-fs.target User=qbittorrent UMask=002 LogsDirectory=qbittorrent -ExecStart=$(command -v qbittorrent-nox) +ExecStart=/usr/bin/qbittorrent-nox [Install] WantedBy=multi-user.target @@ -8534,7 +8545,7 @@ _EOF_ # Install ruTorrent: Web UI for rTorrent # - Grab current version local version=$(curl -sSfL 'https://api.github.com/repos/Novik/ruTorrent/releases/latest' | mawk -F\" '/^ *"tag_name": "[^"]*",$/{print $4}') - [[ $version ]] || { version='v4.3.2'; G_DIETPI-NOTIFY 1 "Automatic latest ruTorrent version detection failed. Version \"$version\" will be installed as fallback, but a newer version might be available. Please report this at: https://github.com/MichaIng/DietPi/issues"; } + [[ $version ]] || { version='v4.3.5'; G_DIETPI-NOTIFY 1 "Automatic latest ruTorrent version detection failed. Version \"$version\" will be installed as fallback, but a newer version might be available. Please report this at: https://github.com/MichaIng/DietPi/issues"; } Download_Install "https://github.com/Novik/ruTorrent/archive/$version.tar.gz" # - Reinstall freshly with preserved configs and 3rd party plugins @@ -8925,7 +8936,7 @@ _EOF_ *) local arch='arm';; esac - local fallback_url="https://github.com/syncthing/syncthing/releases/download/v1.27.8/syncthing-linux-$arch-v1.27.8.tar.gz" + local fallback_url="https://github.com/syncthing/syncthing/releases/download/v1.27.9/syncthing-linux-$arch-v1.27.9.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 @@ -8940,7 +8951,7 @@ _EOF_ G_EXEC chown dietpi /mnt/dietpi_userdata # Run Syncthing to pre-create config dir and exit - G_EXEC_OUTPUT=1 G_EXEC sudo -u dietpi /opt/syncthing/syncthing -generate=/mnt/dietpi_userdata/syncthing + G_EXEC_OUTPUT=1 G_EXEC runuser -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 --follow-symlinks -i '\|:8384|c\
0.0.0.0:8384
' /mnt/dietpi_userdata/syncthing/config.xml @@ -9133,9 +9144,9 @@ _EOF_ if [[ ${aSOFTWARE_INSTALL_STATE[153]} == 2 && -f '/mnt/dietpi_userdata/octoprint/.octoprint/config.yaml' ]] then G_DIETPI-NOTIFY 2 'Configuring OctoPrint to use mjpg-streamer for webcam support' - G_EXEC sudo -u octoprint /mnt/dietpi_userdata/octoprint/.local/bin/octoprint config set webcam.stream "http://$(G_GET_NET ip):8082/?action=stream" - G_EXEC sudo -u octoprint /mnt/dietpi_userdata/octoprint/.local/bin/octoprint config set webcam.snapshot 'http://127.0.0.1:8082/?action=snapshot' - G_EXEC sudo -u octoprint /mnt/dietpi_userdata/octoprint/.local/bin/octoprint config set webcam.ffmpeg "$(command -v ffmpeg)" + G_EXEC runuser -u octoprint -- /mnt/dietpi_userdata/octoprint/.local/bin/octoprint config set webcam.stream "http://$(G_GET_NET ip):8082/?action=stream" + G_EXEC runuser -u octoprint -- /mnt/dietpi_userdata/octoprint/.local/bin/octoprint config set webcam.snapshot 'http://127.0.0.1:8082/?action=snapshot' + G_EXEC runuser -u octoprint -- /mnt/dietpi_userdata/octoprint/.local/bin/octoprint config set webcam.ffmpeg "$(command -v ffmpeg)" fi fi @@ -9388,8 +9399,8 @@ _EOF_ Download_Test_Media # Init - G_EXEC_OUTPUT=1 G_EXEC sudo -u koel "php$PHP_VERSION" artisan koel:init -n --no-assets - G_EXEC_OUTPUT=1 G_EXEC sudo -u koel "php$PHP_VERSION" artisan koel:sync + G_EXEC_OUTPUT=1 G_EXEC runuser -u koel -- "php$PHP_VERSION" artisan koel:init -n --no-assets + G_EXEC_OUTPUT=1 G_EXEC runuser -u koel -- "php$PHP_VERSION" artisan koel:sync G_EXEC cd "$G_WORKING_DIR" # Service: Run on port 8003 by default to avoid conflict with Icecast @@ -9519,7 +9530,7 @@ _EOF_ esac url=$(curl -sSfL 'https://api.github.com/repos/Radarr/Radarr/releases/latest' | mawk -F\" "/^ *\"browser_download_url\": \".*linux-core-$arch\.tar\.gz\"$/{print \$4}") - local fallback_url="https://github.com/Radarr/Radarr/releases/download/v5.6.0.8846/Radarr.master.5.6.0.8846.linux-core-$arch.tar.gz" + local fallback_url="https://github.com/Radarr/Radarr/releases/download/v5.7.0.8882/Radarr.master.5.7.0.8882.linux-core-$arch.tar.gz" fi Download_Install "$url" @@ -9959,7 +9970,7 @@ _EOF_ *) local arch='x64';; esac - local fallback_url="https://github.com/Prowlarr/Prowlarr/releases/download/v1.18.0.4543/Prowlarr.master.1.18.0.4543.linux-core-$arch.tar.gz" + local fallback_url="https://github.com/Prowlarr/Prowlarr/releases/download/v1.19.0.4568/Prowlarr.master.1.19.0.4568.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 @@ -10033,7 +10044,7 @@ _EOF_ *) local arch='x64';; esac - local fallback_url="https://github.com/Readarr/Readarr/releases/download/v0.3.28.2554/Readarr.develop.0.3.28.2554.linux-core-$arch.tar.gz" + local fallback_url="https://github.com/Readarr/Readarr/releases/download/v0.3.29.2565/Readarr.develop.0.3.29.2565.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 @@ -10160,7 +10171,7 @@ _EOF_ aDEPS=('gcc' 'libffi-dev') G_EXEC curl -sSf 'https://sh.rustup.rs/' -o rustup-init.sh G_EXEC chmod +x rustup-init.sh - G_EXEC_OUTPUT=1 G_EXEC sudo -u octoprint ./rustup-init.sh -y --profile minimal + G_EXEC_OUTPUT=1 G_EXEC runuser -u octoprint -- ./rustup-init.sh -y --profile minimal G_EXEC rm rustup-init.sh aPATH=("PATH='/mnt/dietpi_userdata/octoprint/.cargo/bin:$PATH'") @@ -10174,7 +10185,7 @@ _EOF_ [[ -d '/mnt/dietpi_userdata/octoprint/.cache' ]] && G_EXEC rm -R /mnt/dietpi_userdata/octoprint/.cache # Install OctoPrint - G_EXEC_OUTPUT=1 G_EXEC sudo -u octoprint "${aPATH[@]}" pip3 install -U --user --no-warn-script-location octoprint + G_EXEC_OUTPUT=1 G_EXEC runuser -u octoprint -- "${aPATH[@]}" pip3 install -U --user --no-warn-script-location octoprint # Service: https://github.com/OctoPrint/OctoPrint/blob/master/scripts/octoprint.service cat << '_EOF_' > /etc/systemd/system/octoprint.service @@ -10196,22 +10207,22 @@ _EOF_ echo "alias octoprint='sudo -u octoprint /mnt/dietpi_userdata/octoprint/.local/bin/octoprint'" > /etc/bashrc.d/dietpi-octoprint.sh # On fresh installs, change listening port to 5001 to avoid conflict with Shairport Sync. - [[ -f '/mnt/dietpi_userdata/octoprint/.octoprint/config.yaml' ]] || G_EXEC sudo -u octoprint /mnt/dietpi_userdata/octoprint/.local/bin/octoprint config set server.port '5001' + [[ -f '/mnt/dietpi_userdata/octoprint/.octoprint/config.yaml' ]] || G_EXEC runuser -u octoprint -- /mnt/dietpi_userdata/octoprint/.local/bin/octoprint config set server.port '5001' # Apply service and system commands: Allow execution via specific sudoers config, use "which" for "reboot" and "poweroff", since we create shell functions in dietpi-globals to bypass logind calls, if logind is not running. # shellcheck disable=SC2230 echo "octoprint ALL=NOPASSWD: $(command -v systemctl) restart octoprint, $(which reboot), $(which poweroff)" > /etc/sudoers.d/octoprint - G_EXEC sudo -u octoprint /mnt/dietpi_userdata/octoprint/.local/bin/octoprint config set server.commands.serverRestartCommand 'sudo systemctl restart octoprint' - G_EXEC sudo -u octoprint /mnt/dietpi_userdata/octoprint/.local/bin/octoprint config set server.commands.systemRestartCommand 'sudo reboot' - G_EXEC sudo -u octoprint /mnt/dietpi_userdata/octoprint/.local/bin/octoprint config set server.commands.systemShutdownCommand 'sudo poweroff' + G_EXEC runuser -u octoprint -- /mnt/dietpi_userdata/octoprint/.local/bin/octoprint config set server.commands.serverRestartCommand 'sudo systemctl restart octoprint' + G_EXEC runuser -u octoprint -- /mnt/dietpi_userdata/octoprint/.local/bin/octoprint config set server.commands.systemRestartCommand 'sudo reboot' + G_EXEC runuser -u octoprint -- /mnt/dietpi_userdata/octoprint/.local/bin/octoprint config set server.commands.systemShutdownCommand 'sudo poweroff' # mjpg-streamer: Configure OctoPrint to use it, if installed if (( ${aSOFTWARE_INSTALL_STATE[137]} > 0 )) then G_DIETPI-NOTIFY 2 'Configuring OctoPrint to use mjpg-streamer for webcam support' - G_EXEC sudo -u octoprint /mnt/dietpi_userdata/octoprint/.local/bin/octoprint config set webcam.stream "http://$(G_GET_NET ip):8082/?action=stream" - G_EXEC sudo -u octoprint /mnt/dietpi_userdata/octoprint/.local/bin/octoprint config set webcam.snapshot 'http://127.0.0.1:8082/?action=snapshot' - G_EXEC sudo -u octoprint /mnt/dietpi_userdata/octoprint/.local/bin/octoprint config set webcam.ffmpeg "$(command -v ffmpeg)" + G_EXEC runuser -u octoprint -- /mnt/dietpi_userdata/octoprint/.local/bin/octoprint config set webcam.stream "http://$(G_GET_NET ip):8082/?action=stream" + G_EXEC runuser -u octoprint -- /mnt/dietpi_userdata/octoprint/.local/bin/octoprint config set webcam.snapshot 'http://127.0.0.1:8082/?action=snapshot' + G_EXEC runuser -u octoprint -- /mnt/dietpi_userdata/octoprint/.local/bin/octoprint config set webcam.ffmpeg "$(command -v ffmpeg)" fi fi @@ -10898,7 +10909,7 @@ _EOF_ # -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 --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_OUTPUT=1 G_EXEC runuser -u mycroft -- ./dev_setup.sh -sm G_EXEC cd "$G_WORKING_DIR" # Service @@ -11056,6 +11067,10 @@ _EOF_ G_EXEC strip --remove-section=.comment --remove-section=.note box86 G_EXEC make install + # Cleanup + G_EXEC cd "$G_WORKING_DIR" + G_EXEC rm "box86-${version#v}" + # Reload binfmt if kernel module is available to have i386 binaries executed via box86 automatically from now on modprobe binfmt_misc 2> /dev/null && G_EXEC systemctl restart systemd-binfmt fi @@ -11077,8 +11092,8 @@ _EOF_ if (( $G_HW_ARCH == 11 )) then G_EXEC cmake .. -DNOGIT=1 -DCMAKE_BUILD_TYPE=Release -DRV64=1 - # - RPi 3 - elif (( $G_HW_MODEL == 3 )) + # - RPi 2/3 + elif (( $G_HW_MODEL == 2 || $G_HW_MODEL == 3 )) then G_EXEC cmake .. -DNOGIT=1 -DCMAKE_BUILD_TYPE=Release -DRPI3ARM64=1 # - RPi 4 @@ -11109,6 +11124,10 @@ _EOF_ G_EXEC strip --remove-section=.comment --remove-section=.note box64 G_EXEC make install + # Cleanup + G_EXEC cd "$G_WORKING_DIR" + G_EXEC rm "box64-${version#v}" + # Reload binfmt if kernel module is available to have x86_64 binaries executed via box64 automatically from now on modprobe binfmt_misc 2> /dev/null && G_EXEC systemctl restart systemd-binfmt fi @@ -11304,7 +11323,7 @@ _EOF_ G_EXEC curl -sSf 'https://sh.rustup.rs/' -o rustup-init.sh G_EXEC chmod +x rustup-init.sh # RPi with 64-bit kernel on 32-bit image: Enforce 32-bit toolchain: https://github.com/MichaIng/DietPi/issues/6306 - G_EXEC_OUTPUT=1 G_EXEC sudo -u "$ha_user" ./rustup-init.sh -y --profile minimal ${RPI_64KERNEL_32OS:+'--default-host' 'armv7-unknown-linux-gnueabihf'} + G_EXEC_OUTPUT=1 G_EXEC runuser -u "$ha_user" -- ./rustup-init.sh -y --profile minimal ${RPI_64KERNEL_32OS:+'--default-host' 'armv7-unknown-linux-gnueabihf'} G_EXEC rm rustup-init.sh fi @@ -11351,7 +11370,7 @@ eval \"\$(pyenv init -)\" [ -f '.cargo/env' ] && . .cargo/env" > "$ha_home/pyenv-activate.sh" G_EXEC_DESC='Installing Python with Home Assistant module into pyenv' - G_EXEC_OUTPUT=1 G_EXEC sudo -u "$ha_user" dash -c " + G_EXEC_OUTPUT=1 G_EXEC runuser -u "$ha_user" -- dash -c " $ha_pyenv_activation pyenv install $ha_python_version pyenv local $ha_python_version @@ -11639,7 +11658,7 @@ _EOF_ *) local arch='amd64';; esac - local fallback_url="https://github.com/rclone/rclone/releases/download/v1.66.0/rclone-v1.66.0-linux-$arch.deb" + local fallback_url="https://github.com/rclone/rclone/releases/download/v1.67.0/rclone-v1.67.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 @@ -11653,7 +11672,7 @@ _EOF_ *) local arch='arm';; esac - local fallback_url="https://github.com/restic/restic/releases/download/v0.16.4/restic_0.16.4_linux_$arch.bz2" + local fallback_url="https://github.com/restic/restic/releases/download/v0.16.5/restic_0.16.5_linux_$arch.bz2" Download_Install "$(curl -sSfL 'https://api.github.com/repos/restic/restic/releases/latest' | mawk -F\" "/^ *\"browser_download_url\": \".*\/restic_[^\"\/]*_linux_$arch\.bz2\"$/{print \$4}")" /usr/local/bin/restic G_EXEC chmod +x /usr/local/bin/restic fi @@ -11913,27 +11932,18 @@ _EOF_ G_EXEC mkdir -p /mnt/dietpi_userdata/adsb-feeder/config G_EXEC ln -s /mnt/dietpi_userdata/adsb-feeder/config . - # set the 'image name' and version that are shown in the footer of the Web UI + # set the 'image name' and version that are shown in the footer of the Web UI and mark as app, not image G_EXEC eval 'echo '\''ADSB Feeder app running on DietPi'\'' > feeder-image.name' G_EXEC eval "echo '$ADSB_FEEDER_VERSION' > adsb.im.version" + G_EXEC rm -f os.adsb.feeder.image + G_EXEC touch app.adsb.feeder.image - # get the Python module - # for older distros we need to install via pip in order to get flask 2 - if (( $G_DISTRO < 7 )) - then - G_EXEC_OUTPUT=1 G_EXEC pip3 install -U flask - else - G_AGI python3-flask - fi + # get the Python modules + G_EXEC_OUTPUT=1 G_EXEC pip3 install -U flask requests # finally ensure that /run allows executables (this is needed for the containers to be able to not do excessive # writes to physical storage - which might be an SD card) G_EXEC mount -o remount,exec /run - - # now that everything is in place, run the one time service to get the software pre-configured - # running this as a service allows it to do a bit of housekeeping in the background without disrupting - # the software install flow - G_EXEC systemctl start adsb-nonimage fi if To_Install 172 # WireGuard @@ -12094,6 +12104,70 @@ If no WireGuard (auto)start is included, but you require it, please do the follo unset -v choice_required domain port invalid_text server_ip fi + + if To_Install 213 soju # soju + then + # Dependencies + aDEPS=('make' 'scdoc' 'gcc' 'libsqlite3-dev' 'libpam-dev') + + # Download + local fallback_url='https://github.com/emersion/soju/releases/download/v0.8.0/soju-0.8.0.tar.gz' + Download_Install "$(curl -sSfL 'https://api.github.com/repos/emersion/soju/releases/latest' | mawk -F\" '/^ *"browser_download_url": ".*\/soju-[^"\/]*\.tar\.gz"$/{print $4}')" + + # Build + G_EXEC cd soju-* + G_EXEC_OUTPUT=1 G_EXEC make all "-j$(nproc)" config_path='/mnt/dietpi_userdata/soju/config' GOFLAGS='-tags=pam,libsqlite3' + + # Install + local commands=('soju' 'sojuctl' 'sojudb') + local manpages=('doc/soju.1' 'doc/sojuctl.1') + G_EXEC cp "${commands[@]}" /usr/local/bin/ + G_EXEC mkdir -p /usr/local/share/man/man1 + G_EXEC cp "${manpages[@]}" /usr/local/share/man/man1/ + + # Config + if [[ ! -f '/mnt/dietpi_userdata/soju/config' ]] + then + # We shall default to on-disk chat logs + # It's a lossy format, as stated under `message-store` subsection in https://soju.im/doc/soju.1.html#CONFIG_FILE + # But it's the recommended setting as per https://git.sr.ht/~emersion/soju/tree/master/doc/getting-started.md + G_EXEC mkdir -p /mnt/dietpi_userdata/soju + cat <<- '_EOF_' > /mnt/dietpi_userdata/soju/config + db sqlite3 /mnt/dietpi_userdata/soju/data.db + message-store fs /mnt/dietpi_userdata/soju/logs + listen irc+insecure:// + listen unix+admin:// + _EOF_ + fi + + # User + Create_User -d /mnt/dietpi_userdata/soju soju + G_EXEC chown 'soju:soju' -R /mnt/dietpi_userdata/soju + G_EXEC chmod 0660 -R /mnt/dietpi_userdata/soju + G_EXEC chmod 0770 /mnt/dietpi_userdata/soju + + # Service: https://github.com/emersion/soju/blob/master/contrib/soju.service + # - CAP_NET_BIND_SERVICE needed for builtin identd server: https://github.com/emersion/soju/blob/master/doc/packaging.md#binding-to-privileged-ports + cat << '_EOF_' > /etc/systemd/system/soju.service +[Unit] +Description=soju IRC bouncer service +Documentation=https://soju.im/ +Documentation=man:soju(1) man:sojuctl(1) +Wants=network-online.target +After=network-online.target + +[Service] +User=soju +RuntimeDirectory=soju +WorkingDirectory=/mnt/dietpi_userdata/soju +AmbientCapabilities=CAP_NET_BIND_SERVICE +ExecStart=/usr/local/bin/soju +ExecReload=/bin/kill -HUP $MAINPID + +[Install] +WantedBy=multi-user.target +_EOF_ + fi } # $1: 0=None -1=Dropbear -2=OpenSSH @@ -12362,8 +12436,8 @@ If no WireGuard (auto)start is included, but you require it, please do the follo systemctl start redis-server if systemctl start mariadb then - sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --off - sudo -u www-data php /var/www/nextcloud/occ app:disable spreed + runuser -u www-data -- php /var/www/nextcloud/occ maintenance:mode --off + runuser -u www-data -- php /var/www/nextcloud/occ app:disable spreed fi G_DIETPI-NOTIFY 2 'Disabled Nextcloud Talk app, but you need to remove it manually from Nextcloud web UI, if desired.' fi @@ -12633,8 +12707,8 @@ If no WireGuard (auto)start is included, but you require it, please do the follo [[ -d '/mnt/dietpi_userdata/synapse' ]] && G_EXEC rm -R /mnt/dietpi_userdata/synapse command -v pip3 > /dev/null && G_EXEC_OUTPUT=1 G_EXEC pip3 uninstall -y matrix-synapse - command -v dropdb > /dev/null && sudo -u postgres dropdb synapse - command -v dropuser > /dev/null && sudo -u postgres dropuser synapse + command -v dropdb > /dev/null && runuser -u postgres -- dropdb synapse + command -v dropuser > /dev/null && runuser -u postgres -- dropuser synapse fi if To_Uninstall 132 # Aria2 @@ -12927,20 +13001,25 @@ If no WireGuard (auto)start is included, but you require it, please do the follo if To_Uninstall 62 # Box86 then - [[ -f '/usr/local/bin/box86' ]] && G_EXEC rm /usr/local/bin/box86 [[ -f '/etc/binfmt.d/box86.conf' ]] && G_EXEC rm /etc/binfmt.d/box86.conf - [[ -f '/usr/lib/i386-linux-gnu/libstdc++.so.6' ]] && G_EXEC rm /usr/lib/i386-linux-gnu/libstdc++.so.6 - [[ -f '/usr/lib/i386-linux-gnu/libstdc++.so.5' ]] && G_EXEC rm /usr/lib/i386-linux-gnu/libstdc++.so.5 - [[ -f '/usr/lib/i386-linux-gnu/libgcc_s.so.1' ]] && G_EXEC rm /usr/lib/i386-linux-gnu/libgcc_s.so.1 + [[ -d '/proc/sys/fs/binfmt_misc' ]] && G_EXEC systemctl restart systemd-binfmt + [[ -f '/usr/local/bin/box86' ]] && G_EXEC rm /usr/local/bin/box86 + for i in /usr/lib/i386-linux-gnu/lib{gcc_s,png12,stdc++,unwind}.so* + do + [[ -e $i ]] && ! dpkg-query -S "$i" &> /dev/null && G_EXEC rm "$i" + done [[ -d '/usr/lib/i386-linux-gnu' ]] && G_EXEC rmdir --ignore-fail-on-non-empty /usr/lib/i386-linux-gnu fi if To_Uninstall 197 # Box64 then - [[ -f '/usr/local/bin/box64' ]] && G_EXEC rm /usr/local/bin/box64 [[ -f '/etc/binfmt.d/box64.conf' ]] && G_EXEC rm /etc/binfmt.d/box64.conf - [[ -f '/usr/lib/x86_64-linux-gnu/libstdc++.so.6' ]] && G_EXEC rm /usr/lib/x86_64-linux-gnu/libstdc++.so.6 - [[ -f '/usr/lib/x86_64-linux-gnu/libgcc_s.so.1' ]] && G_EXEC rm /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 + [[ -d '/proc/sys/fs/binfmt_misc' ]] && G_EXEC systemctl restart systemd-binfmt + [[ -f '/usr/local/bin/box64' ]] && G_EXEC rm /usr/local/bin/box64 + for i in /usr/lib/x86_64-linux-gnu/lib{crypto,gcc_s,mbed,png12,ssl,stdc++,unwind}* + do + [[ -e $i ]] && ! dpkg-query -S "$i" &> /dev/null && G_EXEC rm "$i" + done [[ -d '/usr/lib/x86_64-linux-gnu' ]] && G_EXEC rmdir --ignore-fail-on-non-empty /usr/lib/x86_64-linux-gnu fi @@ -13772,6 +13851,8 @@ _EOF_ if To_Uninstall 67 # Firefox then G_AGP firefox-esr + G_EXEC rm -Rf /{root,home/*}/.mozilla/firefox + for i in /{root,home/*}/.mozilla; do [[ -d $i ]] && G_EXEC rmdir --ignore-fail-on-non-empty "$i"; done fi if To_Uninstall 159 # Allo GUI full @@ -14219,6 +14300,24 @@ _EOF_ [[ -d '/mnt/dietpi_userdata/spotifyd' ]] && G_EXEC rm -R /mnt/dietpi_userdata/spotifyd fi + if To_Uninstall 213 # soju + then + Remove_Service soju 1 1 + local x + local commands=('soju' 'sojuctl' 'sojudb') + local manpages=('soju.1' 'sojuctl.1') + for x in "${commands[@]}" + do + [[ -f /usr/local/bin/$x ]] && G_EXEC rm "/usr/local/bin/$x" + done + for x in "${manpages[@]}" + do + [[ -f /usr/local/share/man/man1/$x ]] && G_EXEC rm "/usr/local/share/man/man1/$x" + done + [[ -d '/usr/local/share/man/man1' ]] && G_EXEC rmdir -p --ignore-fail-on-non-empty /usr/local/share/man/man1 + [[ -d '/mnt/dietpi_userdata/soju' ]] && G_EXEC rm -Rf /mnt/dietpi_userdata/soju + fi + G_DIETPI-NOTIFY 3 "$G_PROGRAM_NAME" 'Finalising uninstall' # Uninstall finished, set all uninstalled software to state 0 (not installed) @@ -14483,13 +14582,14 @@ _EOF_ if [[ ! -f '/boot/dietpi/.skip_distro_upgrade' ]] then G_AGUP - # Do not repeat APT update in Run_Installations() - SKIP_APT_UPDATE=1 G_AGDUG + G_AGA # Create a persistent flag to not repeat G_AGDUG and rule out a reboot loop when kernel modules remain missing G_EXEC eval '> /boot/dietpi/.skip_distro_upgrade' # Perform a reboot if required as of missing kernel modules - G_CHECK_KERNEL || { G_DIETPI-NOTIFY 2 'A reboot is done to finalise the kernel upgrade'; sync; reboot; } + G_CHECK_KERNEL || { G_DIETPI-NOTIFY 2 'A reboot is done to finalise the kernel upgrade'; sync; reboot; exit 0; } + # Do not repeat APT update in Run_Installations() + SKIP_APT_UPDATE=1 fi # Global PW diff --git a/dietpi/func/dietpi-banner b/dietpi/func/dietpi-banner index e119656403..c6b04d3b98 100755 --- a/dietpi/func/dietpi-banner +++ b/dietpi/func/dietpi-banner @@ -29,6 +29,9 @@ readonly G_PROGRAM_NAME='DietPi-Banner' G_CHECK_ROOT_USER # Required to store settings G_INIT + else + # Apply safe locale in non-menu mode (where G_INIT does it) + export LC_ALL='C.UTF-8' LANG='C.UTF-8' fi # Import DietPi-Globals -------------------------------------------------------------- @@ -179,6 +182,20 @@ $GREEN_LINE" echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[5]} $GREEN_SEPARATOR ${ip:-Use dietpi-config to setup a connection} (${iface:-NONE})" } + Print_Cert_Status() + { + # Let's Encrypt cert status - MUST be run as root + local i + for i in /etc/letsencrypt/live/*/cert.pem + do + # shellcheck disable=SC2292 + [ -f "$i" ] || continue + openssl x509 -enddate -noout -in "$i" | mawk '/notAfter=/{print "Valid until "$4"-"substr($1,10)"-"$2" "$3}' + return 0 + done + echo 'No certificate found' + } + Print_Credits() { echo -e " ${aCOLOUR[2]}DietPi Team : https://github.com/MichaIng/DietPi#the-dietpi-project-team" @@ -259,14 +276,15 @@ $GREEN_LINE" # Let's Encrypt cert status if (( ${aENABLED[16]} == 1 )) then - local i certinfo='No certificate found' - for i in /etc/letsencrypt/live/*/cert.pem - do - [[ -f $i ]] || continue - certinfo=$(openssl x509 -enddate -noout -in "$i" | mawk '/notAfter=/{print "Valid until "$4"-"substr($1,10)"-"$2" "$3}' 2>&1) - break - done - echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[16]} $GREEN_SEPARATOR $certinfo" + echo -en "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[16]} $GREEN_SEPARATOR " + if [[ $EUID == 0 ]] + then + # Running as root + Print_Cert_Status 2>&1 + else + # Running as non-root: Fail silently without NOPASSWD to avoid password prompt, but print info instead + sudo -n dash -c "$(declare -f Print_Cert_Status); Print_Cert_Status 2>&1" 2> /dev/null || echo 'NOPASSWD sudo required to obtain cert status' + fi fi # Custom (( ${aENABLED[10]} == 1 )) && echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[10]} $GREEN_SEPARATOR $(bash "$FP_CUSTOM" 2>&1)" diff --git a/dietpi/func/dietpi-globals b/dietpi/func/dietpi-globals index 06a70c3942..326d8a831b 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=9 - [[ $G_DIETPI_VERSION_SUB ]] || G_DIETPI_VERSION_SUB=5 - [[ $G_DIETPI_VERSION_RC ]] || G_DIETPI_VERSION_RC=1 + [[ $G_DIETPI_VERSION_SUB ]] || G_DIETPI_VERSION_SUB=6 + [[ $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 @@ -1137,6 +1137,7 @@ Press any key to continue...' { acommand[5]=$(sed -n '/^[[:blank:]]*CONFIG_CHECK_CONNECTION_IP=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) [[ ${acommand[5]} ]] || acommand[5]='9.9.9.9' + ecommand=${acommand[*]//\\/\\\\} } # Run check with given timeout and retries G_EXEC_RETRIES=$retries @@ -1165,6 +1166,7 @@ Press any key to continue...' G_GET_NET -6 -q gateway > /dev/null && [[ $(ip -6 -br a s scope global to 2000::/3 2> /dev/null) ]] || { exit_code=0; return 0; } acommand[5]=$(sed -n '/^[[:blank:]]*CONFIG_CHECK_CONNECTION_IPV6=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) [[ ${acommand[5]} ]] || acommand[5]='2620:fe::fe' + ecommand=${acommand[*]//\\/\\\\} } # Run check with given timeout and retries G_EXEC_RETRIES=$retries @@ -1187,6 +1189,7 @@ Press any key to continue...' { acommand[2]=$(sed -n '/^[[:blank:]]*CONFIG_CHECK_DNS_DOMAIN=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) [[ ${acommand[2]} ]] || acommand[2]='dns9.quad9.net' + ecommand=${acommand[*]//\\/\\\\} } # Run check with given retries G_EXEC_RETRIES=$retries @@ -1496,9 +1499,6 @@ Press any key to continue...' G_CHECK_ROOT_USER 1 - # Workaround for Armbian mirrors being out of sync regularly or throwing 5xx errors - [[ -f '/etc/apt/sources.list.d/dietpi-armbian.list' ]] && G_EXEC_POST_FUNC(){ [[ $exit_code != 0 ]] && grep -q '^E: Failed to fetch .*armbian' "$fp_log" && G_EXEC_RETRIES=2 && unset -f G_EXEC_POST_FUNC; } - G_EXEC_DESC="\e[0mAPT install \e[33m$*\e[0m" DEBIAN_FRONTEND=noninteractive G_EXEC_OUTPUT=1 G_EXEC_OUTPUT_COL='\e[90m' G_EXEC apt-get -y --allow-change-held-packages install "$@" local exit_code=$? @@ -1545,9 +1545,6 @@ Press any key to continue...' { G_CHECK_ROOT_USER 1 - # Workaround for Armbian mirrors being out of sync regularly or throwing 5xx errors - [[ -f '/etc/apt/sources.list.d/dietpi-armbian.list' ]] && G_EXEC_POST_FUNC(){ [[ $exit_code != 0 ]] && grep -q '^E: Failed to fetch .*armbian' "$fp_log" && G_EXEC_RETRIES=2 && unset -f G_EXEC_POST_FUNC; } - G_EXEC_DESC="\e[0mAPT fix${*:+ \e[33m$*\e[0m}" DEBIAN_FRONTEND=noninteractive G_EXEC_OUTPUT=1 G_EXEC_OUTPUT_COL='\e[90m' G_EXEC apt-get -y --allow-change-held-packages -f install "$@" local exit_code=$? @@ -1572,9 +1569,6 @@ Press any key to continue...' # Clean cache before every update, which can corrupt and gets fully rewritten anyway G_EXEC_PRE_FUNC(){ apt-get clean; } - # Workaround for Armbian mirrors being out of sync regularly or throwing 5xx errors - [[ -f '/etc/apt/sources.list.d/dietpi-armbian.list' ]] && G_EXEC_POST_FUNC(){ [[ $exit_code != 0 ]] && grep -q '^E: Failed to fetch .*armbian' "$fp_log" && G_EXEC_RETRIES=2 && unset -f G_EXEC_POST_FUNC; } - G_EXEC_DESC='\e[0mAPT update' G_EXEC_OUTPUT=1 G_EXEC_OUTPUT_COL='\e[90m' G_EXEC apt-get -y -eany update local exit_code=$? @@ -1617,9 +1611,6 @@ Press any key to continue...' { G_CHECK_ROOT_USER 1 - # Workaround for Armbian mirrors being out of sync regularly or throwing 5xx errors - [[ -f '/etc/apt/sources.list.d/dietpi-armbian.list' ]] && G_EXEC_POST_FUNC(){ [[ $exit_code != 0 ]] && grep -q '^E: Failed to fetch .*armbian' "$fp_log" && G_EXEC_RETRIES=2 && unset -f G_EXEC_POST_FUNC; } - G_EXEC_DESC="\e[0mAPT upgrade${*:+ \e[33m$*\e[0m}" DEBIAN_FRONTEND=noninteractive G_EXEC_OUTPUT=1 G_EXEC_OUTPUT_COL='\e[90m' G_EXEC apt-get -y --with-new-pkgs upgrade "$@" local exit_code=$? @@ -1636,9 +1627,6 @@ Press any key to continue...' { G_CHECK_ROOT_USER 1 - # Workaround for Armbian mirrors being out of sync regularly or throwing 5xx errors - [[ -f '/etc/apt/sources.list.d/dietpi-armbian.list' ]] && G_EXEC_POST_FUNC(){ [[ $exit_code != 0 ]] && grep -q '^E: Failed to fetch .*armbian' "$fp_log" && G_EXEC_RETRIES=2 && unset -f G_EXEC_POST_FUNC; } - G_EXEC_DESC="\e[0mAPT dist-upgrade${*:+ \e[33m$*\e[0m}" DEBIAN_FRONTEND=noninteractive G_EXEC_OUTPUT=1 G_EXEC_OUTPUT_COL='\e[90m' G_EXEC apt-get -y dist-upgrade "$@" local exit_code=$? diff --git a/dietpi/func/dietpi-set_software b/dietpi/func/dietpi-set_software index 5479c79b77..ca4952bf64 100755 --- a/dietpi/func/dietpi-set_software +++ b/dietpi/func/dietpi-set_software @@ -128,8 +128,12 @@ $FP_SCRIPT rpi_kernel_choice Supported on Debian Bookworm or newer on R 15) all_components='odroidn2';; 16) all_components='odroidc4';; 40) all_components='pinea64';; + 42) all_components='rockpro64';; + 43) all_components='rock64';; 44) all_components='pinebook';; 45) all_components='pineh64';; + 46) all_components='pinebookpro';; + 47) all_components='nanopir4s';; 48) all_components='nanopir1';; 49) # Detect variant either based on $HW_VARIANT environment variable, existing "all" components or installed kernel/firmware package @@ -149,9 +153,12 @@ $FP_SCRIPT rpi_kernel_choice Supported on Debian Bookworm or newer on R ;; esac ;; + 52) all_components='tinkerboard';; 54) all_components='nanopik2';; + 55) all_components='nanopir2s';; 56) all_components='nanopineo3';; 57) all_components='nanopineoplus2';; + 58) all_components='nanopim4v2';; 59) all_components='zeropi';; 60) all_components='nanopineo';; 61) all_components='nanopi2';; @@ -184,7 +191,7 @@ $FP_SCRIPT rpi_kernel_choice Supported on Debian Bookworm or newer on R [[ -f '/etc/apt/sources.list.d/dietpi.list' ]] && all_components=$(sed -n '/ all /{s/^.* all //p;q}' /etc/apt/sources.list.d/dietpi.list) [[ $all_components ]] || for i in nanopineo2{,black} do - dpkg-query -s "linux-u-boot-$i-legacy" &> /dev/null || continue + dpkg-query -s "linux-u-boot-$i-current" &> /dev/null || continue all_components=$i break done @@ -193,18 +200,54 @@ $FP_SCRIPT rpi_kernel_choice Supported on Debian Bookworm or newer on R ;; 66) all_components='nanopim1plus';; 67) all_components='nanopik1plus';; + 68) + # Detect variant either based on $HW_VARIANT environment variable, existing "all" components or installed U-Boot package + # shellcheck disable=SC2154 + case $HW_VARIANT in + 1) all_components='nanopim4';; + 2) all_components='nanopct4';; + 3) all_components='nanopineo4';; + *) + [[ -f '/etc/apt/sources.list.d/dietpi.list' ]] && all_components=$(sed -n '/ all /{s/^.* all //p;q}' /etc/apt/sources.list.d/dietpi.list) + [[ $all_components ]] || for i in nano{pim4,pineo4,pct4} + do + dpkg-query -s "linux-u-boot-$i-current" &> /dev/null || continue + all_components=${i/-//} + break + done + ;; + esac + ;; 70) all_components='sparkysbc';; + 72) + # Detect variant either based on $HW_VARIANT environment variable, existing "all" components or installed U-Boot package + # shellcheck disable=SC2154 + case $HW_VARIANT in + 1) all_components='rock4';; + 2) all_components='rock4se';; + 3) all_components='rock4cplus';; + *) + [[ -f '/etc/apt/sources.list.d/dietpi.list' ]] && all_components=$(sed -n '/ all /{s/^.* all //p;q}' /etc/apt/sources.list.d/dietpi.list) + [[ $all_components ]] || for i in rock{pi-4b,-4se,pi-4cplus} + do + dpkg-query -s "linux-u-boot-$i-current" &> /dev/null || continue + all_components=${i/-//} + break + done + ;; + esac + ;; + 73) all_components='rockpis';; 74) all_components='radxazero';; 76) # Detect variant either based on $HW_VARIANT environment variable, existing "all" components or installed U-Boot package # shellcheck disable=SC2154 case $HW_VARIANT in - 1) all_components='';; # no R5S component is available yet + 1) all_components='nanopir5s';; 2) all_components='nanopir5c';; *) [[ -f '/etc/apt/sources.list.d/dietpi.list' ]] && all_components=$(sed -n '/ all /{s/^.* all //p;q}' /etc/apt/sources.list.d/dietpi.list) - # shellcheck disable=SC2043 - [[ $all_components ]] || for i in nanopi-r5c + [[ $all_components ]] || for i in nanopi-r5{c,s} do dpkg-query -s "linux-u-boot-$i-current" &> /dev/null || continue all_components=${i/-//} @@ -213,19 +256,20 @@ $FP_SCRIPT rpi_kernel_choice Supported on Debian Bookworm or newer on R ;; esac ;; + 77) all_components='rock3a';; 78) all_components='rock5b';; 79) # Detect variant either based on $HW_VARIANT environment variable, existing "all" components or installed U-Boot package # shellcheck disable=SC2154 case $HW_VARIANT in - 1|2) all_components='nanopir6s';; # R6C shares R6S component (and bootloader) for now + 1) all_components='nanopir6s';; + 2) all_components='nanopir6c';; 3) all_components='nanopct6';; *) [[ -f '/etc/apt/sources.list.d/dietpi.list' ]] && all_components=$(sed -n '/ all /{s/^.* all //p;q}' /etc/apt/sources.list.d/dietpi.list) - # shellcheck disable=SC2043 - [[ $all_components ]] || for i in nano{pi-r6s,pct6} + [[ $all_components ]] || for i in nano{pi-r6s,pi-r6c,pct6} do - dpkg-query -s "linux-u-boot-$i-current" &> /dev/null || continue + dpkg-query -s "linux-u-boot-$i-legacy" &> /dev/null || continue all_components=${i/-//} break done @@ -238,6 +282,8 @@ $FP_SCRIPT rpi_kernel_choice Supported on Debian Bookworm or newer on R 83) all_components='orangepizero3';; 84) all_components='star64';; 85) all_components='rock5a';; + 86) all_components='tinkerboard2';; + 87) all_components='orangepi3b';; 88) all_components='orangepizero2w';; 89) all_components='orangepi3lts';; 90) all_components='radxazero3';; diff --git a/rootfs/etc/systemd/system/ifup@.service b/rootfs/etc/systemd/system/ifup@.service new file mode 100644 index 0000000000..c9f8c45466 --- /dev/null +++ b/rootfs/etc/systemd/system/ifup@.service @@ -0,0 +1,17 @@ +[Unit] +Description=ifup for %I +After=local-fs.target network-pre.target apparmor.service systemd-sysctl.service +Before=network.target network-online.target +BindsTo=sys-subsystem-net-devices-%i.device +After=sys-subsystem-net-devices-%i.device +DefaultDependencies=no +IgnoreOnIsolate=yes + +[Service] +Type=oneshot +# avoid stopping on shutdown via stopping system-ifup.slice +Slice=system.slice +ExecStart=/sbin/ifup --allow=hotplug %I +ExecStop=/sbin/ifdown %I +RemainAfterExit=true +TimeoutStartSec=5min diff --git a/rootfs/etc/systemd/system/ifup@.service.d/dietpi.conf b/rootfs/etc/systemd/system/ifup@.service.d/dietpi.conf deleted file mode 100644 index eacef9fac8..0000000000 --- a/rootfs/etc/systemd/system/ifup@.service.d/dietpi.conf +++ /dev/null @@ -1,5 +0,0 @@ -# Override service type to give network(-online).target more meaning and remove obsolete ifquery call: https://github.com/MichaIng/DietPi/issues/4121#issuecomment-782057374 -[Service] -Type=oneshot -ExecStart= -ExecStart=/sbin/ifup --allow=hotplug %I