diff --git a/.build/images/dietpi-imager b/.build/images/dietpi-imager index e1d975a6e4..f4a4aaff46 100755 --- a/.build/images/dietpi-imager +++ b/.build/images/dietpi-imager @@ -529,9 +529,12 @@ G_EXEC mount "${FP_ROOT_DEV::-1}1" "$fat_mountpoint" G_EXEC mount "$FP_ROOT_DEV" "$root_mountpoint" G_DIETPI-NOTIFY 2 'Copying dietpi.txt and other config files to the DIETPISETUP partition' - for f in 'dietpi.txt' 'dietpi-wifi.txt' 'unattended_pivpn.conf' 'Automation_Custom_PreScript.sh' 'Automation_Custom_Script.sh' + for f in 'dietpi.txt' 'dietpi-wifi.txt' 'Automation_Custom_PreScript.sh' 'Automation_Custom_Script.sh' 'unattended_pivpn.conf' do - [[ -f $root_mountpoint/boot/$f ]] && G_EXEC cp "$root_mountpoint/boot/$f" "$fat_mountpoint/" + [[ -f $root_mountpoint/boot/$f ]] || continue + G_EXEC cp "$root_mountpoint/boot/$f" "$fat_mountpoint/" + TZ=UTC G_EXEC touch -t '197001010000' "$fat_mountpoint/$f" + TZ=UTC G_EXEC touch -t '197001010001' "$root_mountpoint/boot/$f" done G_EXEC umount "$root_mountpoint" "$fat_mountpoint" G_EXEC rmdir "$root_mountpoint" "$fat_mountpoint" @@ -558,22 +561,26 @@ G_EXEC mount "$new_dos_part" "$fat_mountpoint" G_EXEC mount "$FP_ROOT_DEV" "$root_mountpoint" G_DIETPI-NOTIFY 2 'Copying dietpi.txt and other config files to the DIETPISETUP partition' - for f in 'dietpi.txt' 'dietpi-wifi.txt' 'dietpiEnv.txt' 'unattended_pivpn.conf' 'Automation_Custom_PreScript.sh' 'Automation_Custom_Script.sh' + for f in 'dietpi.txt' 'dietpi-wifi.txt' 'dietpiEnv.txt' 'boot.ini' 'extlinux/extlinux.conf' 'Automation_Custom_PreScript.sh' 'Automation_Custom_Script.sh' 'unattended_pivpn.conf' do - [[ -f $root_mountpoint/boot/$f ]] && G_EXEC cp "$root_mountpoint/boot/$f" "$fat_mountpoint/" + [[ -f $root_mountpoint/boot/$f ]] || continue + G_EXEC cp "$root_mountpoint/boot/$f" "$fat_mountpoint/" + TZ=UTC G_EXEC touch -t '202101010001' "$fat_mountpoint/${f#extlinux/}" + TZ=UTC G_EXEC touch -t '202101010002' "$root_mountpoint/boot/$f" done - cat << '_EOF_' > "$fat_mountpoint/Readme-DietPi-Config.txt" -DietPi pre-boot configuration + cat << '_EOF_' > "$fat_mountpoint/README.txt" +DietPi config partition -You can edit the files in this folder to setup some configuration options -or even a completely automated install. Please check the documentation and -dietpi.txt for details: https://dietpi.com/docs/install/ +This FAT partition is a place for relevant configuration files to pre-configure and automate your DietPi setup. +Those files will be copied into the root filesystem on first boot, if modified, to become effective, and the partition will be removed. -This folder also supports the following additional files. Please ensure that -they have UNIX style LF line endings: -- unattended_pivpn.conf +Apart of editing the existing files, you can also create the following for further automation: - Automation_Custom_PreScript.sh - Automation_Custom_Script.sh +- unattended_pivpn.conf + +For details, please check our documentation and dietpi.txt itself: +https://dietpi.com/docs/usage/#how-to-do-an-automatic-base-installation-at-first-boot-dietpi-automation _EOF_ G_EXEC umount "$root_mountpoint" "$fat_mountpoint" G_EXEC rmdir "$root_mountpoint" "$fat_mountpoint" diff --git a/.build/images/dietpi-installer b/.build/images/dietpi-installer index 4eb8b9588a..440f046afd 100755 --- a/.build/images/dietpi-installer +++ b/.build/images/dietpi-installer @@ -2171,6 +2171,15 @@ _EOF_ SUBSYSTEM=="leds", KERNEL=="wan_led", ACTION=="add", ATTR{trigger}="netdev", ATTR{device_name}="eth0", ATTR{link}="1", ATTR{rx}="1", ATTR{tx}="1", RUN+="/bin/ip l s up dev eth0", RUN+="/bin/ip l s down dev eth0" SUBSYSTEM=="leds", KERNEL=="lan1_led", ACTION=="add", ATTR{trigger}="netdev", ATTR{device_name}="eth1", ATTR{link}="1", ATTR{rx}="1", ATTR{tx}="1", RUN+="/bin/ip l s up dev eth1", RUN+="/bin/ip l s down dev eth1" SUBSYSTEM=="leds", KERNEL=="user_led", ACTION=="add", ATTR{trigger}="netdev", ATTR{device_name}="wlan0", ATTR{link}="1", ATTR{rx}="1", ATTR{tx}="1", RUN+="/bin/ip l s up dev wlan0", RUN+="/bin/ip l s down dev wlan0" +_EOF_ + # Orange Pi 5 Plus + elif (( $G_HW_MODEL == 82 )) + then + G_DIETPI-NOTIFY 2 'Assuring persistent classic Ethernet interface names: /etc/udev/rules.d/99-dietpi-orangepi5plus.rules' + cat << '_EOF_' > /etc/udev/rules.d/99-dietpi-orangepi5plus.rules +SUBSYSTEM=="net", KERNEL=="eth0", KERNELS=="0004:41:00.0", RUN:="/bin/true" +SUBSYSTEM=="net", KERNEL=="eth1", KERNELS=="0003:31:00.0", NAME="to_eth0", RUN:="/bin/true" +SUBSYSTEM=="net", KERNEL=="to_eth0", RUN="/bin/ip l s dev eth0 name eth1", RUN+="/bin/ip l s dev to_eth0 name eth0", RUN+="/bin/udevadm trigger -c add /sys/class/net/eth0 /sys/class/net/eth1" _EOF_ # Orange Pi 3B/Zero 3/Zero 2W: Module does not load automatically, but we want it loaded on first boot in case firstrun setup is done via WiFi elif [[ $G_HW_MODEL =~ ^(83|87|88)$ ]] diff --git a/.update/patches b/.update/patches index 973ed5f67d..b3ddc055e3 100755 --- a/.update/patches +++ b/.update/patches @@ -1546,6 +1546,7 @@ Patch_9_2() fi } +PATCH_9_3_RAN=0 Patch_9_3() { # Purge ancient vmtouch which prevents /boot from being unmounted e.g. for RPi firmware migration: https://github.com/MichaIng/DietPi/issues/6819, https://github.com/MichaIng/DietPi/issues/6976 @@ -1553,20 +1554,19 @@ Patch_9_3() # Add DietPi APT repo /boot/dietpi/func/dietpi-set_software apt-mirror dietpi - G_AGUP -v - # shellcheck disable=SC2154 - (( $G_AGUP_COUNT )) && G_AGUG + G_AGUP + G_AGUG + PATCH_9_3_RAN=1 } Patch_9_4() { # Update DietPi APT list for several SBCs we added components to our repo for - if [[ $G_HW_MODEL =~ ^(11|40|44|45|48|56|57|59|60|64|65|67|76|83|88|89|90)$ ]] + if [[ $PATCH_9_3_RAN == 0 && $G_HW_MODEL =~ ^(11|40|44|45|48|56|57|59|60|64|65|67|76|78|79|80|82|83|85|88|89|90)$ ]] then /boot/dietpi/func/dietpi-set_software apt-mirror dietpi - G_AGUP -v - # shellcheck disable=SC2154 - (( $G_AGUP_COUNT )) && G_AGUG + G_AGUP + G_AGUG fi # Odroid XU4 @@ -1575,10 +1575,26 @@ Patch_9_4() G_DIETPI-NOTIFY 2 'Migrating boot.ini to support new Linux 6.6 device tree overlay locations' /boot/dietpi/func/dietpi-set_hardware flash-u-boot-mmc # shellcheck disable=SC2016 - G_EXEC sed -i '\|/boot/dtb/overlays/${overlay}.dtbo|c load mmc 0:1 0x60000000 /boot/dtb/${overlay}.dtbo || load mmc 0:1 0x60000000 /boot/dtb/overlays/${overlay}.dtbo || load mmc 0:1 0x60000000 dtb/${overlay}.dtbo || load mmc 0:1 0x60000000 dtb/overlays/${overlay}.dtbo' /boot/boot.ini + G_EXEC sed --follow-symlinks -i '\|/boot/dtb/overlays/${overlay}.dtbo|c\ load mmc 0:1 0x60000000 /boot/dtb/${overlay}.dtbo || load mmc 0:1 0x60000000 /boot/dtb/overlays/${overlay}.dtbo || load mmc 0:1 0x60000000 dtb/${overlay}.dtbo || load mmc 0:1 0x60000000 dtb/overlays/${overlay}.dtbo' /boot/boot.ini G_DIETPI-NOTIFY 2 'Fixing CEC toggle in boot.ini' - G_EXEC sed -i 's|rm /cec@101B0000;|rm /soc/cec@101b0000;|' /boot/boot.ini - + G_EXEC sed --follow-symlinks -i 's|rm /cec@101B0000;|rm /soc/cec@101b0000;|' /boot/boot.ini + G_DIETPI-NOTIFY 2 'Cleaning up obsolete configs' + [[ -f '/etc/modprobe.d/odroid-cloudshell.conf' ]] && G_EXEC rm /etc/modprobe.d/odroid-cloudshell.conf + G_EXEC sed --follow-symlinks -Ei '/^[[:blank:]]*(gpioplug-ir-recv|fbtft_device)[[:blank:]]*$/d' /etc/modules + + # Orange Pi 5 Plus + elif (( $G_HW_MODEL == 82 )) + then + G_DIETPI-NOTIFY 2 'Assuring persistent classic Ethernet interface names: /etc/udev/rules.d/99-dietpi-orangepi5plus.rules' + G_WHIP_MSG '[ WARN ] Persistent eth0/eth1 interface names will be applied +\nSince classic interface names are randomly applied among the two onboard Ethernet adapters, we install a udev rule, which assures they remain the same on each (re)boot: +- /etc/udev/rules.d/99-dietpi-orangepi5plus.rules +\nIf you applied an own workaround via /etc/network/interfaces or similar, this will not be affected. But if you created own udev rules to mitigate the issue, please check whether those conflict with ours. Of course you can remove or rename above file to maintain status quo.' + cat << '_EOF_' > /etc/udev/rules.d/99-dietpi-orangepi5plus.rules +SUBSYSTEM=="net", KERNEL=="eth0", KERNELS=="0004:41:00.0", RUN:="/bin/true" +SUBSYSTEM=="net", KERNEL=="eth1", KERNELS=="0003:31:00.0", NAME="to_eth0", RUN:="/bin/true" +SUBSYSTEM=="net", KERNEL=="to_eth0", RUN="/bin/ip l s dev eth0 name eth1", RUN+="/bin/ip l s dev to_eth0 name eth0", RUN+="/bin/udevadm trigger -c add /sys/class/net/eth0 /sys/class/net/eth1" +_EOF_ # Orange Pi Zero 3 1.5 GiB RAM: Fix lost Ethernet adapter on reboot: https://github.com/MichaIng/DietPi/issues/6938 elif (( $G_HW_MODEL == 83 )) && dpkg-query -s 'linux-u-boot-orangepizero3-next' &> /dev/null then diff --git a/.update/version b/.update/version index dfc5291528..9e903dac26 100644 --- a/.update/version +++ b/.update/version @@ -3,7 +3,7 @@ # Available DietPi version G_REMOTE_VERSION_CORE=9 G_REMOTE_VERSION_SUB=4 -G_REMOTE_VERSION_RC=1 +G_REMOTE_VERSION_RC=2 # 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 93e83feb40..e6e8a1cdfc 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,5 @@ v9.4 -(2024-05-11) +(2024-05-12) New images: - ROCK 4C Plus | Since our Radxa ROCK 4 image has become incompatible with the ROCK 4C Plus, we provide a new image for this particular variant. Many thanks to @lfiorini and @arpegius5555 for reporting this issue: https://github.com/MichaIng/DietPi/issues/6593, https://github.com/MichaIng/DietPi/issues/6935 @@ -12,13 +12,17 @@ Enhancements: - NanoPi R5C | New images, or when flashing the new bootloader binary via dietpi-config > Advanced Options > Update MMC bootloader, support M.2 WiFi modules. - Orange Pi 3B | Added an option for updating the SPI bootloader via dietpi-config > Advanced Options > Update SPI bootloader. - Odroid XU4 | The kernel will be upgraded to Linux 6.6. +- DietPi-CloudShell | On Odroid XU4, when using the CloudShell 2 LCD, during configured auto screen off times, the backlight power of the LCD will be disabled as well, to safe energy and avoid still visible black display content. Many thanks to @smac for suggesting this enhancement: https://dietpi.com/forum/t/15331/55 +- DietPi-Config | Added an option to the LCD display menu to toggle the Odroid XU4 CloudShell 2 LCD. - DietPi-Software | Snapcast: 64-bit ARM and Debian Bookworm + Trixie will have the now available packages from Snapcast installed, instead of those from the Debian repository. Bug fixes: - NanoPi NEO3 | Resolved an issue where the Ethernet adapter was not available after reboots. Many thanks to @murraythegoz for reporting this issue: https://github.com/MichaIng/DietPi/issues/6987 - Orange Pi Zero 3 | Resolved an issue on the 1.5 GiB RAM variant, where the Ethernet adapter was not available anymore after soft/warm reboots. +- Orange Pi 5 Plus | Resolved an issue where the Ethernet interface names eth0/eth1 could swap on (re)boot. We add a udev rule which assures they are named persistently based on the PCI bus identifier. In case you created own udev rules to mitigate the issue, please check whether they conflict and decide whether to use ours or your solution. The DietPi update will also inform you about this change with a prompt. Many thanks to @dirkhh and many others for reporting this issue: https://github.com/MichaIng/DietPi/issues/6592 - DietPi-VPN | Resolved an issue where installing the IPVanish config failed, due to a changed URL, and startup failed on Bookworm systems since their configs contain a deprecated option. Many thanks to @DreamPhreak and @Michael-Robson for reporting this issue: https://github.com/MichaIng/DietPi/issues/7043 - DietPi-Imager | Resolved an issue where the imager could have failed on GPT partitioned images, if either the source image size did not leave space for the GPT backup partition table, or the first usable LBA/sector was above 34. The GPT backup partition table is now created only at the end of the image generation, not anymore additionally at the start, and the required size it takes is correctly obtained. Many thanks to @SelfhostedPro and @disablewong for reporting this issue: https://github.com/MichaIng/DietPi/issues/7024, https://dietpi.com/forum/t/18035 +- DietPi-Config | Resolved a visual-only failure message on non-RPi systems, when enabling Bluetooth, and an actual failure doing so on Orange Pi Zero 3, Orange Pi 3B and Orange Pi Zero 2W, since the required kernel module "sprdbt_tty" was not loaded. Many thanks to @b9AcE for reporting this issue: https://dietpi.com/forum/t/19929/45 - DietPi-Software | Snapcast: Resolved an issue where version 0.27.0 was installed, because since version 0.28.0, Snapcast is provided with client and server packages wrapped into one archive, instead having individual downloads for each package. - DietPi-Software | OctoPrint: Resolved an issue where the installation failed on RISC-V and ARMv6/7 Bullseye systems, due to changed dependencies. - DietPi-Software | X.Org X Server: Resolved an issue where an important config file might have been missing on RPi 5 and potentially Amlogic S905 SBCs, if the config directory /etc/X11/xorg.conf.d did not exist and was not created as part of the related APT packages. Many thanks to @rmscode for reporting this issue: https://dietpi.com/forum/t/19963 diff --git a/dietpi/dietpi-cloudshell b/dietpi/dietpi-cloudshell index d5927cee6c..3d2e91e048 100755 --- a/dietpi/dietpi-cloudshell +++ b/dietpi/dietpi-cloudshell @@ -39,27 +39,26 @@ BLANK_SCREEN_TIME_HOUR_END=0 # This will only work if dietpi-cloudshell was started via dietpi-autostart/dietpi-login, as the setterm power options can only be applied when the command originates from the same terminal without redirects. - RUN_BLANK_SCREEN_AT_SPECIFIC_TIME(){ - + RUN_BLANK_SCREEN_AT_SPECIFIC_TIME() + { local current_hour=$(date '+%-H') # Turn screen off - if (( ! $BLANK_SCREEN_ACTIVE )); then - - (( $BLANK_SCREEN_TIME_HOUR_START == $current_hour )) || return - + if (( ! $BLANK_SCREEN_ACTIVE && $BLANK_SCREEN_TIME_HOUR_START == $current_hour )) + then clear echo -e '\n\nScreen will be powered down in under 1 minute\n' setterm --blank 1 --powersave on # Blank after 1 minute as force requires a poke to bring it back up BLANK_SCREEN_ACTIVE=1 - # Turn screen on - elif (( $BLANK_SCREEN_TIME_HOUR_END == $current_hour )); then + # Odroid XU4 CloudShell 2 backlight + [[ $G_HW_MODEL == 11 && -f '/sys/class/backlight/fb_hktft32/bl_power' ]] && echo 0 > /sys/class/backlight/fb_hktft32/bl_power + # Turn screen on + elif (( $BLANK_SCREEN_ACTIVE && $BLANK_SCREEN_TIME_HOUR_END == $current_hour )) + then Disable_Screen_Blanking - fi - } Disable_Screen_Blanking(){ @@ -68,6 +67,8 @@ setterm --blank 0 --powersave off BLANK_SCREEN_ACTIVE=0 + # Odroid XU4 CloudShell 2 backlight + [[ $G_HW_MODEL == 11 && -f '/sys/class/backlight/fb_hktft32/bl_power' ]] && echo 1 > /sys/class/backlight/fb_hktft32/bl_power } # Converts a byte int to string, in human readable byte format. @@ -1499,8 +1500,7 @@ _EOF_ if [[ $G_WHIP_RETURNED_VALUE == 'Toggle' ]];then - ((BLANK_SCREEN_AT_SPECIFIC_TIME_ENABLED++)) - (( $BLANK_SCREEN_AT_SPECIFIC_TIME_ENABLED > 1 )) && BLANK_SCREEN_AT_SPECIFIC_TIME_ENABLED=0 + BLANK_SCREEN_AT_SPECIFIC_TIME_ENABLED=$(( ! $BLANK_SCREEN_AT_SPECIFIC_TIME_ENABLED )) elif [[ $G_WHIP_RETURNED_VALUE == 'Start time' ]];then diff --git a/dietpi/dietpi-config b/dietpi/dietpi-config index cff560b470..f97fc96d59 100755 --- a/dietpi/dietpi-config +++ b/dietpi/dietpi-config @@ -216,11 +216,10 @@ # Remote local odroid_remote_text='Off' local odroid_remote_enabled=0 - if [[ -f '/etc/systemd/system/odroid-remote.service' ]]; then - + if grep -Eq '^[[:blank:]]*(gpio-ir-recv|meson_ir)[[:blank:]]*$' /etc/modules || systemctl -q is-enabled lircd 2> /dev/null + then odroid_remote_text='On' odroid_remote_enabled=1 - fi G_WHIP_MENU_ARRAY+=('10' ": Odroid remote : [$odroid_remote_text]") @@ -260,7 +259,7 @@ else G_WHIP_MENU_ARRAY+=('odroid-lcd35' ': 480x320 panel with touch input') - (( $G_HW_MODEL == 11 )) && G_WHIP_MENU_ARRAY+=('odroid-cloudshell' ': 320x240 panel') + (( $G_HW_MODEL == 11 )) && G_WHIP_MENU_ARRAY+=('odroid-cloudshell' ': 320x240 panel' 'odroid-cloudshell2' ': Odroid XU4 CloudShell 2 LCD') fi @@ -330,7 +329,7 @@ A long (or insufficiently manufactured) cable may required a higher boost settin /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. + 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 /boot/dietpi/func/dietpi-set_hardware remoteir odroid_remote && REBOOT_REQUIRED=1 diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index 47060c7dae..7a315c4a76 100755 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -9512,7 +9512,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.4.6.8723/Radarr.master.5.4.6.8723.linux-core-$arch.tar.gz" + local fallback_url="https://github.com/Radarr/Radarr/releases/download/v5.5.3.8819/Radarr.master.5.5.3.8819.linux-core-$arch.tar.gz" fi Download_Install "$url" @@ -9955,7 +9955,7 @@ _EOF_ *) local arch='x64';; esac - local fallback_url="https://github.com/Prowlarr/Prowlarr/releases/download/v1.16.2.4435/Prowlarr.master.1.16.2.4435.linux-core-$arch.tar.gz" + local fallback_url="https://github.com/Prowlarr/Prowlarr/releases/download/v1.17.2.4511/Prowlarr.master.1.17.2.4511.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 diff --git a/dietpi/func/dietpi-globals b/dietpi/func/dietpi-globals index 0c51d713cc..d3bda29db1 100644 --- a/dietpi/func/dietpi-globals +++ b/dietpi/func/dietpi-globals @@ -55,7 +55,7 @@ # - Assign defaults/code version as fallback [[ $G_DIETPI_VERSION_CORE ]] || G_DIETPI_VERSION_CORE=9 [[ $G_DIETPI_VERSION_SUB ]] || G_DIETPI_VERSION_SUB=4 - [[ $G_DIETPI_VERSION_RC ]] || G_DIETPI_VERSION_RC=1 + [[ $G_DIETPI_VERSION_RC ]] || G_DIETPI_VERSION_RC=2 [[ $G_GITBRANCH ]] || G_GITBRANCH='master' [[ $G_GITOWNER ]] || G_GITOWNER='MichaIng' # - Save current version and Git branch diff --git a/dietpi/func/dietpi-set_hardware b/dietpi/func/dietpi-set_hardware index 1cf1e5a6de..af4a19e95d 100755 --- a/dietpi/func/dietpi-set_hardware +++ b/dietpi/func/dietpi-set_hardware @@ -257,7 +257,7 @@ _EOF_ # Do not mute progress and error messages eval "$(declare -f write_uboot_platform | sed -e 's| > /dev/null 2>&1||g' -e 's|status=none|status=progress|g')" # shellcheck disable=SC2154 - write_uboot_platform "$DIR" "$rootdev" + write_uboot_platform "$DIR" "$INPUT_DEVICE_VALUE" } #///////////////////////////////////////////////////////////////////////////////////// @@ -332,65 +332,52 @@ _EOF_ #///////////////////////////////////////////////////////////////////////////////////// # remoteir #///////////////////////////////////////////////////////////////////////////////////// - RemoteIR_Prereqs(){ G_AG_CHECK_INSTALL_PREREQ lirc; } - - RemoteIR_Reset(){ - + RemoteIR_Reset() + { # Disable JustBoom - if (( $G_HW_MODEL < 10 )); then - - if [[ -f '/etc/systemd/system/justboom-ir-mpd.service' ]]; then - + if (( $G_HW_MODEL < 10 )) + then + if [[ -f '/etc/systemd/system/justboom-ir-mpd.service' ]] + then G_EXEC systemctl disable --now justboom-ir-mpd G_EXEC rm /etc/systemd/system/justboom-ir-mpd.service - fi [[ -d '/etc/systemd/system/justboom-ir-mpd.service.d' ]] && G_EXEC rm -R /etc/systemd/system/justboom-ir-mpd.service.d - G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*dtoverlay=gpio-ir/d' /boot/config.txt # Disable Odroids - elif (( $G_HW_MODEL < 20 )); then - - if [[ -f '/etc/systemd/system/odroid-remote.service' ]]; then - - G_EXEC systemctl disable --now odroid-remote - G_EXEC rm /etc/systemd/system/odroid-remote.service - + elif (( $G_HW_MODEL < 20 )) + then + if systemctl -q is-active lircd || systemctl -q is-enabled lircd 2> /dev/null + then + G_EXEC systemctl disable --now lircd fi - [[ -d '/etc/systemd/system/odroid-remote.service.d' ]] && G_EXEC rm -R /etc/systemd/system/odroid-remote.service.d - + G_EXEC sed --follow-symlinks -Ei '/^[[:blank:]]*(gpio-ir-recv|meson_ir)[[:blank:]]*$/d' /etc/modules fi - } - RemoteIR_Main(){ - + RemoteIR_Main() + { (( $G_HW_MODEL > 19 )) && { Unsupported_Input_Name; return 1; } # Exit path for non-Odroid/non-RPi RemoteIR_Reset - if [[ $INPUT_DEVICE_VALUE == 'odroid_remote' ]]; then - + if [[ $INPUT_DEVICE_VALUE == 'odroid_remote' ]] + then (( $G_HW_MODEL > 9 )) || { Unsupported_Input_Mode; return 1; } # Exit path for non-Odroid - RemoteIR_Prereqs + G_AG_CHECK_INSTALL_PREREQ lirc - # XU4 Cloudshell - if (( $G_HW_MODEL == 11 )); then - - # Modules - local string='options gpioplug_ir_recv gpio_nr=24 active_low=1' - G_CONFIG_INJECT "$string" "$string" /etc/modprobe.d/odroid-cloudshell.conf + # Kernel modules + # - XU4 CloudShell + if (( $G_HW_MODEL == 11 )) + then G_CONFIG_INJECT 'gpio-ir-recv' 'gpio-ir-recv' /etc/modules - G_CONFIG_INJECT 'gpioplug-ir-recv' 'gpioplug-ir-recv' /etc/modules - - # C2 - elif (( $G_HW_MODEL == 12 )); then - # Module + # - C2 + elif (( $G_HW_MODEL == 12 )) + then G_CONFIG_INJECT 'meson_ir' 'meson_ir' /etc/modules - fi # Config @@ -433,12 +420,13 @@ _EOF_ # Service G_EXEC systemctl enable --now lircd - elif [[ $INPUT_DEVICE_VALUE == 'justboom_ir_remote' ]]; then - + elif [[ $INPUT_DEVICE_VALUE == 'justboom_ir_remote' ]] + then (( $G_HW_MODEL > 9 )) && { Unsupported_Input_Mode; return 1; } # Exit path for non-RPi - RemoteIR_Prereqs + G_AG_CHECK_INSTALL_PREREQ lirc mpc + # Device tree overlay G_CONFIG_INJECT 'dtoverlay=gpio-ir' 'dtoverlay=gpio-ir,gpio_pin=25' /boot/config.txt # Config @@ -490,9 +478,6 @@ begin remote end remote _EOF_ - # MPD control - G_AG_CHECK_INSTALL_PREREQ mpc - cat << '_EOF_' > /root/.lircrc begin prog = irexec @@ -555,12 +540,10 @@ _EOF_ G_EXEC systemctl daemon-reload G_EXEC systemctl enable --now justboom-ir-mpd - elif [[ $INPUT_DEVICE_VALUE != 'none' ]]; then - + elif [[ $INPUT_DEVICE_VALUE != 'none' ]] + then Unknown_Input_Mode - fi - } #///////////////////////////////////////////////////////////////////////////////////// @@ -656,23 +639,25 @@ _EOF_ #///////////////////////////////////////////////////////////////////////////////////// Lcd_Panel_Main() { + (( $G_HW_MODEL > 19 )) && { Unsupported_Input_Name; return 1; } # Exit path for non-RPi/non-Odroid + + # Reset all LCDs + Lcd_Panel_Waveshare32_Disable + Lcd_Panel_Odroidcloudshell_Disable + Lcd_Panel_Odroidcloudshell2_Disable + Lcd_Panel_OdroidLCD35_Disable + Lcd_Panel_ESP01215E_Disable + OLED_Allo_Boss2_Disable + case $INPUT_DEVICE_VALUE in - 'odroid-lcd35') Lcd_Panel_OdroidLCD35_Enable;; - 'waveshare32') Lcd_Panel_Waveshare32_Enable;; - 'odroid-cloudshell') Lcd_Panel_Odroidcloudshell_Enable;; - 'esp01215e') Lcd_Panel_ESP01215E_Enable;; - 'allo-boss2-oled') OLED_Allo_Boss2_Enable;; - 'none') - Lcd_Panel_Waveshare32_Disable - Lcd_Panel_Odroidcloudshell_Disable - Lcd_Panel_OdroidLCD35_Disable - Lcd_Panel_ESP01215E_Disable - OLED_Allo_Boss2_Disable - ;; - *) - Unknown_Input_Mode - return 1 - ;; + 'odroid-lcd35') Lcd_Panel_OdroidLCD35_Enable || return 1;; + 'waveshare32') Lcd_Panel_Waveshare32_Enable || return 1;; + 'odroid-cloudshell') Lcd_Panel_Odroidcloudshell_Enable || return 1;; + 'odroid-cloudshell2') Lcd_Panel_Odroidcloudshell2_Enable || return 1;; + 'esp01215e') Lcd_Panel_ESP01215E_Enable || return 1;; + 'allo-boss2-oled') OLED_Allo_Boss2_Enable || return 1;; + 'none') :;; + *) Unknown_Input_Mode; return 1;; esac # Update dietpi.txt entry @@ -681,6 +666,8 @@ _EOF_ Lcd_Panel_ESP01215E_Enable(){ + (( $G_HW_MODEL > 9 )) && { Unsupported_Input_Mode; return 1; } # Exit path for non-RPi + G_CONFIG_INJECT 'framebuffer_width=' 'framebuffer_width=1024' /boot/config.txt G_CONFIG_INJECT 'framebuffer_height=' 'framebuffer_height=600' /boot/config.txt G_CONFIG_INJECT 'SOFTWARE_CHROMIUM_RES_X=' "SOFTWARE_CHROMIUM_RES_X=1024" /boot/dietpi.txt @@ -730,8 +717,6 @@ _EOF_ Lcd_Panel_Waveshare32_Enable(){ - (( $G_HW_MODEL > 19 )) && { Unsupported_Input_Mode; return 1; } # Exit path for non-RPi/non-Odroid - # Disable 1st to reset any existing installations Lcd_Panel_Waveshare32_Disable @@ -848,29 +833,42 @@ _EOF_ } - # Odroid CloudShell - Lcd_Panel_Odroidcloudshell_Enable(){ - - echo 'options fbtft_device name=hktft9340 busnum=1 rotate=270' > /etc/modprobe.d/odroid-cloudshell.conf - + # Odroid CloudShell: ToDo: Broken after fbtft_device kernel module does not exist anymore with Linux 5.4/6.1/6.6... + Lcd_Panel_Odroidcloudshell_Enable() + { + (( $G_HW_MODEL == 11 )) || { Unsupported_Input_Mode; return 1; } # Odroid XU4 only G_CONFIG_INJECT 'spi_s3c64xx' 'spi_s3c64xx' /etc/modules - G_CONFIG_INJECT 'fbtft_device' 'fbtft_device' /etc/modules - echo 'fbtft_device' >> /etc/modules # XU4 4.9 workaround: https://github.com/MichaIng/DietPi/issues/926#issuecomment-299480918 - } - Lcd_Panel_Odroidcloudshell_Disable(){ + Lcd_Panel_Odroidcloudshell_Disable() + { + (( $G_HW_MODEL == 11 )) || return 0 + G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*spi_s3c64xx[[:blank:]]*/d' /etc/modules + } - [[ -f '/etc/modprobe.d/odroid-cloudshell.conf' ]] && G_EXEC rm /etc/modprobe.d/odroid-cloudshell.conf - G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*spi_s3c64xx/d' /etc/modules - G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*fbtft_device/d' /etc/modules + # Odroid CloudShell 2 + Lcd_Panel_Odroidcloudshell2_Enable() + { + (( $G_HW_MODEL == 11 )) || { Unsupported_Input_Mode; return 1; } # Odroid XU4 only + # Device tree overlay + G_CONFIG_INJECT 'setenv[[:blank:]]+cs2enable[[:blank:]]' 'setenv cs2enable "true"' /boot/boot.ini 'ODROIDXU-UBOOT-CONFIG' + # udev rule to enable backlight power + G_EXEC eval 'echo '\''SUBSYSTEM=="backlight", KERNEL=="fb_hktft32", ACTION=="add", ATTR{bl_power}="1"'\'' > /etc/udev/rules.d/dietpi-odroid-cloudshell2.rules' + } + Lcd_Panel_Odroidcloudshell2_Disable() + { + (( $G_HW_MODEL == 11 )) || return 0 + # udev rule to enable backlight power + [[ -f '/etc/udev/rules.d/dietpi-odroid-cloudshell2.rules' ]] && G_EXEC rm /etc/udev/rules.d/dietpi-odroid-cloudshell2.rules + # Device tree overlay + G_CONFIG_INJECT 'setenv[[:blank:]]+cs2enable[[:blank:]]' '#setenv cs2enable "false"' /boot/boot.ini 'ODROIDXU-UBOOT-CONFIG' } # Odroid LCD 3.5 Lcd_Panel_OdroidLCD35_Enable(){ - (( $G_HW_MODEL > 9 && $G_HW_MODEL < 20 )) || { Unsupported_Input_Mode; return 1; } # Exit path for non-Odroid + (( $G_HW_MODEL > 9 )) || { Unsupported_Input_Mode; return 1; } # Exit path for non-Odroid # Reset to disabled Lcd_Panel_OdroidLCD35_Disable @@ -974,7 +972,9 @@ EndSection _EOF_ } - Lcd_Panel_OdroidLCD35_Disable(){ + Lcd_Panel_OdroidLCD35_Disable() + { + (( $G_HW_MODEL > 9 )) || return 0 # Skip on non-Odroid [[ -f '/etc/X11/xorg.conf.d/99-calibration.conf' ]] && G_EXEC rm /etc/X11/xorg.conf.d/99-calibration.conf [[ -f '/etc/modprobe.d/odroid-lcd35.conf' ]] && G_EXEC rm /etc/modprobe.d/odroid-lcd35.conf @@ -985,7 +985,6 @@ _EOF_ fi [[ -d '/etc/systemd/system/odroid-lcd35.service.d' ]] && G_EXEC rm -R /etc/systemd/system/odroid-lcd35.service.d [[ -f '/etc/X11/xorg.conf.d/99-odroid-lcd35.conf' ]] && G_EXEC rm /etc/X11/xorg.conf.d/99-odroid-lcd35.conf - } OLED_Allo_Boss2_Enable(){ @@ -2388,7 +2387,7 @@ _EOF_ 'wificountrycode') Wifi_Countrycode_Main;; 'i2c') I2c_Main;; 'spi') SPI_Main;; - 'lcdpanel') Lcd_Panel_Main;; + 'lcdpanel') Lcd_Panel_Main || EXIT_CODE=1;; 'rpi-opengl') RPi_OpenGL_Main;; 'eth-forcespeed') Eth_Force_Speed_Main;; 'remoteir') RemoteIR_Main;; diff --git a/dietpi/func/dietpi-set_software b/dietpi/func/dietpi-set_software index 929d90b182..0b6631f002 100755 --- a/dietpi/func/dietpi-set_software +++ b/dietpi/func/dietpi-set_software @@ -208,9 +208,31 @@ $FP_SCRIPT rpi_kernel_choice Supported on Debian Bookworm or newer on R ;; esac ;; + 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 + 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} + do + dpkg-query -s "linux-u-boot-$i-current" &> /dev/null || continue + all_components=${i/-//} + break + done + ;; + esac + ;; + 80) all_components='orangepi5';; 81) all_components='visionfive2';; + 82) all_components='orangepi5plus';; 83) all_components='orangepizero3';; 84) all_components='star64';; + 85) all_components='rock5a';; 88) all_components='orangepizero2w';; 89) all_components='orangepi3lts';; 90) all_components='radxazero3';; diff --git a/rootfs/var/lib/dietpi/services/fs_partition_resize.sh b/rootfs/var/lib/dietpi/services/fs_partition_resize.sh index 5640c5142e..f99f7d913f 100755 --- a/rootfs/var/lib/dietpi/services/fs_partition_resize.sh +++ b/rootfs/var/lib/dietpi/services/fs_partition_resize.sh @@ -2,6 +2,7 @@ { # Error out on command failures set -e + EXIT_CODE=0 Reboot_to_load_Partition_table() { @@ -41,6 +42,7 @@ echo "[ INFO ] Detected root drive $ROOT_DRIVE with root partition $ROOT_PART" # Check if the last partition contains a FAT filesystem with DIETPISETUP label + REBOOT=0 LAST_PART=$(lsblk -nrbo FSTYPE,LABEL "$ROOT_DRIVE" | tail -1) if [[ $LAST_PART == 'vfat DIETPISETUP' ]] then @@ -49,9 +51,20 @@ # Mount it and copy files if present and newer TMP_MOUNT=$(mktemp -d) mount -v "$SETUP_PART" "$TMP_MOUNT" - for f in 'dietpi.txt' 'dietpi-wifi.txt' 'dietpiEnv.txt' 'unattended_pivpn.conf' 'Automation_Custom_PreScript.sh' 'Automation_Custom_Script.sh' + for f in 'dietpi.txt' 'dietpi-wifi.txt' 'dietpiEnv.txt' 'boot.ini' 'extlinux.conf' 'Automation_Custom_PreScript.sh' 'Automation_Custom_Script.sh' 'unattended_pivpn.conf' do - [[ -f $TMP_MOUNT/$f ]] && cp -uv "$TMP_MOUNT/$f" /boot/ + [[ -f $TMP_MOUNT/$f ]] || continue + if [[ $f == 'extlinux.conf' ]] + then + mkdir -pv /boot/extlinux + [[ -f '/boot/extlinux/extlinux.conf' ]] && mtime=$(date -r '/boot/extlinux/extlinux.conf' '+%s') || mtime=0 + cp -uv "$TMP_MOUNT/$f" /boot/extlinux/ + (( $(date -r '/boot/extlinux/extlinux.conf' '+%s') > $mtime )) && REBOOT=1 + else + [[ ( $f == 'dietpiEnv.txt' || $f == 'boot.ini' ) && -f /boot/$f ]] && mtime=$(date -r "/boot/$f" '+%s') || mtime=0 + cp -uv "$TMP_MOUNT/$f" /boot/ + [[ $f == 'dietpiEnv.txt' || $f == 'boot.ini' ]] && (( $(date -r "/boot/$f" '+%s') > $mtime )) && REBOOT=1 + fi done umount -v "$SETUP_PART" rmdir -v "$TMP_MOUNT" @@ -65,7 +78,7 @@ # Mount it and copy files if present and newer TMP_MOUNT=$(mktemp -d) mount -v "$BOOT_PART" "$TMP_MOUNT" - for f in 'dietpi.txt' 'dietpi-wifi.txt' 'dietpiEnv.txt' 'unattended_pivpn.conf' 'Automation_Custom_PreScript.sh' 'Automation_Custom_Script.sh' + for f in 'dietpi.txt' 'dietpi-wifi.txt' 'Automation_Custom_PreScript.sh' 'Automation_Custom_Script.sh' 'unattended_pivpn.conf' do [[ -f $TMP_MOUNT/$f ]] && cp -uv "$TMP_MOUNT/$f" /boot/ done @@ -113,9 +126,12 @@ 'btrfs') btrfs filesystem resize max /;; *) echo "[FAILED] Unsupported root filesystem type ($ROOT_FSTYPE). Aborting..." - exit 1 + EXIT_CODE=1 ;; esac - exit 0 + # Reboot if needed + (( $REBOOT )) && reboot + + exit "$EXIT_CODE" }