diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 5dc6524597..01949cb322 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -5,6 +5,8 @@ Enhancements: - 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 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 ')