From f6c0923c1db2048191a2686844cbd5771d7d1ecb Mon Sep 17 00:00:00 2001 From: MichaIng Date: Mon, 1 Mar 2021 00:32:11 +0100 Subject: [PATCH 001/147] v7.1 (#4158) + VERSION | Raise subversion to v7.1 + DietPi-Globals | Raise default subversion to v7.1 + CHANGELOG | v7.1 init + DietPi-Survey_report | Add 7.1 support --- .meta/dietpi-survey_report | 6 ++++-- .update/version | 4 ++-- CHANGELOG.txt | 25 ++++++++++++++++++------- dietpi/func/dietpi-globals | 4 ++-- 4 files changed, 26 insertions(+), 13 deletions(-) diff --git a/.meta/dietpi-survey_report b/.meta/dietpi-survey_report index fe9774473e..0d1c52c7cf 100644 --- a/.meta/dietpi-survey_report +++ b/.meta/dietpi-survey_report @@ -483,12 +483,14 @@ aSOFTWARE_NAME6_35[134]='Docker Compose' aSOFTWARE_NAME6_35[137]='mjpg-streamer' - # v7.0 (identical to v6.35 transition version) + # v7.0 (identical to v6.35 transition version) + v7.1 aSOFTWARE_NAME7_0=() + aSOFTWARE_NAME7_1=() for i in "${!aSOFTWARE_NAME6_35[@]}" do - # shellcheck disable=SC2034 aSOFTWARE_NAME7_0[$i]=${aSOFTWARE_NAME6_35[$i]} + # shellcheck disable=SC2034 + aSOFTWARE_NAME7_1[$i]=${aSOFTWARE_NAME7_0[$i]} done Main(){ diff --git a/.update/version b/.update/version index 26e350ba72..ab2b18be8b 100644 --- a/.update/version +++ b/.update/version @@ -1,7 +1,7 @@ # Available DietPi version G_REMOTE_VERSION_CORE=7 -G_REMOTE_VERSION_SUB=0 -G_REMOTE_VERSION_RC=2 +G_REMOTE_VERSION_SUB=1 +G_REMOTE_VERSION_RC=0 # Minimum DietPi version to allow update G_MIN_VERSION_CORE=6 G_MIN_VERSION_SUB=-1 diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 16d9e1134e..f928fcbee0 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,21 @@ +v7.1 +(2021-03-XX) + +Changes: + +Fixes: + +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/XXXX + +Known/Outstanding Issues: +- DietPi-Config | Enabling WiFi + Ethernet adapters, both on different subnets, breaks WiFi connection in some cases: https://github.com/MichaIng/DietPi/issues/2103 +- DietPi-Software | MATE desktop: When logging in as root, desktop items and right-click context menu is missing: https://github.com/MichaIng/DietPi/issues/3160 +- DietPi-Software | Sonarr/Radarr/Mono: With current Mono version 6, import to a file system without UNIX permissions support (exFAT, FAT32/vfat, CIFS mounts and NTFS without "permissions" option) fails, regardless of user/umask mount options: https://github.com/MichaIng/DietPi/issues/3179 + +For all additional issues that may appear after release, please see the following link for active tickets: https://github.com/MichaIng/DietPi/issues + +----------------------------------------------------------------------------------------------------------- + v7.0 (2021-02-28) @@ -46,13 +64,6 @@ Fixes: 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/4126 -Known/Outstanding Issues: -- DietPi-Config | Enabling WiFi + Ethernet adapters, both on different subnets, breaks WiFi connection in some cases: https://github.com/MichaIng/DietPi/issues/2103 -- DietPi-Software | MATE desktop: When logging in as root, desktop items and right-click context menu is missing: https://github.com/MichaIng/DietPi/issues/3160 -- DietPi-Software | Sonarr/Radarr/Mono: With current Mono version 6, import to a file system without UNIX permissions support (exFAT, FAT32/vfat, CIFS mounts and NTFS without "permissions" option) fails, regardless of user/umask mount options: https://github.com/MichaIng/DietPi/issues/3179 - -For all additional issues that may appear after release, please see the following link for active tickets: https://github.com/MichaIng/DietPi/issues - ----------------------------------------------------------------------------------------------------------- v6.34 diff --git a/dietpi/func/dietpi-globals b/dietpi/func/dietpi-globals index 4a16b874f2..a819bb27c4 100644 --- a/dietpi/func/dietpi-globals +++ b/dietpi/func/dietpi-globals @@ -65,8 +65,8 @@ [[ -f '/boot/dietpi/.version' ]] && . /boot/dietpi/.version # - Assign defaults/code version as fallback [[ $G_DIETPI_VERSION_CORE ]] || G_DIETPI_VERSION_CORE=7 - [[ $G_DIETPI_VERSION_SUB ]] || G_DIETPI_VERSION_SUB=0 - [[ $G_DIETPI_VERSION_RC ]] || G_DIETPI_VERSION_RC=2 + [[ $G_DIETPI_VERSION_SUB ]] || G_DIETPI_VERSION_SUB=1 + [[ $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 From 5df8f14498ba4d67bf6ec6a04a0949d2c6dc3c52 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Tue, 2 Mar 2021 13:06:08 +0100 Subject: [PATCH 002/147] v7.1 + Network | Define ifup executable path in ifup@.service override --- rootfs/etc/systemd/system/ifup@.service.d/dietpi.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rootfs/etc/systemd/system/ifup@.service.d/dietpi.conf b/rootfs/etc/systemd/system/ifup@.service.d/dietpi.conf index f168af15b5..93823e375b 100644 --- a/rootfs/etc/systemd/system/ifup@.service.d/dietpi.conf +++ b/rootfs/etc/systemd/system/ifup@.service.d/dietpi.conf @@ -1,4 +1,4 @@ # 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=ifup --allow=hotplug %I +ExecStart=/sbin/ifup --allow=hotplug %I From f7b9f0783ce1c544d9ea3464193f2e9bfa875982 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Tue, 2 Mar 2021 13:47:52 +0100 Subject: [PATCH 003/147] v7.1 + Network | Unset original ifup@.service command before setting the new one in the override, since "oneshot" services may run multiple commands. --- rootfs/etc/systemd/system/ifup@.service.d/dietpi.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/rootfs/etc/systemd/system/ifup@.service.d/dietpi.conf b/rootfs/etc/systemd/system/ifup@.service.d/dietpi.conf index 93823e375b..eacef9fac8 100644 --- a/rootfs/etc/systemd/system/ifup@.service.d/dietpi.conf +++ b/rootfs/etc/systemd/system/ifup@.service.d/dietpi.conf @@ -1,4 +1,5 @@ # 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 From 6449f910b6f4f7397dbf99fd16a02410eb912271 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Wed, 3 Mar 2021 15:30:32 +0100 Subject: [PATCH 004/147] v7.1 + DietPi-Software | Fix "uninstall" CLI and missing backup prompt on "reinstall" CLI --- dietpi/dietpi-software | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index 880b5a9fde..9239f6727d 100644 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -16377,14 +16377,13 @@ _EOF_ done # Reinstall, prompt for backup - if [[ $1 == 'reinstall' ]]; then + if [[ $command == 'reinstall' && $GOSTARTINSTALL == 1 ]]; then - (( $GOSTARTINSTALL )) && G_PROMPT_BACKUP + G_PROMPT_BACKUP # Uninstall | Finish up and clear non-required packages - elif [[ $1 == 'uninstall' ]]; then + elif [[ $command == 'uninstall' && $UNINSTALL_REQUIRED == 1 ]]; then - (( $UNINSTALL_REQUIRED )) || return 0 Uninstall_Software Write_InstallFileList From 2fef0dcfe0f16408e99d6ed360d6c8ba4a407530 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Wed, 3 Mar 2021 15:32:40 +0100 Subject: [PATCH 005/147] v7.1 + CHANGELOG | Resolved an issue where the "uninstall" command did not work and the "reinstall" did not show the intended backup prompt --- CHANGELOG.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index f928fcbee0..feb12bf607 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -4,6 +4,7 @@ v7.1 Changes: Fixes: +- DietPi-Software | Resolved an issue where the "uninstall" command did not work and the "reinstall" did not show the intended backup prompt. Many thanks to @Zeuskk for reporting this v7.0 regression: https://dietpi.com/phpbb/viewtopic.php?t=8729 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/XXXX From c429cd76d864229277b44ef2229aecb4b0fd0774 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Wed, 3 Mar 2021 17:57:07 +0100 Subject: [PATCH 006/147] v7.1 + DietPi-Set_software | locale: Assign default locale via debconf, since this is set to "None" when the locale changes and hence the previous default is not available/compiled anymore. This again leads to an empty /etc/default/locales, so that our LC_ALL override was actually required. + DietPi-Set_software | locale: Do not re-assign the LC_ALL and LANG variables within the script. Those are not touched by any of the previous steps and all our scripts export them to the always available "C.UTF-8" anyway. + DietPi-Set_software | locale: Do not apply LC_ALL to /etc/default/locales. With the above change, LANG is always set which is sufficient and allows to override individual localisations by adding e.g. LC_TIME/update-locale LC_TIME=... or setting it in any script/shell, which was prevented/overridden by the LC_ALL entry. --- dietpi/func/dietpi-set_software | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/dietpi/func/dietpi-set_software b/dietpi/func/dietpi-set_software index e8d97b173f..eb1c4bc03c 100644 --- a/dietpi/func/dietpi-set_software +++ b/dietpi/func/dietpi-set_software @@ -61,7 +61,7 @@ $FP_SCRIPT passwords NULL=Prompt user to change DietPi related passwords | X=op #///////////////////////////////////////////////////////////////////////////////////// # locale - # NB: Adds en_GB.UTF-8 alongside any input option + # NB: Adds C.UTF-8 alongside any input option #///////////////////////////////////////////////////////////////////////////////////// Locale_Main(){ @@ -69,23 +69,20 @@ $FP_SCRIPT passwords NULL=Prompt user to change DietPi related passwords | X=op # Create list of locales to generate echo "$INPUT_MODE_VALUE UTF-8" > /etc/locale.gen - # - Add C.UTF-8 back in, if not chosen, required by DietPi scripts + # - Add C.UTF-8 back in, if not chosen, required by DietPi scripts. It's statically pre-compiled, but adding it here adds it to the faster (?) locale cache. [[ $INPUT_MODE_VALUE == 'C.UTF-8' ]] || echo 'C.UTF-8 UTF-8' >> /etc/locale.gen - # Remove current defaults - [[ -f '/etc/default/locale' ]] && rm /etc/default/locale + # Remove current default + [[ -f '/etc/default/locale' ]] && G_EXEC rm /etc/default/locale + + # Assign new default via debconf: This is set to "None" during noninteractive reconfiguration when the previous default is not compiled anymore. + debconf-set-selection <<< "locales locales/default_environment_locale select $INPUT_MODE_VALUE" # Generate locales and set new default - # - 1. this calls locale-gen to regenerate locale cache with /etc/locale.gen entries. - # - 2. this calls update-locale LANG= to set the new default locale. + # - 1. this calls "locale-gen" to regenerate a fresh locale cache based on /etc/locale.gen to /usr/lib/locale/locale-archive. + # - 2. this calls "update-locale LANG=" to apply the new default locale form the debconf default assigned above. G_CHECK_OUTPUT=1 G_EXEC dpkg-reconfigure -f noninteractive locales - # Reassign locale to current script, as in case of wrong locale variables update-locale command will produce ugly errors - export LC_ALL='C.UTF-8' LANG='C.UTF-8' - - # Additionally set new locale via override variable $LC_ALL in /etc/default/locales which is effective from next shell session on - update-locale "LC_ALL=$INPUT_MODE_VALUE" - # Update dietpi.txt entry G_CONFIG_INJECT 'AUTO_SETUP_LOCALE=' "AUTO_SETUP_LOCALE=$INPUT_MODE_VALUE" /boot/dietpi.txt From 03a7ff0c72254c02b530883f6ddb1c8193d43f38 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Thu, 4 Mar 2021 15:17:22 +0100 Subject: [PATCH 007/147] v7.1 + DietPi-Config | RPi overclocking: Added a safe (no overvolt) overclocking profile for RPi 3+ models --- dietpi/dietpi-config | 126 ++++++++++++++++++++----------------------- 1 file changed, 58 insertions(+), 68 deletions(-) diff --git a/dietpi/dietpi-config b/dietpi/dietpi-config index d279b91fdd..749444540a 100644 --- a/dietpi/dietpi-config +++ b/dietpi/dietpi-config @@ -3545,8 +3545,7 @@ Additional benchmarks: local core_freq_value=$(sed -n '/core_freq=/{s/^[^=]*=//p;q}' /boot/config.txt) (( $G_HW_MODEL == 4 )) || local sdram_freq_value=$(sed -n '/sdram_freq=/{s/^[^=]*=//p;q}' /boot/config.txt) - # Overclocking RPi1 - # - Zero + # RPi Zero if [[ $G_HW_MODEL_NAME == 'RPi Zero'* ]]; then G_WHIP_MENU_ARRAY=('none' ': 1000 MHz ARM | 400 MHz core | 450 MHz SDRAM | 0 overvolt') @@ -3563,6 +3562,7 @@ Additional benchmarks: fi + # RPi 1 elif (( $G_HW_MODEL < 2 )); then G_WHIP_MENU_ARRAY=( @@ -3592,27 +3592,21 @@ Additional benchmarks: 'high') - if Warning_Overclocking; then - - Reset_Overclocking - G_CONFIG_INJECT 'over_voltage=' 'over_voltage=4' /boot/config.txt - G_CONFIG_INJECT 'arm_freq=' 'arm_freq=900' /boot/config.txt - G_CONFIG_INJECT 'core_freq=' 'core_freq=500' /boot/config.txt - - fi + Warning_Overclocking || return + Reset_Overclocking + G_CONFIG_INJECT 'over_voltage=' 'over_voltage=4' /boot/config.txt + G_CONFIG_INJECT 'arm_freq=' 'arm_freq=900' /boot/config.txt + G_CONFIG_INJECT 'core_freq=' 'core_freq=500' /boot/config.txt ;; 'extreme') - if Warning_Overclocking; then - - Reset_Overclocking - G_CONFIG_INJECT 'over_voltage=' 'over_voltage=6' /boot/config.txt - G_CONFIG_INJECT 'arm_freq=' 'arm_freq=1025' /boot/config.txt - G_CONFIG_INJECT 'core_freq=' 'core_freq=500' /boot/config.txt - - fi + Warning_Overclocking || return + Reset_Overclocking + G_CONFIG_INJECT 'over_voltage=' 'over_voltage=6' /boot/config.txt + G_CONFIG_INJECT 'arm_freq=' 'arm_freq=1025' /boot/config.txt + G_CONFIG_INJECT 'core_freq=' 'core_freq=500' /boot/config.txt ;; @@ -3620,7 +3614,7 @@ Additional benchmarks: fi - # Overclocking Pi2 + # RPi 2 elif (( $G_HW_MODEL == 2 )); then G_WHIP_MENU_ARRAY=( @@ -3642,39 +3636,30 @@ Additional benchmarks: 'low') - if Warning_Overclocking; then - - Reset_Overclocking - G_CONFIG_INJECT 'over_voltage=' 'over_voltage=3' /boot/config.txt - G_CONFIG_INJECT 'arm_freq=' 'arm_freq=1000' /boot/config.txt - - fi + Warning_Overclocking || return + Reset_Overclocking + G_CONFIG_INJECT 'over_voltage=' 'over_voltage=3' /boot/config.txt + G_CONFIG_INJECT 'arm_freq=' 'arm_freq=1000' /boot/config.txt ;; 'med') - if Warning_Overclocking; then - - Reset_Overclocking - G_CONFIG_INJECT 'over_voltage=' 'over_voltage=5' /boot/config.txt - G_CONFIG_INJECT 'arm_freq=' 'arm_freq=1000' /boot/config.txt - G_CONFIG_INJECT 'core_freq=' 'core_freq=500' /boot/config.txt - - fi + Warning_Overclocking || return + Reset_Overclocking + G_CONFIG_INJECT 'over_voltage=' 'over_voltage=5' /boot/config.txt + G_CONFIG_INJECT 'arm_freq=' 'arm_freq=1000' /boot/config.txt + G_CONFIG_INJECT 'core_freq=' 'core_freq=500' /boot/config.txt ;; 'extreme') - if Warning_Overclocking; then - - Reset_Overclocking - G_CONFIG_INJECT 'over_voltage=' 'over_voltage=6' /boot/config.txt - G_CONFIG_INJECT 'arm_freq=' 'arm_freq=1050' /boot/config.txt - G_CONFIG_INJECT 'core_freq=' 'core_freq=500' /boot/config.txt - - fi + Warning_Overclocking || return + Reset_Overclocking + G_CONFIG_INJECT 'over_voltage=' 'over_voltage=6' /boot/config.txt + G_CONFIG_INJECT 'arm_freq=' 'arm_freq=1050' /boot/config.txt + G_CONFIG_INJECT 'core_freq=' 'core_freq=500' /boot/config.txt ;; @@ -3682,13 +3667,20 @@ Additional benchmarks: fi - # Overclocking Pi3 + # RPi 3/3+ elif (( $G_HW_MODEL == 3 )); then + # RPi 3+ if [[ $G_HW_MODEL_NAME == *'+'* ]]; then - G_WHIP_MENU_ARRAY=('none' ': 1400 MHz ARM | 400 MHz core | 500 MHz SDRAM | 0 overvolt') + G_WHIP_MENU_ARRAY=( + + 'none' ': 1400 MHz ARM | 400 MHz core | 500 MHz SDRAM | 0 overvolt' + 'safe' ': 1450 MHz ARM | 400 MHz core | 500 MHz SDRAM | 0 overvolt' + + ) + # RPi 3 else G_WHIP_MENU_ARRAY=( @@ -3710,42 +3702,40 @@ Additional benchmarks: 'none') Reset_Overclocking;; - 'low') + 'safe') - if Warning_Overclocking; then + Reset_Overclocking + G_CONFIG_INJECT 'arm_freq=' 'arm_freq=1450' /boot/config.txt - Reset_Overclocking - G_CONFIG_INJECT 'over_voltage=' 'over_voltage=3' /boot/config.txt - G_CONFIG_INJECT 'arm_freq=' 'arm_freq=1300' /boot/config.txt - G_CONFIG_INJECT 'core_freq=' 'core_freq=400' /boot/config.txt + ;; - fi + 'low') + + Warning_Overclocking || return + Reset_Overclocking + G_CONFIG_INJECT 'over_voltage=' 'over_voltage=3' /boot/config.txt + G_CONFIG_INJECT 'arm_freq=' 'arm_freq=1300' /boot/config.txt + G_CONFIG_INJECT 'core_freq=' 'core_freq=400' /boot/config.txt ;; 'med') - if Warning_Overclocking; then - - Reset_Overclocking - G_CONFIG_INJECT 'over_voltage=' 'over_voltage=4' /boot/config.txt - G_CONFIG_INJECT 'arm_freq=' 'arm_freq=1325' /boot/config.txt - G_CONFIG_INJECT 'core_freq=' 'core_freq=400' /boot/config.txt - - fi + Warning_Overclocking || return + Reset_Overclocking + G_CONFIG_INJECT 'over_voltage=' 'over_voltage=4' /boot/config.txt + G_CONFIG_INJECT 'arm_freq=' 'arm_freq=1325' /boot/config.txt + G_CONFIG_INJECT 'core_freq=' 'core_freq=400' /boot/config.txt ;; 'high') - if Warning_Overclocking; then - - Reset_Overclocking - G_CONFIG_INJECT 'over_voltage=' 'over_voltage=5' /boot/config.txt - G_CONFIG_INJECT 'arm_freq=' 'arm_freq=1350' /boot/config.txt - G_CONFIG_INJECT 'core_freq=' 'core_freq=400' /boot/config.txt - - fi + Warning_Overclocking || return + Reset_Overclocking + G_CONFIG_INJECT 'over_voltage=' 'over_voltage=5' /boot/config.txt + G_CONFIG_INJECT 'arm_freq=' 'arm_freq=1350' /boot/config.txt + G_CONFIG_INJECT 'core_freq=' 'core_freq=400' /boot/config.txt ;; @@ -3753,7 +3743,7 @@ Additional benchmarks: fi - # Overclocking Pi4 + # RPi 4 elif (( $G_HW_MODEL == 4 )); then G_WHIP_MENU_ARRAY=( From 1e36fabe429138999fce0e98231105fcc45585f0 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Thu, 4 Mar 2021 15:19:49 +0100 Subject: [PATCH 008/147] v7.1 + CHANGELOG | Added a safe overclocking profile for RPi 3+ models --- CHANGELOG.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index feb12bf607..44c0d2f4d8 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -2,6 +2,7 @@ v7.1 (2021-03-XX) Changes: +- DietPi-Config | Added a safe overclocking profile for RPi 3+ models. Many thanks to @lone for doing long-term stability tests and reporting back the result: https://dietpi.com/phpbb/viewtopic.php?p=32285#p32285 Fixes: - DietPi-Software | Resolved an issue where the "uninstall" command did not work and the "reinstall" did not show the intended backup prompt. Many thanks to @Zeuskk for reporting this v7.0 regression: https://dietpi.com/phpbb/viewtopic.php?t=8729 From c306d449a7c4ed86a1e9ff7c4914d9e1c2afd11a Mon Sep 17 00:00:00 2001 From: MichaIng Date: Fri, 5 Mar 2021 18:31:27 +0100 Subject: [PATCH 009/147] v7.1 + DietPi-Software | MariaDB: Do not apply settings which are defaults anyway, to allow admin easier overriding them, if required. This means that only large table prefix and Baraccuda need to be applied on Stretch. Use "97-dietpi.cnf" filename (do be changed via update). + DietPi-Software | Use generic method to remove obsolete SysV services --- dietpi/dietpi-software | 141 ++++++++++++++--------------------------- 1 file changed, 47 insertions(+), 94 deletions(-) diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index 9239f6727d..034136ec91 100644 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -3143,6 +3143,17 @@ _EOF_ return 1 } + # Remove obsolete SysV service + # $1: Service name + # $2: If set, remove defaults file as well (optional) + Remove_SysV() + { + G_DIETPI-NOTIFY 2 "Removing obsolete SysV $1 service" + [[ -f /etc/init.d/$1 ]] && G_EXEC rm "/etc/init.d/$1" + G_EXEC update-rc.d "$1" remove + [[ $2 && -f /etc/default/$1 ]] && G_EXEC rm "/etc/default/$1" + } + # Run marked software installs Install_Dietpi_Software(){ @@ -3388,15 +3399,7 @@ _EOF_ (( ${aSOFTWARE_INSTALL_STATE[89]} == 2 )) && apackages+=("$PHP_NAME-mysql") G_AGI "${apackages[@]}" - # Remove obsolete sysvinit service as we use the systemd mariadb.service - if [[ -f '/etc/init.d/mysql' ]]; then - - G_DIETPI-NOTIFY 2 'Switching from /etc/init.d/mysql to mariadb.service' - systemctl disable --now mysql - rm /etc/init.d/mysql - update-rc.d -f mysql remove - - fi + Remove_SysV mysql 1 fi @@ -4771,9 +4774,7 @@ _EOF_ G_AGI python3-systemd fail2ban - # Remove obsolete sysvinit service and traces - rm -f /etc/{init.d,default}/fail2ban - update-rc.d -f fail2ban remove + Remove_SysV fail2ban 1 # Failsafe G_EXEC systemctl unmask fail2ban @@ -4908,9 +4909,7 @@ _EOF_ Banner_Installing G_AGI openvpn iptables - # Remove obsolete sysvinit service - [[ -f '/etc/init.d/openvpn' ]] && rm /etc/init.d/openvpn - update-rc.d -f openvpn remove + Remove_SysV openvpn fi @@ -7557,9 +7556,7 @@ _EOF_ Banner_Configuration - # Remove obsolete sysvinit service - [[ -f '/etc/init.d/lighttpd' ]] && rm /etc/init.d/lighttpd - update-rc.d -f lighttpd remove + Remove_SysV lighttpd # Webroot G_CONFIG_INJECT 'server.document-root' 'server.document-root = "/var/www"' /etc/lighttpd/lighttpd.conf @@ -7678,36 +7675,19 @@ _EOF_ if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - - G_DIETPI-NOTIFY 2 'Assuring 4-byte support and InnoDB Barracuda file format with large prefix' - cat << _EOF_ > /etc/mysql/mariadb.conf.d/99-dietpi-4byte.cnf + # Stretch: Since Buster (MariaDB 10.3) the following settings are removed and default to our needs: + # - innodb_large_prefix: https://mariadb.com/kb/en/library/innodb-system-variables/#innodb_large_prefix + # - innodb_file_format: https://mariadb.com/kb/en/library/innodb-system-variables/#innodb_file_format + if (( $G_DISTRO < 5 )) + then + G_DIETPI-NOTIFY 2 'Switch to modern InnoDB Barracuda file format' + cat << '_EOF_' > /etc/mysql/mariadb.conf.d/97-dietpi.cnf [mysqld] innodb_large_prefix=1 innodb_file_format=barracuda -innodb_file_per_table=1 -character-set-server=utf8mb4 -collation-server=utf8mb4_general_ci _EOF_ - # Since Buster (MariaDB 10.3) the following settings are removed and default to our needs: - # - innodb_large_prefix: https://mariadb.com/kb/en/library/innodb-system-variables/#innodb_large_prefix - # - innodb_file_format: https://mariadb.com/kb/en/library/innodb-system-variables/#innodb_file_format - if (( $G_DISTRO > 4 )); then - - sed -i '/innodb_large_prefix/d' /etc/mysql/mariadb.conf.d/99-dietpi-4byte.cnf - sed -i '/innodb_file_format/d' /etc/mysql/mariadb.conf.d/99-dietpi-4byte.cnf - fi - # Optimise for reduced memory use: https://github.com/MichaIng/DietPi/issues/605#issue-188930987 - #cat << _EOF_ > /etc/mysql/mariadb.conf.d/97-dietpi.cnf -#[mysqld] -#key_buffer_size=8M -#max_connections=30 -#query_cache_size=8M -#query_cache_limit=512K -#thread_stack=128K -#_EOF_ - fi software_id=90 # phpMyAdmin @@ -7883,8 +7863,7 @@ _EOF_ [[ -d '/var/lib/fahclient' ]] && rm -R /var/lib/fahclient [[ -d '/etc/fahclient' ]] && rm -R /etc/fahclient [[ -f '/etc/default/fahclient' ]] && rm /etc/default/fahclient - [[ -f '/etc/init.d/FAHClient' ]] && rm /etc/init.d/FAHClient - update-rc.d -f FAHClient remove + Remove_SysV FAHClient # Prepare our new config + data directory if not yet present if [[ ! -f '/mnt/dietpi_userdata/fahclient/config.xml' ]]; then @@ -8409,10 +8388,7 @@ The install script will now exit. After applying one of the the above, rerun die # Buster: systemd unit if [[ -f '/lib/systemd/system/coturn.service' ]]; then - # Remove sysvinit service traces - [[ -f '/etc/init.d/coturn' ]] && rm /etc/init.d/coturn - update-rc.d -f coturn remove - [[ -f '/etc/default/coturn' ]] && rm /etc/default/coturn + Remove_SysV coturn 1 # Disable coturn logging by default, this can be overridden via /etc/turnserver.conf G_EXEC mkdir -p /etc/systemd/system/coturn.service.d @@ -8537,9 +8513,7 @@ NB: This port needs to be forwarded by your router and/or opened in your firewal Banner_Configuration # Remove obsolete service and environment files - [[ -f '/etc/init.d/transmission-daemon' ]] && rm -v /etc/init.d/transmission-daemon - update-rc.d -f transmission-daemon remove - [[ -f '/etc/default/transmission-daemon' ]] && rm -v /etc/default/transmission-daemon + Remove_SysV transmission-daemon 1 [[ -f '/etc/init/transmission-daemon.conf' ]] && rm -v /etc/init/transmission-daemon.conf # Make "dietpi" the primary group and "debian-transmission" a supplementary group, to make downloads R/W accessible for other media software and network shares. @@ -8609,10 +8583,7 @@ NB: This port needs to be forwarded by your router and/or opened in your firewal dps_index=$software_id Download_Install 'mpd.conf' /etc/mpd.conf # Service - # - Remove obsolete sysvinit service and config - [[ -f '/etc/init.d/mpd' ]] && rm /etc/init.d/mpd - update-rc.d -f mpd remove - [[ -f '/etc/default/mpd' ]] && rm /etc/default/mpd + Remove_SysV mpd 1 # - Upstream systemd unit: https://github.com/MusicPlayerDaemon/MPD/blob/master/systemd/system/mpd.service.in # - Debian package systemd unit: https://deb.debian.org/debian/pool/main/m/mpd/ # - Run systemd unit as mpd user instead of using config-file based user change, to preserve supplementary group permissions (i.e. dietpi) @@ -9137,10 +9108,8 @@ _EOF_ Create_User -g dietpi -G minidlna -d /var/lib/minidlna minidlna # Remove obsolete service files - [[ -f '/etc/init.d/minidlna' ]] && G_EXEC rm /etc/init.d/minidlna - G_EXEC update-rc.d -f minidlna remove + Remove_SysV minidlna 1 [[ -f '/lib/systemd/system/minidlna.service' ]] && G_EXEC rm /lib/systemd/system/minidlna.service - [[ -f '/etc/default/minidlna' ]] && G_EXEC rm /etc/default/minidlna [[ -d '/var/log/minidlna' ]] && G_EXEC rm -R /var/log/minidlna # Service @@ -9388,9 +9357,7 @@ _EOF_ fi # Remove sysvinit service leftovers, installed by Debian APT package - [[ -f '/etc/init.d/deluged' ]] && rm -v /etc/init.d/deluged - update-rc.d -f deluged remove - [[ -f '/etc/default/deluged' ]] && rm -v /etc/default/deluged + Remove_SysV deluged 1 [[ -d '/var/lib/deluged' ]] && rm -R /var/lib/deluged # Permissions @@ -9404,9 +9371,7 @@ _EOF_ Banner_Configuration - # Remove obsolete SysV service - [[ -f '/etc/init.d/webmin' ]] && rm /etc/init.d/webmin - update-rc.d -f webmin remove + Remove_SysV webmin # Service cat << '_EOF_' > /etc/systemd/system/webmin.service @@ -9672,9 +9637,7 @@ _EOF_ # Remove bundled SysVinit service systemctl disable --now logitechmediaserver &> /dev/null killall -qwr squeezeboxserver* # Provided service may not wait for exit, kill: https://github.com/MichaIng/DietPi/issues/1613#issuecomment-372787574 - [[ -f '/etc/init.d/logitechmediaserver' ]] && rm /etc/init.d/logitechmediaserver - update-rc.d -f logitechmediaserver remove - [[ -f '/etc/default/logitechmediaserver' ]] && rm /etc/default/logitechmediaserver + Remove_SysV logitechmediaserver 1 # Grant user access to DietPi media files G_EXEC usermod -aG dietpi squeezeboxserver @@ -9938,9 +9901,7 @@ _EOF_ Banner_Configuration - # Remove obsolete sysvinit service - [[ -f '/etc/init.d/grafana-server' ]] && rm /etc/init.d/grafana-server - update-rc.d -f grafana-server remove + Remove_SysV grafana-server # Link DB/plugins to userdata location if [[ -d '/mnt/dietpi_userdata/grafana' ]]; then @@ -10572,10 +10533,7 @@ _EOF_ Banner_Configuration - # Remove obsolete sysvinit service and config - [[ -f '/etc/init.d/tor' ]] && rm /etc/init.d/tor - update-rc.d -f tor remove - [[ -f '/etc/default/tor' ]] && rm /etc/default/tor + Remove_SysV tor 1 # Tor config cat << _EOF_ > /etc/tor/torrc @@ -10675,14 +10633,14 @@ _EOF_ Banner_Configuration # Copy config - cp /etc/emonhub/conf/default/emonhub /etc/default/emonhub + G_EXEC cp /etc/emonhub/conf/default/emonhub /etc/default/emonhub # Setup service - cp /etc/emonhub/service/emonhub /etc/init.d/emonhub - chmod +x /etc/init.d/emonhub - update-rc.d emonhub defaults + G_EXEC cp /etc/emonhub/service/emonhub /etc/init.d/emonhub + G_EXEC chmod +x /etc/init.d/emonhub + G_EXEC update-rc.d emonhub defaults - chmod +x -R /etc/emonhub + G_EXEC chmod -R +x /etc/emonhub # Disable onboard Bluetooth, if present, to recover ttyAMA0 if (( $G_HW_ONBOARD_WIFI )); then @@ -10699,7 +10657,7 @@ _EOF_ # Disable console on ttyAMA0 /boot/dietpi/func/dietpi-set_hardware serialconsole disable ttyAMA0 - # Apply user API KEY + # Apply user API key USER_EMONHUB_APIKEY_CURRENT=$(sed -n '/^[[:blank:]]*SOFTWARE_EMONHUB_APIKEY=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) sed -i "/apikey/c\ apikey = $USER_EMONHUB_APIKEY_CURRENT" /etc/emonhub/conf/emonhub.conf @@ -11692,9 +11650,7 @@ genre = none public = no #localDumpFile = /mnt/dietpi_userdata/darkice_recording.ogg _EOF_ - # systemd service for DarkIce - [[ -f '/etc/init.d/darkice' ]] && rm /etc/init.d/darkice - update-rc.d -f darkice remove + Remove_SysV darkice [[ -f '/etc/default/icecast2' ]] && rm /etc/default/icecast2 cat << _EOF_ > /etc/systemd/system/darkice.service [Unit] @@ -11715,9 +11671,7 @@ _EOF_ Banner_Configuration - # Remove obsolete sysvinit service - [[ -f '/etc/init.d/mosquitto' ]] && rm -v /etc/init.d/mosquitto - update-rc.d -f mosquitto remove + Remove_SysV mosquitto # Add systemd unit if missing, since Buster and with official repo it is part of the DEB package: https://github.com/eclipse/mosquitto/tree/master/service/systemd [[ -f '/lib/systemd/system/mosquitto.service' ]] || cat << '_EOF_' > /etc/systemd/system/mosquitto.service @@ -12079,15 +12033,15 @@ _EOF_ Banner_Configuration - cp /etc/couchpotato/init/ubuntu.default /etc/default/couchpotato + G_EXEC cp /etc/couchpotato/init/ubuntu.default /etc/default/couchpotato sed -i '/CP_USER=/c\CP_USER=root' /etc/default/couchpotato sed -i '/CP_HOME=/c\CP_HOME=/etc/couchpotato' /etc/default/couchpotato sed -i '/CP_DATA=/c\CP_DATA=/mnt/dietpi_userdata/couchpotato' /etc/default/couchpotato - mkdir -p /mnt/dietpi_userdata/couchpotato + G_EXEC mkdir -p /mnt/dietpi_userdata/couchpotato #Create_User -d /mnt/dietpi_userdata/couchpotato couchpotato - cp /etc/couchpotato/init/ubuntu /etc/init.d/couchpotato + G_EXEC cp /etc/couchpotato/init/ubuntu /etc/init.d/couchpotato fi @@ -15540,8 +15494,8 @@ _EOF_ if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then Banner_Uninstalling - # Do a full database backup, if mariadb binary is still available: https://github.com/MichaIng/DietPi/issues/3257#issuecomment-568764107 - if command -v mysql > /dev/null; then + # Do a full database backup, if binary is still available: https://github.com/MichaIng/DietPi/issues/3257#issuecomment-568764107 + if command -v mysqldump > /dev/null; then G_WHIP_MSG "Creating MariaDB database backup before uninstallation:\n\nIn case of accident, we create a database backup for you. You can remove it manually, if you are sure, that you don't need it any more.\n\n/mnt/dietpi_userdata/mariadb-database-backup.sql" G_EXEC systemctl start mariadb @@ -15550,9 +15504,8 @@ _EOF_ fi - G_AGP mariadb-server php*-mysql - rm -Rf /{mnt/dietpi_userdata,var/lib,var/log,etc}/mysql - [[ -d '/root/.mysql_history' ]] && rm -R /root/.mysql_history + G_AGP mariadb-server 'php*-mysql' + rm -Rf /{mnt/dietpi_userdata,var/lib,var/log,etc}/mysql /{root,home/*}/.mysql_history fi From 28143faabcbbcd098c319cec09c7b9d006931cec Mon Sep 17 00:00:00 2001 From: MichaIng Date: Fri, 5 Mar 2021 18:34:25 +0100 Subject: [PATCH 010/147] v7.1 + DietPi-Patches | MariaDB: Rename config file --- .update/patches | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.update/patches b/.update/patches index 954a146cba..e56f27df8e 100644 --- a/.update/patches +++ b/.update/patches @@ -4,8 +4,11 @@ # Created by MichaIng / micha@dietpi.com / https://dietpi.com/ # License: GPLv2 / https://github.com/MichaIng/DietPi#license -# Remove obsolete udev rule, as WiFi power saving is disabled via /etc/network/intefaces > "wireless-power off" > /etc/network/if-pre-up.d/wireless-tools (wireless-tools package) when the WiFi interface is configured. +# v7.0: Remove obsolete udev rule, as WiFi power saving is disabled via /etc/network/intefaces > "wireless-power off" > /etc/network/if-pre-up.d/wireless-tools (wireless-tools package) when the WiFi interface is configured. [[ -f '/etc/udev/rules.d/10-wifi-disable-powermanagement.rules' ]] && rm -v /etc/udev/rules.d/10-wifi-disable-powermanagement.rules +# v7.1: MariaDB: Rename config file: https://github.com/MichaIng/DietPi/commit/c306d449a7c4ed86a1e9ff7c4914d9e1c2afd11a +[[ -f '/etc/mysql/mariadb.conf.d/99-dietpi-4byte.cnf' ]] && mv -v /etc/mysql/mariadb.conf.d/99-dietpi-4byte.cnf /etc/mysql/mariadb.conf.d/97-dietpi.cnf + exit 0 } From 9bb38dc64779caf249e273cc5021de3d86ad2eef Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sat, 6 Mar 2021 19:05:14 +0100 Subject: [PATCH 011/147] v7.1 + DietPi-Set_software | Time sync mode: Use documented "NTP" setting in timesyncd.conf. "Servers" still works as good, was required on Jessie, but users might be confused when not finding it in the man pages. + DietPi-Set_software | Time sync mode: Allow calling "dietpi-set_software ntpd-mode" without argument, in which case the mode from dietpi.txt will be re-applied, and if missing the default mode 2 (boot + daily). This makes it easier to change the NTP mirror only. --- dietpi/func/dietpi-set_software | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/dietpi/func/dietpi-set_software b/dietpi/func/dietpi-set_software index eb1c4bc03c..924fd39063 100644 --- a/dietpi/func/dietpi-set_software +++ b/dietpi/func/dietpi-set_software @@ -254,23 +254,27 @@ _EOF_ } #///////////////////////////////////////////////////////////////////////////////////// - # Set NTPD Mode + # Set time sync mode # NB: Also sets mirror as defined in dietpi.txt CONFIG_NTP_MIRROR #///////////////////////////////////////////////////////////////////////////////////// NtpdMode_Main(){ - if G_CHECK_VALIDINT "$INPUT_MODE_VALUE" 0 4; then + if [[ ! $INPUT_MODE_VALUE || $INPUT_MODE_VALUE == [01234] ]]; then - # Reset global to disabled, prevents run_ntpd in dietpi-software + # If no input given, re-apply current dietpi.txt setting, else revert to default mode 2 + [[ $INPUT_MODE_VALUE ]] || INPUT_MODE_VALUE=$(sed -n '/^[[:blank:]]*CONFIG_NTP_MODE=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) + [[ $INPUT_MODE_VALUE ]] || INPUT_MODE_VALUE=2 + + # Disable temporarily, prevents run_ntpd in dietpi-software sed -i '/CONFIG_NTP_MODE=/c\CONFIG_NTP_MODE=0' /boot/dietpi.txt local ntp_mirror=$(sed -n '/^[[:blank:]]*CONFIG_NTP_MIRROR=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) [[ $ntp_mirror ]] || ntp_mirror='default' - # Gateway, auto detect local gateway(s) (router) to use as NTP server. + # Gateway, auto detect local gateway(s)/router(s) to use as NTP server(s). if [[ ${ntp_mirror,,} == 'gateway' ]]; then - # NB: Convert output to single line via ORS, remove trailing space afterwards + # Convert mawk output to single line via ORS, remove trailing space afterwards local gateway=$(ip r l 0/0 | mawk '{print $3}' ORS=' '); gateway=${gateway% } if [[ $gateway ]]; then @@ -290,14 +294,13 @@ _EOF_ # Default, lets timesyncd use DHCP server or fallback to debian.pool.ntp.org. if [[ ${ntp_mirror,,} == 'default' ]]; then - [[ -f '/etc/systemd/timesyncd.conf' ]] && rm /etc/systemd/timesyncd.conf + [[ -f '/etc/systemd/timesyncd.conf' ]] && G_EXEC rm /etc/systemd/timesyncd.conf else local i ntp_mirror_entry for i in $ntp_mirror do - if [[ $i == *'pool.ntp.org' ]]; then ntp_mirror_entry+="0.$i 1.$i 2.$i 3.$i " @@ -307,11 +310,10 @@ _EOF_ ntp_mirror_entry+="$i " fi - done # Set mirror - echo -e "[Time]\nServers=${ntp_mirror_entry% }" > /etc/systemd/timesyncd.conf + echo -e "[Time]\nNTP=${ntp_mirror_entry% }" > /etc/systemd/timesyncd.conf fi @@ -329,7 +331,7 @@ _EOF_ fi - # Update DietPi.txt + # Update dietpi.txt G_CONFIG_INJECT 'CONFIG_NTP_MODE=' "CONFIG_NTP_MODE=$INPUT_MODE_VALUE" /boot/dietpi.txt else From 0203389dab9d7c2716885ab0c8cd21ae32485e97 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Tue, 9 Mar 2021 02:11:05 +0100 Subject: [PATCH 012/147] v7.1 (#4164) + DietPi-FS_partition_resize | Add support for F2FS and Btrfs filesystem expansion + DietPi-FS_partition_resize | Since all known systems require the root/boot file system to be as a partition on a partition table, do not support cases the it is not on a partition, but instead error out with "unsupported naming scheme". Even if there were cases where such was possible, it's better to create visible failure for now. If such cases were reported, we'd need to handle those gracefully at many other places in the code. + DietPi-FS_partition_resize | Use "set -e" to error our directly when any command fails. This requires to use either if-then-else or "a || b" for conditionals, so that the check itself does not error out the script. + DietPi-PREP | Add support for F2FS and Btrfs root file systems by installing related packages to allow resizing and fsck on those file system types + DietPi-PREP | Enhance partition type and file system type estimation by consequently using "lsblk" + DietPi-Drive_Manager | Add support for XFS format and fsck + DietPi-Drive_Manager | Add support for F2FS and Btrfs resize + DietPi-Drive_Manager | To collect drive info, consequently use findmnt for mounted drives and lsblk for unmounted drives. Keep using blkid only to get the list of formatted filesystems, since lsblk prints parent drives and unformatted drives as well. + DietPi-Drive_Manager | Harden and error handle a few steps + DietPi-Drive_Manager | Minor spelling: "Btrfs", "ext4" and "filesystem" which is correct as well and probably more common without space. + DietPi-Imager | Menu: Move from one menu to the logical next, only go back to main menu on cancel or when the image name has been entered + DietPi-Imager | Add F2FS and Btrfs support. F2FS filesystems cannot be shrunk. + DietPi-Image | Use fstrim to NULL Btrfs and F2FS empty space and sgdisk can be used on raw disk image files as well + DietPi-Drive_Manager | When resizing filesystems, assure that F2FS is not R/W mounted and automount Btrfs temporarily, when required + DietPi-Drive_Manager | When unmounting fails, halt and show an error prompt, so users know that and what went wrong, but allow to ignore + DietPi-Drive_Manager | After format, do manual "sync" to induce as small delay, required to show an UUID in some cases. Without this below "lsblk -no UUID" can return an empty string. + DietPi-Drive_Manager | Unmount drive automatically on format, so that it does not need to be unmounted manually. Use Unmount_Drive function, so that the mount point directory is removed as well. + DietPi-Drive_Manager | Unmount drive and stop service on fsck after a supported filesystem type has been detected to minimise the cases where services are stopped unnecessarily. + DietPi-Drive_Manager | Fix loop device detection and remove trailing /dev/ as well for unknown naming schemes + DietPi-Drive_Manager | After fsck, remount affected drive only, and do it and swapon only if it was mounted before. "mount -a" only works for drives without "noauto", hence root, boot and tmpfs mounts by default on DietPi. For this reason, the "mount -a" on each drive scan loop is obsolete as well. + DietPi-PREP | Do not keep sunxi-tools installed. Those are not used by us and only required on Allwinner sunxi SoCs. Define other Armbian packages more specifically. + DietPi-PREP | Fix version string detection for v7.0 --- .meta/dietpi-imager | 198 +++++++++--- CHANGELOG.txt | 3 + PREP_SYSTEM_FOR_DIETPI.sh | 41 ++- dietpi/dietpi-drive_manager | 297 ++++++++++-------- .../dietpi/services/fs_partition_resize.sh | 62 ++-- 5 files changed, 376 insertions(+), 225 deletions(-) diff --git a/.meta/dietpi-imager b/.meta/dietpi-imager index 13ce29b6a9..552b8b0932 100755 --- a/.meta/dietpi-imager +++ b/.meta/dietpi-imager @@ -12,7 +12,7 @@ # - Create new .img file from drive # or use an existing .img file # or use Clonezilla to generate a bootable installer ISO from drive for x86_64 systems - # - Minimises root partition and file system + # - Minimises root partition and filesystem # - Hashes and 7z's the final image ready for release #//////////////////////////////////// @@ -35,6 +35,7 @@ FP_SOURCE= PART_TABLE_TYPE= FP_ROOT_DEV= + ROOT_FS_TYPE= CLONING_TOOL='dd' OUTPUT_IMG_EXT='img' OUTPUT_IMG_NAME='DietPi_RPi-ARMv6-Buster' @@ -50,19 +51,30 @@ Menu_Source_Type() { + main_menu_choice='Source type' # On cancel, keep this entry selected + G_WHIP_MENU_ARRAY=( 'Drive' ': The OS is stored on an attached drive.' 'Image' ': The OS is stored as an image file.' ) G_WHIP_DEFAULT_ITEM=$SOURCE_TYPE - G_WHIP_MENU 'Please select how the input OS is stored:' && { Delete_Loopback; SOURCE_TYPE=$G_WHIP_RETURNED_VALUE FP_SOURCE_IMG='' FP_SOURCE='' FP_ROOT_DEV=''; } + G_WHIP_MENU 'Please select how the input OS is stored:' || return + Delete_Loopback + SOURCE_TYPE=$G_WHIP_RETURNED_VALUE + FP_SOURCE_IMG= + FP_SOURCE= + FP_ROOT_DEV= + + Menu_Source_Path # Directly open this menu next } Menu_Source_Path() { + main_menu_choice='Source path' # On cancel, keep this entry selected + if [[ $SOURCE_TYPE == 'Drive' ]] then - # Detect drives with a partition table, containing a partition with ext4 file system, excluding the hosts root file system drive + # Detect drives with a partition table, containing a partition with ext4 filesystem, excluding the hosts root filesystem drive mapfile -t G_WHIP_MENU_ARRAY < <(mawk -v root="$(lsblk -npo PKNAME "$G_ROOTFS_DEV")" '{if ( $1!=root && $2=="ext4" ) print $1"\n"$2}' < <(lsblk -rnpo PKNAME,FSTYPE) | sort -u) if [[ ! ${G_WHIP_MENU_ARRAY[0]} ]] @@ -80,9 +92,10 @@ G_WHIP_DEFAULT_ITEM=$FP_SOURCE G_WHIP_MENU 'Please select the drive you wish to create the image from: \nNB: All mounted partitions of the selected drive will be unmounted.' || return - FP_SOURCE=$G_WHIP_RETURNED_VALUE FP_ROOT_DEV='' + FP_SOURCE=$G_WHIP_RETURNED_VALUE + FP_ROOT_DEV= - G_DIETPI-NOTIFY 2 "Unmounting all file systems below selected $FP_SOURCE ..." + G_DIETPI-NOTIFY 2 "Unmounting all filesystems below selected $FP_SOURCE ..." local mountpoint for i in "$FP_SOURCE"?* do @@ -95,7 +108,8 @@ [[ -f $fp_selected ]] && rm $fp_selected # Failsafe /boot/dietpi/dietpi-explorer 1 [[ -f $fp_selected && $(<$fp_selected) ]] || { G_DIETPI-NOTIFY 1 'No image file selected, aborting...'; read -rp 'Press any key to return to menu...'; return; } - FP_SOURCE_IMG=$(<$fp_selected) FP_ROOT_DEV='' + FP_SOURCE_IMG=$(<$fp_selected) + FP_ROOT_DEV= rm $fp_selected [[ -f $FP_SOURCE_IMG ]] || { G_DIETPI-NOTIFY 1 "Selected image file ($FP_SOURCE_IMG) does not exist, aborting..."; read -rp 'Press any key to return to menu...'; return; } @@ -108,10 +122,14 @@ G_EXEC_NOEXIT=1 G_EXEC partx -u "$FP_SOURCE" || return G_DIETPI-NOTIFY 0 "Mounted the image ($FP_SOURCE_IMG) as loopback device: $FP_SOURCE" fi + + Menu_Source_RootFS # Directly open this menu next } Menu_Source_RootFS() { + main_menu_choice='Source rootfs' # On cancel, keep this entry selected + # Detect partitions and list for selection # Coders NB: read/mapfile cannot be easily used here since we need to parse multiple lines and split at newline AND space. # shellcheck disable=SC2207 @@ -119,11 +137,16 @@ # Visually separate dev name and size and add FS type for ((i=1;i<${#G_WHIP_MENU_ARRAY[@]};i+=2)); do G_WHIP_MENU_ARRAY[$i]=": $(lsblk -drno SIZE,FSTYPE "${G_WHIP_MENU_ARRAY[$i-1]}")"; done G_WHIP_DEFAULT_ITEM=$FP_ROOT_DEV - G_WHIP_MENU 'Please select the OS root partition:' && FP_ROOT_DEV=$G_WHIP_RETURNED_VALUE + G_WHIP_MENU 'Please select the OS root partition:' || return + FP_ROOT_DEV=$G_WHIP_RETURNED_VALUE + + Menu_Target_Type # Directly open this menu next } Menu_Target_Type() { + main_menu_choice='Target type' # On cancel, keep this entry selected + G_WHIP_MENU_ARRAY=( 'dd' ': Create an .img file to flash to target system drive directly.' 'Clonezilla' ': Create an installer .iso file to boot from removeable media. (x86_64 only!)' @@ -136,12 +159,17 @@ - Clonezilla: An installer ISO image is created which must be flashed to an external/USB/removeable drive. Boot from the external drive will launch Clonezilla and allow you to install DietPi to any internal drive. This is required e.g. for UEFI images. - NB: Only compatible with x86_64 systems!' && CLONING_TOOL=$G_WHIP_RETURNED_VALUE + NB: Only compatible with x86_64 systems!' || return + CLONING_TOOL=$G_WHIP_RETURNED_VALUE [[ $CLONING_TOOL == 'dd' ]] && OUTPUT_IMG_EXT='img' || OUTPUT_IMG_EXT='iso' + + Menu_Target_Name # Directly open this menu next } Menu_Target_Name() { + main_menu_choice='Target name' # On cancel, keep this entry selected + G_WHIP_DEFAULT_ITEM=$OUTPUT_IMG_NAME G_WHIP_INPUTBOX 'Please enter a name for the new image:\n - DietPi_--\n - E.g.: DietPi_RPi-ARMv6-Buster' || return OUTPUT_IMG_NAME=$G_WHIP_RETURNED_VALUE @@ -154,6 +182,8 @@ G_WHIP_YESNO "[WARNING] $PWD/$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT already exists \nDo you want to overwrite or backup the existing file to $PWD/$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT.bak?" || mv "$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT"{,.bak} fi + + main_menu_choice='Mount' # Select this entry next } Menu_Main() @@ -174,7 +204,6 @@ G_WHIP_DEFAULT_ITEM=$main_menu_choice G_WHIP_BUTTON_CANCEL_TEXT='Exit' G_WHIP_MENU 'Select input parameters and hit "Start" to continue image creation:' || exit 0 - main_menu_choice=$G_WHIP_RETURNED_VALUE case $G_WHIP_RETURNED_VALUE in 'Source type') Menu_Source_Type;; @@ -183,12 +212,33 @@ 'Target type') Menu_Target_Type;; 'Target name') Menu_Target_Name;; 'Mount') [[ $MOUNT_IT == 'Off' ]] && MOUNT_IT='On' || MOUNT_IT='Off';; + 'Start') main_menu_choice='Start';; esac } + Run_fsck() + { + if [[ $ROOT_FS_TYPE == 'ext4' ]] + then + G_EXEC_OUTPUT=1 G_EXEC e2fsck -fp "$FP_ROOT_DEV" + + elif [[ $ROOT_FS_TYPE == 'f2fs' ]] + then + G_EXEC_OUTPUT=1 G_EXEC fsck.f2fs -f "$FP_ROOT_DEV" + + elif [[ $ROOT_FS_TYPE == 'btrfs' ]] + then + G_EXEC_OUTPUT=1 G_EXEC btrfs check --repair "$FP_ROOT_DEV" + else + G_DIETPI-NOTIFY 1 "Unsupported root filesystem type ($PART_TABLE_TYPE), aborting..." + exit 1 + fi + } + Main(){ - local main_menu_choice='Source type' + local main_menu_choice + Menu_Source_Type until [[ $main_menu_choice == 'Start' ]] do Menu_Main @@ -201,8 +251,8 @@ G_AG_CHECK_INSTALL_PREREQ parted zerofree p7zip $fdisk unset -v fdisk - # Auto detect partition table type, failsafe detection of MBR to debug possibly other/unknown wording/partition table types - PART_TABLE_TYPE=$(sfdisk -l "$FP_SOURCE" | mawk '/^Disklabel type:/{print $3;exit}') + # Detect partition table type, failsafe detection of MBR to debug possibly other/unknown wording/partition table types + PART_TABLE_TYPE=$(lsblk -no PTTYPE "$FP_ROOT_DEV") if [[ $PART_TABLE_TYPE == 'dos' ]] then G_DIETPI-NOTIFY 2 'MBR partition table detected' @@ -221,7 +271,10 @@ exit 1 fi - G_EXEC_OUTPUT=1 G_EXEC e2fsck -fp "$FP_ROOT_DEV" + # Detect root filesystem type + ROOT_FS_TYPE=$(lsblk -no FSTYPE "$FP_ROOT_DEV") + + Run_fsck # Remount image for any required edits G_EXEC mkdir -p $FP_MNT_TMP @@ -248,37 +301,87 @@ G_EXEC rmdir $FP_MNT_TMP G_EXEC partprobe "$FP_SOURCE" # Failsafe G_EXEC partx -u "$FP_SOURCE" # Failsafe - G_EXEC_OUTPUT=1 G_EXEC e2fsck -fp "$FP_ROOT_DEV" - - # Shrink file system to minimum - # - Run multiple times until no change is done any more - G_DIETPI-NOTIFY 2 'Shrinking RootFS to minimum size...' - local out - FS_SIZE=0 - while : - do - resize2fs -M "$FP_ROOT_DEV" 2>&1 | tee resize2fs_out - if out=$(grep -im1 'nothing to do!' resize2fs_out) - then - FS_SIZE=$(mawk '{print $5}' <<< "$out") # blocks - BLOCK_SIZE=${out%%k) *} BLOCK_SIZE=${BLOCK_SIZE##*\(} # KiB - # Re-add 4 MiB to be failsafe, was required on Raspbian Buster for successful boot - FS_SIZE=$(( $FS_SIZE + 4096/$BLOCK_SIZE )) # blocks - rm resize2fs_out - G_EXEC resize2fs "$FP_ROOT_DEV" $FS_SIZE - G_DIETPI-NOTIFY 0 "Reduced RootFS size to $(( $FS_SIZE * $BLOCK_SIZE / 1024 + 1 )) MiB" - FS_SIZE=$(( $FS_SIZE * $BLOCK_SIZE * 2 )) # blocks => 512 byte sectors - break - - elif out=$(grep -im1 'no such file or directory' resize2fs_out) - then - G_DIETPI-NOTIFY 1 'Partition not found, aborting...' - exit 1 - fi - done + Run_fsck + + # Shrink filesystem to minimum + if [[ $ROOT_FS_TYPE == 'ext4' ]] + then + # Run multiple times until no change is done any more + G_DIETPI-NOTIFY 2 'Shrinking root filesystem to minimum size...' + local out + FS_SIZE=0 + while : + do + resize2fs -M "$FP_ROOT_DEV" 2>&1 | tee resize2fs_out + if out=$(grep -im1 'nothing to do!' resize2fs_out) + then + FS_SIZE=$(mawk '{print $5}' <<< "$out") # blocks + BLOCK_SIZE=${out%%k) *} BLOCK_SIZE=${BLOCK_SIZE##*\(} # KiB + # Re-add 4 MiB to be failsafe, was required on Raspbian Buster for successful boot + FS_SIZE=$(( $FS_SIZE + 4096/$BLOCK_SIZE )) # blocks + rm resize2fs_out + G_EXEC resize2fs "$FP_ROOT_DEV" $FS_SIZE + G_DIETPI-NOTIFY 0 "Reduced RootFS size to $(( $FS_SIZE * $BLOCK_SIZE / 1024 + 1 )) MiB" + FS_SIZE=$(( $FS_SIZE * $BLOCK_SIZE * 2 )) # blocks => 512 byte sectors + break + + elif out=$(grep -im1 'no such file or directory' resize2fs_out) + then + G_DIETPI-NOTIFY 1 'Partition not found, aborting...' + exit 1 + fi + done + G_DIETPI-NOTIFY 2 'Overriding root filesystem free space with zeros to purge removed data and allow further archive size reduction...' + G_EXEC_OUTPUT=1 G_EXEC zerofree -v "$FP_ROOT_DEV" + G_EXEC sync + + elif [[ $ROOT_FS_TYPE == 'f2fs' ]] #&& $(lsblk -rno FSUSE% "$FP_ROOT_DEV") =~ ^(9[5-9]|100)%$ ]] + then + # F2FS does not support shrinking: https://www.reddit.com/r/archlinux/comments/bpp77f/shrinking_a_f2fs_partition/ + # Hence copy all data outside, remove and re-create a smaller filesytem, then copy them back in, as long as disk usage is not >=95% already. + # The UUID changes and there is currently no way to change it back... + #local usage=$(lsblk -rnbo FSUSED "$FP_ROOT_DEV") # bytes + #local sector_size=$(lsblk -rnbo LOG-SEC "$FP_ROOT_DEV") # bytes + #FS_SIZE=$(( ( $usage + 4*1024**2 ) / $sector_size )) # bytes + 4 MiB buffer => sectors + #G_DIETPI-NOTIFY 2 'Copying root filesystem content to temporary directory' + G_EXEC mkdir -p ${FP_MNT_TMP}{,_backup} + G_EXEC mount -o ro "$FP_ROOT_DEV" $FP_MNT_TMP + #G_EXEC cp -a $FP_MNT_TMP/. ${FP_MNT_TMP}_backup/ + #G_EXEC umount $FP_MNT_TMP + #G_DIETPI-NOTIFY 2 'Purging root filesystem' + #G_EXEC dd if=/dev/zero of="$FP_ROOT_DEV" bs=4K count=10 + #G_DIETPI-NOTIFY 2 'Re-creating smaller root filesystem' # Probably sload.f2fs can replace this? https://manpages.debian.org/sload.f2fs + #G_EXEC_OUTPUT=1 G_EXEC mkfs.f2fs -w "$sector_size" "$FP_ROOT_DEV" $FS_SIZE + #G_DIETPI-NOTIFY 2 'Moving root filesystem content back' + #G_EXEC mount "$FP_ROOT_DEV" $FP_MNT_TMP + #G_EXEC cp -a ${FP_MNT_TMP}_backup/. $FP_MNT_TMP/ + #G_EXEC rm -R ${FP_MNT_TMP}_backup + G_EXEC fstrim $FP_MNT_TMP + G_EXEC sync + G_EXEC sleep 1 # Give the system 1 second to avoid "mount is busy" + G_EXEC umount $FP_MNT_TMP + G_EXEC rmdir $FP_MNT_TMP + # Assure root filesystem size is in 512 byte sectors, as this is what sfdisk assmes + #FS_SIZE=$(( $FS_SIZE * $sector_size / 512 )) + elif [[ $ROOT_FS_TYPE == 'btrfs' ]] + then + G_DIETPI-NOTIFY 2 'Shrinking root filesystem to minimum size...' + G_EXEC mkdir -p $FP_MNT_TMP + G_EXEC mount "$FP_ROOT_DEV" $FP_MNT_TMP + FS_SIZE=$(( $(btrfs inspect-internal min-dev-size $FP_MNT_TMP) + 4*1024**2 )) # bytes? + 4 MiB buffer + G_EXEC_OUTPUT=1 G_EXEC btrfs filesystem resize $FS_SIZE $FP_MNT_TMP + G_EXEC fstrim $FP_MNT_TMP + G_EXEC sync + G_EXEC sleep 1 # Give the system 1 second to avoid "mount is busy" + G_EXEC umount $FP_MNT_TMP + G_EXEC rmdir $FP_MNT_TMP + FS_SIZE=$(( $FS_SIZE / 512 )) # bytes => 512 byte sectors + fi + + Run_fsck # Only resize partition when new size would be less than current size - if (( $( $FS_SIZE )) + if [[ $ROOT_FS_TYPE != 'f2fs' ]] && (( $( $FS_SIZE )) then G_DIETPI-NOTIFY 2 "Shrinking root partition to: $(( $FS_SIZE / 2048 + 1 )) MiB" G_EXEC_OUTPUT=1 G_EXEC eval "sfdisk --no-reread --no-tell-kernel -fN${FP_ROOT_DEV: -1} '$FP_SOURCE' <<< ',$FS_SIZE'" @@ -286,13 +389,7 @@ G_EXEC partx -u "$FP_SOURCE" fi - G_DIETPI-NOTIFY 2 'Overriding root partition free space with zeros to purge removed data and allow further archive size reduction...' - G_EXEC_OUTPUT=1 G_EXEC zerofree -v "$FP_ROOT_DEV" - G_EXEC sync - # Finished: Derive final image size from last partition end + failsafe buffer - G_EXEC partprobe "$FP_SOURCE" - G_EXEC partx -u "$FP_SOURCE" IMAGE_SIZE=$(( ( $(sfdisk -qlo End "$FP_SOURCE" | tail -1) + 1 ) * 512 )) # 512 byte sectors => Byte IMAGE_SIZE=$(( $IMAGE_SIZE + ( 512 * 256 ) )) # 64 byte for secondary GPT + safety net @@ -461,11 +558,8 @@ _EOF_ # - gdisk will correct this if [[ $PART_TABLE_TYPE == 'gpt' ]] then - local loop=$(losetup -f) - G_EXEC losetup "$loop" "$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT" - G_EXEC_DESC='Reapplying GPT partition backup table fix' G_EXEC_OUTPUT=1 G_EXEC sgdisk -e "$loop" + G_EXEC_DESC='Reapplying GPT partition backup table fix' G_EXEC_OUTPUT=1 G_EXEC sgdisk -e "$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT" G_EXEC sync - G_EXEC losetup -d "$loop" fi # Generate hashes: MD5, SHA1, SHA256 diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 44c0d2f4d8..bc1b34d2bf 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -2,6 +2,8 @@ v7.1 (2021-03-XX) Changes: +- DietPi-FS_partition_resize | Added support to automatically resize F2FS and Btrfs filesystems on first boot. +- DietPi-Drive_Manager | Added support for resizing F2FS and Btrfs filesystems as well as format- and filesystem check & repair support for XFS filesystems. - DietPi-Config | Added a safe overclocking profile for RPi 3+ models. Many thanks to @lone for doing long-term stability tests and reporting back the result: https://dietpi.com/phpbb/viewtopic.php?p=32285#p32285 Fixes: @@ -10,6 +12,7 @@ Fixes: 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/XXXX Known/Outstanding Issues: +- DietPi-Drive_Manager | Fixed detection and visualisation of loop devices in menu. - DietPi-Config | Enabling WiFi + Ethernet adapters, both on different subnets, breaks WiFi connection in some cases: https://github.com/MichaIng/DietPi/issues/2103 - DietPi-Software | MATE desktop: When logging in as root, desktop items and right-click context menu is missing: https://github.com/MichaIng/DietPi/issues/3160 - DietPi-Software | Sonarr/Radarr/Mono: With current Mono version 6, import to a file system without UNIX permissions support (exFAT, FAT32/vfat, CIFS mounts and NTFS without "permissions" option) fails, regardless of user/umask mount options: https://github.com/MichaIng/DietPi/issues/3179 diff --git a/PREP_SYSTEM_FOR_DIETPI.sh b/PREP_SYSTEM_FOR_DIETPI.sh index 7d92fdd8e2..8301a4f16c 100644 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -634,12 +634,13 @@ Currently installed: $G_DISTRO_NAME (ID: $G_DISTRO)"; then G_EXEC mv "DietPi-$G_GITBRANCH/CHANGELOG.txt" /boot/dietpi-CHANGELOG.txt # Reading version string for later use - G_DIETPI_VERSION_CORE=$(mawk 'NR==1' "DietPi-$G_GITBRANCH/dietpi/server_version-6") - G_DIETPI_VERSION_SUB=$(mawk 'NR==2' "DietPi-$G_GITBRANCH/dietpi/server_version-6") - G_DIETPI_VERSION_RC=$(mawk 'NR==3' "DietPi-$G_GITBRANCH/dietpi/server_version-6") + . "DietPi-$G_GITBRANCH/.update/version" + G_DIETPI_VERSION_CORE=$G_REMOTE_VERSION_CORE + G_DIETPI_VERSION_SUB=$G_REMOTE_VERSION_SUB + G_DIETPI_VERSION_RC=$G_REMOTE_VERSION_RC - # Remove server_version* / (pre-)patch_file (downloads fresh from dietpi-update) - rm "DietPi-$G_GITBRANCH/dietpi/server_version"* + # Remove server_version-6 / (pre-)patch_file (downloads fresh from dietpi-update) + rm "DietPi-$G_GITBRANCH/dietpi/server_version-6" rm "DietPi-$G_GITBRANCH/dietpi/pre-patch_file" rm "DietPi-$G_GITBRANCH/dietpi/patch_file" @@ -775,14 +776,25 @@ Currently installed: $G_DISTRO_NAME (ID: $G_DISTRO)"; then fi # Install gdisk if root file system is on a GPT partition, used by DietPi-FS_partition_resize - [[ $(parted -s "$(lsblk -npo PKNAME "$(findmnt -no SOURCE /)")" print) == *'Partition Table: gpt'* ]] && aPACKAGES_REQUIRED_INSTALL+=('gdisk') + [[ $(lsblk -ndo PTTYPE "$(lsblk -npo PKNAME "$(findmnt -no SOURCE /)")") == 'gpt' ]] && aPACKAGES_REQUIRED_INSTALL+=('gdisk') - # Install required filesystem packages - if [[ $(blkid -s TYPE -o value) =~ (^|[[:space:]]|v)'fat' ]]; then + # Install file system tools required for file system resizing and fsck + while read -r line + do + if [[ $line == 'vfat' ]] + then + aPACKAGES_REQUIRED_INSTALL+=('dosfstools') - aPACKAGES_REQUIRED_INSTALL+=('dosfstools') # DietPi-Drive_Manager + fat (boot) drive file system check and creation tools + elif [[ $line == 'f2fs' ]] + then + aPACKAGES_REQUIRED_INSTALL+=('f2fs-tools') - fi + elif [[ $line == 'btrfs' ]] + then + aPACKAGES_REQUIRED_INSTALL+=('btrfs-progs') + fi + + done < <(lsblk -no FSTYPE | sort -u) # Kernel/bootloader/firmware # - We need to install those directly to allow G_AGA() autoremove possible older packages later: https://github.com/MichaIng/DietPi/issues/1285#issuecomment-354602594 @@ -817,11 +829,10 @@ Currently installed: $G_DISTRO_NAME (ID: $G_DISTRO)"; then local apackages=( - 'linux-dtb-' - 'linux-u-' 'linux-image-' - "linux-$DISTRO_TARGET_NAME-" - 'sunxi-tools' + 'linux-dtb-' + 'linux-u-boot-' + "linux-$DISTRO_TARGET_NAME-root-" ) @@ -834,7 +845,7 @@ Currently installed: $G_DISTRO_NAME (ID: $G_DISTRO)"; then aPACKAGES_REQUIRED_INSTALL+=("$line") G_DIETPI-NOTIFY 2 "Armbian package detected and added: $line" - done <<< "$(dpkg-query -Wf '${Package}\n' | mawk -v pat="^$i" '$0~pat')" + done < <(dpkg-query -Wf '${Package}\n' | mawk -v pat="^$i" '$0~pat') done unset -v apackages diff --git a/dietpi/dietpi-drive_manager b/dietpi/dietpi-drive_manager index b58b751ec4..49a212264a 100644 --- a/dietpi/dietpi-drive_manager +++ b/dietpi/dietpi-drive_manager @@ -172,13 +172,13 @@ $swap_mounts aDRIVE_SOURCE_DEVICE[$index]=$(Return_Drive_Without_Partitions "${aDRIVE_MOUNT_SOURCE[$index]}") [[ ${aDRIVE_MOUNT_SOURCE[$index]} == /dev/${aDRIVE_SOURCE_DEVICE[$index]} ]] || aDRIVE_ISPARTITIONTABLE[$index]=1 - aDRIVE_UUID[$index]=$(blkid -s UUID -o value "${aDRIVE_MOUNT_SOURCE[$index]}") - (( ${aDRIVE_ISPARTITIONTABLE[$index]} )) && aDRIVE_PART_UUID[$index]=$(blkid -s PARTUUID -o value "${aDRIVE_MOUNT_SOURCE[$index]}") + aDRIVE_UUID[$index]=$(findmnt -no UUID "${aDRIVE_MOUNT_TARGET[$index]}") + (( ${aDRIVE_ISPARTITIONTABLE[$index]} )) && aDRIVE_PART_UUID[$index]=$(findmnt -no PARTUUID "${aDRIVE_MOUNT_TARGET[$index]}") # Physical? if [[ -d '/sys/block/'${aDRIVE_SOURCE_DEVICE[$index]} ]]; then - aDRIVE_FSTYPE[$index]=$(blkid -s TYPE -o value "${aDRIVE_MOUNT_SOURCE[$index]}") + aDRIVE_FSTYPE[$index]=$(findmnt -no FSTYPE "${aDRIVE_MOUNT_TARGET[$index]}") [[ ${aDRIVE_FSTYPE[$index]} ]] && aDRIVE_ISFILESYSTEM[$index]=1 # Networked @@ -248,7 +248,7 @@ $swap_mounts if [[ ${aDRIVE_MOUNT_TARGET[$index]} =~ ^/(boot(/efi)?)?$ ]]; then # On RPi we need to use PARTUUID for Root/BootFS - (( $G_HW_MODEL < 10 )) && dev_entry="PARTUUID=${aDRIVE_PART_UUID[$index]}" + (( $G_HW_MODEL > 9 )) || dev_entry="PARTUUID=${aDRIVE_PART_UUID[$index]}" [[ ${aDRIVE_MOUNT_TARGET[$index]} == '/' ]] && options+=' 0 1' || options+=' 0 2' # dump + fsck flag else @@ -267,20 +267,20 @@ $swap_mounts done < <(df -a --output=source --exclude-type=tmpfs --exclude-type=ecryptfs --exclude-type=vboxsf --exclude-type=glusterfs | sed "\|^/dev/root$|c$G_ROOTFS_DEV" | mawk '/\// && !x[$0]++') - # Check blkid for unmounted drives, if drive is not mounted, add entry as disabled/commented mount + # Check blkid for unmounted filesystems while read -r line do [[ $line ]] || continue - # Exclude drives already found + # Exclude drives already found (mounted) for i in "${aDRIVE_MOUNT_SOURCE[@]}" do [[ $i == "$line"* ]] && continue 2 done - # Must have a valid UUID! (this excludes /dev/mmcblk0) - local uuid=$(blkid -s UUID -o value "$line") + # Failsafe: Must have a valid UUID! But blkid should print only drives with filesytems. + local uuid=$(lsblk -no UUID "$line") [[ $uuid ]] || continue G_DIETPI-NOTIFY 2 " - Detected unmounted drive: $line" @@ -292,26 +292,20 @@ $swap_mounts aDRIVE_MOUNT_TARGET[$index]="/mnt/${aDRIVE_UUID[$index]}" aDRIVE_SOURCE_DEVICE[$index]=$(Return_Drive_Without_Partitions "${aDRIVE_MOUNT_SOURCE[$index]}") [[ ${aDRIVE_MOUNT_SOURCE[$index]} == /dev/${aDRIVE_SOURCE_DEVICE[$index]} ]] || aDRIVE_ISPARTITIONTABLE[$index]=1 - (( ${aDRIVE_ISPARTITIONTABLE[$index]} )) && aDRIVE_PART_UUID[$index]=$(blkid -s PARTUUID -o value "${aDRIVE_MOUNT_SOURCE[$index]}") - aDRIVE_FSTYPE[$index]=$(blkid -s TYPE -o value "${aDRIVE_MOUNT_SOURCE[$index]}") + (( ${aDRIVE_ISPARTITIONTABLE[$index]} )) && aDRIVE_PART_UUID[$index]=$(lsblk -no PARTUUID "${aDRIVE_MOUNT_SOURCE[$index]}") + aDRIVE_FSTYPE[$index]=$(lsblk -no FSTYPE "${aDRIVE_MOUNT_SOURCE[$index]}") [[ ${aDRIVE_FSTYPE[$index]} ]] && aDRIVE_ISFILESYSTEM[$index]=1 - # FS type: In case of unknown network drive, use "auto", to allow remove FS changes without breaking the fstab entry - local type=${aDRIVE_FSTYPE[$index]} - (( ${aDRIVE_ISNETWORKED[$index]} )) && type='auto' - - echo "#UUID=${aDRIVE_UUID[$index]} ${aDRIVE_MOUNT_TARGET[$index]} ${type:-auto} noatime,lazytime,rw,nofail,noauto,x-systemd.automount" >> $fp_fstab_tmp - done < <(blkid -o device) - # Find unformated drives + # Find unformatted drives # - Exclude mtdblock devices: https://github.com/MichaIng/DietPi/issues/2067#issuecomment-422400520 while read -r line do [[ $line ]] || continue - # Exclude drives already found + # Exclude drives already found (formatted) for i in "${aDRIVE_SOURCE_DEVICE[@]}" do [[ $line == $i* ]] && continue 2 @@ -390,15 +384,13 @@ aDRIVE_ISPARTITIONTABLE ${aDRIVE_ISPARTITIONTABLE[$i]} Update_Menu_Drive_Index # Move new fstab in place and reload systemd generators - cp -a $fp_fstab_tmp /etc/fstab - systemctl daemon-reload - rm $fp_fstab_tmp + G_EXEC mv $fp_fstab_tmp /etc/fstab + G_EXEC systemctl daemon-reload # Install required APT packages for FS R/W access [[ $APT_CHECK == 0 && $need_ntfs$need_hfs$need_exfat ]] && G_AG_CHECK_INSTALL_PREREQ $need_ntfs $need_hfs $need_exfat && APT_CHECK=1 - sync - mount -a + G_EXEC sync } @@ -418,22 +410,22 @@ aDRIVE_ISPARTITIONTABLE ${aDRIVE_ISPARTITIONTABLE[$i]} # $1=source Return_Drive_Without_Partitions(){ + local drive=${1#/dev/} + # IDE/SATA/SCSI - if [[ $1 == /dev/[sh]d[a-z]* ]]; then + if [[ $1 == /dev/[sh]d[a-z][1-9] ]]; then - local drive=${1#/dev/} echo "${drive%[0-9]}" - # MMC/NVMe - elif [[ $1 == '/dev/mmcblk'* || $1 == '/dev/nvme'* ]]; then + # MMC/NVMe/loop + elif [[ $1 =~ ^/dev/(mmcblk|nvme[0-9]n|loop)[0-9]p[1-9]$ ]]; then - local drive=${1#/dev/} echo "${drive%p[0-9]}" - # Network drive + # No partition table or unknown block device type else - echo "$1" + echo "$drive" fi @@ -481,7 +473,7 @@ Do you wish to ignore this warning, and, mount the drive regardless?" || return # Mount options local aoptions=() # - FS type specific options - local fs_type=$(blkid "$source" -s TYPE -o value) + local fs_type=$(lsblk -no FSTYPE "$source") if [[ $fs_type == 'ntfs' ]]; then aoptions=('-o' 'permissions') @@ -500,13 +492,10 @@ Do you wish to ignore this warning, and, mount the drive regardless?" || return local target=$1 - if G_EXEC_NOHALT=1 G_EXEC umount "$target"; then - - sed -i "\#[[:blank:]]${target}[[:blank:]]#d" /etc/fstab # Only needed for networked drives currently... - rmdir "$target" - Init_Drives_and_Refresh - - fi + G_EXEC_NOEXIT=1 G_EXEC umount "$target" || return 1 + sed -i "\#[[:blank:]]${target}[[:blank:]]#d" /etc/fstab # Only needed for networked drives currently... + G_EXEC_NOEXIT=1 G_EXEC rmdir "$target" + Init_Drives_and_Refresh } @@ -514,16 +503,34 @@ Do you wish to ignore this warning, and, mount the drive regardless?" || return if [[ ${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]} == '/' ]]; then - systemctl unmask dietpi-fs_partition_resize G_EXEC systemctl enable dietpi-fs_partition_resize - G_WHIP_YESNO 'RootFS resize will occur on next reboot.\n\nWould you like to reboot the system now?' && reboot + G_WHIP_YESNO 'RootFS resize will occur on next reboot.\n\nWould you like to reboot the system now?' && reboot || return - else + elif [[ ${aDRIVE_FSTYPE[$MENU_DRIVE_INDEX]} == ext[2-4] ]]; then - G_EXEC_NOHALT=1 G_EXEC resize2fs "${aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]}" - Init_Drives_and_Refresh + G_EXEC_NOEXIT=1 G_EXEC resize2fs "${aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]}" + elif [[ ${aDRIVE_FSTYPE[$MENU_DRIVE_INDEX]} == 'f2fs' ]]; then + + (( ${aDRIVE_ISMOUNTED[$MENU_DRIVE_INDEX]} && ! ${aDRIVE_ISREADONLY_CURRENTLY[$MENU_DRIVE_INDEX]} )) && G_EXEC_NOEXIT=1 G_EXEC mount -o remount,ro "${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]}" + G_EXEC_NOEXIT=1 G_EXEC resize.f2fs "${aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]}" + (( ${aDRIVE_ISMOUNTED[$MENU_DRIVE_INDEX]} && ! ${aDRIVE_ISREADONLY_CURRENTLY[$MENU_DRIVE_INDEX]} )) && G_EXEC_NOEXIT=1 G_EXEC mount -o remount,rw "${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]}" + + elif [[ ${aDRIVE_FSTYPE[$MENU_DRIVE_INDEX]} == 'btrfs' ]]; then + + if (( ! ${aDRIVE_ISMOUNTED[$MENU_DRIVE_INDEX]} )) + then + G_EXEC_NOEXIT=1 G_EXEC mkdir -p /tmp/temporary_f2fs_mountpoint + G_EXEC_NOEXIT=1 G_EXEC mount "${aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]}" /tmp/temporary_f2fs_mountpoint + fi + G_EXEC_NOEXIT=1 G_EXEC btrfs filesystem resize max "${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]}" + if (( ! ${aDRIVE_ISMOUNTED[$MENU_DRIVE_INDEX]} )) + then + G_EXEC_NOEXIT=1 G_EXEC umount /tmp/temporary_f2fs_mountpoint + G_EXEC_NOEXIT=1 G_EXEC rmdir /tmp/temporary_f2fs_mountpoint + fi fi + Init_Drives_and_Refresh } @@ -532,7 +539,7 @@ Do you wish to ignore this warning, and, mount the drive regardless?" || return local i text_desc info_format_fs_type local info_format_type_output='Drive format' # Used in complete message - # No partition table, force drive wipe + # Failsafe: No partition table, force drive wipe - actually done in parent menu already (( ${aDRIVE_ISPARTITIONTABLE[$MENU_DRIVE_INDEX]} )) || FORMAT_MODE=0 if (( $FORMAT_MODE )); then @@ -553,7 +560,7 @@ Do you wish to ignore this warning, and, mount the drive regardless?" || return info_format_type_output='Single partition format' # Unmount - umount "${aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]}" + (( ${aDRIVE_ISMOUNTED[$MENU_DRIVE_INDEX]} )) && { Unmount_Drive "${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]}" || return 1; } # Clear partition from device G_DIETPI-NOTIFY 2 "Writing zeros to partition ${aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]}" @@ -563,18 +570,18 @@ Do you wish to ignore this warning, and, mount the drive regardless?" || return else # Umount and zero all partitions on device + # - Partition wipe must be done 1st, else UUIDs are still reported. for i in "/dev/${aDRIVE_SOURCE_DEVICE[$MENU_DRIVE_INDEX]}"?* do - [[ -b $i ]] || continue - umount "$i" + local target=$(findmnt -no TARGET "$i") + [[ $target ]] && { Unmount_Drive "$target" || return 1; } G_DIETPI-NOTIFY 2 "Writing zeros to partition: $i" - G_EXEC dd if=/dev/zero of="$i" bs=4K count=10 # Partition wipe must be done 1st, else blkid still reports UUIDs etc - + G_EXEC dd if=/dev/zero of="$i" bs=4K count=10 done # Unmount whole drive in case of fs on drive without partition table - umount "${aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]}" + (( ${aDRIVE_ISMOUNTED[$MENU_DRIVE_INDEX]} )) && { Unmount_Drive "${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]}" || return 1; } # Clear partition table from device G_DIETPI-NOTIFY 2 "Writing zeros to partition table: /dev/${aDRIVE_SOURCE_DEVICE[$MENU_DRIVE_INDEX]}" @@ -588,23 +595,20 @@ Do you wish to ignore this warning, and, mount the drive regardless?" || return G_EXEC parted -s "/dev/${aDRIVE_SOURCE_DEVICE[$MENU_DRIVE_INDEX]}" mklabel $parition_table_type G_EXEC parted -s "/dev/${aDRIVE_SOURCE_DEVICE[$MENU_DRIVE_INDEX]}" mkpart primary 0% 100% partprobe "/dev/${aDRIVE_SOURCE_DEVICE[$MENU_DRIVE_INDEX]}" + partx -u "/dev/${aDRIVE_SOURCE_DEVICE[$MENU_DRIVE_INDEX]}" sleep 1 # Due to systemd automount, wait for it - umount "${aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]}" + findmnt "${aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]}" > /dev/null && G_EXEC umount "${aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]}" # Generate new aDRIVE_MOUNT_SOURCE location to use - # - mmcblkXp1/nvmeXn1p1 - aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]="/dev/${aDRIVE_SOURCE_DEVICE[$MENU_DRIVE_INDEX]}p1" - # - h/sdX1 - if [[ ${aDRIVE_SOURCE_DEVICE[$MENU_DRIVE_INDEX]} == [sh]d[a-z]* ]]; then - + # - hda1/sda1 + if [[ ${aDRIVE_SOURCE_DEVICE[$MENU_DRIVE_INDEX]} == [sh]d[a-z] ]] + then aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]="/dev/${aDRIVE_SOURCE_DEVICE[$MENU_DRIVE_INDEX]}1" - # - NanoPC-T4 + NVMe special: https://github.com/MichaIng/DietPi/issues/2102#issue-366001513 - elif [[ $G_HW_MODEL == 68 && ${aDRIVE_SOURCE_DEVICE[$MENU_DRIVE_INDEX]} == nvme* ]]; then - - aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]="/dev/${aDRIVE_SOURCE_DEVICE[$MENU_DRIVE_INDEX]}p6" - + # - mmcblk0p1/nvme0n0p1 + else + aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]="/dev/${aDRIVE_SOURCE_DEVICE[$MENU_DRIVE_INDEX]}p1" fi fi @@ -613,23 +617,23 @@ Do you wish to ignore this warning, and, mount the drive regardless?" || return if (( $FORMAT_FILESYSTEM_TYPE == 0 )); then # force - info_format_fs_type='EXT4' + info_format_fs_type='ext4' G_EXEC mkfs.ext4 -F -m 0 "${aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]}" resize2fs "${aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]}" # Format NTFS elif (( $FORMAT_FILESYSTEM_TYPE == 1 )); then - # fast format / no indexing / force + # -f: fast format | -I: no indexing | -F: force info_format_fs_type='NTFS' G_EXEC mkfs.ntfs -f -I -F "${aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]}" # Format FAT32 elif (( $FORMAT_FILESYSTEM_TYPE == 2 )); then - # Use 1 parition on whole device + # -I: Use 1 parition on whole device info_format_fs_type='FAT' - G_EXEC mkfs.vfat -I "${aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]}" + G_EXEC mkfs.fat -I "${aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]}" # Format HFS+ elif (( $FORMAT_FILESYSTEM_TYPE == 3 )); then @@ -640,8 +644,8 @@ Do you wish to ignore this warning, and, mount the drive regardless?" || return # Format btrfs elif (( $FORMAT_FILESYSTEM_TYPE == 4 )); then - # force - info_format_fs_type='BTRFS' + # -f: force + info_format_fs_type='Btrfs' G_EXEC mkfs.btrfs -f "${aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]}" # Format f2fs @@ -656,16 +660,25 @@ Do you wish to ignore this warning, and, mount the drive regardless?" || return info_format_fs_type='exFAT' G_EXEC mkfs.exfat "${aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]}" + # Format XFS + elif (( $FORMAT_FILESYSTEM_TYPE == 7 )); then + + # -f: force + info_format_fs_type='XFS' + G_EXEC mkfs.xfs -f "${aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]}" + fi + G_EXEC sync # Sync to disk, as well to add a slight delay since XFS formatted file systems do not return a UUID (below) immediately + G_DIETPI-NOTIFY 0 "Created $info_format_fs_type filesystem: ${aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]}" FORMAT_COMPLETED=1 # Remove old mount point - [[ -e ${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]} ]] && rm -R "${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]}" + [[ -e ${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]} ]] && G_EXEC_NOEXIT=1 G_EXEC rm -R "${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]}" # Automatically mount it - local new_uuid=$(blkid -s UUID -o value "${aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]}") + local new_uuid=$(lsblk -no UUID "${aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]}") if ! Mount_Drive "${aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]}" "/mnt/$new_uuid"; then MENU_DRIVE_TARGET="/mnt/$new_uuid" @@ -705,7 +718,7 @@ Do you wish to ignore this warning, and, mount the drive regardless?" || return # Mount rootfs to tmp mountpoint to allow rsync # - rsync "-x" option prevents copying mounts content, but it copies permissions of mountpoint dirs according to mount options instead of those of the dir on the parent fs. - # - Since mount permissions might not be wanted for the underlying file system dir, we copy from a temporary mountpoint to assure that underlying rootfs content matches 100%. + # - Since mount permissions might not be wanted for the underlying filesystem dir, we copy from a temporary mountpoint to assure that underlying rootfs content matches 100%. G_EXEC mkdir -p /tmp/tmp_rootfs G_EXEC mount "$G_ROOTFS_DEV" /tmp/tmp_rootfs @@ -908,7 +921,7 @@ Do you wish to ignore this warning, and, mount the drive regardless?" || return elif [[ $G_WHIP_RETURNED_VALUE == 'Add network drive' ]]; then - TARGETMENUID=3 + TARGETMENUID=3 # Add network drive menu elif [[ $G_WHIP_RETURNED_VALUE == 'Idle Spindown' ]]; then @@ -963,7 +976,7 @@ Do you wish to ignore this warning, and, mount the drive regardless?" || return # Edit drive elif [[ $G_WHIP_RETURNED_VALUE ]]; then - TARGETMENUID=1 + TARGETMENUID=1 # Drive menu MENU_DRIVE_TARGET=$G_WHIP_RETURNED_VALUE Update_Menu_Drive_Index @@ -991,6 +1004,7 @@ Do you wish to ignore this warning, and, mount the drive regardless?" || return } + # TARGETMENUID=1 Menu_Drive(){ G_WHIP_MENU_ARRAY=() @@ -1073,11 +1087,11 @@ Do you wish to ignore this warning, and, mount the drive regardless?" || return [[ $FP_SWAPFILE_CURRENT == '/var/swap' && ${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]} == '/' ]]; }; then partition_contains_swapfile=1 - G_WHIP_MENU_ARRAY+=('Swapfile' ": [X] | ${swapfile_size} MiB used on this drive, select to change size") + G_WHIP_MENU_ARRAY+=('Swap file' ": [X] | ${swapfile_size} MiB used on this drive, select to change size") else - G_WHIP_MENU_ARRAY+=('Swapfile' ': [ ] | Select to transfer swapfile to this drive') + G_WHIP_MENU_ARRAY+=('Swap file' ': [ ] | Select to transfer swapfile to this drive') fi @@ -1133,7 +1147,7 @@ Do you wish to ignore this warning, and, mount the drive regardless?" || return G_WHIP_MENU_ARRAY+=('Check & Repair' ': Check and optionally repair filesystem') # Resize - if [[ ${aDRIVE_ISREADONLY_CURRENTLY[$MENU_DRIVE_INDEX]} == 0 && ${aDRIVE_FSTYPE[$MENU_DRIVE_INDEX]} == 'ext4' ]]; then + if [[ ${aDRIVE_FSTYPE[$MENU_DRIVE_INDEX]} =~ ^(ext[2-4]|f2fs|btrfs)$ ]]; then G_WHIP_MENU_ARRAY+=('Resize' ': Maximize the available filesystem size') @@ -1205,7 +1219,7 @@ Do you wish to ignore this warning, and, mount the drive regardless?" || return \nNB: You can add additional network shares at a later date through the 'dietpi-drive_manager' main menu."; then Unmount_Drive "${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]}" - TARGETMENUID=0 + TARGETMENUID=0 # Main menu fi @@ -1215,15 +1229,15 @@ Do you wish to ignore this warning, and, mount the drive regardless?" || return fi - elif [[ $G_WHIP_RETURNED_VALUE == 'Swapfile' ]]; then + elif [[ $G_WHIP_RETURNED_VALUE == 'Swap file' ]]; then local min=0 local current_freespace=$(G_CHECK_FREESPACE "${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]}") local max=$(( $current_freespace - 2000 )) if [[ ${aDRIVE_FSTYPE[$MENU_DRIVE_INDEX]} == 'btrfs' ]]; then - G_WHIP_MSG '[FAILED] The file system BTRFS does not support swap files.\n -Please choose another drive or format this one with another file system, e.g. ext4.' + G_WHIP_MSG '[FAILED] The filesystem Btrfs does not support swap files.\n +Please choose another drive or format this one with another filesystem, e.g. ext4.' elif (( $max < $min )); then @@ -1232,9 +1246,9 @@ Please choose another drive or format this one with another file system, e.g. ex else G_WHIP_DEFAULT_ITEM=$swapfile_size - if G_WHIP_INPUTBOX "Please input a new value for swapfile size (MiB): -\nSwapfile has a swapiness setting of 1, and, is used only to prevent out of memory errors. -\n - Recommended value = 1 (auto)\n - 0 = Disable swapfile\n - 1 = Auto size swapfile (2GB - RAM = size)\n - 2 - $max = Manual size"; then + if G_WHIP_INPUTBOX "Please input a new value for swap file size (MiB): +\nSwap file has a swapiness setting of 1, and, is used only to prevent out of memory errors. +\n - Recommended value = 1 (auto)\n - 0 = Disable swap file\n - 1 = Auto size swap file (2GB - RAM = size)\n - 2 - $max = Manual size"; then if G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" $min $max; then @@ -1307,14 +1321,9 @@ Please enter the desired percentage of reserved blocks, e.g. "0.05" for 0.05% or Notification 1 - # User must unmount partition on this drive, before we can format, this ensures a valid unmount check - elif (( ${aDRIVE_ISMOUNTED[$MENU_DRIVE_INDEX]} )); then - - G_WHIP_MSG "The partition (${aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]}) must be unmounted, before formatting is allowed.\n\nPlease use the option 'Unmount' on the next screen, then retry the 'Format' option." - else - TARGETMENUID=2 + TARGETMENUID=2 # Format menu fi @@ -1341,7 +1350,7 @@ We recommend \"ext4\" as filesystem type for the RootFS." if G_WHIP_YESNO 'This process will move the root filesystem data to another location. This may increase R/W performance when using a USB drive over SDcard, however, there are some limitations: \n - The SD/eMMC card, which holds kernel and bootloader, is still required for the boot process. On RPi3, which supports full USB boot, instead it is recommended to flash the whole DietPi image to a USB drive and boot the system without SDcard. -\n - Custom software installs might use info of the old root mount/filesystem, hence we recommend to move the root file system on fresh DietPi systems only. +\n - Custom software installs might use info of the old root mount/filesystem, hence we recommend to move the root filesystem on fresh DietPi systems only. \n - An immediate reboot is done after the transfer has successfully finished to assure that fstab and cmdline cannot be reverted. \nDo you wish to continue?'; then @@ -1350,12 +1359,10 @@ We recommend \"ext4\" as filesystem type for the RootFS." \n - Odroid: RootFS transfer supports ONLY EXT4 format\n\n - RPi: RootFS transfer supports EXT4, BTRFS and F2FS' # NB: We dont enter main loop in this func - TARGETMENUID=2 + TARGETMENUID=2 # Format menu while (( $TARGETMENUID == 2 )) do - Menu_Format - done (( $FORMAT_COMPLETED )) && RootFS_Move @@ -1386,8 +1393,8 @@ We recommend \"ext4\" as filesystem type for the RootFS." if [[ ${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]} == '/' ]]; then - if G_WHIP_YESNO 'The root file system can only be checked on reboot. -\nDo you want to force a file system check of root partition on next reboot? + if G_WHIP_YESNO 'The root filesystem can only be checked on reboot. +\nDo you want to force a filesystem check of root partition on next reboot? \nNB: Logs can be found after reboot either via "journalctl -t systemd-fsck" or "cat /run/initramfs/fsck.log"'; then > /forcefsck @@ -1398,22 +1405,7 @@ We recommend \"ext4\" as filesystem type for the RootFS." fi - if (( ${aDRIVE_ISMOUNTED[$MENU_DRIVE_INDEX]} )); then - - G_WHIP_YESNO 'For safe check and repair, the drive needs to be unmounted. -\nDo you want to continue with the drive being unmounted automatically?' || { TARGETMENUID=1; return; } - - (( $SERVICES_STOPPED )) || { /boot/dietpi/dietpi-services stop; SERVICES_STOPPED=1; } - - # Disable swap - (( $partition_contains_swapfile )) && G_EXEC swapoff -a - - # Unmount drive - G_EXEC umount "${aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]}" - - fi - - if [[ ${aDRIVE_FSTYPE[$MENU_DRIVE_INDEX]} =~ 'ext' ]]; then + if [[ ${aDRIVE_FSTYPE[$MENU_DRIVE_INDEX]} == ext[2-4] ]]; then local fsck_dry='e2fsck -n -f' local fsck_fix='e2fsck -y -f' @@ -1453,15 +1445,34 @@ We recommend \"ext4\" as filesystem type for the RootFS." local fsck_dry='btrfs check --readonly' local fsck_fix='btrfs check --repair' + elif [[ ${aDRIVE_FSTYPE[$MENU_DRIVE_INDEX]} == 'xfs' ]]; then + + G_AG_CHECK_INSTALL_PREREQ xfsprogs + local fsck_dry='xfs_repair -n' + local fsck_fix='xfs_repair' + else - G_WHIP_MSG "File system checks are currently not supported for '${aDRIVE_FSTYPE[$MENU_DRIVE_INDEX]}'. Aborting..." - TARGETMENUID=1 - return + G_WHIP_MSG "Filesystem checks are currently not supported for '${aDRIVE_FSTYPE[$MENU_DRIVE_INDEX]}'. Aborting..." + return 1 + + fi + + if (( ${aDRIVE_ISMOUNTED[$MENU_DRIVE_INDEX]} )) + then + G_WHIP_YESNO 'For safe check and repair, the drive needs to be unmounted. +\nDo you want to continue with the drive being unmounted automatically?' || return 1 + + (( $SERVICES_STOPPED )) || { /boot/dietpi/dietpi-services stop; SERVICES_STOPPED=1; } + + # Disable swap + (( $partition_contains_swapfile )) && G_EXEC swapoff -a + # Unmount drive + G_EXEC umount "${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]}" fi - # Do dry-run first for file systems supporting it: + # Do dry-run first for filesystems supporting it: if [[ $fsck_dry ]]; then G_WHIP_MSG "The following drive will now be checked for errors:\n${aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]}\n\nNo repair will be completed during this process. An option to repair the drive, will be provided after the check." @@ -1471,8 +1482,8 @@ We recommend \"ext4\" as filesystem type for the RootFS." fi - if G_WHIP_YESNO "Would you like to run an automated repair on the following drive now?\n ${aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]}\n -NB: + if G_WHIP_YESNO "Would you like to run an automated repair on the following drive now?\n${aDRIVE_MOUNT_SOURCE[$MENU_DRIVE_INDEX]} +\nNB: - Automated repair steps potentially lead to data loss, which would have been able to recover by professional drive recovery services. - If the data is extremely important and you don't have any backup, you might want to hand the drive to a recovery service as is. - These services are usually very expensive, but might be able to recover more data than (after) this automated repair steps!"; then @@ -1483,11 +1494,14 @@ NB: fi - # Remount all drives - G_EXEC mount -a + if (( ${aDRIVE_ISMOUNTED[$MENU_DRIVE_INDEX]} )) + then + # Remount drive + G_EXEC mount "${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]}" - # Re-enable swap - (( $partition_contains_swapfile )) && G_EXEC swapon -a + # Re-enable swap + (( $partition_contains_swapfile )) && G_EXEC swapon -a + fi elif [[ $G_WHIP_RETURNED_VALUE == 'I/O Scheduler' ]]; then @@ -1520,12 +1534,13 @@ Read more about I/O scheduling: https://wiki.archlinux.org/index.php/Improving_p else - TARGETMENUID=0 # Exit + TARGETMENUID=0 # Main menu fi } + # TARGETMENUID=2 Menu_Format(){ FORMAT_COMPLETED=0 @@ -1536,7 +1551,7 @@ Read more about I/O scheduling: https://wiki.archlinux.org/index.php/Improving_p local format_mode_text='Drive' (( $FORMAT_MODE )) && format_mode_text='Partition' - local format_type_text='EXT4' + local format_type_text='ext4' if (( $FORMAT_FILESYSTEM_TYPE == 1 )); then format_type_text='NTFS' @@ -1551,7 +1566,7 @@ Read more about I/O scheduling: https://wiki.archlinux.org/index.php/Improving_p elif (( $FORMAT_FILESYSTEM_TYPE == 4 )); then - format_type_text='BTRFS' + format_type_text='Btrfs' elif (( $FORMAT_FILESYSTEM_TYPE == 5 )); then @@ -1561,6 +1576,10 @@ Read more about I/O scheduling: https://wiki.archlinux.org/index.php/Improving_p format_type_text='exFAT' + elif (( $FORMAT_FILESYSTEM_TYPE == 7 )); then + + format_type_text='XFS' + fi G_WHIP_MENU_ARRAY=() @@ -1589,8 +1608,7 @@ Read more about I/O scheduling: https://wiki.archlinux.org/index.php/Improving_p if [[ $G_WHIP_RETURNED_VALUE == 'Partition Type' ]]; then - G_WHIP_BUTTON_OK_TEXT='MBR' - G_WHIP_BUTTON_CANCEL_TEXT='GPT' + G_WHIP_BUTTON_OK_TEXT='MBR' G_WHIP_BUTTON_CANCEL_TEXT='GPT' G_WHIP_YESNO 'Would you like to use GPT or MBR parition table?\n - GPT is required for 2TB+ drives\n - MBR does NOT support 2TB+ drives\n\nIf unsure, select GPT (default)' && FORMAT_GPT=0 || FORMAT_GPT=1 elif [[ $G_WHIP_RETURNED_VALUE == 'Format Mode' ]]; then @@ -1613,19 +1631,22 @@ NB: If you are planning to dedicate the drive to this system, it is recommended G_WHIP_MENU_ARRAY=( - '0' ': EXT4 | Default (Recommended)' + '0' ': ext4 | Default (Recommended)' '1' ': NTFS | Windows (High CPU usage)' '2' ': FAT32 | All OS (4GB filesize limit)' - '3' ': HFS+ | Mac OS X (Intel Mac default file system)' - '4' ': BTRFS | Linux (Modern filesystem)' + '3' ': HFS+ | macOS (Apple default filesystem)' + '4' ': Btrfs | Linux (Modern filesystem)' '5' ': F2FS | Linux (Flash filesystem)' '6' ': exFAT | Windows (Flash filesystem)' + '7' ': XFS | Linux (Modern filesystem)' ) G_WHIP_DEFAULT_ITEM=$FORMAT_FILESYSTEM_TYPE - if G_WHIP_MENU 'Please select a filesystem type for this format:\n\nEXT4:\nHighly recommended if you plan to use this drive solely on this system (dedicated drive).\n -NTFS:\nRecommended if you plan to use this drive on a Windows system. High CPU usage during transfers.\n\nFull list of different filesystem types:\nhttps://dietpi.com/docs/dietpi_tools/#dietpi-drive-manager'; then + if G_WHIP_MENU 'Please select a filesystem type for this format: +\next4:\nHighly recommended if you plan to use this drive solely on this system (dedicated drive). +\nNTFS:\nRecommended if you plan to use this drive on a Windows system. High CPU usage during transfers. +\nFull list of different filesystem types:\nhttps://dietpi.com/docs/dietpi_tools/#dietpi-drive-manager'; then # Install FS pre-reqs # - NTFS @@ -1658,6 +1679,11 @@ NTFS:\nRecommended if you plan to use this drive on a Windows system. High CPU u G_AG_CHECK_INSTALL_PREREQ exfat-utils exfat-fuse + # - XFS + elif (( $G_WHIP_RETURNED_VALUE == 7 )); then + + G_AG_CHECK_INSTALL_PREREQ xfsprogs + fi FORMAT_FILESYSTEM_TYPE=$G_WHIP_RETURNED_VALUE @@ -1667,13 +1693,13 @@ NTFS:\nRecommended if you plan to use this drive on a Windows system. High CPU u elif [[ $G_WHIP_RETURNED_VALUE == 'Format' ]]; then Run_Format - TARGETMENUID=1 + TARGETMENUID=1 # Drive menu fi else - TARGETMENUID=1 + TARGETMENUID=1 # Drive menu fi @@ -1743,7 +1769,7 @@ NTFS:\nRecommended if you plan to use this drive on a Windows system. High CPU u MENU_DRIVE_TARGET=$samba_fp_mount_target Init_Drives_and_Refresh - TARGETMENUID=1 + TARGETMENUID=1 # Drive menu G_WHIP_MSG "Mount completed. The new mount can be accessed via:\n - $samba_fp_mount_target\n - CIFS vers=$i" rm $fp_tmp @@ -1805,7 +1831,7 @@ NTFS:\nRecommended if you plan to use this drive on a Windows system. High CPU u MENU_DRIVE_TARGET=$nfs_fp_mount_target Init_Drives_and_Refresh - TARGETMENUID=1 + TARGETMENUID=1 # Drive menu G_WHIP_MSG "Mount completed. The new mount can be accessed via:\n - $nfs_fp_mount_target" rm $fp_tmp @@ -1828,7 +1854,7 @@ NTFS:\nRecommended if you plan to use this drive on a Windows system. High CPU u MENU_DRIVE_TARGET=$nfs_fp_mount_target Init_Drives_and_Refresh - TARGETMENUID=1 + TARGETMENUID=1 # Drive menu G_WHIP_MSG "Mount completed. The new mount can be accessed via:\n - $nfs_fp_mount_target" rm $fp_tmp @@ -1846,6 +1872,7 @@ NTFS:\nRecommended if you plan to use this drive on a Windows system. High CPU u } + # TARGETMENUID=3 Menu_Add_Network_Drive(){ G_WHIP_MENU_ARRAY=( diff --git a/rootfs/var/lib/dietpi/services/fs_partition_resize.sh b/rootfs/var/lib/dietpi/services/fs_partition_resize.sh index 1e1882a548..caed704141 100644 --- a/rootfs/var/lib/dietpi/services/fs_partition_resize.sh +++ b/rootfs/var/lib/dietpi/services/fs_partition_resize.sh @@ -1,7 +1,10 @@ #!/bin/bash { + # Error out on command failures + set -e + # Disable this service - systemctl disable dietpi-fs_partition_resize + ! systemctl is-enabled dietpi-fs_partition_resize > /dev/null || systemctl disable dietpi-fs_partition_resize # Detect root device ROOT_DEV=$(findmnt -no SOURCE /) @@ -12,47 +15,60 @@ # - eMMC: /dev/mmcblk[0-9]p[1-9] # - NVMe: /dev/nvme[0-9]n[0-9]p[1-9] # - loop: /dev/loop[0-9]p[1-9] - if [[ $ROOT_DEV =~ ^/dev/(mmcblk|nvme[0-9]n|loop)[0-9](p[1-9])?$ ]]; then - - ROOT_PART=${ROOT_DEV##*[0-9]p} # /dev/mmcblk0p1 => 1 - ROOT_DRIVE=${ROOT_DEV%p[1-9]} # /dev/mmcblk0p1 => /dev/mmcblk0 - - elif [[ $ROOT_DEV =~ ^/dev/[sh]d[a-z][1-9]?$ ]]; then + if [[ $ROOT_DEV == /dev/[sh]d[a-z][1-9] ]]; then ROOT_PART=${ROOT_DEV: -1} # /dev/sda1 => 1 ROOT_DRIVE=${ROOT_DEV%[1-9]} # /dev/sda1 => /dev/sda + elif [[ $ROOT_DEV =~ ^/dev/(mmcblk|nvme[0-9]n|loop)[0-9]p[1-9]$ ]]; then + + ROOT_PART=${ROOT_DEV##*[0-9]p} # /dev/mmcblk0p1 => 1 + ROOT_DRIVE=${ROOT_DEV%p[1-9]} # /dev/mmcblk0p1 => /dev/mmcblk0 + else - echo "[FAILED] Unsupported block device naming scheme ($ROOT_DEV). Aborting..." + echo "[FAILED] Unsupported root device naming scheme ($ROOT_DEV). Aborting..." exit 1 fi - # Maximize root partition if drive contains a partition table - if [[ $ROOT_PART == [1-9] ]]; then + # Failsafe: Sync changes to disk before touching partitions + sync - # Failsafe: Sync changes to disk before touching partitions - sync + # GPT partition table: Move backup GPT data structures to the end of the disk + [[ $(lsblk -ndo PTTYPE "$ROOT_DRIVE") != 'gpt' ]] || sgdisk -e "$ROOT_DRIVE" - # GPT partition table: Move backup GPT data structures to the end of the disk - sfdisk -l "$ROOT_DRIVE" | grep -q '^Disklabel type: gpt$' && sgdisk -e "$ROOT_DRIVE" + # Maximise root partition size + sfdisk --no-reread --no-tell-kernel -fN"$ROOT_PART" "$ROOT_DRIVE" <<< ',+' - # Maximize root partition size - sfdisk --no-reread --no-tell-kernel -fN"$ROOT_PART" "$ROOT_DRIVE" <<< ',+' + # Inform kernel about changed partition table, be failsafe by using two differet methods + partprobe "$ROOT_DRIVE" + partx -u "$ROOT_DRIVE" - # Inform kernel about changed partition table, be failsafe by using two differet methods - partprobe "$ROOT_DRIVE" - partx -u "$ROOT_DRIVE" + # Detect root file system type + ROOT_FSTYPE=$(findmnt -no FSTYPE /) + + # Maximise root file system if type is supported + if [[ $ROOT_FSTYPE == ext[2-4] ]]; then + + resize2fs "$ROOT_DEV" + + elif [[ $ROOT_FSTYPE == 'f2fs' ]]; then + + mount -o remount,ro / + resize.f2fs "$ROOT_DEV" + mount -o remount,rw / + + elif [[ $ROOT_FSTYPE == 'btrfs' ]]; then + + btrfs filesystem resize max / else - echo "[ INFO ] The root file system ($ROOT_DEV) does not seem to be on a partition. Skipping partition resize..." + echo "[FAILED] Unsupported root file system type ($ROOT_FSTYPE). Aborting..." + exit 1 fi - # Maximize root file system - resize2fs "$ROOT_DEV" - exit 0 } From 7e8046c2404f37d1c03ad55729747a57ef85458f Mon Sep 17 00:00:00 2001 From: MichaIng Date: Tue, 9 Mar 2021 21:08:44 +0100 Subject: [PATCH 013/147] v7.1 + DietPi-Software | X.Org X Server: On RPi, install xserver-xorg-video-fbdev by default, which is required when no KMS device tree overlay is enabled. fbdev will be used as fallback, hence modesetting (KMS) will be used, i possible. + DietPi-Software | LXDE: Since LightDM is pulled as part of the dependency tail and assigns itself as default display manager, check whether a default display manager is set, before installing the packages, and if not, remove it afterwards. Else LightDM will start automatically on reboot without users having manual desktop login chosen. --- dietpi/dietpi-software | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index 034136ec91..1ae9f5df16 100644 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -3164,18 +3164,19 @@ _EOF_ Banner_Installing # RPi: Block packages from RPi desktop which conflict with a native LXDE desktop: https://github.com/MichaIng/DietPi/issues/1558#issuecomment-691206284 - if (( $G_HW_MODEL < 10 )); then - - cat << '_EOF_' > /etc/apt/preferences.d/dietpi-lxde + (( $G_HW_MODEL > 9 )) || cat << '_EOF_' > /etc/apt/preferences.d/dietpi-lxde Package: pcmanfm libfm4 libfm-gtk4 lxpanel lxpanel-data Pin: origin archive.raspberrypi.org Pin-Priority: -1 _EOF_ - fi # https://github.com/MichaIng/DietPi/issues/1558#issuecomment-701547904 local dbus_package= (( ${aSOFTWARE_INSTALL_STATE[28]} > 0 )) && dbus_package='dbus-user-session' + # LXDE pulls in LightDM as dependency, which sets up itself as display manager so that the system boots automatically into it. So check whether a default display manager is present first, and if not, remove it afterwards. + local display_manager=0 + [[ -f '/etc/systemd/system/display-manager.service' ]] && display_manager=1 G_AGI lxde upower firefox-esr $dbus_package xcompmgr + [[ $display_manager == 0 && -f '/etc/systemd/system/display-manager.service' ]] && G_EXEC rm /etc/systemd/system/display-manager.service fi @@ -6799,6 +6800,9 @@ exec sudo -u $ha_user dash -c '$ha_pyenv_activation; exec pip3 install -U homeas # Generic X server + Mesa OpenGL libraries and utilities DEPS_LIST='xserver-xorg-core xserver-xorg-input-libinput xinit dbus-x11 xfonts-base x11-xserver-utils x11-utils libgl1-mesa-dri mesa-utils mesa-utils-extra' + # On RPi, add fbdev display driver, as modesetting requires the full- or fake KMS driver overlay being enabled, so that /dev/dri/card0 exists. + (( $G_HW_MODEL > 9 )) || DEPS_LIST+=' xserver-xorg-video-fbdev' + # On VM, add VMware display driver, which offers slightly better performance. VirtualBox can emulate it as well, which es even the nowadays recommended default. (( $G_HW_MODEL == 20 )) && DEPS_LIST+=' xserver-xorg-video-vmware' From 880182ddcfd9a06661c5f08e8d578aa083d4a7c9 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Tue, 9 Mar 2021 22:50:38 +0100 Subject: [PATCH 014/147] v7.1 + CHANGELOG | Resolved X server and LXDE issues --- CHANGELOG.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index bc1b34d2bf..5195dff5bd 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -8,6 +8,8 @@ Changes: Fixes: - DietPi-Software | Resolved an issue where the "uninstall" command did not work and the "reinstall" did not show the intended backup prompt. Many thanks to @Zeuskk for reporting this v7.0 regression: https://dietpi.com/phpbb/viewtopic.php?t=8729 +- DietPi-Software | X.Org X Server: Resolved an issue on RPi where the X server start failed when the KMS device tree overlay was not enabled. Many thanks to @xthedakmanx for reporting this issue: https://github.com/MichaIng/DietPi/issues/4175 +- DietPi-Software | LXDE: Resolved an issue where after installing LXDE, the system booted into the LightDM desktop login mask automatically, even if desktop autologin was not chosen via dietpi-autostart. Many thanks to @manilx for reporting this issue: https://dietpi.com/phpbb/viewtopic.php?t=8766 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/XXXX From 6ee389d1f55abe99ae25782a6ce7c35f2c258612 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Wed, 10 Mar 2021 17:13:02 +0100 Subject: [PATCH 015/147] v7.1 + Images | Add Odroid N2 boot config supporting Odroid N2+ device tree, CPU frequencies and a boot label for petitboot --- boot_n2.ini | 119 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 boot_n2.ini diff --git a/boot_n2.ini b/boot_n2.ini new file mode 100644 index 0000000000..880b824a9a --- /dev/null +++ b/boot_n2.ini @@ -0,0 +1,119 @@ +ODROIDN2-UBOOT-CONFIG + +# Serial console device: /dev/tty1 is appended automatically +setenv condev "console=ttyS0,115200n8" + +# Auto-detection of monitor settings based on your screen information +setenv display_autodetect "true" + +# HDMI mode resolution configuration +# Symbol | Resolution +# ----------------------+------------- +# "480x272p60hz" | 480x272 Progressive 60Hz +# "480x320p60hz" | 480x320 Progressive 60Hz +# "480p60hz" | 720x480 Progressive 60Hz +# "576p50hz" | 720x576 Progressive 50Hz +# "720p60hz" | 1280x720 Progressive 60Hz +# "720p50hz" | 1280x720 Progressive 50Hz +# "1080p60hz" | 1920x1080 Progressive 60Hz +# "1080p50hz" | 1920x1080 Progressive 50Hz +# "1080p30hz" | 1920x1080 Progressive 30Hz +# "1080p24hz" | 1920x1080 Progressive 24Hz +# "1080i60hz" | 1920x1080 Interlaced 60Hz +# "1080i50hz" | 1920x1080 Interlaced 50Hz +# "2160p60hz" | 3840x2160 Progressive 60Hz +# "2160p50hz" | 3840x2160 Progressive 50Hz +# "2160p30hz" | 3840x2160 Progressive 30Hz +# "2160p25hz" | 3840x2160 Progressive 25Hz +# "2160p24hz" | 3840x2160 Progressive 24Hz +# "smpte24hz" | 3840x2160 Progressive 24Hz SMPTE +# "2160p60hz420" | 3840x2160 Progressive 60Hz YCbCr 4:2:0 +# "2160p50hz420" | 3840x2160 Progressive 50Hz YCbCr 4:2:0 +# "640x480p60hz" | 640x480 Progressive 60Hz +# "800x480p60hz" | 800x480 Progressive 60Hz +# "800x600p60hz" | 800x600 Progressive 60Hz +# "1024x600p60hz" | 1024x600 Progressive 60Hz +# "1024x768p60hz" | 1024x768 Progressive 60Hz +# "1280x800p60hz" | 1280x800 Progressive 60Hz +# "1280x1024p60hz" | 1280x1024 Progressive 60Hz +# "1360x768p60hz" | 1360x768 Progressive 60Hz +# "1440x900p60hz" | 1440x900 Progressive 60Hz +# "1600x900p60hz" | 1600x900 Progressive 60Hz +# "1600x1200p60hz" | 1600x1200 Progressive 60Hz +# "1680x1050p60hz" | 1680x1050 Progressive 60Hz +# "1920x1200p60hz" | 1920x1200 Progressive 60Hz +# "2560x1080p60hz" | 2560x1080 Progressive 60Hz +# "2560x1440p60hz" | 2560x1440 Progressive 60Hz +# "2560x1600p60hz" | 2560x1600 Progressive 60Hz +# "3440x1440p60hz" | 3440x1440 Progressive 60Hz +setenv hdmimode "1080p60hz" + +# Overscan percentage +# This value scales down the actual screen size by the percentage below. +# Valid range is 80 to 100. +setenv overscan "100" + +# Output mode: "hdmi" or "dvi" +# "dvi" disables HDMI audio. +setenv voutmode "hdmi" + +# HPD enable/disable option: "false" or "true" +setenv disablehpd "false" + +# Hardkernel ODROID-VU7 support: "false" or "true" +# By default VU7 support is disabled +setenv disable_vu7 "true" + +# Max CPU frequency for big A73 cores in MHz +# - Valid values on Odroid N2: 500, 667, 1000, 1200, 1398, 1512, 1608, 1704, 1800 (default), 1908, 2004 +# - Valid values on Odroid N2+: 500, 667, 1000, 1200, 1398, 1512, 1608, 1704, 1800, 1908, 2016, 2100, 2208 (default), 2304, 2400 +#setenv max_freq_a73 "2004" + +# Max CPU frequency for small A53 cores in MHz +# - Valid values on Odroid N2: 100, 250, 500, 667, 1000, 1200, 1398, 1512, 1608, 1704, 1896 (default), 1992 +# - Valid values on Odroid N2+: 500, 667, 1000, 1200, 1398, 1512, 1608, 1704, 1800, 1908 (default), 2016 +#setenv max_freq_a53 "1992" + +# Max CPU cores +# Note: +# CPU's 0 and 1 are the A53 (small cores) +# CPU's 2 to 5 are the A73 (big cores) +# Lowering this value disables only the bigger cores (the last cores). +# Valid range is 1 to 6. +setenv maxcpus "6" + +### DO NOT EDIT ANYTHING BELOW THIS LINE ### + +# Apply HDMI settings +if test "${display_autodetect}" = "true"; then hdmitx edid; fi +if test "${hdmimode}" = "custombuilt"; then setenv cmode "modeline=${modeline}"; fi + +# Apply VU7 settings +if test "${disable_vu7}" = "false"; then setenv hid_quirks "usbhid.quirks=0x0eef:0x0005:0x0004"; fi + +# Apply CPU frequencies if assigned +if test "${max_freq_a73}"; then setenv a73_freq "max_freq_a73=${max_freq_a73}"; fi +if test "${max_freq_a53}"; then setenv a53_freq "max_freq_a53=${max_freq_a53}"; fi + +# Label for petitboot +setenv bootlabel "DietPi (64-bit)" + +# Boot args +setenv bootargs "root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait rw ${condev} ${amlogic} no_console_suspend fsck.repair=yes net.ifnames=0 elevator=noop hdmimode=${hdmimode} cvbsmode=576cvbs maxcpus=${maxcpus} voutmode=${voutmode} disablehpd=${disablehpd} ${hid_quirks} ${cmode} overscan=${overscan} cvbscable=${cvbscable} ${a73_freq] ${a53_freq}" + +# Set load addresses +setenv dtb_loadaddr "0x1000000" +setenv k_addr "0x1100000" +setenv loadaddr "0x1B00000" +setenv initrd_loadaddr "0x3700000" + +# Load kernel, dtb and initrd +fatload mmc ${devno}:1 ${k_addr} Image.gz +fatload mmc ${devno}:1 ${dtb_loadaddr} meson64_odroid${variant}.dtb +fatload mmc ${devno}:1 ${initrd_loadaddr} uInitrd +fdt addr ${dtb_loadaddr} +# unzip the kernel +unzip ${k_addr} ${loadaddr} + +# boot +booti ${loadaddr} ${initrd_loadaddr} ${dtb_loadaddr} From 8274830ca50974a05c47e60dcac12355a8d7ccce Mon Sep 17 00:00:00 2001 From: MichaIng Date: Wed, 10 Mar 2021 19:38:27 +0100 Subject: [PATCH 016/147] v7.1 + Odroid N2 | Add support for additional HDMI/monitor features, CEC, WOL and device tree overlays. All credits go to Meveric: https://forum.odroid.com/viewtopic.php?p=323888#p323888 --- boot_n2.ini | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/boot_n2.ini b/boot_n2.ini index 880b824a9a..f36cef5d20 100644 --- a/boot_n2.ini +++ b/boot_n2.ini @@ -1,11 +1,31 @@ ODROIDN2-UBOOT-CONFIG +setenv board "odroidn2" + # Serial console device: /dev/tty1 is appended automatically setenv condev "console=ttyS0,115200n8" -# Auto-detection of monitor settings based on your screen information +# Auto-detection of monitor settings based on your screen information: "false" or "true" setenv display_autodetect "true" +# Toggle HDMI output: "false" or "true" +setenv monitor_onoff "false" + +# Force SDR or HDR mode: "sdr", "hdr" or "auto" +setenv sdrmode "auto" + +# Toggle CEC support: "false" or "true" +setenv cec "true" + +# Toggle Wake-On-Lan support: 0=disable, 1=enable +setenv enable_wol "0" + +# Device tree overlays +# See /boot/overlays/odroidn2/ for available overlays, e.g.: +# - hktft32: 3.2" TFT from HardKernel +# - hktft35: 3.5" TFT from HardKernel +#setenv overlays "spi0 i2c0 i2c1 uart0" + # HDMI mode resolution configuration # Symbol | Resolution # ----------------------+------------- @@ -88,6 +108,9 @@ setenv maxcpus "6" if test "${display_autodetect}" = "true"; then hdmitx edid; fi if test "${hdmimode}" = "custombuilt"; then setenv cmode "modeline=${modeline}"; fi +# Apply CEC setting +if test "${cec}" = "true"; then setenv cec_enable "hdmitx=cec3f"; fi + # Apply VU7 settings if test "${disable_vu7}" = "false"; then setenv hid_quirks "usbhid.quirks=0x0eef:0x0005:0x0004"; fi @@ -99,7 +122,7 @@ if test "${max_freq_a53}"; then setenv a53_freq "max_freq_a53=${max_freq_a53}"; setenv bootlabel "DietPi (64-bit)" # Boot args -setenv bootargs "root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait rw ${condev} ${amlogic} no_console_suspend fsck.repair=yes net.ifnames=0 elevator=noop hdmimode=${hdmimode} cvbsmode=576cvbs maxcpus=${maxcpus} voutmode=${voutmode} disablehpd=${disablehpd} ${hid_quirks} ${cmode} overscan=${overscan} cvbscable=${cvbscable} ${a73_freq] ${a53_freq}" +setenv bootargs "root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait ro ${condev} ${amlogic} no_console_suspend fsck.repair=yes net.ifnames=0 elevator=noop hdmimode=${hdmimode} cvbsmode=576cvbs maxcpus=${maxcpus} voutmode=${voutmode} disablehpd=${disablehpd} enable_wol=${enable_wol} ${cec_enable} sdrmode=${sdrmode} consoleblank=0 logo=osd0,loaded monitor_onoff=${monitor_onoff} ${hid_quirks} ${cmode} overscan=${overscan} cvbscable=${cvbscable} ${a73_freq] ${a53_freq}" # Set load addresses setenv dtb_loadaddr "0x1000000" @@ -112,8 +135,18 @@ fatload mmc ${devno}:1 ${k_addr} Image.gz fatload mmc ${devno}:1 ${dtb_loadaddr} meson64_odroid${variant}.dtb fatload mmc ${devno}:1 ${initrd_loadaddr} uInitrd fdt addr ${dtb_loadaddr} -# unzip the kernel + +# Load device tree overlays +if test "${overlays}"; then + setenv dtbo_addr_r "0x11000000" + fdt resize "16384" + for overlay in ${overlays}; do + fatload mmc ${devno}:1 ${dtbo_addr_r} overlays/${board}/${overlay}.dtbo && fdt apply ${dtbo_addr_r} + done +fi + +# Unzip the kernel unzip ${k_addr} ${loadaddr} -# boot +# Boot booti ${loadaddr} ${initrd_loadaddr} ${dtb_loadaddr} From 20f0d1e66fb6436732fe7fd8747ea4649e6c4d6d Mon Sep 17 00:00:00 2001 From: MichaIng Date: Wed, 10 Mar 2021 20:50:42 +0100 Subject: [PATCH 017/147] v7.1 + Odroid C1 | Reveal a bunch of new boot configuration settings settings --- boot_c2.ini | 118 +++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 103 insertions(+), 15 deletions(-) diff --git a/boot_c2.ini b/boot_c2.ini index 82f34ace25..8896f69ad8 100644 --- a/boot_c2.ini +++ b/boot_c2.ini @@ -1,26 +1,72 @@ ODROIDC2-UBOOT-CONFIG -#Resolution + Refresh rate +# Auto-detection of monitor settings based on your screen information: "false" or "true" +# See: http://odroid.com/dokuwiki/doku.php?id=en:c2_auto_detect_display +setenv display_autodetect "true" + +# Display modes +# 480 Lines (720x480) +# - "480i60hz" # Interlaced 60Hz +# - "480i_rpt" # Interlaced for Rear Projection Televisions 60Hz +# VESA modes +# - "640x480p60hz" +# - "800x480p60hz" +# - "480x320p60hz" +# - "480x800p60hz" +# - "800x600p60hz" +# - "1024x600p60hz" +# - "1024x768p60hz" +# - "1280x800p60hz" +# - "1280x1024p60hz" +# - "1360x768p60hz" +# - "1440x900p60hz" +# - "1600x900p60hz" +# - "1680x1050p60hz" +# - "1600x1200p60hz" +# - "1920x1200p60hz" +# - "2560x1080p60hz" +# - "2560x1440p60hz" +# - "2560x1600p60hz" +# - "3440x1440p60hz" setenv m "720p60hz" -# HDMI BPP Mode +# Custom modeline! +# To use custom modeline you need to disable all the above resolutions. +# and setup your own! +# For more information check our wiki: +# http://odroid.com/dokuwiki/doku.php?id=en:c2_hdmi_autosetting +# Example: +#setenv m "custombuilt" +#setenv modeline "1920,1200,154000,74040,60,1920,1968,2000,2080,1200,1202,1208,1235,1,0,1" + +# HDMI BPP mode setenv m_bpp "32" -# HDMI DVI/VGA modes -# Uncomment only a single Line! The line with setenv written. -# At least one mode must be selected. (no true ;) ) -# setenv vout "dvi" -# setenv vout "vga" +# HDMI DVI/VGA mode: "dvi" or "vga" +#setenv vout "dvi" -# HDMI HotPlug Detection control +# HDMI HotPlug Detection control: "false" or "true" # Allows you to force HDMI thinking that the cable is connected. # true = HDMI will believe that cable is always connected # false = will let board/monitor negotiate the connection status setenv hpd "true" -# setenv hpd "false" -# Default Console Device Setting -setenv condev "console=tty0 console=ttyS0,115200n8" +# Toggle HDMI output: "false" or "true" +setenv monitor_onoff "false" + +# Toggle CEC support +# 0 = Disable CEC +# 1 = Enable CEC +# 2 = Enable but disable auto TV switching ON +setenv cec "1" + +# Force HDMI to use RGB colorspace regardless of TV request +# 0 Disable +# 1 Enable +setenv hdmi_forcergb "0" + +# Default console settings +setenv condev "consoleblank=0 console=tty0 console=ttyS0,115200n8" # Meson Timer # 1 - Meson Timer @@ -29,15 +75,55 @@ setenv condev "console=tty0 console=ttyS0,115200n8" # Using arch timer allows KVM/Virtualization to work however you'll experience poor video setenv mesontimer "1" -# Server Mode (aka. No Graphics) +# Server mode (aka. No Graphics) # Setting nographics to 1 will disable all video subsystem # This mode is ideal of server type usage. (Saves ~300Mb of RAM) setenv nographics "0" -########################################### +# Toggle UHS (Ultra High Speed) micro SD mode: "false" or "true" +setenv disableuhs "false" + +# Force micro SD detection: "false" or "true" +# - Forces the MMC controlled to believe that a card is connected. +setenv mmc_removable "true" + +# Toggle USB multi-webcam tweak: "false" or "true" +# - Only enable this if you use it. +setenv usbmulticam "false" + +# Disable/Enable ODROID-VU7 Touchscreen: "false" or "true" +setenv disable_vu7 "false" + +### WARNING!!! WARNING!!! WARNING!!! +# Before changing anything here please read the wiki entry: +# http://odroid.com/dokuwiki/doku.php?id=en:c2_set_cpu_freq -# Boot Arguments -setenv bootargs "root=/dev/mmcblk0p2 rootwait ro ${condev} no_console_suspend hdmimode=${m} m_bpp=${m_bpp} vout=${vout} fsck.repair=yes net.ifnames=0 elevator=noop disablehpd=${hpd}" +# Max CPU cores: "1", "2", "3" or "4" +setenv maxcpus "4" + +# Max CPU frequency in MHz:"1536", "1680", "1752", "1896", "1920", "1944", "2016" +setenv max_freq "1536" + +### DO NOT EDIT ANYTHING BELOW THIS LINE ### + +# Apply display auto-detect +if test "${display_autodetect}" = "true"; then usb pwren; hdmitx edid; fi + +# Apply custom resolution mode +if test "${m}" = "custombuilt"; then setenv cmode "modeline=${modeline}"; fi + +# Apply VU7 setting +if test "${disable_vu7}" = "false"; then setenv hid_quirks "usbhid.quirks=0x0eef:0x0005:0x0004"; fi + +# Apply CEC option +if test "${cec}" = "1"; then setenv cec "cecf"; fi +if test "${cec}" = "2"; then setenv cec "cec7"; fi + +# Apply forced RGB mode +if test "${hdmi_forcergb}" = "1"; then setenv forcergb "hdmitx=forcergb"; fi + +# Boot args +setenv bootargs "root=/dev/mmcblk0p2 rootwait ro ${condev} no_console_suspend hdmitx=${cec} ${forcergb} hdmimode=${m} m_bpp=${m_bpp} vout=${vout} fsck.repair=yes max_freq=${max_freq} maxcpus=${maxcpus} monitor_onoff=${monitor_onoff} disableuhs=${disableuhs} mmc_removable=${mmc_removable} usbmulticam=${usbmulticam} ${hid_quirks} net.ifnames=0 elevator=noop disablehpd=${hpd} ${cmode}" # Booting @@ -58,4 +144,6 @@ if test "${nographics}" = "1"; then fdt rm /meson-fb; fdt rm /amhdmitx; fdt rm / if test "${nographics}" = "1"; then fdt rm /meson-vout; fdt rm /mesonstream; fdt rm /meson-fb; fi if test "${nographics}" = "1"; then fdt rm /deinterlace; fdt rm /codec_mm; fi +if test "${cec}" = "0"; then fdt rm /aocec; fi + booti ${loadaddr} ${initrd_loadaddr} ${dtb_loadaddr} From 4af8e48faba1c0d3a53607e1961adbfede322c80 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Wed, 10 Mar 2021 22:22:44 +0100 Subject: [PATCH 018/147] v7.1 + DietPi-PREP | Odroid N2: Apply our new own Odroid N2 U-Boot config --- PREP_SYSTEM_FOR_DIETPI.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PREP_SYSTEM_FOR_DIETPI.sh b/PREP_SYSTEM_FOR_DIETPI.sh index 8301a4f16c..8abd9af94c 100644 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -626,6 +626,10 @@ Currently installed: $G_DISTRO_NAME (ID: $G_DISTRO)"; then G_EXEC mv "DietPi-$G_GITBRANCH/boot_c2.ini" /boot/boot.ini + elif (( $G_HW_MODEL == 15 )); then + + G_EXEC mv "DietPi-$G_GITBRANCH/boot_n2.ini" /boot/boot.ini + fi G_EXEC mv "DietPi-$G_GITBRANCH/dietpi.txt" /boot/ From 743af4912e44ce3024c580972e7f916635a21b8a Mon Sep 17 00:00:00 2001 From: MichaIng Date: Thu, 11 Mar 2021 13:36:50 +0100 Subject: [PATCH 019/147] v7.1 + DietPi-PREP | The Odroid C4/HC4 repo now contains a U-Boot package, hence apply it via G_AGI to simplify code, G_AGDUG later equals both ways. AFAIK that U-Boot is still for N2, so a placeholder only, but the install is a noop until it gets a new version, which will then be the actual C4 U-Boot. --- PREP_SYSTEM_FOR_DIETPI.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/PREP_SYSTEM_FOR_DIETPI.sh b/PREP_SYSTEM_FOR_DIETPI.sh index 8abd9af94c..14d7557b9a 100644 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -864,8 +864,7 @@ Currently installed: $G_DISTRO_NAME (ID: $G_DISTRO)"; then # Odroid C4 elif (( $G_HW_MODEL == 16 )); then - G_AGI linux-image-arm64-odroid-c4 meveric-keyring - G_EXEC_NOHALT=1 G_EXEC apt-mark manual u-boot # Workaround until C4 u-boot package has been added to repo: https://dietpi.com/meveric/pool/c4/ + G_AGI linux-image-arm64-odroid-c4 meveric-keyring u-boot # On C4, the kernel package does not depend on the U-Boot package # Apply kernel postinst steps manually, that depend on /proc/cpuinfo content, not matching when running in a container. [[ -f '/boot/Image' ]] && G_EXEC mv /boot/Image /boot/Image.gz [[ -f '/boot/Image.gz.bak' ]] && G_EXEC rm /boot/Image.gz.bak From 000cfe51339502ec3e86ab95384895b8c6a56c7e Mon Sep 17 00:00:00 2001 From: MichaIng Date: Thu, 11 Mar 2021 20:38:01 +0100 Subject: [PATCH 020/147] v7.1 + Odroid C2 | No not set nographics by default as having it unset or "0" has the same result, only "1" has a meaning. Also enhance comments slightly. --- boot_c2.ini | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/boot_c2.ini b/boot_c2.ini index 8896f69ad8..4ea0560c4f 100644 --- a/boot_c2.ini +++ b/boot_c2.ini @@ -75,10 +75,10 @@ setenv condev "consoleblank=0 console=tty0 console=ttyS0,115200n8" # Using arch timer allows KVM/Virtualization to work however you'll experience poor video setenv mesontimer "1" -# Server mode (aka. No Graphics) -# Setting nographics to 1 will disable all video subsystem -# This mode is ideal of server type usage. (Saves ~300Mb of RAM) -setenv nographics "0" +# Disable video output +# - Setting nographics to "1" will disable all video subsystems. +# - This mode is ideal for headless server type usage, as it saves ~300 MiB RAM. +#setenv nographics "1" # Toggle UHS (Ultra High Speed) micro SD mode: "false" or "true" setenv disableuhs "false" @@ -101,7 +101,7 @@ setenv disable_vu7 "false" # Max CPU cores: "1", "2", "3" or "4" setenv maxcpus "4" -# Max CPU frequency in MHz:"1536", "1680", "1752", "1896", "1920", "1944", "2016" +# Max CPU frequency in MHz: "1536" (default), "1680", "1752", "1896", "1920", "1944", "2016" setenv max_freq "1536" ### DO NOT EDIT ANYTHING BELOW THIS LINE ### From 72a40175c9e3e87b0419c3b8dd77b2131d944fec Mon Sep 17 00:00:00 2001 From: MichaIng Date: Thu, 11 Mar 2021 22:20:22 +0100 Subject: [PATCH 021/147] v7.1 + DietPi-Banner | Replace old donate URL with new contribution page --- dietpi/func/dietpi-banner | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dietpi/func/dietpi-banner b/dietpi/func/dietpi-banner index 7a125a5b4e..8afeb480e3 100644 --- a/dietpi/func/dietpi-banner +++ b/dietpi/func/dietpi-banner @@ -156,11 +156,11 @@ $GREEN_LINE" echo -e " ${aCOLOUR[2]}DietPi Team : MichaIng (lead), Daniel Knight (founder), Joulinar (support)" - [[ -f '/boot/dietpi/.prep_info' ]] && mawk 'NR==1 {sub(/^0$/,"DietPi Core Team");a=$0} NR==2 {print " Image : "a" (pre-image: "$0")"}' /boot/dietpi/.prep_info + [[ -f '/boot/dietpi/.prep_info' ]] && mawk 'NR==1 {sub(/^0$/,"DietPi Core Team");a=$0} NR==2 {print " Image by : "a" (pre-image: "$0")"}' /boot/dietpi/.prep_info echo -e " Web : https://dietpi.com | https://twitter.com/DietPi_ Patreon Legends : Camry2731 - Donate : https://dietpi.com/#donate + Contribute : https://dietpi.com/contribute.html DietPi Hosting : Powered by https://myvirtualserver.com$COLOUR_RESET\n" # DietPi update available? From b880c92397d0f94fcab2c1c77b6f07ab0a921f78 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Fri, 12 Mar 2021 13:07:00 +0100 Subject: [PATCH 022/147] v7.1 + DietPi-PREP | Do not compile locales at start of the script. C-UTF-8 is statically available as part of the libc-bin essential. Simply export the variables and reset /etc/environment for sub scripts. Reset and clear locales as part of the later steps via "dietpi-set_software locale". + DietPi-PREP | Minor refinement of automatic detection and interactive input steps. Rule out ARMv6 on Debian (instead of Raspbian), which would be armel and is not supported by DietPi. --- PREP_SYSTEM_FOR_DIETPI.sh | 235 +++++++++++++++----------------------- 1 file changed, 90 insertions(+), 145 deletions(-) diff --git a/PREP_SYSTEM_FOR_DIETPI.sh b/PREP_SYSTEM_FOR_DIETPI.sh index 14d7557b9a..edc3fa7c30 100644 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -40,6 +40,12 @@ fi + # Set locale + # - Reset possibly conflicting environment for sub scripts + > /etc/environment + # - Apply override LC_ALL and default LANG for current script + export LC_ALL='C.UTF-8' LANG='C.UTF-8' + # Set $PATH variable to include all expected default binary locations, since we don't know the current system setup: https://github.com/MichaIng/DietPi/issues/3206 export PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' @@ -56,7 +62,7 @@ # RPi: Allow PDiffs since the "slow implementation" argument is outdated and PDiffs allow lower download size and less disk I/O [[ -f '/etc/apt/apt.conf.d/50raspi' ]] && rm -v /etc/apt/apt.conf.d/50raspi # https://github.com/MichaIng/DietPi/issues/4083 - rm -f /etc/apt/sources.list.d/vscode.list /etc/apt/trusted.gpg.d/microsoft.gpg /etc/apt/preferences.d/3rd_parties.pref + rm -fv /etc/apt/sources.list.d/vscode.list /etc/apt/trusted.gpg.d/microsoft.gpg /etc/apt/preferences.d/3rd_parties.pref # Meveric: https://github.com/MichaIng/DietPi/issues/1285#issuecomment-355759321 [[ -f '/etc/apt/sources.list.d/deb-multimedia.list' ]] && rm -v /etc/apt/sources.list.d/deb-multimedia.list [[ -f '/etc/apt/preferences.d/deb-multimedia-pin-99' ]] && rm -v /etc/apt/preferences.d/deb-multimedia-pin-99 @@ -66,7 +72,7 @@ # Conflicting configs rm -fv /etc/apt/apt.conf.d/*{recommends,armbian}* # - Apply wanted APT configs: Overwritten by DietPi code archive - cat << _EOF_ > /etc/apt/apt.conf.d/97dietpi # https://raw.githubusercontent.com/MichaIng/DietPi/dev/rootfs/etc/apt/apt.conf.d/97dietpi + cat << '_EOF_' > /etc/apt/apt.conf.d/97dietpi # https://raw.githubusercontent.com/MichaIng/DietPi/dev/rootfs/etc/apt/apt.conf.d/97dietpi APT::Install-Recommends "false"; APT::Install-Suggests "false"; APT::AutoRemove::RecommendsImportant "false"; @@ -80,7 +86,7 @@ Acquire::IndexTargets::deb-src::Sources::KeepCompressedAs "xz"; _EOF_ # - Forcing new DEB package config files (during PREP only) echo -e '#clear DPkg::options;\nDPkg::options:: "--force-confmiss,confnew";' > /etc/apt/apt.conf.d/98dietpi-forceconf - # - Prefer IPv4 by default to avoid hanging access attempts in some cases + # - Prefer IPv4 by default to avoid hanging access attempts in some cases, e.g. WiFi bridges # NB: This needs to match the method in: /DietPi/dietpi/func/dietpi-set_hardware preferipv4 enable echo 'Acquire::ForceIPv4 "true";' > /etc/apt/apt.conf.d/99-dietpi-force-ipv4 @@ -92,7 +98,6 @@ _EOF_ 'curl' # Download DietPi-Globals... 'ca-certificates' # ...via HTTPS - 'locales' # Set C.UTF-8 locale 'whiptail' # G_WHIP ) @@ -100,14 +105,9 @@ _EOF_ grep -q 'stretch' /etc/os-release && aAPT_PREREQS+=('apt-transport-https') for i in "${aAPT_PREREQS[@]}" do - - if ! dpkg-query -s "$i" &> /dev/null && ! apt-get -y install "$i"; then - - echo -e "[FAILED] Unable to install $i, please try to install it manually:\n\t # apt install $i\n" - exit 1 - - fi - + dpkg-query -s "$i" &> /dev/null && apt-get -y install "$i" && continue + echo -e "[FAILED] Unable to install $i, please try to install it manually:\n\t # apt install $i\n" + exit 1 done unset -v aAPT_PREREQS @@ -127,26 +127,6 @@ _EOF_ fi - # Setup locale - # - Reset existing configs - > /etc/environment - [[ -f '/etc/default/locale' ]] && rm /etc/default/locale - # - Prepare C.UTF-8 generation only, statically shipped as /usr/lib/locale/C.UTF-8 via libc-bin essential package - echo 'C.UTF-8 UTF-8' > /etc/locale.gen - # - Apply override LC_ALL and default LANG for current script - export LC_ALL='C.UTF-8' LANG='C.UTF-8' - # - dpkg-reconfigure includes: - # - "locale-gen": Generate locale(s) based on "/etc/locale.gen" or interactive selection. - # - "update-locale": Add LANG to "/etc/default/locale" based on generated locale(s) or interactive default language selection. - if ! dpkg-reconfigure -f noninteractive locales; then - - echo -e '[FAILED] Locale generation failed. Aborting...\n' - exit 1 - - fi - # - Add override LC_ALL to "/etc/default/locale" as well - update-locale 'LC_ALL=C.UTF-8' - # Set Git owner GITOWNER=${GITOWNER:-MichaIng} @@ -162,7 +142,7 @@ _EOF_ ) if ! GITBRANCH=$(whiptail --title "$G_PROGRAM_NAME" --menu 'Please select the Git branch the installer should use:' --default-item 'master' --ok-button 'Ok' --cancel-button 'Exit' --backtitle "$G_PROGRAM_NAME" 12 80 3 "${aWHIP_BRANCH[@]}" 3>&1 1>&2 2>&3-); then - echo -e '[ INFO ] No choice detected. Aborting...\n' + echo -e '[ INFO ] Exit selected. Aborting...\n' exit 0 fi @@ -204,7 +184,7 @@ _EOF_ G_GITBRANCH=$GITBRANCH unset -v GITOWNER GITBRANCH - # Detect the Debian version of this operating system + # Detect the distro version of this operating system if grep -q 'stretch' /etc/os-release; then G_DISTRO=4 @@ -222,35 +202,44 @@ _EOF_ else - G_DIETPI-NOTIFY 1 "Unknown or unsupported distribution version: $(sed -n '/^PRETTY_NAME=/{s/^PRETTY_NAME=//p;q}' /etc/os-release 2>&1). Aborting...\n" + G_DIETPI-NOTIFY 1 "Unsupported distribution version: $(sed -n '/^PRETTY_NAME=/{s/^PRETTY_NAME=//p;q}' /etc/os-release 2>&1). Aborting...\n" exit 1 fi + G_DIETPI-NOTIFY 2 "Detected distribution version: ${G_DISTRO_NAME^} (ID: $G_DISTRO)" # Detect the hardware architecture of this operating system G_HW_ARCH_NAME=$(uname -m) - if [[ $G_HW_ARCH_NAME == 'armv6l' ]]; then + if grep -q '^ID=raspbian' /etc/os-release; then - G_HW_ARCH=1 + # Raspbian: Force ARMv6 + G_RASPBIAN=1 G_HW_ARCH=1 - elif [[ $G_HW_ARCH_NAME == 'armv7l' ]]; then + else - G_HW_ARCH=2 + # Debian: ARMv6 is not supported here + G_RASPBIAN=0 + if [[ $G_HW_ARCH_NAME == 'armv7l' ]]; then - elif [[ $G_HW_ARCH_NAME == 'aarch64' ]]; then + G_HW_ARCH=2 - G_HW_ARCH=3 + elif [[ $G_HW_ARCH_NAME == 'aarch64' ]]; then - elif [[ $G_HW_ARCH_NAME == 'x86_64' ]]; then + G_HW_ARCH=3 - G_HW_ARCH=10 + elif [[ $G_HW_ARCH_NAME == 'x86_64' ]]; then - else + G_HW_ARCH=10 - G_DIETPI-NOTIFY 1 "Unknown or unsupported CPU architecture: \"$G_HW_ARCH_NAME\". Aborting...\n" - exit 1 + else + + G_DIETPI-NOTIFY 1 "Unsupported CPU architecture: \"$G_HW_ARCH_NAME\". Aborting...\n" + exit 1 + + fi fi + G_DIETPI-NOTIFY 2 "Detected target CPU architecture: $G_HW_ARCH_NAME (ID: $G_HW_ARCH)" Main(){ @@ -307,61 +296,55 @@ _EOF_ else - G_WHIP_INPUTBOX 'Please enter your name. This will be used to identify the image creator within credits banner.\n\nYou can add your contact information as well for end users.\n\nNB: An entry is required.' + G_WHIP_BUTTON_CANCEL_TEXT='Exit' + if ! G_WHIP_INPUTBOX 'Please enter your name. This will be used to identify the image creator within credits banner.\n\nYou can add your contact information as well for end users.\n\nNB: An entry is required.'; then - fi - - if [[ $G_WHIP_RETURNED_VALUE ]]; then + G_DIETPI-NOTIFY 1 'Exit selected. Aborting...\n' + exit 0 - # Disallowed? - DISALLOWED_NAME=0 - aDISALLOWED_NAMES=( + fi - 'official' - 'fourdee' - 'daniel knight' - 'dan knight' - 'michaing' - 'diet' + fi - ) + # Disallowed names + aDISALLOWED_NAMES=( - for i in "${aDISALLOWED_NAMES[@]}" - do + 'official' + 'fourdee' + 'daniel knight' + 'dan knight' + 'michaing' + 'diet' - [[ ${G_WHIP_RETURNED_VALUE,,} =~ $i ]] || continue - DISALLOWED_NAME=1 - break + ) - done - unset -v aDISALLOWED_NAMES + for i in "${aDISALLOWED_NAMES[@]}" + do + [[ ${G_WHIP_RETURNED_VALUE,,} =~ $i ]] || continue + G_WHIP_MSG "\"$G_WHIP_RETURNED_VALUE\" is reserved and cannot be used. Please try again." + continue 2 + done + unset -v aDISALLOWED_NAMES - if (( $DISALLOWED_NAME )); then + IMAGE_CREATOR=$G_WHIP_RETURNED_VALUE + break - G_WHIP_MSG "\"$G_WHIP_RETURNED_VALUE\" is reserved and cannot be used. Please try again." + done + G_DIETPI-NOTIFY 2 "Entered image creator: $IMAGE_CREATOR" - else + # Pre-image used/name: Respect environment variable + if [[ ! $PREIMAGE_INFO ]]; then - IMAGE_CREATOR=$G_WHIP_RETURNED_VALUE - break + G_WHIP_BUTTON_CANCEL_TEXT='Exit' + if ! G_WHIP_INPUTBOX 'Please enter the name or URL of the pre-image you installed on this system, prior to running this script. This will be used to identify the pre-image credits.\n\nEG: Debian, Raspberry Pi OS Lite, Meveric or "forum.odroid.com/viewtopic.php?t=123456" etc.\n\nNB: An entry is required.'; then - fi + G_DIETPI-NOTIFY 1 'Exit selected. Aborting...\n' + exit 0 fi - - done - - G_DIETPI-NOTIFY 2 "Entered image creator: $IMAGE_CREATOR" - - # Pre-image used/name - until [[ $PREIMAGE_INFO ]] - do - - G_WHIP_INPUTBOX 'Please enter the name or URL of the pre-image you installed on this system, prior to running this script. This will be used to identify the pre-image credits.\n\nEG: Debian, Raspbian Lite, Meveric, FriendlyARM, or "forum.odroid.com/viewtopic.php?t=123456" etc.\n\nNB: An entry is required.' PREIMAGE_INFO=$G_WHIP_RETURNED_VALUE - done - + fi G_DIETPI-NOTIFY 2 "Entered pre-image info: $PREIMAGE_INFO" # Hardware selection @@ -436,53 +419,26 @@ _EOF_ while : do + # Check for valid environment variabe + [[ $HW_MODEL =~ ^[0-9]+$ ]] && for i in "${G_WHIP_MENU_ARRAY[@]}" + do + [[ $HW_MODEL == "$i" ]] && break 2 + done - # Check for valid entry, e.g. when set via environment variabe - if disable_error=1 G_CHECK_VALIDINT "$HW_MODEL" 0; then - - for i in "${G_WHIP_MENU_ARRAY[@]}" - do - - [[ $HW_MODEL == "$i" ]] && break 2 - - done - - fi - - if ! G_WHIP_MENU 'Please select the current device this is being installed on:\n - NB: Select "Generic device" if not listed.\n - "Core devices": Are fully supported by DietPi, offering full GPU + Kodi support.\n - "Limited support devices": No GPU support, supported limited to DietPi specific issues only (eg: excludes Kernel/GPU/VPU related items).'; then + G_WHIP_BUTTON_CANCEL_TEXT='Exit' + if ! G_WHIP_MENU 'Please select the current device this is being installed on:\n - NB: Select "Generic device" if not listed.\n - "Core devices": Fully supported by DietPi, offering full GPU acceleration + Kodi support.\n - "Limited support devices": No GPU acceleration guaranteed.'; then - G_DIETPI-NOTIFY 1 'No choice detected. Aborting...\n' + G_DIETPI-NOTIFY 0 'Exit selected. Aborting...\n' exit 0 - elif [[ $G_WHIP_RETURNED_VALUE ]]; then - - HW_MODEL=$G_WHIP_RETURNED_VALUE - break - fi - + HW_MODEL=$G_WHIP_RETURNED_VALUE + break done G_HW_MODEL=$HW_MODEL unset -v HW_MODEL - # RPi: Detect Debian vs Raspbian and 64 vs 32 bit image - if (( $G_HW_MODEL < 10 )); then - - if grep -q '^ID=debian' /etc/os-release; then - - G_RASPBIAN=0 - [[ $(mawk 'NR==1' /var/lib/dpkg/arch) == 'arm64' ]] && G_HW_ARCH=3 || G_HW_ARCH=2 - - else - - G_RASPBIAN=1 G_HW_ARCH=1 - - fi - - fi - G_DIETPI-NOTIFY 2 "Selected hardware model ID: $G_HW_MODEL" - G_DIETPI-NOTIFY 2 "Detected target CPU architecture: $G_HW_ARCH_NAME (ID: $G_HW_ARCH)" # WiFi selection if [[ $WIFI_REQUIRED != [01] ]]; then @@ -495,23 +451,23 @@ _EOF_ ) (( $G_HW_MODEL == 20 )) && G_WHIP_DEFAULT_ITEM=0 || G_WHIP_DEFAULT_ITEM=1 + G_WHIP_BUTTON_CANCEL_TEXT='Exit' if G_WHIP_MENU 'Please select an option:'; then WIFI_REQUIRED=$G_WHIP_RETURNED_VALUE else - G_DIETPI-NOTIFY 1 'No choice detected. Aborting...\n' + G_DIETPI-NOTIFY 0 'Exit selected. Aborting...\n' exit 0 fi fi - # shellcheck disable=SC2015 (( $WIFI_REQUIRED )) && G_DIETPI-NOTIFY 2 'Marking WiFi as required' || G_DIETPI-NOTIFY 2 'Marking WiFi as NOT required' - # Distro Selection + # Distro selection DISTRO_LIST_ARRAY=( '5' ': Buster (current stable release, recommended)' @@ -524,7 +480,6 @@ _EOF_ G_WHIP_MENU_ARRAY=() for ((i=0; i<${#DISTRO_LIST_ARRAY[@]}; i+=2)) do - # Disable downgrades if (( ${DISTRO_LIST_ARRAY[$i]} < $G_DISTRO )); then @@ -536,7 +491,6 @@ _EOF_ G_WHIP_MENU_ARRAY+=("${DISTRO_LIST_ARRAY[$i]}" "${DISTRO_LIST_ARRAY[$i+1]}") fi - done unset -v DISTRO_LIST_ARRAY @@ -549,17 +503,10 @@ _EOF_ while : do - - if disable_error=1 G_CHECK_VALIDINT "$DISTRO_TARGET" 0; then - - for i in "${G_WHIP_MENU_ARRAY[@]}" - do - - [[ $DISTRO_TARGET == "$i" ]] && break 2 - - done - - fi + [[ $DISTRO_TARGET =~ ^[0-9]+$ ]] && for i in "${G_WHIP_MENU_ARRAY[@]}" + do + [[ $DISTRO_TARGET == "$i" ]] && break 2 + done G_WHIP_DEFAULT_ITEM=${G_WHIP_MENU_ARRAY[0]} # Downgrades disabled, so first item matches current/lowest supported distro version G_WHIP_BUTTON_CANCEL_TEXT='Exit' @@ -569,13 +516,9 @@ Currently installed: $G_DISTRO_NAME (ID: $G_DISTRO)"; then DISTRO_TARGET=$G_WHIP_RETURNED_VALUE break - else - - G_DIETPI-NOTIFY 1 'No choice detected. Aborting...\n' - exit 0 - fi - + G_DIETPI-NOTIFY 0 'Exit selected. Aborting...\n' + exit 0 done if (( $DISTRO_TARGET == 5 )); then @@ -588,6 +531,7 @@ Currently installed: $G_DISTRO_NAME (ID: $G_DISTRO)"; then else + # Failsafe: This can actually never happen G_DIETPI-NOTIFY 1 'Invalid choice detected. Aborting...\n' exit 1 @@ -1470,7 +1414,8 @@ _EOF_' # - It will be unmasked automatically if libpam-systemd got installed during dietpi-software install, e.g. with desktops. G_EXEC systemctl mask --now systemd-logind - #G_DIETPI-NOTIFY 2 'Configuring locales:' # Runs at start of script + G_DIETPI-NOTIFY 2 'Configuring locales:' + /boot/dietpi/func/dietpi-set_software locale 'C.UTF-8' G_DIETPI-NOTIFY 2 'Configuring time zone:' rm -fv /etc/{localtime,timezone} From e8751e37d0760f99ca2d339bef167cf11e1dd189 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sat, 13 Mar 2021 17:00:04 +0100 Subject: [PATCH 023/147] v7.1 (#4193) + DietPi-Obtain_HW_model | Remove unsupported SBC models and instead add generic SoC-specific models where we provide and use an SoC ID for. + DietPi-Patches | Replace removed hardware IDs with new generic SoC IDs before dietpi-obtain_hw_model would reset them to 22 + DietPi-Patch | Pre-v7.0: Remove obsolete v6.-1 patches, which were only required for a small number of the very first v6.0 images, auto-updated to v6.0 on first boot. + DietPi-PREP | Replace unsupported SBC IDs with generic SoC IDs + DietPi-PREP | Remove tweaks for removed hardware models. Those are very old and we have no chance to verify whether they are still required or not without providing and assuming a base image/kernel. + DietPi-Set_hardware | Remove code for removed hardware IDs + DietPi-Config | Remove code for removed hardware IDs + DietPi-Software | Remove code for removed hardware IDs + DietPi-Survey_report | Add support for generic SoC hardware IDs + CHANGELOG | Add a detailed entry about the removed/unsupported SBC models + CHANGELOG | Fix location of the DietPi-Drive_Manager loop device fix --- .meta/dietpi-survey_report | 7 ++ .update/patches | 19 ++++++ CHANGELOG.txt | 6 +- PREP_SYSTEM_FOR_DIETPI.sh | 59 ++++------------- dietpi/dietpi-config | 11 ---- dietpi/dietpi-software | 9 +-- dietpi/func/dietpi-obtain_hw_model | 102 ++++++++--------------------- dietpi/func/dietpi-set_hardware | 58 ++-------------- dietpi/patch_file | 62 +++++++----------- 9 files changed, 97 insertions(+), 236 deletions(-) diff --git a/.meta/dietpi-survey_report b/.meta/dietpi-survey_report index 0d1c52c7cf..d9630a87f2 100644 --- a/.meta/dietpi-survey_report +++ b/.meta/dietpi-survey_report @@ -27,6 +27,13 @@ aHW_NAME[20]='x86_64 VM' aHW_NAME[21]='x86_64 PC' aHW_NAME[22]='Generic Device' + aHW_NAME[29]='Generic Amlogic S922X' + aHW_NAME[28]='Generic Amlogic S905' + aHW_NAME[27]='Generic Allwinner H6' + aHW_NAME[26]='Generic Allwinner H5' + aHW_NAME[25]='Generic Allwinner H3' + aHW_NAME[24]='Generic Rockchip RK3399' + aHW_NAME[23]='Generic Rockchip RK3328' aHW_NAME[30]='OrangePi PC' aHW_NAME[31]='OrangePi One' aHW_NAME[32]='OrangePi Zero (H2+)' diff --git a/.update/patches b/.update/patches index e56f27df8e..b0f8811308 100644 --- a/.update/patches +++ b/.update/patches @@ -4,6 +4,25 @@ # Created by MichaIng / micha@dietpi.com / https://dietpi.com/ # License: GPLv2 / https://github.com/MichaIng/DietPi#license +# Update changed hardware IDs before dietpi-obtain_hw_model would reset them to 22 +if [[ -f '/etc/.dietpi_hw_model_identifier' ]] +then + G_HW_MODEL=$( /etc/.dietpi_hw_model_identifier # Generic Rockchip RK3399 + + elif [[ $G_HW_MODEL == 50 || $G_HW_MODEL == 41 || $G_HW_MODEL == 3[54310] ]] # BananaPi M2+, OrangePi PC Plus, OPi Zero 2 Plus, OrangePi Plus, OrangePi Lite, OrangePi One, OrangePi PC + then + echo 25 > /etc/.dietpi_hw_model_identifier # Generic Allwinner H3 + + elif [[ $G_HW_MODEL == 3[87] ]] # OPi PC2, OPi Prime + then + echo 26 > /etc/.dietpi_hw_model_identifier # Generic Allwinner H5 + fi +fi + # v7.0: Remove obsolete udev rule, as WiFi power saving is disabled via /etc/network/intefaces > "wireless-power off" > /etc/network/if-pre-up.d/wireless-tools (wireless-tools package) when the WiFi interface is configured. [[ -f '/etc/udev/rules.d/10-wifi-disable-powermanagement.rules' ]] && rm -v /etc/udev/rules.d/10-wifi-disable-powermanagement.rules diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 5195dff5bd..ebad3ef3a2 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,12 +1,17 @@ v7.1 (2021-03-XX) +Supported SBC changes: +- For historical reasons, DietPi had internal hardware identifiers for SBCs which are not officially supported anymore for a long time, namely variouos Orange Pi and Banana Pi models, BeagleBone Black and LeMaker Guitar. Since we do not provide a reference image and do not test features on those boards, we have no chance to reasonably use those hardware IDs code-wise to apply tweaks or enable features, which renders them meaningless. To avoid wrong assumptions, we hence removed the identifies for the named SBC models. As a replacement, we added a set of generic SoC identifiers, which can as well be selected from within the DietPi-PREP system converter script. This means that one is e.g. able to select "Generic Allwinner H3" and have an SoC identifier set by this, which is used within the code for conditionals based on the SoC, e.g. regarding GPU acceleration and other SoC-internal hardware features. The removed SBC models are converted automatically to those generic identifiers, so that e.g. after the update an OrangePi PC will be shown in our scripts and banner as "Generic Allwinner H3". While it looks like a degradation, it is a hardening, as it assures that no false assumptions and conditionals are triggered in our scripts but only those which we can know for sure being true, regardless of the initial Debian image you used. +- We removed the Firefly RK3399 from our supported devices list, as no a single user is reported via DietPi-Survey (https://dietpi.com/survey/#device). If case there were actually Firefly RK3399 DietPi systems, not participating DietPi-Survey, those would be migrated to the "Generic Rockchip RK3399" identifier, which code-wise maintains the exact same support. + Changes: - DietPi-FS_partition_resize | Added support to automatically resize F2FS and Btrfs filesystems on first boot. - DietPi-Drive_Manager | Added support for resizing F2FS and Btrfs filesystems as well as format- and filesystem check & repair support for XFS filesystems. - DietPi-Config | Added a safe overclocking profile for RPi 3+ models. Many thanks to @lone for doing long-term stability tests and reporting back the result: https://dietpi.com/phpbb/viewtopic.php?p=32285#p32285 Fixes: +- DietPi-Drive_Manager | Fixed detection and visualisation of loop devices in menu. - DietPi-Software | Resolved an issue where the "uninstall" command did not work and the "reinstall" did not show the intended backup prompt. Many thanks to @Zeuskk for reporting this v7.0 regression: https://dietpi.com/phpbb/viewtopic.php?t=8729 - DietPi-Software | X.Org X Server: Resolved an issue on RPi where the X server start failed when the KMS device tree overlay was not enabled. Many thanks to @xthedakmanx for reporting this issue: https://github.com/MichaIng/DietPi/issues/4175 - DietPi-Software | LXDE: Resolved an issue where after installing LXDE, the system booted into the LightDM desktop login mask automatically, even if desktop autologin was not chosen via dietpi-autostart. Many thanks to @manilx for reporting this issue: https://dietpi.com/phpbb/viewtopic.php?t=8766 @@ -14,7 +19,6 @@ Fixes: 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/XXXX Known/Outstanding Issues: -- DietPi-Drive_Manager | Fixed detection and visualisation of loop devices in menu. - DietPi-Config | Enabling WiFi + Ethernet adapters, both on different subnets, breaks WiFi connection in some cases: https://github.com/MichaIng/DietPi/issues/2103 - DietPi-Software | MATE desktop: When logging in as root, desktop items and right-click context menu is missing: https://github.com/MichaIng/DietPi/issues/3160 - DietPi-Software | Sonarr/Radarr/Mono: With current Mono version 6, import to a file system without UNIX permissions support (exFAT, FAT32/vfat, CIFS mounts and NTFS without "permissions" option) fails, regardless of user/umask mount options: https://github.com/MichaIng/DietPi/issues/3179 diff --git a/PREP_SYSTEM_FOR_DIETPI.sh b/PREP_SYSTEM_FOR_DIETPI.sh index edc3fa7c30..4dfcbaacf4 100644 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -354,7 +354,7 @@ _EOF_ G_WHIP_DEFAULT_ITEM=0 G_WHIP_MENU_ARRAY=( - '' '●─ ARM ─ Core devices with GPU support ' + '' '●─ ARM ─ Core devices with GPU acceleration ' '0' ': Raspberry Pi (all models)' #'0' ': Raspberry Pi 1 (256 MiB) #'1' ': Raspberry Pi 1/Zero (512 MiB)' @@ -369,7 +369,7 @@ _EOF_ '' '●─ x86_64 ' '21' ': x86_64 Native PC' '20' ': x86_64 Virtual Machine' - '' '●─ ARM ─ Limited support devices without GPU support ' + '' '●─ ARM ─ Limited GPU acceleration ' '10' ': Odroid C1' '13' ': Odroid U3' '14' ': Odroid N1' @@ -396,23 +396,14 @@ _EOF_ '54' ': NanoPi K2' '72' ': ROCK Pi 4' '73' ': ROCK Pi S' - '69' ': Firefly RK3399' - '38' ': OrangePi PC 2' - '37' ': OrangePi Prime' - '36' ': OrangePi Win' - '35' ': OrangePi Zero Plus 2 (H3/H5)' - '34' ': OrangePi Plus' - '33' ': OrangePi Lite' - '32' ': OrangePi Zero (H2+)' - '31' ': OrangePi One' - '30' ': OrangePi PC' - '41' ': OrangePi PC Plus' - '53' ': BananaPi (sinovoip)' - '51' ': BananaPi Pro (Lemaker)' - '50' ': BananaPi M2+ (sinovoip)' - '71' ': BeagleBone Black' - '39' ': LeMaker Guitar' '' '●─ Other ' + '29' ': Generic Amlogic S922X' + '28' ': Generic Amlogic S905' + '27' ': Generic Allwinner H6' + '26' ': Generic Allwinner H5' + '25' ': Generic Allwinner H3' + '24' ': Generic Rockchip RK3399' + '23' ': Generic Rockchip RK3328' '22' ': Generic Device' ) @@ -969,7 +960,6 @@ Currently installed: $G_DISTRO_NAME (ID: $G_DISTRO)"; then getent passwd rock > /dev/null && userdel -f rock # Radxa images getent passwd linaro > /dev/null && userdel -f linaro # ASUS TB getent passwd dietpi > /dev/null && userdel -f dietpi # recreated below - getent passwd debian > /dev/null && userdel -f debian # BBB getent passwd openmediavault-webgui > /dev/null && userdel -f openmediavault-webgui # OMV (NanoPi NEO2) getent passwd admin > /dev/null && userdel -f admin # OMV (NanoPi NEO2) getent passwd fa > /dev/null && userdel -f fa # OMV (NanoPi NEO2) @@ -1321,17 +1311,8 @@ _EOF_' G_EXEC mkdir -p /root/.ssh echo 'ssh.dietpi.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDE6aw3r6aOEqendNu376iiCHr9tGBIWPgfrLkzjXjEsHGyVSUFNnZt6pftrDeK7UX+qX4FxOwQlugG4fymOHbimRCFiv6cf7VpYg1Ednquq9TLb7/cIIbX8a6AuRmX4fjdGuqwmBq3OG7ZksFcYEFKt5U4mAJIaL8hXiM2iXjgY02LqiQY/QWATsHI4ie9ZOnwrQE+Rr6mASN1BVFuIgyHIbwX54jsFSnZ/7CdBMkuAd9B8JkxppWVYpYIFHE9oWNfjh/epdK8yv9Oo6r0w5Rb+4qaAc5g+RAaknHeV6Gp75d2lxBdCm5XknKKbGma2+/DfoE8WZTSgzXrYcRlStYN' > /root/.ssh/known_hosts - # Add pre-up lines for WiFi on OrangePi Zero - if (( $G_HW_MODEL == 32 )); then - - sed -i '/iface wlan0 inet dhcp/apre-up modprobe xradio_wlan\npre-up iwconfig wlan0 power on' /etc/network/interfaces - # ASUS TB WiFi: https://github.com/MichaIng/DietPi/issues/1760 - elif (( $G_HW_MODEL == 52 )); then - - G_CONFIG_INJECT '8723bs' '8723bs' /etc/modules - - fi + (( $G_HW_MODEL == 52 )) && G_CONFIG_INJECT '8723bs' '8723bs' /etc/modules # Fix wireless-tools bug on Stretch: https://bugs.debian.org/908886 # shellcheck disable=SC2016 @@ -1482,13 +1463,8 @@ _EOF_" fi - # - Armbian OPi Zero 2: https://github.com/MichaIng/DietPi/issues/876#issuecomment-294350580 - if (( $G_HW_MODEL == 35 )); then - - echo 'blacklist bmp085' > /etc/modprobe.d/dietpi-disable_bmp085.conf - # - Sparky SBC - elif (( $G_HW_MODEL == 70 )); then + if (( $G_HW_MODEL == 70 )); then # Install latest kernel/drivers G_EXEC curl -sSfL https://raw.githubusercontent.com/sparky-sbc/sparky-test/master/dragon_fly_check/uImage -o /boot/uImage @@ -1762,18 +1738,7 @@ _EOF_ /boot/dietpi/func/dietpi-set_software apt-cache cache disable /boot/dietpi/func/dietpi-set_software apt-cache clean - # BBB remove fsexpansion: https://github.com/MichaIng/DietPi/issues/931#issuecomment-345451529 - if (( $G_HW_MODEL == 71 )); then - - systemctl disable dietpi-fs_partition_resize - rm -v /etc/systemd/system/dietpi-fs_partition_resize.service - rm -v /var/lib/dietpi/services/fs_partition_resize.sh - - else - - G_EXEC_DESC='Enabling automated partition and file system resize for first boot' G_EXEC systemctl enable dietpi-fs_partition_resize - - fi + G_EXEC_DESC='Enabling automated partition and file system resize for first boot' G_EXEC systemctl enable dietpi-fs_partition_resize G_EXEC_DESC='Enabling first boot installation process' G_EXEC systemctl enable dietpi-firstboot G_DIETPI-NOTIFY 2 'Storing DietPi version info:' diff --git a/dietpi/dietpi-config b/dietpi/dietpi-config index 749444540a..0e0f272779 100644 --- a/dietpi/dietpi-config +++ b/dietpi/dietpi-config @@ -3935,17 +3935,6 @@ Additional benchmarks: G_WHIP_MENU_ARRAY+=('odroid-hifishield-plus' ': Odroid HiFi Shield 1/Plus') G_WHIP_MENU_ARRAY+=('odroid-hifishield-2' ': Odroid HiFi Shield 2') - # H2+ | OPi Zero - elif (( $G_HW_MODEL == 32 )); then - - G_WHIP_MENU_ARRAY+=('default' ': 3.5mm Analogue') - G_WHIP_MENU_ARRAY+=('h2-hdmi' ': HDMI') - - # BPi Pro - elif (( $G_HW_MODEL == 51 )); then - - G_WHIP_MENU_ARRAY+=('default' ': 3.5mm Analogue') - # NanoPi M2/M3 elif [[ $G_HW_MODEL == 6[12] ]]; then diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index 1ae9f5df16..50acf7b23f 100644 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -1404,8 +1404,6 @@ _EOF_ do aSOFTWARE_AVAIL_G_HW_MODEL[$software_id,$i]=0 done - # + BPi Pro - aSOFTWARE_AVAIL_G_HW_MODEL[$software_id,51]=1 #------------------ software_id=71 @@ -2879,7 +2877,7 @@ _EOF_ local output=0 local gigabit_device=1 - (( $G_HW_MODEL < 4 || $G_HW_MODEL == 30 || $G_HW_MODEL == 32 || $G_HW_MODEL == 40 || $G_HW_MODEL == 60 || $G_HW_MODEL == 70 )) && gigabit_device=0 + (( $G_HW_MODEL < 4 || $G_HW_MODEL == 40 || $G_HW_MODEL == 60 || $G_HW_MODEL == 70 )) && gigabit_device=0 # Cache size (MB) 1/10th of total mem if (( $1 == 0 )); then @@ -4465,11 +4463,6 @@ amvdec_vp9' > /etc/modules-load.d/dietpi-c4-kodi.conf Download_Install 'https://github.com/hardkernel/wiringPi/archive/master.tar.gz' - # BPi Pro - elif (( $G_HW_MODEL == 51 )); then - - Download_Install 'https://github.com/LeMaker/WiringBP/archive/bananapro.zip' - fi mv WiringBP* wiringPi &> /dev/null # BPi diff --git a/dietpi/func/dietpi-obtain_hw_model b/dietpi/func/dietpi-obtain_hw_model index c32ff2e5ef..d3e6d3ddb2 100644 --- a/dietpi/func/dietpi-obtain_hw_model +++ b/dietpi/func/dietpi-obtain_hw_model @@ -19,9 +19,7 @@ # # G_HW_MODEL 73 ROCK Pi S # G_HW_MODEL 72 ROCK Pi 4 - # G_HW_MODEL 71 BeagleBone Black # G_HW_MODEL 70 Sparky SBC - # G_HW_MODEL 69 Firefly RK3399 # G_HW_MODEL 68 NanoPi M4/T4/NEO4 # G_HW_MODEL 67 NanoPi K1 Plus # G_HW_MODEL 66 NanoPi M1 Plus @@ -37,26 +35,19 @@ # G_HW_MODEL 56 NanoPi NEO3 # G_HW_MODEL 55 NanoPi R2S # G_HW_MODEL 54 NanoPi K2 - # G_HW_MODEL 53 BananaPi (sinovoip) # G_HW_MODEL 52 ASUS Tinker Board - # G_HW_MODEL 51 BananaPi Pro (Lemaker) - # G_HW_MODEL 50 BananaPi M2+ (sinovoip) # G_HW_MODEL 45 PINE H64 # G_HW_MODEL 44 Pinebook # G_HW_MODEL 43 ROCK64 # G_HW_MODEL 42 ROCKPro64 - # G_HW_MODEL 41 OrangePi PC Plus # G_HW_MODEL 40 PINE A64 - # G_HW_MODEL 39 LeMaker Guitar - # G_HW_MODEL 38 OrangePi PC 2 - # G_HW_MODEL 37 OrangePi Prime - # G_HW_MODEL 36 OrangePi Win - # G_HW_MODEL 35 OrangePi Zero Plus 2 (H3/H5) - # G_HW_MODEL 34 OrangePi Plus - # G_HW_MODEL 33 OrangePi Lite - # G_HW_MODEL 32 OrangePi Zero (H2+) - # G_HW_MODEL 31 OrangePi One - # G_HW_MODEL 30 OrangePi PC + # G_HW_MODEL 29 Generic Amlogic S922X + # G_HW_MODEL 28 Generic Amlogic S905 + # G_HW_MODEL 27 Generic Allwinner H6 + # G_HW_MODEL 26 Generic Allwinner H5 + # G_HW_MODEL 25 Generic Allwinner H3 + # G_HW_MODEL 24 Generic Rockchip RK3399 + # G_HW_MODEL 23 Generic Rockchip RK3328 # G_HW_MODEL 22 Generic Device # G_HW_MODEL 21 x86_64 PC # G_HW_MODEL 20 x86_64 VM @@ -318,19 +309,10 @@ G_HW_MODEL_NAME='ROCK Pi 4' G_HW_CPUID=3 - elif (( $G_HW_MODEL == 71 )); then - - G_HW_MODEL_NAME='BeagleBone Black' - elif (( $G_HW_MODEL == 70 )); then G_HW_MODEL_NAME='Sparky SBC' - elif (( $G_HW_MODEL == 69 )); then - - G_HW_MODEL_NAME='Firefly RK3399' - G_HW_CPUID=3 - elif (( $G_HW_MODEL == 68 )); then G_HW_MODEL_NAME='NanoPi M4/T4/NEO4' @@ -404,23 +386,10 @@ G_HW_MODEL_NAME='NanoPi K2' G_HW_CPUID=7 - elif (( $G_HW_MODEL == 53 )); then - - G_HW_MODEL_NAME='BananaPi' - elif (( $G_HW_MODEL == 52 )); then G_HW_MODEL_NAME='ASUS Tinker Board' - elif (( $G_HW_MODEL == 51 )); then - - G_HW_MODEL_NAME='BananaPi Pro' - - elif (( $G_HW_MODEL == 50 )); then - - G_HW_MODEL_NAME='BananaPi M2+' - G_HW_CPUID=1 - elif (( $G_HW_MODEL == 45 )); then G_HW_MODEL_NAME='PINE H64' @@ -440,61 +409,44 @@ G_HW_MODEL_NAME='ROCKPro64' G_HW_CPUID=3 - elif (( $G_HW_MODEL == 41 )); then - - G_HW_MODEL_NAME='OrangePi PC Plus' - G_HW_CPUID=1 - elif (( $G_HW_MODEL == 40 )); then G_HW_MODEL_NAME='PINE A64' - elif (( $G_HW_MODEL == 39 )); then - - G_HW_MODEL_NAME='LeMaker Guitar' - - elif (( $G_HW_MODEL == 38 )); then + elif (( $G_HW_MODEL == 29 )); then - G_HW_MODEL_NAME='OPi PC2' - G_HW_CPUID=2 - - elif (( $G_HW_MODEL == 37 )); then - - G_HW_MODEL_NAME='OPi Prime' - G_HW_CPUID=2 + G_HW_MODEL_NAME='Generic Amlogic S922X' + G_HW_CPUID=4 - elif (( $G_HW_MODEL == 36 )); then + elif (( $G_HW_MODEL == 28 )); then - G_HW_MODEL_NAME='OPi Win' + G_HW_MODEL_NAME='Generic Amlogic S905' + G_HW_CPUID=7 - elif (( $G_HW_MODEL == 35 )); then + elif (( $G_HW_MODEL == 27 )); then - G_HW_MODEL_NAME='OPi Zero 2 Plus' - G_HW_CPUID=1 + G_HW_MODEL_NAME='Generic Allwinner H6' + G_HW_CPUID=5 - elif (( $G_HW_MODEL == 34 )); then + elif (( $G_HW_MODEL == 26 )); then - G_HW_MODEL_NAME='OrangePi Plus' - G_HW_CPUID=1 + G_HW_MODEL_NAME='Generic Allwinner H5' + G_HW_CPUID=2 - elif (( $G_HW_MODEL == 33 )); then + elif (( $G_HW_MODEL == 25 )); then - G_HW_MODEL_NAME='OrangePi Lite' + G_HW_MODEL_NAME='Generic Allwinner H3' G_HW_CPUID=1 - elif (( $G_HW_MODEL == 32 )); then - - G_HW_MODEL_NAME='OrangePi Zero' - - elif (( $G_HW_MODEL == 31 )); then + elif (( $G_HW_MODEL == 24 )); then - G_HW_MODEL_NAME='OrangePi One' - G_HW_CPUID=1 + G_HW_MODEL_NAME='Generic Rockchip RK3399' + G_HW_CPUID=3 - elif (( $G_HW_MODEL == 30 )); then + elif (( $G_HW_MODEL == 23 )); then - G_HW_MODEL_NAME='OrangePi PC' - G_HW_CPUID=1 + G_HW_MODEL_NAME='Generic Rockchip RK3328' + G_HW_CPUID=6 elif (( $G_HW_MODEL == 21 )); then diff --git a/dietpi/func/dietpi-set_hardware b/dietpi/func/dietpi-set_hardware index 2dc68055d0..83899687a8 100644 --- a/dietpi/func/dietpi-set_hardware +++ b/dietpi/func/dietpi-set_hardware @@ -1310,13 +1310,8 @@ Do you want to continue and disable the serial login console?' || return 1 aWIFI_MODULES+=('brcmfmac' 'brcmutil') - # + OrangePi Zero - elif (( $G_HW_MODEL == 32 )); then - - aWIFI_MODULES+=('xradio_wlan') - - # + OrangePi Plus / NanoPi K1 Plus - elif (( $G_HW_MODEL == 34 || $G_HW_MODEL == 67 )); then + # + NanoPi K1 Plus + elif (( $G_HW_MODEL == 67 )); then aWIFI_MODULES+=('8189es') @@ -1325,13 +1320,8 @@ Do you want to continue and disable the serial login console?' || return 1 aWIFI_MODULES+=('8723bs') - # + BPi Pro (onboard) - elif (( $G_HW_MODEL == 51 )); then - - aWIFI_MODULES+=('ap6211') - - # + NanoPi NEO Air / OrangePi Zero Plus 2 - elif (( $G_HW_MODEL == 35 || $G_HW_MODEL == 64 )); then + # + NanoPi NEO Air + elif (( $G_HW_MODEL == 64 )); then # 4.9 uses brcm, only enable dhd for 3.x if [[ -d '/boot/dtb' ]]; then @@ -1682,21 +1672,11 @@ Do you want to continue and DISABLE Bluetooth now?' || return 1 Soundcard_Reset_Odroid - # - OPi Zero (H2+) - elif (( $G_HW_MODEL == 32 )); then - - Soundcard_Reset_H2 - # - H3 elif (( $G_HW_CPUID == 1 )); then Soundcard_Reset_H3 - # - BPi Pro - elif (( $G_HW_MODEL == 51 )); then - - Soundcard_Reset_BPi_Pro - # - Sparky SBC elif (( $G_HW_MODEL == 70 )); then @@ -1762,13 +1742,6 @@ Do you want to continue and DISABLE Bluetooth now?' || return 1 } - Soundcard_Reset_H2(){ - - # Set 3.5mm - [[ $INPUT_DEVICE_VALUE == 'none' ]] || amixer set -c 0 'Audio lineout' unmute 2> /dev/null - - } - Soundcard_Reset_H3(){ # Set HDMI @@ -1798,21 +1771,6 @@ Do you want to continue and DISABLE Bluetooth now?' || return 1 } - Soundcard_Reset_BPi_Pro(){ - - # Set 3.5mm: https://github.com/MichaIng/DietPi/issues/732#issuecomment-275915919 - [[ $INPUT_DEVICE_VALUE == 'none' ]] && return - - amixer sset 'Left Mixer Left DAC' off - amixer sset 'Power Amplifier' 62 - amixer sset 'Power Amplifier DAC' on - amixer sset 'Power Amplifier Mixer' off - amixer sset 'Power Amplifier Mute' on - amixer sset 'Right Mixer Left DAC' off - amixer sset 'Right Mixer Right DAC' off - - } - Soundcard_Main(){ #----------------------------------------------------------------------------- @@ -2103,14 +2061,6 @@ _EOF_ ;; - # --------------- H2 -------------------- - h2-hdmi) - - G_EXEC amixer set -c 0 'Audio lineout' mute - SOUNDCARD_TARGET_CARD=1 - - ;; - # --------------- H3 -------------------- h3-analogue) diff --git a/dietpi/patch_file b/dietpi/patch_file index e10016286f..d8a18d9c07 100644 --- a/dietpi/patch_file +++ b/dietpi/patch_file @@ -128,6 +128,25 @@ _EOF_ fi + # Update changed hardware IDs before dietpi-obtain_hw_model would reset them to 22 + if [[ -f '/etc/.dietpi_hw_model_identifier' ]] + then + G_HW_MODEL=$( /etc/.dietpi_hw_model_identifier # Generic Rockchip RK3399 + + elif [[ $G_HW_MODEL == 50 || $G_HW_MODEL == 41 || $G_HW_MODEL == 3[54310] ]] # BananaPi M2+, OrangePi PC Plus, OPi Zero 2 Plus, OrangePi Plus, OrangePi Lite, OrangePi One, OrangePi PC + then + echo 25 > /etc/.dietpi_hw_model_identifier # Generic Allwinner H3 + + elif [[ $G_HW_MODEL == 3[87] ]] # OPi PC2, OPi Prime + then + echo 26 > /etc/.dietpi_hw_model_identifier # Generic Allwinner H5 + fi + fi + # Import DietPi-Globals -------------------------------------------------------------- /boot/dietpi/func/dietpi-obtain_hw_model # Always update . /boot/dietpi/func/dietpi-globals @@ -142,8 +161,8 @@ _EOF_ # Pre-v6.29: Migrate newly supported SBCs from dev to master branch if [[ $G_DIETPI_VERSION_SUB -lt 29 && -f '/etc/.dietpi_hw_model_identifier' ]]; then - # NanoPi M4v2 (58) - # Pine H64 (45) + # NanoPi M4V2 (58) + # PINE H64 (45) # ROCK Pi S (73) if [[ $( /etc/.dietpi_hw_model_identifier - /boot/dietpi/func/dietpi-obtain_hw_model - . /boot/dietpi/.hw_model - - fi - #------------------------------------------------------------------------------- - # bash.bashrc removal of any outstanding dietpi entries (moved to globals). Just incase I missed any manually during PREP... - sed -i '/#DietPi_Entries/Q' /etc/bash.bashrc - sed -i '/#Apply system locale/Q' /etc/bash.bashrc - sed -i '/#DietPi Additions/Q' /etc/bash.bashrc - #------------------------------------------------------------------------------- - # Fix doubled and renamed config files: https://github.com/MichaIng/DietPi/commit/68148cec6b49afc787deca638456e1c4689e1cab#diff-8370b86e635383d521462994afe04a2d - [[ -f '/etc/apt/apt.conf.d/99force-ipv' ]] && rm /etc/apt/apt.conf.d/99force-ipv - [[ -f '/etc/sysctl.d/97-dietpi.conf' ]] && rm /etc/sysctl.d/97-dietpi.conf - #------------------------------------------------------------------------------- - # Core_ENV update: https://github.com/MichaIng/DietPi/pull/1419 - # - consoleblank disable x86_64 - if [[ -f '/etc/default/grub' ]]; then - - G_CONFIG_INJECT 'GRUB_CMDLINE_LINUX_DEFAULT=' 'GRUB_CMDLINE_LINUX_DEFAULT="consoleblank=0 quiet"' /etc/default/grub - G_CONFIG_INJECT 'GRUB_CMDLINE_LINUX=' 'GRUB_CMDLINE_LINUX="net.ifnames=0"' /etc/default/grub - G_CONFIG_INJECT 'GRUB_TIMEOUT=' 'GRUB_TIMEOUT=0' /etc/default/grub - update-grub - - fi - #------------------------------------------------------------------------------- - # Remove -dev keyring - apt-mark auto debian-keyring - #------------------------------------------------------------------------------- - - elif (( $G_DIETPI_VERSION_SUB == 0 )); then + if (( $G_DIETPI_VERSION_SUB == 0 )); then #------------------------------------------------------------------------------- # Reinstalls: From 5d039648fffa5e396cba7360e89e54c725623d37 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sat, 13 Mar 2021 21:05:20 +0100 Subject: [PATCH 024/147] v7.1 + DietPi-PREP | Align initial interfaces config with dietpi-config: loopback device does not need to be defined, as it's hardcoded in ifup --- PREP_SYSTEM_FOR_DIETPI.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/PREP_SYSTEM_FOR_DIETPI.sh b/PREP_SYSTEM_FOR_DIETPI.sh index 4dfcbaacf4..7a5db81599 100644 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -1244,10 +1244,6 @@ _EOF_' # Drop-in configs source interfaces.d/* -# Loopback -auto lo -iface lo inet loopback - # Ethernet #allow-hotplug eth0 iface eth0 inet dhcp @@ -1262,9 +1258,9 @@ iface wlan0 inet dhcp address 192.168.0.100 netmask 255.255.255.0 gateway 192.168.0.1 +#dns-nameservers 9.9.9.9 149.112.112.112 wireless-power off wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf -#dns-nameservers 9.9.9.9 149.112.112.112 _EOF_' #----------------------------------------------------------------------------------- # MISC From 576df0fb0f071c338e91a6e501a75b05247cef49 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sun, 14 Mar 2021 11:50:45 +0100 Subject: [PATCH 025/147] v7.1 + Odroid N2 | Fix typo in boot.ini --- boot_n2.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot_n2.ini b/boot_n2.ini index f36cef5d20..48ae54cc46 100644 --- a/boot_n2.ini +++ b/boot_n2.ini @@ -122,7 +122,7 @@ if test "${max_freq_a53}"; then setenv a53_freq "max_freq_a53=${max_freq_a53}"; setenv bootlabel "DietPi (64-bit)" # Boot args -setenv bootargs "root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait ro ${condev} ${amlogic} no_console_suspend fsck.repair=yes net.ifnames=0 elevator=noop hdmimode=${hdmimode} cvbsmode=576cvbs maxcpus=${maxcpus} voutmode=${voutmode} disablehpd=${disablehpd} enable_wol=${enable_wol} ${cec_enable} sdrmode=${sdrmode} consoleblank=0 logo=osd0,loaded monitor_onoff=${monitor_onoff} ${hid_quirks} ${cmode} overscan=${overscan} cvbscable=${cvbscable} ${a73_freq] ${a53_freq}" +setenv bootargs "root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait ro ${condev} ${amlogic} no_console_suspend fsck.repair=yes net.ifnames=0 elevator=noop hdmimode=${hdmimode} cvbsmode=576cvbs maxcpus=${maxcpus} voutmode=${voutmode} disablehpd=${disablehpd} enable_wol=${enable_wol} ${cec_enable} sdrmode=${sdrmode} consoleblank=0 logo=osd0,loaded monitor_onoff=${monitor_onoff} ${hid_quirks} ${cmode} overscan=${overscan} cvbscable=${cvbscable} ${a73_freq} ${a53_freq}" # Set load addresses setenv dtb_loadaddr "0x1000000" From 9a6f0741d9ae33f2eb997f2c25b4bd12daa7a60b Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sun, 14 Mar 2021 15:53:18 +0100 Subject: [PATCH 026/147] v7.1 + DietPi-Software | ownCloud/Nextcloud: Create a temporary password for the temporary privileged database user to pass to the CLI install, instead of the global software password: https://github.com/MichaIng/DietPi/issues/4199#issuecomment-798898135 + DietPi-Software | ownCloud: Like in case of Nextcloud, error out when a database exists without an install directory, as a fresh install with an old database is a risk + DietPi-Software | Nextcloud: Add missing primary keys on install to satisfy the admin panel check about it + DietPi-Software | ownCloud/Nextcloud: Minor coding enhancements --- dietpi/dietpi-software | 186 ++++++++++++++++++++++------------------- 1 file changed, 98 insertions(+), 88 deletions(-) diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index 50acf7b23f..422fcef7a8 100644 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -2721,10 +2721,8 @@ _EOF_ # ownCloud up to v10.2 elif [[ -f '/var/www/owncloud/version.php' ]]; then - # shellcheck disable=SC2016 - local oc_version_major=$(sed -n '/$OC_VersionString/{s/^[^0-9]*//;s/\..*$//;p;q}' /var/www/owncloud/version.php) - # shellcheck disable=SC2016 - local oc_version_minor=$(sed -n '/$OC_VersionString/{s/^[^.]*\.//;s/\..*$//;p;q}' /var/www/owncloud/version.php) + local oc_version_major=$(sed -n '/\$OC_VersionString/{s/^[^0-9]*//;s/\..*$//p;q}' /var/www/owncloud/version.php) + local oc_version_minor=$(sed -n '/\$OC_VersionString/{s/^[^.]*\.//;s/\..*$//p;q}' /var/www/owncloud/version.php) if (( $oc_version_major < 10 || ( $oc_version_major == 10 && $oc_version_minor < 3 ) )); then PHP_NAME='php7.2' @@ -3677,10 +3675,7 @@ _EOF_ fi - chown -R www-data:www-data /var/www/owncloud - - [[ $DEPS_LIST ]] && G_DIETPI-NOTIFY 2 'Installing required PHP modules' && G_AGI $DEPS_LIST - DEPS_LIST= + [[ $DEPS_LIST ]] && { G_DIETPI-NOTIFY 2 'Installing required PHP modules'; G_AGI $DEPS_LIST; DEPS_LIST=''; } fi @@ -3713,10 +3708,7 @@ _EOF_ fi - chown -R www-data:www-data /var/www/nextcloud - - [[ $DEPS_LIST ]] && G_DIETPI-NOTIFY 2 'Installing required PHP modules' && G_AGI $DEPS_LIST - DEPS_LIST= + [[ $DEPS_LIST ]] && { G_DIETPI-NOTIFY 2 'Installing required PHP modules'; G_AGI $DEPS_LIST; DEPS_LIST=''; } fi @@ -7895,7 +7887,7 @@ _EOF_ Banner_Configuration - G_DIETPI-NOTIFY 2 'Enabling needed PHP modules.' # https://doc.owncloud.org/server/administration_manual/installation/manual_installation.html#php-extensions + G_DIETPI-NOTIFY 2 'Enabling required PHP modules.' # https://doc.owncloud.org/server/administration_manual/installation/manual_installation.html#php-extensions G_EXEC phpenmod ctype curl dom gd iconv intl json mbstring pdo_mysql posix simplexml xmlreader xmlwriter zip fileinfo opcache apcu redis exif G_DIETPI-NOTIFY 2 'Enabling APCu memory cache for PHP command line usage (CLI) as well, including ownCloud occ command and cron jobs.' @@ -7903,11 +7895,9 @@ _EOF_ G_EXEC phpenmod dietpi-owncloud # Get version string - # shellcheck disable=SC2016 - local oc_version_major=$(sed -n '/$OC_VersionString/{s/^[^0-9]*//;s/\..*$//;p;q}' /var/www/owncloud/version.php) + local oc_version_major=$(sed -n '/\$OC_VersionString/{s/^[^0-9]*//;s/\..*$//p;q}' /var/www/owncloud/version.php) [[ $oc_version_major ]] || oc_version_major=10 - # shellcheck disable=SC2016 - local oc_version_minor=$(sed -n '/$OC_VersionString/{s/^[^.]*\.//;s/\..*$//;p;q}' /var/www/owncloud/version.php) + local oc_version_minor=$(sed -n '/\$OC_VersionString/{s/^[^.]*\.//;s/\..*$//p;q}' /var/www/owncloud/version.php) [[ $oc_version_minor ]] || oc_version_minor=3 if (( ${aSOFTWARE_INSTALL_STATE[83]} > 0 )); then @@ -8015,49 +8005,69 @@ location = /.well-known/caldav { # Adjusting config file: local config_php='/var/www/owncloud/config/config.php' - local datadir=$(grep -m1 '^[[:blank:]]*SOFTWARE_OWNCLOUD_DATADIR=' /boot/dietpi.txt | sed 's/^[^=]*=//') + local datadir=$(sed -n '/^[[:blank:]]*SOFTWARE_OWNCLOUD_DATADIR=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) [[ $datadir ]] || datadir='/mnt/dietpi_userdata/owncloud_data' - mkdir -p $datadir - chown -R www-data:www-data $datadir + G_EXEC mkdir -p "$datadir" + G_EXEC chown -R www-data:www-data /var/www/owncloud "$datadir" if [[ -d '/mnt/dietpi_userdata/mysql/owncloud' ]]; then G_DIETPI-NOTIFY 2 'ownCloud database found, will NOT overwrite.' + if [[ ! -f $config_php ]]; then - else + G_WHIP_MSG '[WARNING] Existing ownCloud database was found, but no related install directory\n +A remaining MariaDB "owncloud" database from an earlier installed instance was found. But the related install directory "/var/www/owncloud/config/config.php" does not exist. +Since running a fresh install with an existing database can produce data corruption, if the versions do not exactly match, you either need to remove the database or find and place the related install directory.\n +We cannot predict your aim and do not want to mess or break your data, so please do this manually.\n +To remove the existing database (including e.g. contacts, calendar, file tags etc.): + # mysqladmin drop owncloud +Otherwise to copy an existing instance in place: + # rm -R /var/www/owncloud + # mkdir /var/www/owncloud + # cp -a /path/to/existing/owncloud/. /var/www/owncloud/ +The install script will now exit. After applying one of the the above, rerun dietpi-software, e.g.: + # dietpi-software install 47' - if [[ -f $datadir/dietpi-owncloud-database-backup.sql ]]; then + [[ -f '/var/www/owncloud/occ' ]] && G_EXEC rm /var/www/owncloud/occ + /boot/dietpi/dietpi-services start + exit 1 - G_DIETPI-NOTIFY 2 'ownCloud database backup found, starting recovery...' - local dbuser=$(grep -m1 "^[[:blank:]]*'dbuser'" $config_php | mawk '{print $3}' | sed "s/[',]//g") - local dbpass=$(grep -m1 "^[[:blank:]]*'dbpassword'" $config_php | mawk '{print $3}' | sed "s/[',]//g") - /boot/dietpi/func/create_mysql_db owncloud "$dbuser" "$dbpass" - mysql owncloud < "$datadir"/dietpi-owncloud-database-backup.sql - ### Seems to be not needed anymore and can cause double entries: https://help.nextcloud.com/t/howto-change-move-data-directory-after-installation/17170/3?u=michaing - # Adjust database data directory entry, in case it changed due to server migration: - #mysql -e "update owncloud.oc_storages set id='local::$datadir/' where id rlike 'local::'" + fi - elif ! grep -q "'installed' => true," $config_php 2>/dev/null; then + elif [[ -f $datadir/dietpi-owncloud-database-backup.sql ]]; then - local username=$(grep -m1 '^[[:blank:]]*SOFTWARE_OWNCLOUD_NEXTCLOUD_USERNAME=' /boot/dietpi.txt | sed 's/^[^=]*=//') - [[ $username ]] || username='admin' + G_DIETPI-NOTIFY 2 'ownCloud database backup found, starting recovery...' + local dbuser=$(grep -m1 "^[[:blank:]]*'dbuser'" $config_php | mawk -F\' '{print $4}') + local dbpass=$(grep -m1 "^[[:blank:]]*'dbpassword'" $config_php | mawk -F\' '{print $4}') + /boot/dietpi/func/create_mysql_db owncloud "$dbuser" "$dbpass" + mysql owncloud < "$datadir/dietpi-owncloud-database-backup.sql" + ### Seems to be not needed anymore and can cause double entries: https://help.nextcloud.com/t/howto-change-move-data-directory-after-installation/17170/3?u=michaing + # Adjust database data directory entry, in case it changed due to server migration: + #G_EXEC mysql -e "update owncloud.oc_storages set id='local::$datadir/' where id rlike 'local::'" - # For MariaDB, temporary database admin user needs to be created, as 'root' uses unix_socket login, which cannot be accessed by sudo -u www-data. - mysql -e "grant all privileges on *.* to 'tmp_root'@'localhost' identified by '$GLOBAL_PW' with grant option" + elif ! grep -q "'installed' => true," $config_php 2>/dev/null; then - G_EXEC_DESC='ownCloud occ install' - # - Replace password string internally to avoid printing it to console - G_EXEC_PRE_FUNC(){ acommand[10]=$GLOBAL_PW acommand[14]=$GLOBAL_PW; } - # - Checking output for stack trace to handle internal errors that do not lead to php error exit code - G_EXEC_POST_FUNC(){ grep -qi 'Stack trace' $fp_log && exit_code=1337; } - G_EXEC occ maintenance:install --no-interaction --database 'mysql' --database-name 'owncloud' --database-user 'tmp_root' --database-pass '' --admin-user "$username" --admin-pass '' --data-dir "$datadir" + local username=$(sed -n '/^[[:blank:]]*SOFTWARE_OWNCLOUD_NEXTCLOUD_USERNAME=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) + [[ $username ]] || username='admin' - # Remove obsolete default data dir - [[ $(readlink -f $datadir) != $(readlink -f /var/www/owncloud/data) ]] && rm -R /var/www/owncloud/data + # For MariaDB, temporary database admin user needs to be created, as 'root' uses unix_socket login, which cannot be accessed by sudo -u www-data. + # - Create random temporary alphanumeric 30 characters password + local oc_password=$(tr -dc '[:alnum:]' < /dev/random | head -c30) + # - Failsafe: Use non-blocking entropy source, if /dev/random fails + (( ${#oc_password} == 30 )) || oc_password=$(tr -dc '[:alnum:]' < /dev/urandom | head -c30) + G_EXEC mysql -e "grant all privileges on *.* to tmp_root@localhost identified by '$oc_password' with grant option" - mysql -e 'drop user tmp_root@localhost' + G_EXEC_DESC='ownCloud occ install' + # - Replace password strings internally to avoid printing it to console + G_EXEC_PRE_FUNC(){ acommand[10]=$oc_password acommand[14]=$GLOBAL_PW; } + # - Checking output for stack trace to handle internal errors that do not lead to php error exit code + G_EXEC_POST_FUNC(){ grep -qi 'Stack trace' $fp_log && exit_code=255; } + G_EXEC occ maintenance:install --no-interaction --database 'mysql' --database-name 'owncloud' --database-user 'tmp_root' --database-pass '' --admin-user "$username" --admin-pass '' --data-dir "$datadir" + G_EXEC mysql -e 'drop user tmp_root@localhost' + unset -v oc_password - fi + # Remove obsolete default data dir + [[ $(readlink -f "$datadir") != $(readlink -f /var/www/owncloud/data) ]] && G_EXEC rm -R /var/www/owncloud/data fi @@ -8125,7 +8135,7 @@ location = /.well-known/caldav { G_DIETPI-NOTIFY 2 'Apply PHP override settings for Nextcloud.' # https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/server_tuning.html#enable-php-opcache echo -e '; Nextcloud PHP settings\n; priority=98\napc.enable_cli=1\nopcache.enable=1\nopcache.interned_strings_buffer=8 -opcache.max_accelerated_files=10000\nopcache.memory_consumption=128\nopcache.save_comments=1\nopcache.revalidate_freq=1\nmemory_limit=512M' > $FP_PHP_BASE_DIR/mods-available/dietpi-nextcloud.ini +opcache.max_accelerated_files=10000\nopcache.memory_consumption=128\nopcache.save_comments=1\nopcache.revalidate_freq=5\nmemory_limit=512M' > $FP_PHP_BASE_DIR/mods-available/dietpi-nextcloud.ini G_EXEC phpenmod dietpi-nextcloud if (( ${aSOFTWARE_INSTALL_STATE[83]} > 0 )); then @@ -8205,8 +8215,7 @@ url.redirect += ( fi # Disable pretty URLs (front controller), if Nextcloud version is lower than 13 - # shellcheck disable=SC2016 - if (( $(sed -n '/$OC_VersionString/{s/^[^0-9]*//;s/\..*$//;p;q}' /var/www/nextcloud/version.php) < 13 )); then + if (( $(sed -n '/\$OC_VersionString/{s/^[^0-9]*//;s/\..*$//p;q}' /var/www/nextcloud/version.php) < 13 )); then sed -i 's/^[[:blank:]]*fastcgi_param front_controller_active true;/\t\t#fastcgi_param front_controller_active true;/g' $nextcloud_conf @@ -8238,10 +8247,10 @@ location = /.well-known/caldav { # Adjusting config file: local config_php='/var/www/nextcloud/config/config.php' - local datadir=$(grep -m1 '^[[:blank:]]*SOFTWARE_NEXTCLOUD_DATADIR=' /boot/dietpi.txt | sed 's/^[^=]*=//') + local datadir=$(sed -n '/^[[:blank:]]*SOFTWARE_NEXTCLOUD_DATADIR=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) [[ $datadir ]] || datadir='/mnt/dietpi_userdata/nextcloud_data' - mkdir -p $datadir - chown www-data:www-data $datadir + G_EXEC mkdir -p "$datadir" + G_EXEC chown -R www-data:www-data /var/www/nextcloud "$datadir" if [[ -d '/mnt/dietpi_userdata/mysql/nextcloud' ]]; then @@ -8256,64 +8265,64 @@ To remove the existing database (including e.g. contacts, calendar, file tags et # mysqladmin drop nextcloud Otherwise to copy an existing instance in place: # rm -R /var/www/nextcloud + # mkdir /var/www/nextcloud # cp -a /path/to/existing/nextcloud/. /var/www/nextcloud/ - # chown -R www-data:www-data /var/www/nextcloud\n The install script will now exit. After applying one of the the above, rerun dietpi-software, e.g.: # dietpi-software install 114' - [[ -f /var/www/nextcloud/occ ]] && rm /var/www/nextcloud/occ + [[ -f '/var/www/nextcloud/occ' ]] && G_EXEC rm /var/www/nextcloud/occ /boot/dietpi/dietpi-services start exit 1 fi - else - - if [[ -f $datadir/dietpi-nextcloud-database-backup.sql ]]; then + elif [[ -f $datadir/dietpi-nextcloud-database-backup.sql ]]; then - G_DIETPI-NOTIFY 2 'Nextcloud database backup found, starting recovery...' - local dbuser=$(grep -m1 "^[[:blank:]]*'dbuser'" $config_php | mawk '{print $3}' | sed "s/[',]//g") - local dbpass=$(grep -m1 "^[[:blank:]]*'dbpassword'" $config_php | mawk '{print $3}' | sed "s/[',]//g") - /boot/dietpi/func/create_mysql_db nextcloud "$dbuser" "$dbpass" - mysql nextcloud < $datadir/dietpi-nextcloud-database-backup.sql - ### Seems to be not needed anymore and can cause double entries: https://help.nextcloud.com/t/howto-change-move-data-directory-after-installation/17170/3?u=michaing - # Adjust database data directory entry, in case it changed due to server migration: - #mysql -e "update nextcloud.oc_storages set id='local::$datadir/' where id rlike 'local::'" + G_DIETPI-NOTIFY 2 'Nextcloud database backup found, starting recovery...' + local dbuser=$(grep -m1 "^[[:blank:]]*'dbuser'" $config_php | mawk -F\' '{print $4}') + local dbpass=$(grep -m1 "^[[:blank:]]*'dbpassword'" $config_php | mawk -F\' '{print $4}') + /boot/dietpi/func/create_mysql_db nextcloud "$dbuser" "$dbpass" + mysql nextcloud < "$datadir/dietpi-nextcloud-database-backup.sql" + ### Seems to be not needed anymore and can cause double entries: https://help.nextcloud.com/t/howto-change-move-data-directory-after-installation/17170/3?u=michaing + # Adjust database data directory entry, in case it changed due to server migration: + #G_EXEC mysql -e "update nextcloud.oc_storages set id='local::$datadir/' where id rlike 'local::'" - elif ! grep -q "'installed' => true," $config_php 2>/dev/null; then + elif ! grep -q "'installed' => true," $config_php 2>/dev/null; then - local username=$(grep -m1 '^[[:blank:]]*SOFTWARE_OWNCLOUD_NEXTCLOUD_USERNAME=' /boot/dietpi.txt | sed 's/^[^=]*=//') - [[ $username ]] || username='admin' + local username=$(sed -n '/^[[:blank:]]*SOFTWARE_OWNCLOUD_NEXTCLOUD_USERNAME=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) + [[ $username ]] || username='admin' - # For MariaDB, temporary database admin user needs to be created, as 'root' uses unix_socket login, which cannot be accessed by sudo -u www-data. - mysql -e "grant all privileges on *.* to 'tmp_root'@'localhost' identified by '$GLOBAL_PW' with grant option" + # For MariaDB, temporary database admin user needs to be created, as 'root' uses unix_socket login, which cannot be accessed by sudo -u www-data. + # - Create random temporary alphanumeric 30 characters password + local nc_password=$(tr -dc '[:alnum:]' < /dev/random | head -c30) + # - Failsafe: Use non-blocking entropy source, if /dev/random fails + (( ${#nc_password} == 30 )) || nc_password=$(tr -dc '[:alnum:]' < /dev/urandom | head -c30) + G_EXEC mysql -e "grant all privileges on *.* to tmp_root@localhost identified by '$nc_password' with grant option" - G_EXEC_DESC='Nextcloud ncc install' - # - Replace password string internally to avoid printing it to console - G_EXEC_PRE_FUNC(){ acommand[10]=$GLOBAL_PW acommand[14]=$GLOBAL_PW; } - # - Checking output for stack trace to handle internal errors that do not lead to php error exit code - # - Workaround Nextcloud 14.0.3 throwing an error, when data dir path contains a symlink: https://github.com/nextcloud/server/issues/12247 - G_EXEC_POST_FUNC(){ + G_EXEC_DESC='Nextcloud ncc install' + # - Replace password strings internally to avoid printing it to console + G_EXEC_PRE_FUNC(){ acommand[10]=$nc_password acommand[14]=$GLOBAL_PW; } + # - Checking output for stack trace to handle internal errors that do not lead to php error exit code + # - Workaround Nextcloud 14.0.3 throwing an error, when data dir path contains a symlink: https://github.com/nextcloud/server/issues/12247 + G_EXEC_POST_FUNC(){ - if (( $exit_code )); then + if (( $exit_code )); then - grep -q 'Following symlinks is not allowed' $fp_log && { cp -a /var/www/nextcloud/core/skeleton/. "$datadir/$username/files/"; exit_code=0; } + grep -q 'Following symlinks is not allowed' $fp_log && { cp -a /var/www/nextcloud/core/skeleton/. "$datadir/$username/files/"; exit_code=0; } - else - - grep -qi 'Stack trace' $fp_log && exit_code=1337 - - fi + else - } - G_EXEC ncc maintenance:install --no-interaction --database 'mysql' --database-name 'nextcloud' --database-user 'tmp_root' --database-pass '' --admin-user "$username" --admin-pass '' --data-dir "$datadir" + grep -qi 'Stack trace' $fp_log && exit_code=255 - # Remove obsolete default data dir - [[ $(readlink -f $datadir) != $(readlink -f /var/www/nextcloud/data) ]] && rm -R /var/www/nextcloud/data + fi - mysql -e 'drop user tmp_root@localhost' + } + G_EXEC ncc maintenance:install --no-interaction --database 'mysql' --database-name 'nextcloud' --database-user 'tmp_root' --database-pass '' --admin-user "$username" --admin-pass '' --data-dir "$datadir" + G_EXEC mysql -e 'drop user tmp_root@localhost' + unset -v nc_password - fi + # Remove obsolete default data dir + [[ $(readlink -f "$datadir") != $(readlink -f /var/www/nextcloud/data) ]] && G_EXEC rm -R /var/www/nextcloud/data fi @@ -8367,6 +8376,7 @@ The install script will now exit. After applying one of the the above, rerun die # Add missing database columns and indices, which is not done automatically by Nextcloud ncc db:add-missing-columns ncc db:add-missing-indices + ncc db:add-missing-primary-keys # Enable maintenance mode to allow handling by dietpi-services: grep -q "^[[:blank:]]*'maintenance' => true," $config_php || ncc maintenance:mode --on From 049cc81d9e8993d1b030f99c30b826e13753c977 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sun, 14 Mar 2021 20:24:33 +0100 Subject: [PATCH 027/147] v7.1 + DietPi-Imager | Tiny --- .meta/dietpi-imager | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.meta/dietpi-imager b/.meta/dietpi-imager index 552b8b0932..afb8ca996b 100755 --- a/.meta/dietpi-imager +++ b/.meta/dietpi-imager @@ -575,11 +575,11 @@ _EOF_ G_EXEC_DESC='Downloading current README.md to pack with image...' G_EXEC curl -sSfL "$DIETPI_REPO"/README.md -o README.md # Generate 7z archive - # NB: LZMA2 ultra compression requires much memory for usage and allocation, which is an issue on 32bit (ARM) devices. Use "-mmt" to limit used CPU threads to "" and lower memory usage and allocation. + # NB: LZMA2 ultra compression requires much memory per thread. 1 GiB is not sufficient for >2 threads, hence use "-mmt2" to limit used CPU threads to "2" on 1 GiB devices with more than two cores. local limit_threads (( $(free -m | mawk '/Mem:/{print $2}') < 1750 && $(nproc) > 2 )) && limit_threads='-mmt2' [[ -f $OUTPUT_IMG_NAME.7z ]] && G_EXEC rm "$OUTPUT_IMG_NAME.7z" - G_EXEC_DESC='Creating final 7zip archive' G_EXEC_OUTPUT=1 G_EXEC 7zr a -m0=lzma2 $limit_threads -mx=9 "$OUTPUT_IMG_NAME.7z" "$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT" hash.txt README.md + G_EXEC_DESC='Creating final 7zip archive' G_EXEC_OUTPUT=1 G_EXEC 7zr a -m0=lzma2 -mx=9 $limit_threads "$OUTPUT_IMG_NAME.7z" "$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT" hash.txt README.md G_EXEC_NOHALT=1 G_EXEC rm hash.txt README.md G_WHIP_MSG "[ OK ] DietPi-Imager has successfully finished.\n From c161efe319bf6873a4896dd8c78bb8f3b7d5229e Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sun, 14 Mar 2021 21:00:02 +0100 Subject: [PATCH 028/147] v7.1 + DietPi-Imager | Fix output of 7zr, omitted when piped as part of G_EXEC --- .meta/dietpi-imager | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.meta/dietpi-imager b/.meta/dietpi-imager index afb8ca996b..a6af1f88e9 100755 --- a/.meta/dietpi-imager +++ b/.meta/dietpi-imager @@ -579,7 +579,8 @@ _EOF_ local limit_threads (( $(free -m | mawk '/Mem:/{print $2}') < 1750 && $(nproc) > 2 )) && limit_threads='-mmt2' [[ -f $OUTPUT_IMG_NAME.7z ]] && G_EXEC rm "$OUTPUT_IMG_NAME.7z" - G_EXEC_DESC='Creating final 7zip archive' G_EXEC_OUTPUT=1 G_EXEC 7zr a -m0=lzma2 -mx=9 $limit_threads "$OUTPUT_IMG_NAME.7z" "$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT" hash.txt README.md + # Add "-bsp1 -bso1 -bse2" to print output to regular STDOUT and STDERR, else the pipe to "tee" makes it omit at least the progress output. + G_EXEC_DESC='Creating final 7zip archive' G_EXEC_OUTPUT=1 G_EXEC 7zr a -bsp1 -bso1 -bse2 -m0=lzma2 -mx=9 $limit_threads "$OUTPUT_IMG_NAME.7z" "$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT" hash.txt README.md G_EXEC_NOHALT=1 G_EXEC rm hash.txt README.md G_WHIP_MSG "[ OK ] DietPi-Imager has successfully finished.\n From 422e66fea31efd0ffcaf53fa1d9ed4fc5aa5c91e Mon Sep 17 00:00:00 2001 From: MichaIng Date: Mon, 15 Mar 2021 18:35:17 +0100 Subject: [PATCH 029/147] v7.1 + DietPi-Set_hardware | RPi: When disabling the camera features, additionally blacklist the bcm2835_isp kernel module, which is automatically loaded since kernel 5.X and pulls in the whole camera module stack. --- dietpi/func/dietpi-set_hardware | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dietpi/func/dietpi-set_hardware b/dietpi/func/dietpi-set_hardware index 83899687a8..34b805218b 100644 --- a/dietpi/func/dietpi-set_hardware +++ b/dietpi/func/dietpi-set_hardware @@ -112,22 +112,22 @@ $FP_SCRIPT rpi-eeprom if [[ $INPUT_DEVICE_VALUE == 'enable' ]]; then # Remove modules blacklist - [[ -f '/etc/modprobe.d/dietpi-disable_rpi_camera.conf' ]] && rm /etc/modprobe.d/dietpi-disable_rpi_camera.conf + [[ -f '/etc/modprobe.d/dietpi-disable_rpi_camera.conf' ]] && G_EXEC rm /etc/modprobe.d/dietpi-disable_rpi_camera.conf # Enable video devices via extended start G_CONFIG_INJECT 'start_x=' 'start_x=1' /boot/config.txt # Requires 128 MiB memory split at least local gpu_mem=$(sed -n '/^[[:blank:]]*gpu_mem[_0-9]*=/{s/^[^=]*=//p;q}' /boot/config.txt) - (( ${gpu_mem:-0} < 128 )) && INPUT_DEVICE_VALUE=128 Gpu_Memory_Split_Main + (( ${gpu_mem:-64} < 128 )) && INPUT_DEVICE_VALUE=128 Gpu_Memory_Split_Main elif [[ $INPUT_DEVICE_VALUE == 'disable' ]]; then # Comment extended start setting - sed -i '/^[[:blank:]]*start_x=/c\#start_x=1' /boot/config.txt + G_EXEC sed -i '/^[[:blank:]]*start_x=/c\#start_x=1' /boot/config.txt # Add modules blacklist, which are otherwise loaded by default since kernel 4.19 - echo -e 'blacklist bcm2835_codec\nblacklist bcm2835_v4l2' > /etc/modprobe.d/dietpi-disable_rpi_camera.conf + echo -e 'blacklist bcm2835_codec\nblacklist bcm2835_v4l2\nblacklist bcm2835_isp' > /etc/modprobe.d/dietpi-disable_rpi_camera.conf else From 8decbdb330544237dda73be34efc4414bca16422 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Mon, 15 Mar 2021 18:39:10 +0100 Subject: [PATCH 030/147] v7.1 + CHANGELOG | DietPi-Config: When disabling the RPi camera feature, the bcm2835_isp kernel module is now additionally blacklisted --- CHANGELOG.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index ebad3ef3a2..d9f76fc3dc 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -9,6 +9,7 @@ Changes: - DietPi-FS_partition_resize | Added support to automatically resize F2FS and Btrfs filesystems on first boot. - DietPi-Drive_Manager | Added support for resizing F2FS and Btrfs filesystems as well as format- and filesystem check & repair support for XFS filesystems. - DietPi-Config | Added a safe overclocking profile for RPi 3+ models. Many thanks to @lone for doing long-term stability tests and reporting back the result: https://dietpi.com/phpbb/viewtopic.php?p=32285#p32285 +- DietPi-Config | When disabling the RPi camera feature, the bcm2835_isp kernel module is now additionally blacklisted. Since kernel 5.X it is otherwise loaded automatically and pulls in the whole camera modules stack as dependency, adding some additional memory usage and boot overhead. Many thanks to @ferbar for making us aware of this: https://github.com/MichaIng/DietPi/issues/4203 Fixes: - DietPi-Drive_Manager | Fixed detection and visualisation of loop devices in menu. From ead4f4a50dab0cbce0ea15b58c41abb43da865b6 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Mon, 15 Mar 2021 18:43:03 +0100 Subject: [PATCH 031/147] v7.1 + DietPi-Patches | Additionally blacklist the bcm2835_isp kernel module when the RPi camera feature is disabled --- .update/patches | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.update/patches b/.update/patches index b0f8811308..c66d08cc4b 100644 --- a/.update/patches +++ b/.update/patches @@ -4,7 +4,7 @@ # Created by MichaIng / micha@dietpi.com / https://dietpi.com/ # License: GPLv2 / https://github.com/MichaIng/DietPi#license -# Update changed hardware IDs before dietpi-obtain_hw_model would reset them to 22 +# v7.1: Update changed hardware IDs before dietpi-obtain_hw_model would reset them to 22 if [[ -f '/etc/.dietpi_hw_model_identifier' ]] then G_HW_MODEL=$(> /etc/modprobe.d/dietpi-disable_rpi_camera.conf + exit 0 } From 93bd0c0b675f16c3b46a69bccff626bb452f1b15 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Tue, 16 Mar 2021 16:15:44 +0100 Subject: [PATCH 032/147] v7.1 + DietPi-Set_hardware | Only alter /etc/securetty up to Buster. On Bullseye it is not respected anymore by default PAM rules and has been removed from the login package. --- dietpi/func/dietpi-set_hardware | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dietpi/func/dietpi-set_hardware b/dietpi/func/dietpi-set_hardware index 34b805218b..23343d829f 100644 --- a/dietpi/func/dietpi-set_hardware +++ b/dietpi/func/dietpi-set_hardware @@ -1484,8 +1484,8 @@ Do you want to continue and DISABLE Bluetooth now?' || return 1 # Start now if device (already) exists [[ -e /dev/$INPUT_ADDITIONAL ]] && G_EXEC systemctl start "serial-getty@$INPUT_ADDITIONAL" - # Allow root login on selected TTY if not enabled by default - G_CONFIG_INJECT "$INPUT_ADDITIONAL" "$INPUT_ADDITIONAL" /etc/securetty + # Allow root login on selected TTY if not enabled by default. This file has been removed with Debian Bullseye and is not respected by its default PAM rules. + (( $G_DISTRO < 6 )) && G_CONFIG_INJECT "$INPUT_ADDITIONAL" "$INPUT_ADDITIONAL" /etc/securetty # Enable boot messages depending on device # - RPi From 6e82b5859b1df4e607524d5b240b9b80aedcf740 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Tue, 16 Mar 2021 16:19:25 +0100 Subject: [PATCH 033/147] v7.1 + CHANGELOG DietPi-Config/DietPi-PREP | Resolved an issue on Debian Bullseye, when toggling serial consoles, where /etc/securetty is attempted to be altered even that it is not used and does not exist anymore since Debian Bullseye --- CHANGELOG.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index d9f76fc3dc..20f9b5d70d 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -12,6 +12,7 @@ Changes: - DietPi-Config | When disabling the RPi camera feature, the bcm2835_isp kernel module is now additionally blacklisted. Since kernel 5.X it is otherwise loaded automatically and pulls in the whole camera modules stack as dependency, adding some additional memory usage and boot overhead. Many thanks to @ferbar for making us aware of this: https://github.com/MichaIng/DietPi/issues/4203 Fixes: +- DietPi-Config/DietPi-PREP | Resolved an issue on Debian Bullseye, when toggling serial consoles, where /etc/securetty is attempted to be altered even that it is not used and does not exist anymore since Debian Bullseye. Many thanks to @NastyDesertFox for reporting this issue: https://github.com/MichaIng/DietPi/issues/4205 - DietPi-Drive_Manager | Fixed detection and visualisation of loop devices in menu. - DietPi-Software | Resolved an issue where the "uninstall" command did not work and the "reinstall" did not show the intended backup prompt. Many thanks to @Zeuskk for reporting this v7.0 regression: https://dietpi.com/phpbb/viewtopic.php?t=8729 - DietPi-Software | X.Org X Server: Resolved an issue on RPi where the X server start failed when the KMS device tree overlay was not enabled. Many thanks to @xthedakmanx for reporting this issue: https://github.com/MichaIng/DietPi/issues/4175 From c8187abd0d5a27356cfdabf4d450d172b45264c7 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Tue, 16 Mar 2021 17:06:17 +0100 Subject: [PATCH 034/147] v7.1 + DietPi-PREP | Fix installer dependency conditional + DietPi-PREP | Do not apply preferring IPv4 with wget at the start of the script, since we don't use it in any of our scripts anymore. Instead apply the complete "preferipv4" option later, as the default for first boot. --- PREP_SYSTEM_FOR_DIETPI.sh | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/PREP_SYSTEM_FOR_DIETPI.sh b/PREP_SYSTEM_FOR_DIETPI.sh index 7a5db81599..0887666ed3 100644 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -86,8 +86,8 @@ Acquire::IndexTargets::deb-src::Sources::KeepCompressedAs "xz"; _EOF_ # - Forcing new DEB package config files (during PREP only) echo -e '#clear DPkg::options;\nDPkg::options:: "--force-confmiss,confnew";' > /etc/apt/apt.conf.d/98dietpi-forceconf - # - Prefer IPv4 by default to avoid hanging access attempts in some cases, e.g. WiFi bridges - # NB: This needs to match the method in: /DietPi/dietpi/func/dietpi-set_hardware preferipv4 enable + # - Force IPv4 by default to avoid hanging access attempts in some cases, e.g. WiFi bridges + # NB: This needs to match the method in: /boot/dietpi/func/dietpi-set_hardware preferipv4 enable echo 'Acquire::ForceIPv4 "true";' > /etc/apt/apt.conf.d/99-dietpi-force-ipv4 apt-get clean @@ -105,28 +105,12 @@ _EOF_ grep -q 'stretch' /etc/os-release && aAPT_PREREQS+=('apt-transport-https') for i in "${aAPT_PREREQS[@]}" do - dpkg-query -s "$i" &> /dev/null && apt-get -y install "$i" && continue + dpkg-query -s "$i" &> /dev/null || apt-get -y install "$i" && continue echo -e "[FAILED] Unable to install $i, please try to install it manually:\n\t # apt install $i\n" exit 1 done unset -v aAPT_PREREQS - # Wget: Prefer IPv4 by default to avoid hanging access attempts in some cases - # - NB: This needs to match the method in: /boot/dietpi/func/dietpi-set_hardware preferipv4 enable - if grep -q '^[[:blank:]]*prefer-family[[:blank:]]*=' /etc/wgetrc; then - - sed -i '/^[[:blank:]]*prefer-family[[:blank:]]*=/c\prefer-family = IPv4' /etc/wgetrc - - elif grep -q '^[[:blank:]#;]*prefer-family[[:blank:]]*=' /etc/wgetrc; then - - sed -i '/^[[:blank:]#;]*prefer-family[[:blank:]]*=/c\prefer-family = IPv4' /etc/wgetrc - - else - - echo 'prefer-family = IPv4' >> /etc/wgetrc - - fi - # Set Git owner GITOWNER=${GITOWNER:-MichaIng} @@ -1022,11 +1006,9 @@ Currently installed: $G_DISTRO_NAME (ID: $G_DISTRO)"; then for i in "${aservices[@]}" do - # Loop through known service locations for j in /etc/init.d/$i /{etc,lib,usr/lib,usr/local/lib}/systemd/system/{$i.service{,.d},*.wants/$i.service} do - [[ -e $j || -L $j ]] || continue [[ -f $j ]] && systemctl disable --now "${j##*/}" # Remove if not attached to any DEB package, else mask @@ -1038,9 +1020,7 @@ Currently installed: $G_DISTRO_NAME (ID: $G_DISTRO)"; then rm -Rv "$j" fi - done - done # - Remove obsolete SysV service entries @@ -1204,7 +1184,6 @@ MAILTO="" 47 1 * * 7 root test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.weekly; } 52 1 1 * * root test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.monthly; } _EOF_' - #----------------------------------------------------------------------------------- # Network G_DIETPI-NOTIFY 2 'Removing all rfkill soft blocks and the rfkill package' @@ -1262,6 +1241,9 @@ gateway 192.168.0.1 wireless-power off wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf _EOF_' + # Prefer IPv4 by default + /boot/dietpi/func/dietpi-set_hardware preferipv4 enable + #----------------------------------------------------------------------------------- # MISC G_DIETPI-NOTIFY 2 'Disabling apt-daily services to prevent random APT cache lock' From 3c089dd1e45f7d0dc0a482c97fcdd11607b34b69 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Wed, 17 Mar 2021 22:06:05 +0100 Subject: [PATCH 035/147] v7.1 + Odroid N2 | Add composite video (CVBS) cable and mode settings --- boot_n2.ini | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/boot_n2.ini b/boot_n2.ini index 48ae54cc46..93e0636004 100644 --- a/boot_n2.ini +++ b/boot_n2.ini @@ -68,6 +68,21 @@ setenv enable_wol "0" # "3440x1440p60hz" | 3440x1440 Progressive 60Hz setenv hdmimode "1080p60hz" +# Custom modeline! +# To use custom modeline you need to disable all the above resolutions. +# and setup your own! +# For more information check our wiki: +# http://odroid.com/dokuwiki/doku.php?id=en:c2_hdmi_autosetting +# Example: +#setenv hdmimode "custombuilt" +#setenv modeline "2560,1440,241500,88800,60,2560,2608,2640,2720,1440,1442,1447,1481,1,1,1" + +# Toggle composite video (CVBS) output: "0" or "1" +setenv cvbscable "0" + +# Composite video (CVBS) mode: "480cvbs" (NTSC) or "576cvbs" (PAL) +setenv cvbsmode "576cvbs" + # Overscan percentage # This value scales down the actual screen size by the percentage below. # Valid range is 80 to 100. @@ -122,7 +137,7 @@ if test "${max_freq_a53}"; then setenv a53_freq "max_freq_a53=${max_freq_a53}"; setenv bootlabel "DietPi (64-bit)" # Boot args -setenv bootargs "root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait ro ${condev} ${amlogic} no_console_suspend fsck.repair=yes net.ifnames=0 elevator=noop hdmimode=${hdmimode} cvbsmode=576cvbs maxcpus=${maxcpus} voutmode=${voutmode} disablehpd=${disablehpd} enable_wol=${enable_wol} ${cec_enable} sdrmode=${sdrmode} consoleblank=0 logo=osd0,loaded monitor_onoff=${monitor_onoff} ${hid_quirks} ${cmode} overscan=${overscan} cvbscable=${cvbscable} ${a73_freq} ${a53_freq}" +setenv bootargs "root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait ro ${condev} ${amlogic} no_console_suspend fsck.repair=yes net.ifnames=0 elevator=noop hdmimode=${hdmimode} cvbsmode=${cvbsmode} maxcpus=${maxcpus} voutmode=${voutmode} disablehpd=${disablehpd} enable_wol=${enable_wol} ${cec_enable} sdrmode=${sdrmode} consoleblank=0 logo=osd0,loaded monitor_onoff=${monitor_onoff} ${hid_quirks} ${cmode} overscan=${overscan} cvbscable=${cvbscable} ${a73_freq} ${a53_freq}" # Set load addresses setenv dtb_loadaddr "0x1000000" From cd2ad2154916c8cd23658ca33fe11fc5a2001efa Mon Sep 17 00:00:00 2001 From: ravenclaw900 <50060110+ravenclaw900@users.noreply.github.com> Date: Sat, 20 Mar 2021 08:19:20 -0500 Subject: [PATCH 036/147] v7.1 + DietPi-Morsecode | Fix it showing failed when converting a file to lowercase --- dietpi/dietpi-morsecode | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dietpi/dietpi-morsecode b/dietpi/dietpi-morsecode index 407d644838..c56e08f6a4 100644 --- a/dietpi/dietpi-morsecode +++ b/dietpi/dietpi-morsecode @@ -105,9 +105,9 @@ Mc_Convert_Input_Textfile_Lowercase(){ - G_DIETPI-NOTIFY 1 'DietPi-Morsecode\n\nConverting input file to lowercase......\n' + G_DIETPI-NOTIFY 2 'DietPi-Morsecode\n\nConverting input file to lowercase......\n' dd if="$FP_TEXTFILE_INPUT" of="$FP_TEXTFILE_LOWERCASE" conv=lcase &> /dev/null - G_DIETPI-NOTIFY 1 "Completed\nRendering to Output_Mode $OUTPUT_MODE" + G_DIETPI-NOTIFY 0 "Completed\nRendering to Output_Mode $OUTPUT_MODE" } From 49d0bc9d5db79e32dbf18b30481b85dffa966074 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Tue, 23 Mar 2021 12:14:09 +0100 Subject: [PATCH 037/147] v7.1 + Odroid N2 | Fix CPU frequency and overlays syntax --- boot_n2.ini | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/boot_n2.ini b/boot_n2.ini index 93e0636004..d514299ffd 100644 --- a/boot_n2.ini +++ b/boot_n2.ini @@ -68,12 +68,10 @@ setenv enable_wol "0" # "3440x1440p60hz" | 3440x1440 Progressive 60Hz setenv hdmimode "1080p60hz" -# Custom modeline! -# To use custom modeline you need to disable all the above resolutions. -# and setup your own! -# For more information check our wiki: +# Custom modeline +# To use a custom modeline you need to comment "setenv hdmimode" above, +# uncomment the two settings below and adjust "setenv modeline" to your needs: # http://odroid.com/dokuwiki/doku.php?id=en:c2_hdmi_autosetting -# Example: #setenv hdmimode "custombuilt" #setenv modeline "2560,1440,241500,88800,60,2560,2608,2640,2720,1440,1442,1447,1481,1,1,1" @@ -92,11 +90,10 @@ setenv overscan "100" # "dvi" disables HDMI audio. setenv voutmode "hdmi" -# HPD enable/disable option: "false" or "true" +# Disable HDMI hot-plug detection and force HDMI output: "false" or "true" setenv disablehpd "false" -# Hardkernel ODROID-VU7 support: "false" or "true" -# By default VU7 support is disabled +# Disable Hardkernel ODROID-VU7 LCD support: "false" or "true" (default) setenv disable_vu7 "true" # Max CPU frequency for big A73 cores in MHz @@ -110,7 +107,6 @@ setenv disable_vu7 "true" #setenv max_freq_a53 "1992" # Max CPU cores -# Note: # CPU's 0 and 1 are the A53 (small cores) # CPU's 2 to 5 are the A73 (big cores) # Lowering this value disables only the bigger cores (the last cores). @@ -130,8 +126,8 @@ if test "${cec}" = "true"; then setenv cec_enable "hdmitx=cec3f"; fi if test "${disable_vu7}" = "false"; then setenv hid_quirks "usbhid.quirks=0x0eef:0x0005:0x0004"; fi # Apply CPU frequencies if assigned -if test "${max_freq_a73}"; then setenv a73_freq "max_freq_a73=${max_freq_a73}"; fi -if test "${max_freq_a53}"; then setenv a53_freq "max_freq_a53=${max_freq_a53}"; fi +if test "x${max_freq_a73}" != "x"; then setenv a73_freq "max_freq_a73=${max_freq_a73}"; fi +if test "x${max_freq_a53}" != "x"; then setenv a53_freq "max_freq_a53=${max_freq_a53}"; fi # Label for petitboot setenv bootlabel "DietPi (64-bit)" @@ -152,7 +148,7 @@ fatload mmc ${devno}:1 ${initrd_loadaddr} uInitrd fdt addr ${dtb_loadaddr} # Load device tree overlays -if test "${overlays}"; then +if test "x${overlays} != "x"; then setenv dtbo_addr_r "0x11000000" fdt resize "16384" for overlay in ${overlays}; do From 95ec9c9cb546bdea1f906aa02aeb1077a14ab744 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Tue, 23 Mar 2021 13:28:08 +0100 Subject: [PATCH 038/147] v7.1 + Odroid N2 | Syntax --- boot_n2.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot_n2.ini b/boot_n2.ini index d514299ffd..1ae041aea2 100644 --- a/boot_n2.ini +++ b/boot_n2.ini @@ -148,7 +148,7 @@ fatload mmc ${devno}:1 ${initrd_loadaddr} uInitrd fdt addr ${dtb_loadaddr} # Load device tree overlays -if test "x${overlays} != "x"; then +if test "x${overlays}" != "x"; then setenv dtbo_addr_r "0x11000000" fdt resize "16384" for overlay in ${overlays}; do From 7f972eb310c5c3bb8f2cfb49ad04d6e673e23868 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Tue, 23 Mar 2021 16:41:47 +0100 Subject: [PATCH 039/147] v7.1 + DietPi-PREP | Install modern rng-tools5 on all RPi models, proven to work on RPi 1 as well, and on all Amlogic S922X SBCs (Odroid N2) --- PREP_SYSTEM_FOR_DIETPI.sh | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/PREP_SYSTEM_FOR_DIETPI.sh b/PREP_SYSTEM_FOR_DIETPI.sh index 0887666ed3..590e4c03b3 100644 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -671,18 +671,14 @@ Currently installed: $G_DISTRO_NAME (ID: $G_DISTRO)"; then aPACKAGES_REQUIRED_INSTALL+=('initramfs-tools') fi - # - Entropy daemon: Use modern rng-tools5 on all devices where it has been proven to work, on RPi rng-tools (default on Raspbian), else haveged: https://github.com/MichaIng/DietPi/issues/2806 - if [[ $G_HW_MODEL =~ ^(11|14|16|42|58|68|69|72)$ ]]; then # Odroid XU4, RK3399, Odroid C4 + # - Entropy daemon: Use modern rng-tools5 on all devices where it has been proven to work, else haveged: https://github.com/MichaIng/DietPi/issues/2806 + if [[ $G_HW_MODEL -lt 10 || $G_HW_MODEL =~ ^(11|14|15|16|24|29|42|58|68|72)$ ]]; then # RPi, Odroid XU4, RK3399, S922X, Odroid C4 aPACKAGES_REQUIRED_INSTALL+=('rng-tools5') - elif (( $G_HW_MODEL > 9 )); then - - aPACKAGES_REQUIRED_INSTALL+=('haveged') - else - aPACKAGES_REQUIRED_INSTALL+=('rng-tools') + aPACKAGES_REQUIRED_INSTALL+=('haveged') fi # - Drive power management control From 9e2c3d652da1ae6d304ed05482c22490132fa33a Mon Sep 17 00:00:00 2001 From: MichaIng Date: Wed, 24 Mar 2021 12:09:57 +0100 Subject: [PATCH 040/147] v7.1 + DietPi-PREP | Inside systemd-nspawn containers, lsblk is not able to obtain filesystem types and partition table types. Revert to blkid for those, which works without issues. --- PREP_SYSTEM_FOR_DIETPI.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PREP_SYSTEM_FOR_DIETPI.sh b/PREP_SYSTEM_FOR_DIETPI.sh index 590e4c03b3..7c97412a0f 100644 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -695,7 +695,7 @@ Currently installed: $G_DISTRO_NAME (ID: $G_DISTRO)"; then fi # Install gdisk if root file system is on a GPT partition, used by DietPi-FS_partition_resize - [[ $(lsblk -ndo PTTYPE "$(lsblk -npo PKNAME "$(findmnt -no SOURCE /)")") == 'gpt' ]] && aPACKAGES_REQUIRED_INSTALL+=('gdisk') + [[ $(blkid -s PTTYPE -o value "$(lsblk -npo PKNAME "$(findmnt -no SOURCE /)")") == 'gpt' ]] && aPACKAGES_REQUIRED_INSTALL+=('gdisk') # Install file system tools required for file system resizing and fsck while read -r line @@ -713,7 +713,7 @@ Currently installed: $G_DISTRO_NAME (ID: $G_DISTRO)"; then aPACKAGES_REQUIRED_INSTALL+=('btrfs-progs') fi - done < <(lsblk -no FSTYPE | sort -u) + done < <(blkid -s TYPE -o value | sort -u) # Kernel/bootloader/firmware # - We need to install those directly to allow G_AGA() autoremove possible older packages later: https://github.com/MichaIng/DietPi/issues/1285#issuecomment-354602594 From d6a7f9f1794266b1e78ec09ce8816e643b42c552 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Wed, 24 Mar 2021 12:14:33 +0100 Subject: [PATCH 041/147] v7.1 + DietPi-Drive_Manager | lsblk is not able to obtain filesystem type inside systemd-nspawn contains. Revert to blkid, which works without issues. --- dietpi/dietpi-drive_manager | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dietpi/dietpi-drive_manager b/dietpi/dietpi-drive_manager index 49a212264a..7961e2b45d 100644 --- a/dietpi/dietpi-drive_manager +++ b/dietpi/dietpi-drive_manager @@ -293,7 +293,7 @@ $swap_mounts aDRIVE_SOURCE_DEVICE[$index]=$(Return_Drive_Without_Partitions "${aDRIVE_MOUNT_SOURCE[$index]}") [[ ${aDRIVE_MOUNT_SOURCE[$index]} == /dev/${aDRIVE_SOURCE_DEVICE[$index]} ]] || aDRIVE_ISPARTITIONTABLE[$index]=1 (( ${aDRIVE_ISPARTITIONTABLE[$index]} )) && aDRIVE_PART_UUID[$index]=$(lsblk -no PARTUUID "${aDRIVE_MOUNT_SOURCE[$index]}") - aDRIVE_FSTYPE[$index]=$(lsblk -no FSTYPE "${aDRIVE_MOUNT_SOURCE[$index]}") + aDRIVE_FSTYPE[$index]=$(blkid -s TYPE -o value "${aDRIVE_MOUNT_SOURCE[$index]}") [[ ${aDRIVE_FSTYPE[$index]} ]] && aDRIVE_ISFILESYSTEM[$index]=1 done < <(blkid -o device) @@ -473,7 +473,7 @@ Do you wish to ignore this warning, and, mount the drive regardless?" || return # Mount options local aoptions=() # - FS type specific options - local fs_type=$(lsblk -no FSTYPE "$source") + local fs_type=$(blkid -s TYPE -o value "$source") if [[ $fs_type == 'ntfs' ]]; then aoptions=('-o' 'permissions') From 9fe8d107ea020cbf26857a20cd9d94656d7a482c Mon Sep 17 00:00:00 2001 From: MichaIng Date: Wed, 24 Mar 2021 12:17:02 +0100 Subject: [PATCH 042/147] v7.1 + DietPi-FS_partition_resize | lsblk is not able to obtain partition table types within systemd-nspawn containers, hence revert to blkid which works fine. --- rootfs/var/lib/dietpi/services/fs_partition_resize.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rootfs/var/lib/dietpi/services/fs_partition_resize.sh b/rootfs/var/lib/dietpi/services/fs_partition_resize.sh index caed704141..a08dc78e5a 100644 --- a/rootfs/var/lib/dietpi/services/fs_partition_resize.sh +++ b/rootfs/var/lib/dietpi/services/fs_partition_resize.sh @@ -36,7 +36,8 @@ sync # GPT partition table: Move backup GPT data structures to the end of the disk - [[ $(lsblk -ndo PTTYPE "$ROOT_DRIVE") != 'gpt' ]] || sgdisk -e "$ROOT_DRIVE" + # - lsblk -ndo PTTYPE "$ROOT_DRIVE" does not work inside systemd-nspawn containers. + [[ $(blkid -s PTTYPE -o value "$ROOT_DRIVE") != 'gpt' ]] || sgdisk -e "$ROOT_DRIVE" # Maximise root partition size sfdisk --no-reread --no-tell-kernel -fN"$ROOT_PART" "$ROOT_DRIVE" <<< ',+' From 912606ed46c8961dd20f260db281aac0858c95ea Mon Sep 17 00:00:00 2001 From: MichaIng Date: Wed, 24 Mar 2021 20:28:59 +0100 Subject: [PATCH 043/147] v7.1 + DietPi-Pre-patches | Update Ondrej's PHP APT repo key, expired on February 16 2021 --- .update/pre-patches | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.update/pre-patches b/.update/pre-patches index 5d00232950..9579fe3dd0 100644 --- a/.update/pre-patches +++ b/.update/pre-patches @@ -15,7 +15,7 @@ G_INIT # - Pre-v6.29: Create G_EXEC as G_RUN_CMD wrapper declare -F G_EXEC > /dev/null || G_EXEC(){ G_RUN_CMD "$@"; } -# Update Jellyfin APT repo key: https://dietpi.com/phpbb/viewtopic.php?t=8703 +# v7.0: Update Jellyfin APT repo key: https://dietpi.com/phpbb/viewtopic.php?t=8703 if [[ -f '/etc/apt/trusted.gpg.d/dietpi-jellyfin.gpg' && $(date -u '+%Y%m%d' -r '/etc/apt/trusted.gpg.d/dietpi-jellyfin.gpg') -lt 20201216 ]] then G_DIETPI-NOTIFY 2 'Updating Jellyfin APT repo key: https://dietpi.com/phpbb/viewtopic.php?t=8703' @@ -24,5 +24,13 @@ then G_EXEC rm jellyfin_team.gpg.key fi +# v7.1: Update Ondrej's PHP APT repo key: https://github.com/MichaIng/DietPi/issues/4219 +if apt-key list '95BD4743' 2> /dev/null | grep -q 'expires: 2021-' +then + G_DIETPI-NOTIFY 2 'Updating PHP APT repo key: https://github.com/MichaIng/DietPi/issues/4219' + G_EXEC apt-key del '95BD4743' + G_EXEC curl -sSfL 'https://packages.sury.org/php/apt.gpg' -o /etc/apt/trusted.gpg.d/dietpi-php.gpg +fi + exit 0 } From 1356370cd8c98adcfd66171f76c829f70f1b37b2 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Wed, 24 Mar 2021 20:32:45 +0100 Subject: [PATCH 044/147] v7.1 + DietPi-Software | Don't install PHP APT repo key via deprecated apt-key anymore --- dietpi/dietpi-software | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index 422fcef7a8..528bc8b935 100644 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -3449,11 +3449,8 @@ Package: *\nPin: release n=buster\nPin-Priority: 100' > /etc/apt/preferences.d/d else - # Check URL - INSTALL_URL_ADDRESS='https://packages.sury.org/php/apt.gpg' - G_CHECK_URL "$INSTALL_URL_ADDRESS" # APT key - curl -sSfL "$INSTALL_URL_ADDRESS" | apt-key add - + G_EXEC curl -sSfL 'https://packages.sury.org/php/apt.gpg' -o /etc/apt/trusted.gpg.d/dietpi-php.gpg # APT source echo "deb https://packages.sury.org/php/ $G_DISTRO_NAME main" > /etc/apt/sources.list.d/dietpi-php.list # Pin down libssl1.1 version from this repo on Stretch: https://github.com/MichaIng/DietPi/issues/2734 @@ -13563,6 +13560,7 @@ _EOF_ ## Leave PHP repo in place to avoid issues with remaining dependency packages that were pulled from this repo # APT repo #[[ -f '/etc/apt/sources.list.d/dietpi-php.list' ]] && rm /etc/apt/sources.list.d/dietpi-php.list + #[[ -f '/etc/apt/trusted.gpg.d/dietpi-php.gpg' ]] && rm /etc/apt/trusted.gpg.d/dietpi-php.gpg # APT preferences #[[ -f '/etc/apt/preferences.d/dietpi-openssl' ]] && rm /etc/apt/preferences.d/dietpi-openssl #[[ -f '/etc/apt/preferences.d/dietpi-php' ]] && rm /etc/apt/preferences.d/dietpi-php From 71ad4f49893831f5f73e44c8e1f7aa6dc4fc37cb Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sun, 28 Mar 2021 13:25:17 +0200 Subject: [PATCH 045/147] v7.1 + DietPi-Set_userdata | Re-apply dietpi:dietpi owner to target directory, used by some software titles like Syncthing and file servers to permit creating files and directories, as intended: https://github.com/MichaIng/DietPi/issues/4228 + DietPi-Set_userdata | Do not check for source directory content, before moving it. "cp source/. target/" does not error out if the directory is empty and we still want the source directory removed, the symlink created and the log about succeeded transfer, even with empty data. --- dietpi/func/dietpi-set_userdata | 77 ++++++++++++++++----------------- 1 file changed, 37 insertions(+), 40 deletions(-) diff --git a/dietpi/func/dietpi-set_userdata b/dietpi/func/dietpi-set_userdata index eff5dc8c48..5cbbd8c106 100644 --- a/dietpi/func/dietpi-set_userdata +++ b/dietpi/func/dietpi-set_userdata @@ -39,34 +39,31 @@ # Stop all running services /boot/dietpi/dietpi-services stop - # Copy source to target, if it contains any files/folders - if [[ -z $(find "$SOURCE_DIRECTORY" -maxdepth 0 -empty) ]]; then + G_DIETPI-NOTIFY 2 "Moving your existing data from $SOURCE_DIRECTORY to $TARGET_DIRECTORY, please wait..." - G_DIETPI-NOTIFY 0 "Moving your existing data from $SOURCE_DIRECTORY to $TARGET_DIRECTORY" - G_DIETPI-NOTIFY 2 'Please wait...\n' + # Begin transfer + if cp -a "$SOURCE_DIRECTORY/." "$TARGET_DIRECTORY/"; then - # Begin transfer - if cp -a "$SOURCE_DIRECTORY/." "$TARGET_DIRECTORY/"; then + # Remove source + rm -R "$SOURCE_DIRECTORY" - # Remove source - rm -R "$SOURCE_DIRECTORY" + # Create symlink at /mnt/dietpi_userdata if required + if [[ $TARGET_DIRECTORY != '/mnt/dietpi_userdata' ]]; then - # Create symlink to G_FP_DIETPI_USERDATA if required - if [[ $TARGET_DIRECTORY != '/mnt/dietpi_userdata' ]]; then + rm -Rf /mnt/dietpi_userdata + ln -s "$TARGET_DIRECTORY" /mnt/dietpi_userdata - rm -Rf /mnt/dietpi_userdata - ln -s "$TARGET_DIRECTORY" /mnt/dietpi_userdata - - fi + fi - LOGFILE_OUTPUT_TEXT="[ OK ] Successfully moved your data from $SOURCE_DIRECTORY to $TARGET_DIRECTORY" + # Apply dietpi:dietpi owner, used by some software titles like Syncthing and file servers to permit creating files and directories + chown dietpi:dietpi "$TARGET_DIRECTORY" - else + LOGFILE_OUTPUT_TEXT="Successfully moved your data from $SOURCE_DIRECTORY to $TARGET_DIRECTORY." - LOGFILE_OUTPUT_TEXT="[FAILED] Failed to copy $SOURCE_DIRECTORY/ to $TARGET_DIRECTORY." - EXIT_CODE=1 + else - fi + LOGFILE_OUTPUT_TEXT="Failed to copy $SOURCE_DIRECTORY/ to $TARGET_DIRECTORY." + EXIT_CODE=1 fi @@ -86,55 +83,57 @@ # Sanity checks # - Check for both inputs - if [[ ! $SOURCE_DIRECTORY || ! $TARGET_DIRECTORY ]]; then + if ! [[ $SOURCE_DIRECTORY && $TARGET_DIRECTORY ]]; then - LOGFILE_OUTPUT_TEXT="[FAILED] Please provide a source ($SOURCE_DIRECTORY) and target ($TARGET_DIRECTORY) directory for input." + LOGFILE_OUTPUT_TEXT="Please provide a source ($SOURCE_DIRECTORY) and target ($TARGET_DIRECTORY) directory for input." EXIT_CODE=1 # - Check if symlink is already pointing to target directory elif [[ $(readlink -f /mnt/dietpi_userdata) == "$TARGET_DIRECTORY" ]]; then - LOGFILE_OUTPUT_TEXT='[ INFO ] /mnt/dietpi_userdata is already symlinked to target directory.' + LOGFILE_OUTPUT_TEXT="/mnt/dietpi_userdata has already been moved to $TARGET_DIRECTORY, nothing to do." # - Check if source directory exists elif [[ ! -d $SOURCE_DIRECTORY ]]; then - LOGFILE_OUTPUT_TEXT="[FAILED] Source directory $SOURCE_DIRECTORY does not exist." + LOGFILE_OUTPUT_TEXT="Source directory $SOURCE_DIRECTORY does not exist." EXIT_CODE=1 # - Check for disallowed directory match - elif [[ $SOURCE_DIRECTORY =~ $TARGET_DIRECTORY || $TARGET_DIRECTORY =~ $SOURCE_DIRECTORY ]]; then + elif [[ $SOURCE_DIRECTORY == "$TARGET_DIRECTORY" || $SOURCE_DIRECTORY == "$TARGET_DIRECTORY/"* || $TARGET_DIRECTORY == "$SOURCE_DIRECTORY/"* ]]; then - LOGFILE_OUTPUT_TEXT="[FAILED] $SOURCE_DIRECTORY and $TARGET_DIRECTORY cannot be within each other. Disallowed directory match." + LOGFILE_OUTPUT_TEXT="$SOURCE_DIRECTORY and $TARGET_DIRECTORY cannot be within each other. Disallowed directory match." EXIT_CODE=1 # - Only allow full filepaths elif [[ $SOURCE_DIRECTORY != '/'* || $TARGET_DIRECTORY != '/'* ]]; then - LOGFILE_OUTPUT_TEXT="[FAILED] Both source ($SOURCE_DIRECTORY) and target directories ($TARGET_DIRECTORY) must contain the full filepath (eg: /mnt/drive1)" + LOGFILE_OUTPUT_TEXT="Source ($SOURCE_DIRECTORY) and target directories ($TARGET_DIRECTORY) must be given with absolute path, e.g.: /mnt/drive1" EXIT_CODE=1 else - # - Remove /mnt/dietpi_userdata symlink, if chosen as target + # Remove /mnt/dietpi_userdata symlink, if chosen as target [[ $TARGET_DIRECTORY == '/mnt/dietpi_userdata' && -L '/mnt/dietpi_userdata' ]] && rm /mnt/dietpi_userdata + + # Create target directory mkdir -p "$TARGET_DIRECTORY" - # - Ensure we can create, write and set permissions to target directory + # Ensure target directory supports POSIX permissions if ! G_CHECK_FS_PERMISSION_SUPPORT "$TARGET_DIRECTORY"; then - LOGFILE_OUTPUT_TEXT="[FAILED] $TARGET_DIRECTORY does not support filesystem permissions. Transfer aborted." + LOGFILE_OUTPUT_TEXT="$TARGET_DIRECTORY does not support POSIX permissions. Transfer aborted." EXIT_CODE=1 else - # - Ensure enough freespace in target - # "-m" => result in MiB actual disc usage, respecting disk block size, e.g. "144" - # Trailing slash required with "du" to correctly check symlink target in case + # Check for sufficient free space in target directory + # - "-m" => result in MiB actual disk usage, respecting disk block size, e.g. "144" + # - Trailing slash required with "du" to correctly check symlink target in case FREESPACE_REQUIRED_SOURCE=$(du -sm "$SOURCE_DIRECTORY/" | mawk '{print $1}') if ! G_CHECK_FREESPACE "$TARGET_DIRECTORY" "$FREESPACE_REQUIRED_SOURCE"; then - LOGFILE_OUTPUT_TEXT="[FAILED] Not enough free space in target directory $TARGET_DIRECTORY.\n - Required: $FREESPACE_REQUIRED_SOURCE MiB" + LOGFILE_OUTPUT_TEXT="Not enough free space in target directory $TARGET_DIRECTORY.\n - Required: $FREESPACE_REQUIRED_SOURCE MiB" EXIT_CODE=1 else @@ -150,24 +149,22 @@ #----------------------------------------------------------------------------------- # Print results and send to logfile - [[ -f $FP_LOG ]] && rm $FP_LOG if [[ $LOGFILE_OUTPUT_TEXT ]]; then - # Error + # Failed if (( $EXIT_CODE )); then G_DIETPI-NOTIFY 1 "$LOGFILE_OUTPUT_TEXT" + echo -e "[FAILED] $LOGFILE_OUTPUT_TEXT" > $FP_LOG - # Info + # Ok else - G_DIETPI-NOTIFY 2 "$LOGFILE_OUTPUT_TEXT" + G_DIETPI-NOTIFY 0 "$LOGFILE_OUTPUT_TEXT" + echo -e "[ OK ] $LOGFILE_OUTPUT_TEXT" > $FP_LOG fi - # Send to logfile - echo -e "$LOGFILE_OUTPUT_TEXT" > $FP_LOG - fi #----------------------------------------------------------------------------------- From 3ff09d406bb216e2dc9f06277efdaa4bf07c302d Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sun, 28 Mar 2021 13:29:29 +0200 Subject: [PATCH 046/147] v7.1 + CHANGELOG | When dietpi_userdata was moved to another drive, the intended dietpi:dietpi ownership was not applied to the target directory as intended. This is required by some software titles, like Syncthing and file servers, to permit the creation of files and directories. Many thanks to @redschumi for reporting this issue: https://github.com/MichaIng/DietPi/issues/4228 --- CHANGELOG.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 20f9b5d70d..3bcbcb06af 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -14,6 +14,7 @@ Changes: Fixes: - DietPi-Config/DietPi-PREP | Resolved an issue on Debian Bullseye, when toggling serial consoles, where /etc/securetty is attempted to be altered even that it is not used and does not exist anymore since Debian Bullseye. Many thanks to @NastyDesertFox for reporting this issue: https://github.com/MichaIng/DietPi/issues/4205 - DietPi-Drive_Manager | Fixed detection and visualisation of loop devices in menu. +- DietPi-Set_userdata | When dietpi_userdata was moved to another drive, the intended dietpi:dietpi ownership was not applied to the target directory as intended. This is required by some software titles, like Syncthing and file servers, to permit the creation of files and directories. Many thanks to @redschumi for reporting this issue: https://github.com/MichaIng/DietPi/issues/4228 - DietPi-Software | Resolved an issue where the "uninstall" command did not work and the "reinstall" did not show the intended backup prompt. Many thanks to @Zeuskk for reporting this v7.0 regression: https://dietpi.com/phpbb/viewtopic.php?t=8729 - DietPi-Software | X.Org X Server: Resolved an issue on RPi where the X server start failed when the KMS device tree overlay was not enabled. Many thanks to @xthedakmanx for reporting this issue: https://github.com/MichaIng/DietPi/issues/4175 - DietPi-Software | LXDE: Resolved an issue where after installing LXDE, the system booted into the LightDM desktop login mask automatically, even if desktop autologin was not chosen via dietpi-autostart. Many thanks to @manilx for reporting this issue: https://dietpi.com/phpbb/viewtopic.php?t=8766 From ddeb95a5a4aac39d044a376a58400ae3e4e27f67 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sun, 28 Mar 2021 13:57:23 +0200 Subject: [PATCH 047/147] v7.1 + DietPi-Software | Syncthing: Failsafe: Assure that "dietpi" has permission to create the /mnt/dietpi_userdata/syncthing directory + DietPi-Software | Syncthing: Update systemd unit to include the restart burst protected that is about to be added upstream with v1.15: https://github.com/syncthing/syncthing/pull/7529 + DietPi-Software | Syncthing: Update fallback download and add G_EXEC error handler where applicable --- dietpi/dietpi-software | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index 528bc8b935..8f7113c379 100644 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -5538,7 +5538,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=bullseye\nPin- fi - local fallback_url="https://github.com/syncthing/syncthing/releases/download/v1.13.1/syncthing-linux-$arch-v1.13.1.tar.gz" + local fallback_url="https://github.com/syncthing/syncthing/releases/download/v1.14.0/syncthing-linux-$arch-v1.14.0.tar.gz" Download_Install "$(curl -sSfL 'https://api.github.com/repos/syncthing/syncthing/releases/latest' | grep "\"browser_download_url\": .*/syncthing-linux-$arch-[^\"/]*\.tar\.gz\"" | cut -d \" -f 4)" G_EXEC mv syncthing-* /opt/syncthing @@ -11390,20 +11390,23 @@ _EOF_ Banner_Configuration # Permissions - chown -R dietpi:dietpi /opt/syncthing + G_EXEC chown -R dietpi:dietpi /opt/syncthing # to permit self-updates # Pre-create and edit default config only on fresh installs if [[ ! -f '/mnt/dietpi_userdata/syncthing/config.xml' ]]; then + # Failsafe: Assure that "dietpi" has permission to create the /mnt/dietpi_userdata/syncthing directory + G_EXEC chown dietpi /mnt/dietpi_userdata + # Run Syncthing to pre-create config dir and exit - sudo -u dietpi /opt/syncthing/syncthing -generate=/mnt/dietpi_userdata/syncthing + G_EXEC_OUTPUT=1 G_EXEC sudo -u dietpi /opt/syncthing/syncthing -generate=/mnt/dietpi_userdata/syncthing # Allow remote access: https://docs.syncthing.net/users/faq.html#how-do-i-access-the-web-gui-from-another-computer - sed -i '\|:8384|c\
0.0.0.0:8384
' /mnt/dietpi_userdata/syncthing/config.xml + G_EXEC sed -i '\|:8384|c\
0.0.0.0:8384
' /mnt/dietpi_userdata/syncthing/config.xml - # Set default folder - mkdir -p /mnt/dietpi_userdata/syncthing_data - chown -R dietpi:dietpi /mnt/dietpi_userdata/syncthing_data + # Set default data directory + G_EXEC mkdir -p /mnt/dietpi_userdata/syncthing_data + G_EXEC chown -R dietpi:dietpi /mnt/dietpi_userdata/syncthing_data sed -i '\| /etc/sysctl.d/dietpi-syncthing.conf + G_EXEC eval "echo 'fs.inotify.max_user_watches=204800' > /etc/sysctl.d/dietpi-syncthing.conf" fi @@ -15081,7 +15087,7 @@ _EOF_ G_EXEC_NOHALT=1 G_EXEC rm -R /etc/systemd/system/qbittorrent.service* fi - [[ -d '/etc/systemd/system/qbittorrent.service.d' ]] && G_EXEC_NOHALT=1 G_EXEC rm -R /etc/systemd/system/qbittorrent.service.d + [[ -d '/etc/systemd/system/qbittorrent.service.d' ]] && G_EXEC_NOEXIT=1 G_EXEC rm -R /etc/systemd/system/qbittorrent.service.d G_AGP qbittorrent-nox getent passwd qbittorrent > /dev/null && userdel qbittorrent getent group qbittorrent > /dev/null && groupdel qbittorrent # pre-v6.29 @@ -15098,12 +15104,15 @@ _EOF_ if [[ -f '/etc/systemd/system/syncthing.service' ]]; then systemctl disable --now syncthing - rm -R /etc/systemd/system/syncthing.service* + G_EXEC_NOEXIT=1 G_EXEC rm -R /etc/systemd/system/syncthing.service* fi - [[ -d '/opt/syncthing' ]] && rm -R /opt/syncthing - [[ -d '/mnt/dietpi_userdata/syncthing' ]] && rm -R /mnt/dietpi_userdata/syncthing - [[ -f '/etc/sysctl.d/dietpi-syncthing.conf' ]] && rm /etc/sysctl.d/dietpi-syncthing.conf + [[ -d '/etc/systemd/system/syncthing.service.d' ]] && G_EXEC_NOEXIT=1 G_EXEC rm -R /etc/systemd/system/syncthing.service.d + + [[ -d '/opt/syncthing' ]] && G_EXEC_NOEXIT=1 G_EXEC rm -R /opt/syncthing + [[ -d '/mnt/dietpi_userdata/syncthing' ]] && G_EXEC_NOEXIT=1 G_EXEC rm -R /mnt/dietpi_userdata/syncthing + #[[ -d '/mnt/dietpi_userdata/syncthing_data' ]] && G_EXEC_NOEXIT=1 G_EXEC rm -R /mnt/dietpi_userdata/syncthing_data # Leave data in place + [[ -f '/etc/sysctl.d/dietpi-syncthing.conf' ]] && G_EXEC_NOEXIT=1 G_EXEC rm /etc/sysctl.d/dietpi-syncthing.conf fi From ddb04d15a8177d26089a13e7b9c5bb0bcb865389 Mon Sep 17 00:00:00 2001 From: ravenclaw900 <50060110+ravenclaw900@users.noreply.github.com> Date: Sun, 28 Mar 2021 14:33:42 -0500 Subject: [PATCH 048/147] v7.1 (#4180) + DietPi-NordVPN | Add support for ProtonVPN and custom OVPN files and consequently rename to DietPi-VPN + DietPi-Software | DietPi-NordVPN: Remove install option, as the new DietPi-VPN downloads and installs server lists/configs on demand and its service is installed as static part of the DietPi source code + DietPi-Bash | Add "dietpi-vpn" alias and print an error about the changed command when "dietpi-nordvpn" is called + DietPi-Patches | Migrate existing DietPi-NordVPN settings to DietPi-VPN, and remove obsolete script + DietPi-VPN | Up connection timeout to 20 seconds, as not all providers are as fast as NordVPN, especially free VPNs + DietPi-VPN | Turn off IPv6 on connection, as most providers do not support it which would lead to IPv6 request leaks + DietPi-Software | Unbound: Add information to config about root hints being updated monthly via cronjob + DietPi-VPN | Add a killswitch + DietPi-VPN | Create config files and client configs with 600 permissions right from the start via umask 0077. Still chown/chmod them, in case they existed already, but after all files have been created. + DietPi-VPN | Align WAN IP request timeout with banner: up to 3 seconds from 2 + DietPi-VPN | Do not stop the VPN service when applying/saving settings. It is restarted afterwards, which includes a stop, so that way the connection is stopped the shortest possible time. + DietPi-Banner | Rename VPN status menu entry --- .conf/dps_182/unbound.conf | 2 +- .conf/dpv/protonvpn.template | 149 ++++++ .update/patches | 18 + CHANGELOG.txt | 1 + dietpi/dietpi-services | 2 +- dietpi/dietpi-software | 50 +- dietpi/dietpi-vpn | 475 +++++++++++++++++++ dietpi/func/dietpi-banner | 6 +- dietpi/misc/dietpi-nordvpn | 366 -------------- rootfs/etc/bashrc.d/dietpi.bash | 3 +- rootfs/etc/systemd/system/dietpi-vpn.service | 21 + 11 files changed, 677 insertions(+), 416 deletions(-) create mode 100644 .conf/dpv/protonvpn.template create mode 100644 dietpi/dietpi-vpn delete mode 100644 dietpi/misc/dietpi-nordvpn create mode 100644 rootfs/etc/systemd/system/dietpi-vpn.service diff --git a/.conf/dps_182/unbound.conf b/.conf/dps_182/unbound.conf index 99e9140dc0..a68b126ce9 100644 --- a/.conf/dps_182/unbound.conf +++ b/.conf/dps_182/unbound.conf @@ -49,7 +49,7 @@ server: do-ip6: yes prefer-ip6: no - # DNS root server information file. Update regularly via: "curl -# https://www.internic.net/domain/named.root > /var/lib/unbound/root.hints" + # DNS root server information file. Updated monthly via cronjob root-hints: "/var/lib/unbound/root.hints" # Maximum number of queries per second diff --git a/.conf/dpv/protonvpn.template b/.conf/dpv/protonvpn.template new file mode 100644 index 0000000000..ba8ce1f09a --- /dev/null +++ b/.conf/dpv/protonvpn.template @@ -0,0 +1,149 @@ +# ============================================================================== +# Copyright (c) 2016-2020 Proton Technologies AG (Switzerland) +# Email: contact@protonvpn.com +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR # OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# ============================================================================== + +client +dev tun +proto $PROTOCOL + +remote $VPN_SERVER 443 +remote $VPN_SERVER 80 +remote $VPN_SERVER 1194 +remote $VPN_SERVER 5060 +remote $VPN_SERVER 4569 + +remote-random +resolv-retry infinite +nobind +cipher AES-256-CBC +auth SHA512 +comp-lzo no +verb 3 + +setenv CLIENT_CERT 0 +tun-mtu 1500 +tun-mtu-extra 32 +mssfix 1450 +persist-key +persist-tun + +reneg-sec 0 + +remote-cert-tls server +auth-user-pass +pull +fast-io + + + +-----BEGIN CERTIFICATE----- +MIIFozCCA4ugAwIBAgIBATANBgkqhkiG9w0BAQ0FADBAMQswCQYDVQQGEwJDSDEV +MBMGA1UEChMMUHJvdG9uVlBOIEFHMRowGAYDVQQDExFQcm90b25WUE4gUm9vdCBD +QTAeFw0xNzAyMTUxNDM4MDBaFw0yNzAyMTUxNDM4MDBaMEAxCzAJBgNVBAYTAkNI +MRUwEwYDVQQKEwxQcm90b25WUE4gQUcxGjAYBgNVBAMTEVByb3RvblZQTiBSb290 +IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAt+BsSsZg7+AuqTq7 +vDbPzfygtl9f8fLJqO4amsyOXlI7pquL5IsEZhpWyJIIvYybqS4s1/T7BbvHPLVE +wlrq8A5DBIXcfuXrBbKoYkmpICGc2u1KYVGOZ9A+PH9z4Tr6OXFfXRnsbZToie8t +2Xjv/dZDdUDAqeW89I/mXg3k5x08m2nfGCQDm4gCanN1r5MT7ge56z0MkY3FFGCO +qRwspIEUzu1ZqGSTkG1eQiOYIrdOF5cc7n2APyvBIcfvp/W3cpTOEmEBJ7/14RnX +nHo0fcx61Inx/6ZxzKkW8BMdGGQF3tF6u2M0FjVN0lLH9S0ul1TgoOS56yEJ34hr +JSRTqHuar3t/xdCbKFZjyXFZFNsXVvgJu34CNLrHHTGJj9jiUfFnxWQYMo9UNUd4 +a3PPG1HnbG7LAjlvj5JlJ5aqO5gshdnqb9uIQeR2CdzcCJgklwRGCyDT1pm7eoiv +WV19YBd81vKulLzgPavu3kRRe83yl29It2hwQ9FMs5w6ZV/X6ciTKo3etkX9nBD9 +ZzJPsGQsBUy7CzO1jK4W01+u3ItmQS+1s4xtcFxdFY8o/q1zoqBlxpe5MQIWN6Qa +lryiET74gMHE/S5WrPlsq/gehxsdgc6GDUXG4dk8vn6OUMa6wb5wRO3VXGEc67IY +m4mDFTYiPvLaFOxtndlUWuCruKcCAwEAAaOBpzCBpDAMBgNVHRMEBTADAQH/MB0G +A1UdDgQWBBSDkIaYhLVZTwyLNTetNB2qV0gkVDBoBgNVHSMEYTBfgBSDkIaYhLVZ +TwyLNTetNB2qV0gkVKFEpEIwQDELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFByb3Rv +blZQTiBBRzEaMBgGA1UEAxMRUHJvdG9uVlBOIFJvb3QgQ0GCAQEwCwYDVR0PBAQD +AgEGMA0GCSqGSIb3DQEBDQUAA4ICAQCYr7LpvnfZXBCxVIVc2ea1fjxQ6vkTj0zM +htFs3qfeXpMRf+g1NAh4vv1UIwLsczilMt87SjpJ25pZPyS3O+/VlI9ceZMvtGXd +MGfXhTDp//zRoL1cbzSHee9tQlmEm1tKFxB0wfWd/inGRjZxpJCTQh8oc7CTziHZ +ufS+Jkfpc4Rasr31fl7mHhJahF1j/ka/OOWmFbiHBNjzmNWPQInJm+0ygFqij5qs +51OEvubR8yh5Mdq4TNuWhFuTxpqoJ87VKaSOx/Aefca44Etwcj4gHb7LThidw/ky +zysZiWjyrbfX/31RX7QanKiMk2RDtgZaWi/lMfsl5O+6E2lJ1vo4xv9pW8225B5X +eAeXHCfjV/vrrCFqeCprNF6a3Tn/LX6VNy3jbeC+167QagBOaoDA01XPOx7Odhsb +Gd7cJ5VkgyycZgLnT9zrChgwjx59JQosFEG1DsaAgHfpEl/N3YPJh68N7fwN41Cj +zsk39v6iZdfuet/sP7oiP5/gLmA/CIPNhdIYxaojbLjFPkftVjVPn49RqwqzJJPR +N8BOyb94yhQ7KO4F3IcLT/y/dsWitY0ZH4lCnAVV/v2YjWAWS3OWyC8BFx/Jmc3W +DK/yPwECUcPgHIeXiRjHnJt0Zcm23O2Q3RphpU+1SO3XixsXpOVOYP6rJIXW9bMZ +A1gTTlpi7A== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIFszCCA5ugAwIBAgIBBjANBgkqhkiG9w0BAQ0FADBAMQswCQYDVQQGEwJDSDEV +MBMGA1UEChMMUHJvdG9uVlBOIEFHMRowGAYDVQQDExFQcm90b25WUE4gUm9vdCBD +QTAeFw0xNzAyMTUxNTE3MDBaFw0yNzAyMTUxNDM4MDBaMEoxCzAJBgNVBAYTAkNI +MRUwEwYDVQQKEwxQcm90b25WUE4gQUcxJDAiBgNVBAMTG1Byb3RvblZQTiBJbnRl +cm1lZGlhdGUgQ0EgMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANv3 +uwQMFjYOx74taxadhczLbjCTuT73jMz09EqFNv7O7UesXfYJ6kQgYV9YyE86znP4 +xbsswNUZYh+XdZUpOoP6Zu3tR/iiYiuzi6jVYrJ66G89nPqS2mm5dn8Fbb8CRWkJ +ygm8AdlYkDwYNldhDUrERlQdCRDGsYYg/98dded+5pXnSG8Y/+iuLM6/YYhkUVQe +Cfq1L6XguSwu8CuvJjIjjE1PptUHa3Hc3tGziVydltKynxWlqb1dJqinGKiBZvYn +oiV4motpFYwhc3Wd09JLPzeobhD2IAZ2evSatikMWDingEv1EJXpI+V/E2AK3xHK +Skhw+YZx99tNxCiOu3U5BFAreZR3j2YnZzX1nEv9p02IGaWzzYJPNED0zSO2w07u +thSmKcxA39VTvs91lptbcV7VTxoJY0SErHIeVS3Scrnr7WvoOTuu3M3SCRqe6oI9 +oJZMOdfNsceBdvG+qlpOFICoBjO53W4BK8KahzTd/PWlBRiVJ3UVv8xXwUDA+o98 +34DXVAobaAHXQtM9jNobqT98FXhZktjOQEA2UORL581ZPxfKeHLRcgWJ5dmPsDBG +y/L6/qW/yrm6DUDAdN5+q41+gSNEjNBjLBJQFUmDk3l6Qxiu0uEDQ98oFvGHk5US +2Kbj0OAq1RpiDjHci/536yua9rTC+cxekTM2asdXAgMBAAGjga0wgaowEgYDVR0T +AQH/BAgwBgEB/wIBADAdBgNVHQ4EFgQUJbaTWcIB4t5ETvvhUy5/yQqqGjMwaAYD +VR0jBGEwX4AUg5CGmIS1WU8MizU3rTQdqldIJFShRKRCMEAxCzAJBgNVBAYTAkNI +MRUwEwYDVQQKEwxQcm90b25WUE4gQUcxGjAYBgNVBAMTEVByb3RvblZQTiBSb290 +IENBggEBMAsGA1UdDwQEAwIBBjANBgkqhkiG9w0BAQ0FAAOCAgEAAgZ/BIVl+DcK +OTVJJBy+RZ1E8os11gFaMKy12lAT1XEXDqLAnitvVyQgG5lPZKFQ2wzUR/TCrYKT +SUZWdYaJIXkRWAU0aCDZ2I81T0OMpg9aS7xdxgHCGWOwwes8GhjtvQad9GJ8mUZH +GyzfMaGG6fAZrgHnlOb4OIoqhBWYla6D2bpvbKgGkMo5NLAaX/7+U0HcxjjSS9vm +/3XHTZU4q77pn+lhPWncajnVyMtm1mIZxMioyckR4+scyZse0mYJS6xli/7crH7j +qScX7c5sWcaN4J63a3+x3uGvzOXjCyoDl9IaeqnxQpi8yc0nsWxIyDalR3uRQ9tJ +7l/eRxJZ/1Pzz2LRHSQZuqN2ZReWVNTqJ42af8cWWH0fDOEt2468GLeSm08Hvyz0 +lRjn7Tf5hxOJSw4/3oGihvzuTdquJMOi62kThbp7DS3mMaZsfbmDoU3oNDv91bvL +57z8wm7yRcGEoMsUNnrOZ4SU8dG/souvJM1BDStMLprFEgUbHEY5MjSR4/PLR6j9 +3NZgocfnfk80nBvNtgWVHxW019nuT93WL0/5L5g4UVm0Ay1V6pNkGZCmgNUBaRY4 +2JLzyY8p48OKapR5GnedLTJXJVbdd9GUNzIzm4iVITDH3p/u1g69dITCNXTO9EO5 +sGEYLNPbV49XBnVAm1tUWuoByZAjoWs= +-----END CERTIFICATE----- + + +key-direction 1 + +# 2048 bit OpenVPN static key +-----BEGIN OpenVPN Static key V1----- +6acef03f62675b4b1bbd03e53b187727 +423cea742242106cb2916a8a4c829756 +3d22c7e5cef430b1103c6f66eb1fc5b3 +75a672f158e2e2e936c3faa48b035a6d +e17beaac23b5f03b10b868d53d03521d +8ba115059da777a60cbfd7b2c9c57472 +78a15b8f6e68a3ef7fd583ec9f398c8b +d4735dab40cbd1e3c62a822e97489186 +c30a0b48c7c38ea32ceb056d3fa5a710 +e10ccc7a0ddb363b08c3d2777a3395e1 +0c0b6080f56309192ab5aacd4b45f55d +a61fc77af39bd81a19218a79762c3386 +2df55785075f37d8c71dc8a42097ee43 +344739a0dd48d03025b0450cf1fb5e8c +aeb893d9a96d1f15519bb3c4dcb40ee3 +16672ea16c012664f8a9f11255518deb +-----END OpenVPN Static key V1----- + diff --git a/.update/patches b/.update/patches index c66d08cc4b..30a537ffa9 100644 --- a/.update/patches +++ b/.update/patches @@ -26,6 +26,24 @@ fi # v7.0: Remove obsolete udev rule, as WiFi power saving is disabled via /etc/network/intefaces > "wireless-power off" > /etc/network/if-pre-up.d/wireless-tools (wireless-tools package) when the WiFi interface is configured. [[ -f '/etc/udev/rules.d/10-wifi-disable-powermanagement.rules' ]] && rm -v /etc/udev/rules.d/10-wifi-disable-powermanagement.rules +# v7.1: Migrate from DietPi-NordVPN to DietPi-VPN +[[ -f '/boot/dietpi/misc/dietpi-nordvpn' ]] && rm -v /boot/dietpi/misc/dietpi-nordvpn +[[ -d '/var/lib/dietpi/dietpi-software/installed/dietpi-nordvpn' ]] && mv -v /var/lib/dietpi/dietpi-software/installed/dietpi-nordvpn /var/lib/dietpi/dietpi-vpn +if [[ -f '/var/lib/dietpi/dietpi-vpn/settings_dietpi.conf' ]] +then + sed -Ei 's/^NORDVPN_(SERVER|USERNAME|PASSWORD)=/VPN_\1=/' /var/lib/dietpi/dietpi-vpn/settings_dietpi.conf + . /var/lib/dietpi/dietpi-vpn/settings_dietpi.conf + [[ -f '/etc/openvpn/client.ovpn' ]] || cp -av "/etc/openvpn/ovpn_$PROTOCOL/$VPN_SERVER" /etc/openvpn/client.ovpn + unset -v VPN_SERVER PROTOCOL VPN_USERNAME VPN_PASSWORD + sed -i 's|/var/lib/dietpi/dietpi-software/installed/dietpi-nordvpn/|/var/lib/dietpi/dietpi-vpn/|' /etc/openvpn/client.ovpn +fi +if [[ -f '/etc/systemd/system/dietpi-nordvpn.service' ]] +then + systemctl -q is-enabled dietpi-nordvpn && systemctl enable dietpi-vpn + systemctl disable dietpi-nordvpn + rm -v /etc/systemd/system/dietpi-nordvpn.service +fi + # v7.1: MariaDB: Rename config file: https://github.com/MichaIng/DietPi/commit/c306d449a7c4ed86a1e9ff7c4914d9e1c2afd11a [[ -f '/etc/mysql/mariadb.conf.d/99-dietpi-4byte.cnf' ]] && mv -v /etc/mysql/mariadb.conf.d/99-dietpi-4byte.cnf /etc/mysql/mariadb.conf.d/97-dietpi.cnf diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 3bcbcb06af..ac09a351ef 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -6,6 +6,7 @@ Supported SBC changes: - We removed the Firefly RK3399 from our supported devices list, as no a single user is reported via DietPi-Survey (https://dietpi.com/survey/#device). If case there were actually Firefly RK3399 DietPi systems, not participating DietPi-Survey, those would be migrated to the "Generic Rockchip RK3399" identifier, which code-wise maintains the exact same support. Changes: +- DietPi-NordVPN | The script reveived a major rework to allow being setup as ProtonVPN client and even with a custom OVPN config. For this reason it has been renamed to "DietPi-VPN", with the script moved to /boot/dietpi/dietpi-vpn and the console command alias changed to "dietpi-vpn" accordingly. Additionally a killswitch feature has been added which forcefully drops all WAN packets not sent through the VPN, when the connection got lost, until the VPN is disconnected manually/intentionally. Further is IPv6 now automatically disabled when the VPN connection is established. This is required to prevent IPv6 leaks as most publish VPN providers/servers do not support IPv6. When it has not been disabled before, IPv6 is re-enabled automatically once the VPN connection stops. Many thanks to @ravenclaw900 for doing this major rework: https://github.com/MichaIng/DietPi/pull/4180 - DietPi-FS_partition_resize | Added support to automatically resize F2FS and Btrfs filesystems on first boot. - DietPi-Drive_Manager | Added support for resizing F2FS and Btrfs filesystems as well as format- and filesystem check & repair support for XFS filesystems. - DietPi-Config | Added a safe overclocking profile for RPi 3+ models. Many thanks to @lone for doing long-term stability tests and reporting back the result: https://dietpi.com/phpbb/viewtopic.php?p=32285#p32285 diff --git a/dietpi/dietpi-services b/dietpi/dietpi-services index e110ca3f7e..f7590e2c34 100644 --- a/dietpi/dietpi-services +++ b/dietpi/dietpi-services @@ -222,7 +222,7 @@ Available services: #aSERVICE_NAME+=('wg-quick@wg0') # WireGuard: Currently instantiated services are not supported # DietPi - aSERVICE_NAME+=('dietpi-nordvpn') # NordVPN install + client + aSERVICE_NAME+=('dietpi-vpn') # NordVPN install + client if [[ $INPUT_CMD == 'status' ]]; then aSERVICE_NAME+=('dietpi-ramlog') diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index 8f7113c379..f650f65bf9 100644 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -1781,14 +1781,6 @@ _EOF_ aSOFTWARE_REQUIRES_USERINPUT[$software_id]=1 aSOFTWARE_REQUIRES_GIT[$software_id]=1 aSOFTWARE_RECOMMENDS_AUTOMATED_UPGRADES[$software_id]=1 - #------------------ - software_id=171 - - aSOFTWARE_NAME[$software_id]='DietPi-NordVPN' - aSOFTWARE_DESC[$software_id]='vpn client with connection gui' - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_CATEGORY_INDEX[$software_id]=15 - aSOFTWARE_ONLINEDOC_URL[$software_id]='https://dietpi.com/docs/software/vpn/#dietpi-nordvpn' # Advanced Networking #-------------------------------------------------------------------------------- @@ -2721,8 +2713,8 @@ _EOF_ # ownCloud up to v10.2 elif [[ -f '/var/www/owncloud/version.php' ]]; then - local oc_version_major=$(sed -n '/\$OC_VersionString/{s/^[^0-9]*//;s/\..*$//p;q}' /var/www/owncloud/version.php) - local oc_version_minor=$(sed -n '/\$OC_VersionString/{s/^[^.]*\.//;s/\..*$//p;q}' /var/www/owncloud/version.php) + local oc_version_major=$(sed -n '/OC_VersionString/{s/^[^0-9]*//;s/\..*$//p;q}' /var/www/owncloud/version.php) + local oc_version_minor=$(sed -n '/OC_VersionString/{s/^[^.]*\.//;s/\..*$//p;q}' /var/www/owncloud/version.php) if (( $oc_version_major < 10 || ( $oc_version_major == 10 && $oc_version_minor < 3 ) )); then PHP_NAME='php7.2' @@ -4304,7 +4296,7 @@ amvdec_vp9' > /etc/modules-load.d/dietpi-c4-kodi.conf G_CONFIG_INJECT 'prefer-ip6:[[:blank:]]' ' prefer-ip6: yes' /etc/unbound/unbound.conf.d/dietpi.conf fi - # Stretch: Remove incompatile setting + # Stretch: Remove incompatible setting (( $G_DISTRO < 5 )) && sed -i '/log-replies/d' /etc/unbound/unbound.conf.d/dietpi.conf # Since IP binding might be used, start after network interfaces have been configured, not when they just start to be configured @@ -5018,20 +5010,6 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=bullseye\nPin- fi - software_id=171 # DietPi-NordVPN - if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then - - Banner_Installing - G_AGI openvpn - - Download_Install 'https://downloads.nordcdn.com/configs/archives/servers/ovpn.zip' /etc/openvpn - - G_EXEC mkdir -p /var/lib/dietpi/dietpi-software/installed/dietpi-nordvpn - - G_WHIP_MSG '[ INFO ] DietPi-NordVPN has been installed.\n\nOnce DietPi-Software has finished all other installations, you can run the GUI using the following command:\n - dietpi-nordvpn' - - fi - software_id=92 # Certbot if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then @@ -7892,9 +7870,9 @@ _EOF_ G_EXEC phpenmod dietpi-owncloud # Get version string - local oc_version_major=$(sed -n '/\$OC_VersionString/{s/^[^0-9]*//;s/\..*$//p;q}' /var/www/owncloud/version.php) + local oc_version_major=$(sed -n '/OC_VersionString/{s/^[^0-9]*//;s/\..*$//p;q}' /var/www/owncloud/version.php) [[ $oc_version_major ]] || oc_version_major=10 - local oc_version_minor=$(sed -n '/\$OC_VersionString/{s/^[^.]*\.//;s/\..*$//p;q}' /var/www/owncloud/version.php) + local oc_version_minor=$(sed -n '/OC_VersionString/{s/^[^.]*\.//;s/\..*$//p;q}' /var/www/owncloud/version.php) [[ $oc_version_minor ]] || oc_version_minor=3 if (( ${aSOFTWARE_INSTALL_STATE[83]} > 0 )); then @@ -8212,7 +8190,7 @@ url.redirect += ( fi # Disable pretty URLs (front controller), if Nextcloud version is lower than 13 - if (( $(sed -n '/\$OC_VersionString/{s/^[^0-9]*//;s/\..*$//p;q}' /var/www/nextcloud/version.php) < 13 )); then + if (( $(sed -n '/OC_VersionString/{s/^[^0-9]*//;s/\..*$//p;q}' /var/www/nextcloud/version.php) < 13 )); then sed -i 's/^[[:blank:]]*fastcgi_param front_controller_active true;/\t\t#fastcgi_param front_controller_active true;/g' $nextcloud_conf @@ -14725,22 +14703,6 @@ _EOF_ fi - software_id=171 # DietPi-NordVPN - if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then - - Banner_Uninstalling - if [[ -f '/etc/systemd/system/dietpi-nordvpn.service' ]]; then - - systemctl disable --now dietpi-nordvpn - rm -R /etc/systemd/system/dietpi-nordvpn.service* - - fi - [[ -d '/etc/systemd/system/dietpi-nordvpn.service.d' ]] && rm -R /etc/systemd/system/dietpi-nordvpn.service.d - rm -Rf /etc/openvpn/ovpn_{tcp,udp}/*nordvpn* /var/lib/dietpi/dietpi-software/installed/dietpi-nordvpn - rmdir --ignore-fail-on-non-empty /etc/openvpn/ovpn_{tcp,udp} - - fi - software_id=92 # Certbot if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then diff --git a/dietpi/dietpi-vpn b/dietpi/dietpi-vpn new file mode 100644 index 0000000000..6f372e9a13 --- /dev/null +++ b/dietpi/dietpi-vpn @@ -0,0 +1,475 @@ +#!/bin/bash +{ + #//////////////////////////////////// + # DietPi-VPN + # + #//////////////////////////////////// + # Created by Daniel Knight / daniel.knight@dietpi.com / dietpi.com + # Updated by MichaIng / micha@dietpi.com / dietpi.com + # Reworked by ravenclaw900 / https://github.com/ravenclaw900 + # + #//////////////////////////////////// + # + # Info: + # - Location: /boot/dietpi/dietpi-vpn + # - GUI to setup a VPN client connection + # - Allows to automatically connect on boot + # - Allows to enable a killswitch + # - Allows to add custom post-up and pre-down scripts + readonly USAGE=' +Usage: dietpi-vpn [] +Available commands: + Interactive menu to control VPN settings and connection + status Print VPN connection status +' #//////////////////////////////////// + + # Grab input + readonly INPUT=$1 + + # Import DietPi-Globals -------------------------------------------------------------- + # - Only load for interactive menu + if [[ $INPUT ]] + then + readonly G_PROGRAM_NAME='DietPi-VPN' + else + . /boot/dietpi/func/dietpi-globals + readonly G_PROGRAM_NAME='DietPi-VPN' + G_CHECK_ROOT_USER + G_CHECK_ROOTFS_RW + G_INIT + fi + # Import DietPi-Globals -------------------------------------------------------------- + + readonly FP_SETTINGS='/var/lib/dietpi/dietpi-vpn' + readonly FP_SETTINGS_DIETPI="$FP_SETTINGS/settings_dietpi.conf" + readonly FP_SETTINGS_OVPN="$FP_SETTINGS/settings_ovpn.conf" + readonly FP_CUSTOM_UP="$FP_SETTINGS/up.sh" + readonly FP_CUSTOM_DOWN="$FP_SETTINGS/down.sh" + readonly FP_STATIC_UP="$FP_SETTINGS/static_up.sh" + readonly FP_STATIC_DOWN="$FP_SETTINGS/static_down.sh" + readonly FP_NORDVPN='/etc/openvpn/nordvpn' + readonly FP_PROTONVPN='/etc/openvpn/protonvpn' + readonly FP_PROTONVPN_SERVERS="$FP_PROTONVPN/serverlist.txt" + readonly FP_PROTONVPN_TEMPLATE="$FP_PROTONVPN/template.ovpn" + readonly FP_CLIENT_OVPN='/etc/openvpn/client.ovpn' + readonly IFACE='tun0' + readonly CONNECTION_TIMEOUT=20 # seconds + + VPN_PROVIDER= + VPN_USERNAME= + VPN_PASSWORD= + VPN_SERVER= + PROTOCOL='udp' + VPN_CONNECTED=0 + WAN_IP= + RX='N/A' + TX='N/A' + + Update_WAN_IP(){ WAN_IP=$(curl -sSfLm 3 https://ifconfig.co/json 2>&1 | mawk -F\" '/"ip"/{o=$4}/"country"/{c=$4}/"region_name"/{c=$4"-"c}END{if(c){o=o" "c}if(o){print o;exit}{print}}'); } + + Check_Connected() + { + [[ $(ip r l dev $IFACE 2> /dev/null) ]] && VPN_CONNECTED=1 || VPN_CONNECTED=0 + return $(( ! $VPN_CONNECTED )) + } + + Get_Connection_Info() + { + RX='N/A' + if [[ -f /sys/class/net/$IFACE/statistics/rx_bytes ]] + then + local rx=$( $FP_PROTONVPN_SERVERS + G_EXEC_NOEXIT=1 G_EXEC rm logicals + + # Download .ovpn file template + G_EXEC curl -sSfL "https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH/.conf/dpv/protonvpn.template" -o $FP_PROTONVPN_TEMPLATE + + elif [[ $VPN_PROVIDER == 'Custom' ]] + then + G_WHIP_MSG "Please select your custom .ovpn client config file from the next file browser dialogue. It will be copied to $FP_CLIENT_OVPN and loaded from there." + /boot/dietpi/dietpi-explorer 1 /etc/openvpn || return 1 + G_EXEC umask 0077 + G_EXEC cp "$( $FP_STATIC_UP +#!/bin/bash +# Disable IPv6 on connect to prevent IPv6 leakage +sysctl -w net.ipv6.conf.all.disable_ipv6=1 +sysctl -w net.ipv6.conf.default.disable_ipv6=1 +# If enabled, turn on killswitch +if [[ -f $FP_SETTINGS/killswitch.rules ]] +then + iptables-save > $FP_SETTINGS/iptables.bak + . $FP_SETTINGS_DIETPI + [[ \$VPN_SERVER == *'udp'* ]] && VPN_SERVER=\${VPN_SERVER%.udp.ovpn} || VPN_SERVER=\${VPN_SERVER%.tcp.ovpn} + export VPN_SERVER + iptables-restore < <(envsubst < $FP_SETTINGS/killswitch.rules) +fi +_EOF_ + cat << _EOF_ > $FP_STATIC_DOWN +#!/bin/dash +# If enabled, turn off killswitch +if [ -f $FP_SETTINGS/killswitch.rules ] +then + iptables-restore < $FP_SETTINGS/iptables.bak + rm $FP_SETTINGS/iptables.bak +fi +# Re-enables IPv6 on disconnect +if grep -q 'CONFIG_ENABLE_IPV6=1' /boot/dietpi.txt +then + sysctl -w net.ipv6.conf.all.disable_ipv6=0 + sysctl -w net.ipv6.conf.default.disable_ipv6=0 +fi +_EOF_ + G_EXEC chmod +x $FP_STATIC_UP $FP_STATIC_DOWN + } + + Read_Settings(){ [[ -f $FP_SETTINGS_DIETPI ]] && . $FP_SETTINGS_DIETPI; } + + Save_Settings() + { + if ! [[ $VPN_SERVER && $VPN_USERNAME && $VPN_PASSWORD ]] + then + G_WHIP_MSG '[FAILED] You need to enter your VPN username + password and select a server, before settings can be applied.' + return 1 + fi + + # Assure files are generated with strict modes right form the start + G_EXEC umask 0077 + + cat << _EOF_ > $FP_SETTINGS_OVPN +${VPN_USERNAME//\'/\'\\\'\'} +${VPN_PASSWORD//\'/\'\\\'\'} +_EOF_ + cat << _EOF_ > $FP_SETTINGS_DIETPI +VPN_PROVIDER='$VPN_PROVIDER' +VPN_USERNAME='${VPN_USERNAME//\'/\'\\\'\'}' +VPN_PASSWORD='${VPN_PASSWORD//\'/\'\\\'\'}' +VPN_SERVER='$VPN_SERVER' +PROTOCOL='$PROTOCOL' +_EOF_ + G_DIETPI-NOTIFY 2 'Generating OVPN file, please wait...' + if [[ $VPN_PROVIDER == 'ProtonVPN' ]] + then + export PROTOCOL VPN_SERVER + G_EXEC eval "envsubst < $FP_PROTONVPN_TEMPLATE > $FP_CLIENT_OVPN" + + elif [[ $VPN_PROVIDER == 'NordVPN' ]] + then + G_EXEC cp -f "$FP_NORDVPN/ovpn_$PROTOCOL/$VPN_SERVER" $FP_CLIENT_OVPN + fi + + G_EXEC umask 0022 + G_EXEC chmod 0600 $FP_SETTINGS_OVPN $FP_SETTINGS_DIETPI $FP_CLIENT_OVPN + G_EXEC chown root:root $FP_SETTINGS_OVPN $FP_SETTINGS_DIETPI $FP_CLIENT_OVPN + + # Apply credentials to client config + G_CONFIG_INJECT 'auth-user-pass([[:blank:]]|$)' "auth-user-pass $FP_SETTINGS_OVPN" $FP_CLIENT_OVPN + + # Apply static up/down scripts to client config + G_CONFIG_INJECT 'script-security[[:blank:]]' 'script-security 2' $FP_CLIENT_OVPN 'auth[[:blank:]]' + G_CONFIG_INJECT 'up[[:blank:]]' "up $FP_STATIC_UP" $FP_CLIENT_OVPN 'script-security[[:blank:]]' + G_CONFIG_INJECT 'down[[:blank:]]' "down $FP_STATIC_DOWN" $FP_CLIENT_OVPN 'up[[:blank:]]' + + # Apply or remove custom up/down scripts from client file + # shellcheck disable=SC2015 + [[ -f $FP_CUSTOM_UP ]] && G_CONFIG_INJECT 'route-up[[:blank:]]' "route-up $FP_CUSTOM_UP" $FP_CLIENT_OVPN 'up[[:blank:]]' || G_EXEC sed -i '/^[[:blank:]]*route-up[[:blank:]]/d' $FP_CLIENT_OVPN + # shellcheck disable=SC2015 + [[ -f $FP_CUSTOM_DOWN ]] && G_CONFIG_INJECT 'route-pre-down[[:blank:]]' "route-pre-down $FP_CUSTOM_DOWN" $FP_CLIENT_OVPN 'down[[:blank:]]' || G_EXEC sed -i '/^[[:blank:]]*route-pre-down[[:blank:]]/d' $FP_CLIENT_OVPN + + # Establish and test connection + G_EXEC systemctl restart dietpi-vpn + local i=1 + until Check_Connected || (( $i > $CONNECTION_TIMEOUT )) + do + G_DIETPI-NOTIFY -2 "Waiting for connection ($((i++))/$CONNECTION_TIMEOUT)" + sleep 1 + done + + if (( $VPN_CONNECTED )) + then + G_DIETPI-NOTIFY 0 "Connection established: $VPN_SERVER" + else + G_DIETPI-NOTIFY 1 "Connection failed/timeout: $VPN_SERVER" + G_EXEC systemctl stop dietpi-vpn + G_WHIP_MSG "Connection failed/timeout: $VPN_SERVER\n\nPlease verify account details are correct.\n\nIf problems persist, please check the service status: \"systemctl -l status dietpi-vpn\"" + fi + } + + #///////////////////////////////////////////////////////////////////////////////////// + # Menus + #///////////////////////////////////////////////////////////////////////////////////// + TARGETMENUID=0 + LAST_SELECTED_NAME='Username' + + Menu_Provider() + { + G_WHIP_MENU_ARRAY=( + + 'NordVPN' ': Connect to NordVPN' + 'ProtonVPN' ': Connect to ProtonVPN' + 'Custom' ': Use your own .ovpn file' + ) + G_WHIP_DEFAULT_ITEM=$VPN_PROVIDER + G_WHIP_MENU 'Please choose your VPN provider:' || return 1 + VPN_PROVIDER=$G_WHIP_RETURNED_VALUE + Update_Servers || return 1 + } + + Menu_Exit() + { + G_WHIP_SIZE_X_MAX=50 + G_WHIP_YESNO "Exit $G_PROGRAM_NAME?" && TARGETMENUID=-1 # Exit + } + + # TARGETMENUID=0 + Menu_Main() + { + # Obtain connection status + local text_status="WAN IP : $WAN_IP\nState : " + if ! Check_Connected + then + text_status+='Disconnected\nNordVPN Subscription : https://go.nordvpn.net/aff_c?offer_id=15&aff_id=5305&url_id=902' + else + Get_Connection_Info + text_status+="Connected\nTraffic : Sent = $TX | Received = $RX" + fi + + # Obtain connection settings + local autostart_enabled=0 autostart_text='Off' + systemctl -q is-enabled dietpi-vpn && { autostart_enabled=1 autostart_text='On'; } + local killswitch_enabled=0 killswitch_text='Off' + [[ -f $FP_SETTINGS/killswitch.rules ]] && { killswitch_enabled=1 killswitch_text='On'; } + + G_WHIP_MENU_ARRAY=( + + '' '●─ Connection Settings ' + 'Provider' ": [$VPN_PROVIDER]" + 'Username' ": [$VPN_USERNAME]" + 'Password' ": [${VPN_PASSWORD//?/*}]" + ) + [[ $VPN_PROVIDER == 'Custom' ]] || G_WHIP_MENU_ARRAY+=('Server' ": [$VPN_SERVER]") + G_WHIP_MENU_ARRAY+=('' '●─ Control Options ') + (( $VPN_CONNECTED )) && G_WHIP_MENU_ARRAY+=('Disconnect' '') + G_WHIP_MENU_ARRAY+=('Refresh' ': Update VPN connection status') + [[ $VPN_PROVIDER == 'Custom' ]] || G_WHIP_MENU_ARRAY+=('Update' ': Update VPN server list') + G_WHIP_MENU_ARRAY+=('Reset' ': Remove and reset ALL configs and settings') + G_WHIP_MENU_ARRAY+=( + + '' '●─ Advanced Options ' + 'Autostart' ": [$autostart_text]" + 'Killswitch' ": [$killswitch_text]" + 'Edit Up' ': This script gets executed right after the VPN is connected' + 'Edit Down' ': This script gets executed right before the VPN is disconnected' + '' '●─ Save Settings ' + 'Apply' ': Save settings and restart VPN connection' + ) + + G_WHIP_DEFAULT_ITEM=$LAST_SELECTED_NAME + G_WHIP_BUTTON_CANCEL_TEXT='Exit' + if G_WHIP_MENU "$text_status" + then + LAST_SELECTED_NAME=$G_WHIP_RETURNED_VALUE + + if [[ $G_WHIP_RETURNED_VALUE == 'Apply' ]] + then + Save_Settings + Update_WAN_IP + + elif [[ $G_WHIP_RETURNED_VALUE == 'Edit'* ]] + then + local fp=$FP_CUSTOM_UP + [[ $G_WHIP_RETURNED_VALUE == *'Down' ]] && fp=$FP_CUSTOM_DOWN + [[ -f $fp ]] || echo -e '#!/bin/bash\n# Clear this file completely, including line breaks, to have it removed.' > $fp + nano $fp + if [[ -s $fp ]] + then + G_EXEC_NOEXIT=1 G_EXEC chmod 0700 $fp + else + G_EXEC_NOEXIT=1 G_EXEC rm $fp + fi + + elif [[ $G_WHIP_RETURNED_VALUE == 'Autostart' ]] + then + if (( $autostart_enabled )) + then + G_EXEC_NOEXIT=1 G_EXEC systemctl disable dietpi-vpn + else + G_EXEC_NOEXIT=1 G_EXEC systemctl enable dietpi-vpn + fi + + elif [[ $G_WHIP_RETURNED_VALUE == 'Killswitch' ]] + then + if (( $killswitch_enabled )) + then + G_EXEC rm $FP_SETTINGS/killswitch.rules + else + G_AG_CHECK_INSTALL_PREREQ iptables + cat << '_EOF_' > $FP_SETTINGS/killswitch.rules +*filter +:INPUT DROP [0:0] +:FORWARD DROP [0:0] +:OUTPUT DROP [0:0] +-A OUTPUT -o lo -j ACCEPT +-A OUTPUT -o tun0 -j ACCEPT +-A OUTPUT -d 192.168.0.0/16 -j ACCEPT +-A OUTPUT -d 172.16.0.0/12 -j ACCEPT +-A OUTPUT -d 10.0.0.0/8 -j ACCEPT +-A OUTPUT -d $VPN_SERVER -p tcp -m multiport --dports 80,443,1194,4569,5060 -j ACCEPT +-A OUTPUT -d $VPN_SERVER -p udp -m multiport --dports 80,443,1194,4569,5060 -j ACCEPT +-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT +COMMIT +_EOF_ + fi + + elif [[ $G_WHIP_RETURNED_VALUE == 'Provider' ]] + then + Menu_Provider + + elif [[ $G_WHIP_RETURNED_VALUE == 'Username' ]] + then + G_WHIP_DEFAULT_ITEM=$VPN_USERNAME + G_WHIP_INPUTBOX 'Please enter your NordVPN or ProtonVPN username:\n\nNB: For ProtonVPN, use the OpenVPN credentials located at https://account.protonvpn.com/account' && VPN_USERNAME=$G_WHIP_RETURNED_VALUE + + elif [[ $G_WHIP_RETURNED_VALUE == 'Password' ]] + then + G_WHIP_PASSWORD 'Please enter your NordVPN or ProtonVPN password:\n\nNB: For ProtonVPN, use the OpenVPN credentials located at https://account.protonvpn.com/account' && VPN_PASSWORD=$result + unset -v result + + elif [[ $G_WHIP_RETURNED_VALUE == 'Disconnect' ]] + then + G_EXEC systemctl stop dietpi-vpn + Update_WAN_IP + LAST_SELECTED_NAME='Refresh' + + elif [[ $G_WHIP_RETURNED_VALUE == 'Server' ]] + then + # Select protocol + G_WHIP_MENU_ARRAY=( + + 'UDP' ': Recommended' + 'TCP' ': Reliable' + ) + + G_WHIP_DEFAULT_ITEM=$PROTOCOL + G_WHIP_MENU 'Please select the connection protocol type:' && PROTOCOL=${G_WHIP_RETURNED_VALUE,,} + + # Select server + G_DIETPI-NOTIFY 2 'Populating VPN server list, please wait...' + G_WHIP_MENU_ARRAY=() + if [[ $VPN_PROVIDER == 'NordVPN' ]] + then + for i in "$FP_NORDVPN/ovpn_$PROTOCOL/"*.ovpn + do + G_WHIP_MENU_ARRAY+=("${i##*/}" '') + done + + elif [[ $VPN_PROVIDER == 'ProtonVPN' ]] + then + # Get the list of server names from the file + while read -r server + do + G_WHIP_MENU_ARRAY+=("$server" '') + + done < "$FP_PROTONVPN_SERVERS" + fi + G_WHIP_DEFAULT_ITEM=$VPN_SERVER + G_WHIP_MENU 'Please select a VPN server to use:' && VPN_SERVER=$G_WHIP_RETURNED_VALUE + + elif [[ $G_WHIP_RETURNED_VALUE == 'Refresh' ]] + then + Update_WAN_IP + + elif [[ $G_WHIP_RETURNED_VALUE == 'Update' ]] + then + Update_Servers -f + + elif [[ $G_WHIP_RETURNED_VALUE == 'Reset' ]] + then + G_WHIP_YESNO 'WARNING: This will turn off DietPi-VPN and will remove all configuration files.\n\nIf you want to use DietPi-VPN in the future, you will have to go through the setup again.' + G_EXEC systemctl disable --now dietpi-vpn + G_EXEC rm -Rf $FP_CLIENT_OVPN $FP_SETTINGS $FP_NORDVPN $FP_PROTONVPN + exit 0 + fi + else + Menu_Exit + fi + } + + #///////////////////////////////////////////////////////////////////////////////////// + # Main Loop + #///////////////////////////////////////////////////////////////////////////////////// + #----------------------------------------------------------------------------------- + if [[ $INPUT == 'status' ]] + then + if [[ ! -f $FP_CLIENT_OVPN ]] + then + echo -e "\e[33m$G_PROGRAM_NAME is not configured! Please run: \"dietpi-vpn\"\e[0m" + + elif ! Check_Connected + then + echo -e '\e[1;31mDisconnected\e[0m' + else + Get_Connection_Info + echo -e "\e[1;32mConnected\e[0m - Sent = $TX | Received = $RX" + fi + + elif [[ $INPUT ]] + then + # Unknown input + echo -e "\e[90m[\e[0m\e[31mFAILURE\e[0m\e[90m]\e[0m \e[90m$G_PROGRAM_NAME | \e[0mInvalid input command ($INPUT). Aborting...\n$USAGE" + exit 1 + else + G_AG_CHECK_INSTALL_PREREQ openvpn + Read_Settings + [[ -d $FP_SETTINGS ]] || G_EXEC mkdir -p $FP_SETTINGS + [[ $VPN_PROVIDER ]] || Menu_Provider || exit 0 + Update_WAN_IP + + until (( $TARGETMENUID < 0 )) + do + Menu_Main + done + fi + #----------------------------------------------------------------------------------- + exit + #----------------------------------------------------------------------------------- +} diff --git a/dietpi/func/dietpi-banner b/dietpi/func/dietpi-banner index 8afeb480e3..395684f5ac 100644 --- a/dietpi/func/dietpi-banner +++ b/dietpi/func/dietpi-banner @@ -54,7 +54,7 @@ 'Custom banner entry' 'Display DietPi useful commands?' 'MOTD' - 'NordVPN status' + 'VPN status' ) # Set defaults @@ -206,8 +206,8 @@ $GREEN_LINE" Print_Local_Ip # WAN IP + location info: Move this to /run/dietpi/.network? (( ${aENABLED[6]} == 1 )) && echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[6]} $GREEN_SEPARATOR $(curl -sSfLm 3 https://ifconfig.co/json 2>&1 | mawk -F\" '/"ip"/{o=$4}/"country"/{c=$4}/"region_name"/{c=$4"-"c}END{if(c){o=o" "c}if(o){print o;exit}{print}}')" - # DietPi-NordVPN connection status - (( ${aENABLED[13]} == 1 )) && echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[13]} $GREEN_SEPARATOR $(/boot/dietpi/misc/dietpi-nordvpn status 2>&1)" + # DietPi-VPN connection status + (( ${aENABLED[13]} == 1 )) && echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[13]} $GREEN_SEPARATOR $(/boot/dietpi/misc/dietpi-vpn status 2>&1)" # Freespace (RootFS) (( ${aENABLED[7]} == 1 )) && echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[7]} $GREEN_SEPARATOR $(df -h --output=avail / | mawk 'NR==2 {print $1}' 2>&1)" # Freespace (DietPi userdata) diff --git a/dietpi/misc/dietpi-nordvpn b/dietpi/misc/dietpi-nordvpn deleted file mode 100644 index 69720ac03d..0000000000 --- a/dietpi/misc/dietpi-nordvpn +++ /dev/null @@ -1,366 +0,0 @@ -#!/bin/bash -{ - #//////////////////////////////////// - # DietPi NordVPN - # - #//////////////////////////////////// - # Created by Daniel Knight / daniel.knight@dietpi.com / dietpi.com - # - #//////////////////////////////////// - # - # Info: - # - GUI to setup a NordVPN connection - # - Allows to automatically connect on boot - # - Allows to add post-up and pre-down scripts - readonly USAGE=' -Usage: dietpi-nordvpn [] -Available commands: - Interactive menu to edit, connect and apply NordVPN settings - status Print NordVPN connection status info -' #//////////////////////////////////// - - # Grab Inputs - INPUT=$1 - - # Import DietPi-Globals -------------------------------------------------------------- - # - Only load for interactive menu - if [[ $INPUT ]]; then - - readonly G_PROGRAM_NAME='DietPi-NordVPN' - - else - - . /boot/dietpi/func/dietpi-globals - readonly G_PROGRAM_NAME='DietPi-NordVPN' - G_CHECK_ROOT_USER - G_CHECK_ROOTFS_RW - G_INIT - - fi - # Import DietPi-Globals -------------------------------------------------------------- - - readonly FP_SETTINGS_DIETPI='/var/lib/dietpi/dietpi-software/installed/dietpi-nordvpn/settings_dietpi.conf' - readonly FP_SETTINGS_OVPN='/var/lib/dietpi/dietpi-software/installed/dietpi-nordvpn/settings_ovpn.conf' - readonly FP_SETTINGS_UP='/var/lib/dietpi/dietpi-software/installed/dietpi-nordvpn/up.sh' - readonly FP_SETTINGS_DOWN='/var/lib/dietpi/dietpi-software/installed/dietpi-nordvpn/down.sh' - readonly IFACE='tun0' - readonly MAX_WAIT_FOR_CONNECTION=5 # seconds - NORDVPN_USERNAME= - NORDVPN_PASSWORD= - NORDVPN_SERVER= - PROTOCOL='udp' - NORDVPN_INSTALLED=0 - NORDVPN_SERVICE=0 - NORDVPN_CONNECTED=0 - WAN_IP= - RX='N/A' - TX='N/A' - - Update_Wan_Ip(){ WAN_IP=$(curl -sSfLm 2 https://ifconfig.co/json 2>&1 | mawk -F\" '/"ip"/{o=$4}/"country"/{c=$4}/"region_name"/{c=$4"-"c}END{if(c){o=o" "c}if(o){print o;exit}{print}}'); } - - Init() - { - # Check installed - until grep -q '^aSOFTWARE_INSTALL_STATE\[171\]=2' /boot/dietpi/.installed - do - # Offer install only for interactive menu - if [[ ! $INPUT ]] && G_WHIP_YESNO "$G_PROGRAM_NAME is not installed, would you like to install it now?" - then - /boot/dietpi/dietpi-software install 171 - else - TARGETMENUID=-1 # Skip menu - return - fi - done - NORDVPN_INSTALLED=1 - - # Check service exists - [[ -f '/etc/systemd/system/dietpi-nordvpn.service' ]] && NORDVPN_SERVICE=1 - } - - Check_Connected() - { - [[ $(ip r l dev $IFACE 2> /dev/null) ]] && NORDVPN_CONNECTED=1 || NORDVPN_CONNECTED=0 - return $(( ! $NORDVPN_CONNECTED )) - } - - Get_Connection_Info() - { - RX='N/A' - if [[ -f /sys/class/net/$IFACE/statistics/rx_bytes ]] - then - local rx=$( $FP_SETTINGS_OVPN -${NORDVPN_USERNAME//\'/\'\\\'\'} -${NORDVPN_PASSWORD//\'/\'\\\'\'} -_EOF_ - cat << _EOF_ > $FP_SETTINGS_DIETPI -NORDVPN_USERNAME='${NORDVPN_USERNAME//\'/\'\\\'\'}' -NORDVPN_PASSWORD='${NORDVPN_PASSWORD//\'/\'\\\'\'}' -NORDVPN_SERVER='$NORDVPN_SERVER' -PROTOCOL='$PROTOCOL' -_EOF_ - local fp_ovpn="/etc/openvpn/ovpn_$PROTOCOL/$NORDVPN_SERVER" - G_EXEC chmod 0600 $FP_SETTINGS_OVPN $FP_SETTINGS_DIETPI $fp_ovpn - G_EXEC chown root:root $FP_SETTINGS_OVPN $FP_SETTINGS_DIETPI $fp_ovpn - - G_CONFIG_INJECT 'auth-user-pass([[:blank:]]|$)' "auth-user-pass $FP_SETTINGS_OVPN" $fp_ovpn - [[ -f $FP_SETTINGS_UP || -f $FP_SETTINGS_DOWN ]] && G_CONFIG_INJECT 'script-security[[:blank:]]' 'script-security 2' $fp_ovpn 'auth[[:blank:]]' - # shellcheck disable=SC2015 - [[ -f $FP_SETTINGS_UP ]] && G_CONFIG_INJECT 'route-up[[:blank:]]' "route-up $FP_SETTINGS_UP" $fp_ovpn 'auth[[:blank:]]' || sed -i '/^[[:blank:]]*route-up[[:blank:]]/d' $fp_ovpn - # shellcheck disable=SC2015 - [[ -f $FP_SETTINGS_DOWN ]] && G_CONFIG_INJECT 'route-pre-down[[:blank:]]' "route-pre-down $FP_SETTINGS_DOWN" $fp_ovpn 'auth[[:blank:]]' || sed -i '/^[[:blank:]]*route-pre-down[[:blank:]]/d' $fp_ovpn - - # Service: https://github.com/OpenVPN/openvpn/blob/master/distro/systemd/openvpn-client%40.service.in - cat << _EOF_ > /etc/systemd/system/dietpi-nordvpn.service -[Unit] -Description=NordVPN (DietPi) -Wants=network-online.target -After=network-online.target dietpi-boot.service - -[Service] -Type=notify -ExecStart=$(command -v openvpn) --suppress-timestamps --nobind --config $fp_ovpn -KillMode=process -# Hardenings -PrivateTmp=true -CapabilityBoundingSet=CAP_IPC_LOCK CAP_NET_ADMIN CAP_NET_RAW CAP_SETGID CAP_SETUID CAP_SYS_CHROOT CAP_DAC_OVERRIDE -LimitNPROC=10 -DeviceAllow=/dev/null rw -DeviceAllow=/dev/net/tun rw -ProtectSystem=true -ProtectHome=true - -[Install] -WantedBy=multi-user.target -_EOF_ - systemctl daemon-reload - NORDVPN_SERVICE=1 - G_EXEC systemctl restart dietpi-nordvpn - - local i=1 - until Check_Connected || (( $i > $MAX_WAIT_FOR_CONNECTION )) - do - G_DIETPI-NOTIFY -2 "Waiting for connection ($((i++))/$MAX_WAIT_FOR_CONNECTION)" - sleep 1 - done - - if (( $NORDVPN_CONNECTED )) - then - G_DIETPI-NOTIFY 0 "Connection established: $NORDVPN_SERVER" - else - G_DIETPI-NOTIFY 1 "Connection failed/timeout: $NORDVPN_SERVER" - G_WHIP_MSG "Connection failed/timeout: $NORDVPN_SERVER\n\nPlease verify account details are correct.\n\nIf problems persist, please check the service status: \"systemctl -l status dietpi-nordvpn\"" - fi - } - - #///////////////////////////////////////////////////////////////////////////////////// - # Whip - #///////////////////////////////////////////////////////////////////////////////////// - TARGETMENUID=0 - LAST_SELECTED_NAME='Username' - - Menu_Exit() - { - G_WHIP_SIZE_X_MAX=50 - G_WHIP_YESNO "Exit $G_PROGRAM_NAME?" && TARGETMENUID=-1 # Exit - } - - # TARGETMENUID=0 - Menu_Main() - { - local text_status="WAN IP : $WAN_IP\nState : " - if (( ! $NORDVPN_SERVICE )) - then - text_status+='Not configured\nSubscription : https://go.nordvpn.net/aff_c?offer_id=15&aff_id=5305&url_id=902' - - elif ! Check_Connected - then - text_status+='Disconnected\nSubscription : https://go.nordvpn.net/aff_c?offer_id=15&aff_id=5305&url_id=902' - else - Get_Connection_Info - text_status+="Connected\nTraffic : Sent = $TX | Received = $RX" - fi - - G_WHIP_MENU_ARRAY=( - - '' '●─ Global Options ' - 'Username' ": [$NORDVPN_USERNAME]" - 'Password' ": [${NORDVPN_PASSWORD//?/*}]" - 'Server' ": [$NORDVPN_SERVER]" - 'Update' ': This updates the NordVPN server list' - ) - if (( $NORDVPN_SERVICE )) - then - local autostart_enabled=0 autostart_text='Off' - systemctl -q is-enabled dietpi-nordvpn && { autostart_enabled=1 autostart_text='On'; } - G_WHIP_MENU_ARRAY+=( - - 'Autostart' ": [$autostart_text]" - 'Refresh' ': Update VPN connection status' - ) - (( $NORDVPN_CONNECTED )) && G_WHIP_MENU_ARRAY+=('Disconnect' '') - fi - G_WHIP_MENU_ARRAY+=( - - '' '●─ Connection Up and Down Scripts ' - 'Edit Up' ': This script gets executed right after the VPN is connected' - 'Edit Down' ': This script gets executed right before the VPN is disconnected' - '' '●─ Save Settings ' - 'Apply' ': Save settings and restart VPN connection' - ) - - G_WHIP_DEFAULT_ITEM=$LAST_SELECTED_NAME - G_WHIP_BUTTON_CANCEL_TEXT='Exit' - if G_WHIP_MENU "$text_status" - then - LAST_SELECTED_NAME=$G_WHIP_RETURNED_VALUE - - if [[ $G_WHIP_RETURNED_VALUE == 'Apply' ]] - then - Save_Settings - Update_Wan_Ip - - elif [[ $G_WHIP_RETURNED_VALUE == 'Edit'* ]] - then - local fp=$FP_SETTINGS_UP - [[ $G_WHIP_RETURNED_VALUE == *'Down' ]] && fp=$FP_SETTINGS_DOWN - [[ -f $fp ]] || echo -e '#!/bin/bash\n# Clear this file completely, including line breaks, to have it removed.' > $fp - nano $fp - if [[ -s $fp ]] - then - G_EXEC_NOEXIT=1 G_EXEC chmod 0700 $fp - else - G_EXEC_NOEXIT=1 G_EXEC rm $fp - fi - - elif [[ $G_WHIP_RETURNED_VALUE == 'Autostart' ]] - then - if (( $autostart_enabled )) - then - G_EXEC_NOEXIT=1 G_EXEC systemctl disable dietpi-nordvpn - else - G_EXEC_NOEXIT=1 G_EXEC systemctl enable dietpi-nordvpn - fi - - elif [[ $G_WHIP_RETURNED_VALUE == 'Username' ]] - then - G_WHIP_DEFAULT_ITEM=$NORDVPN_USERNAME - G_WHIP_INPUTBOX 'Please enter your NordVPN username:' && NORDVPN_USERNAME=$G_WHIP_RETURNED_VALUE - - elif [[ $G_WHIP_RETURNED_VALUE == 'Password' ]] - then - G_WHIP_PASSWORD 'Please enter your NordVPN password:' && NORDVPN_PASSWORD=$result - unset -v result - - elif [[ $G_WHIP_RETURNED_VALUE == 'Disconnect' ]] - then - G_EXEC systemctl stop dietpi-nordvpn - Update_Wan_Ip - LAST_SELECTED_NAME='Refresh' - - elif [[ $G_WHIP_RETURNED_VALUE == 'Server' ]] - then - # Select protocol - G_WHIP_MENU_ARRAY=( - - 'UDP' ': Recommended' - 'TCP' '' - ) - - G_WHIP_DEFAULT_ITEM=$PROTOCOL - G_WHIP_MENU 'Please select the connection protocol type:' && PROTOCOL=${G_WHIP_RETURNED_VALUE,,} - - # Select server - G_DIETPI-NOTIFY 2 'Populating NordVPN server list, please wait...' - G_WHIP_MENU_ARRAY=() - for i in /etc/openvpn/"ovpn_$PROTOCOL"/*.ovpn - do - G_WHIP_MENU_ARRAY+=("${i##*/}" '') - done - - G_WHIP_DEFAULT_ITEM=$NORDVPN_SERVER - G_WHIP_MENU 'Please select a NordVPN server to use:' && NORDVPN_SERVER=$G_WHIP_RETURNED_VALUE - - elif [[ $G_WHIP_RETURNED_VALUE == 'Refresh' ]] - then - Update_Wan_Ip - - elif [[ $G_WHIP_RETURNED_VALUE == 'Update' ]] - then - G_WHIP_YESNO 'This will remove all NordVPN server files and perform a fresh download of NordVPN server configurations. Once completed, you will need to reselect a NordVPN server from the new list.\n\nDo you want to continue?' || return 0 - G_EXEC curl -sSfLO 'https://downloads.nordcdn.com/configs/archives/servers/ovpn.zip' - NORDVPN_SERVER= - G_EXEC_DESC='Removing old NordVPN server configs' G_EXEC rm -Rf /etc/openvpn/ovpn_{tcp,udp}/*.nordvpn.com.{tcp,udp}.ovpn - G_EXEC unzip -o ovpn.zip -d/etc/openvpn - G_EXEC_NOEXIT=1 G_EXEC rm ovpn.zip - fi - else - Menu_Exit - fi - } - - #///////////////////////////////////////////////////////////////////////////////////// - # Main Loop - #///////////////////////////////////////////////////////////////////////////////////// - #----------------------------------------------------------------------------------- - Init - #----------------------------------------------------------------------------------- - if [[ $INPUT == 'status' ]] - then - if (( ! $NORDVPN_INSTALLED )) - then - echo -e "\e[33m$G_PROGRAM_NAME is not installed! Please run: \"dietpi-software install 171\"\e[0m" - - elif (( ! $NORDVPN_SERVICE )) - then - echo -e "\e[33m$G_PROGRAM_NAME is not configured! Please run: \"dietpi-nordvpn\"\e[0m" - - elif ! Check_Connected - then - echo -e '\e[1;31mDisconnected\e[0m' - else - Get_Connection_Info - echo -e "\e[1;32mConnected\e[0m - Sent = $TX | Received = $RX" - fi - - elif [[ $INPUT ]] - then - # Unknown input - echo -e "\e[90m[\e[0m\e[31mFAILURE\e[0m\e[90m]\e[0m \e[90m$G_PROGRAM_NAME | \e[0mInvalid input command ($INPUT). Aborting...\n$USAGE" - exit 1 - else - Read_Settings - Update_Wan_Ip - - until (( $TARGETMENUID < 0 )) - do - Menu_Main - done - fi - #----------------------------------------------------------------------------------- - exit - #----------------------------------------------------------------------------------- -} diff --git a/rootfs/etc/bashrc.d/dietpi.bash b/rootfs/etc/bashrc.d/dietpi.bash index 0bb2a6e6c1..80968e4b79 100644 --- a/rootfs/etc/bashrc.d/dietpi.bash +++ b/rootfs/etc/bashrc.d/dietpi.bash @@ -47,7 +47,8 @@ alias dietpi-wifidb='/boot/dietpi/func/dietpi-wifidb' alias dietpi-optimal_mtu='/boot/dietpi/func/dietpi-optimal_mtu' alias dietpi-cloudshell='/boot/dietpi/dietpi-cloudshell' - alias dietpi-nordvpn='/boot/dietpi/misc/dietpi-nordvpn' + alias dietpi-nordvpn='G_DIETPI-NOTIFY 1 "DietPi-NordVPN has been renamed to DietPi-VPN. Please use the \"dietpi-vpn\" command."' + alias dietpi-vpn="/boot/dietpi/dietpi-vpn" alias cpu='/boot/dietpi/dietpi-cpuinfo' # - Optional DietPi software aliases [[ -d '/mnt/dietpi_userdata/sonarr' || -d '/mnt/dietpi_userdata/radarr' || -d '/mnt/dietpi_userdata/lidarr' ]] && alias dietpi-arr_to_RAM='/boot/dietpi/misc/dietpi-arr_to_RAM' diff --git a/rootfs/etc/systemd/system/dietpi-vpn.service b/rootfs/etc/systemd/system/dietpi-vpn.service new file mode 100644 index 0000000000..8b6e4a29d9 --- /dev/null +++ b/rootfs/etc/systemd/system/dietpi-vpn.service @@ -0,0 +1,21 @@ +[Unit] +Description=VPN Client (DietPi) +Wants=network-online.target +After=network-online.target dietpi-boot.service + +[Service] +Type=notify +ExecStart=/usr/sbin/openvpn --suppress-timestamps --nobind --config /etc/openvpn/client.ovpn +KillMode=process + +# Hardenings +PrivateTmp=true +CapabilityBoundingSet=CAP_IPC_LOCK CAP_NET_ADMIN CAP_NET_RAW CAP_SETGID CAP_SETUID CAP_SYS_CHROOT CAP_DAC_OVERRIDE +LimitNPROC=10 +DeviceAllow=/dev/null rw +DeviceAllow=/dev/net/tun rw +ProtectSystem=true +ProtectHome=true + +[Install] +WantedBy=multi-user.target From 752416383678f9d6f8ee3d6339629bca163dbe27 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sun, 28 Mar 2021 22:04:59 +0200 Subject: [PATCH 049/147] v7.1 + DietPi-Survey_report | Sort out invalid file names in the first place, remove debug mode (we never use it) and minor coding style changes --- .meta/dietpi-survey_report | 67 +++++++++----------------------------- 1 file changed, 16 insertions(+), 51 deletions(-) diff --git a/.meta/dietpi-survey_report b/.meta/dietpi-survey_report index d9630a87f2..6cb0064c8f 100644 --- a/.meta/dietpi-survey_report +++ b/.meta/dietpi-survey_report @@ -1,6 +1,5 @@ #!/bin/bash { - # Created by MichaIng / micha@dietpi.com / dietpi.com # Prevent concurrent executions @@ -143,7 +142,7 @@ # Globals - Survey #----------------------------------------------------------- SURVEY_COUNT_TOTAL=0 - SURVEY_COUNT_EMPTY=0 + SURVEY_COUNT_OPTIN=0 declare -A aDIETPI_VERSION declare -A aDEVICE_NAME @@ -500,30 +499,28 @@ aSOFTWARE_NAME7_1[$i]=${aSOFTWARE_NAME7_0[$i]} done - Main(){ - + Main() + { # Copy files to RAM to speed up sourcing #mkdir -p /tmp/dietpi-survey_report #cp /home/dietpi-survey/survey/*.txt /tmp/dietpi-survey_report/ # cp: Argument list too long rm -Rf /tmp/dietpi-survey_report || exit 1 cp -R /home/dietpi-survey/survey /tmp/dietpi-survey_report || exit 1 - cd /tmp/dietpi-survey_report || exit 1 - for file in *.txt + + # Loop through files, including dot files, so that we can detect and sort out invalid file names + shopt -s dotglob + for file in * do + # Skip and move match with invalid name, when not a file or unexpected first line + [[ $file =~ ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\.txt$ && -f $file && ( ! -s $file || $(<"$file") == '#!/bin/bash'* ) ]] || { mv -v "/home/dietpi-survey/survey/$file" /home/dietpi-survey/invalid/; continue; } - # Filled and empty survey files + # Count total and optin files ((SURVEY_COUNT_TOTAL++)) - if [[ ! -s $file ]]; then - - ((SURVEY_COUNT_EMPTY++)) - continue - - fi + [[ -s $file ]] || continue + ((SURVEY_COUNT_OPTIN++)) # Source survey files - [[ $(<"$file") == '#!/bin/bash'* ]] || continue - . "$file" # Add bench to array @@ -600,8 +597,8 @@ unset -v BENCH_RAM_WRITE BENCH_RAM_READ unset -v BENCH_CUSTOMFS_WRITE BENCH_CUSTOMFS_READ unset -v BENCH_NET_LAN_SPEED - done + shopt -u dotglob # Navigate to parent /tmp cd /tmp || exit 1 @@ -610,12 +607,11 @@ rm -R /tmp/dietpi-survey_report || exit 1 # Optin count - SURVEY_COUNT_OPTIN=$(( $SURVEY_COUNT_TOTAL - $SURVEY_COUNT_EMPTY )) + SURVEY_COUNT_EMPTY=$(( $SURVEY_COUNT_TOTAL - $SURVEY_COUNT_OPTIN )) # Merge old and new hardware model names for i in "${!aDEVICE_NAME[@]}" do - [[ $i == 'RPi B (ECN0001) (armv6l)' ]] && ((aDEVICE_NAME['RPi B (armv6l)']+=aDEVICE_NAME["$i"])) && unset "aDEVICE_NAME[$i]" [[ $i == 'RPi (armv6l)' ]] && ((aDEVICE_NAME['RPi (Unknown) (armv6l)']+=aDEVICE_NAME["$i"])) && unset "aDEVICE_NAME[$i]" [[ $i == 'RPi (armv7l)' ]] && ((aDEVICE_NAME['RPi (Unknown) (armv7l)']+=aDEVICE_NAME["$i"])) && unset "aDEVICE_NAME[$i]" @@ -635,7 +631,6 @@ [[ $i == 'BBB (armv7l)' ]] && ((aDEVICE_NAME['BeagleBone Black (armv7l)']+=aDEVICE_NAME["$i"])) && unset "aDEVICE_NAME[$i]" [[ $i == 'Unknown Device (armv7l)' ]] && ((aDEVICE_NAME['Generic Device (armv7l)']+=aDEVICE_NAME["$i"])) && unset "aDEVICE_NAME[$i]" [[ $i == 'Unknown Device (aarch64)' ]] && ((aDEVICE_NAME['Generic Device (aarch64)']+=aDEVICE_NAME["$i"])) && unset "aDEVICE_NAME[$i]" - done # Process all results, for later use in HTML printout @@ -644,7 +639,6 @@ # CPU for i in "${!aBENCH_CPU_INDEX[@]}" do - aBENCH_RESULT_CPU_MIN[$i]= aBENCH_RESULT_CPU_MAX[$i]= aBENCH_RESULT_CPU_AVG[$i]= @@ -657,7 +651,6 @@ for (( j=0; j<${aBENCH_CPU_INDEX[$i]}; j++ )) do - (( ${aBENCH_CPU[$i,$j]} < ${aBENCH_RESULT_CPU_MIN[$i]:=${aBENCH_CPU[$i,$j]}} )) && aBENCH_RESULT_CPU_MIN[$i]=${aBENCH_CPU[$i,$j]} (( ${aBENCH_CPU[$i,$j]} > ${aBENCH_RESULT_CPU_MAX[$i]:=${aBENCH_CPU[$i,$j]}} )) && aBENCH_RESULT_CPU_MAX[$i]=${aBENCH_CPU[$i,$j]} (( aBENCH_RESULT_CPU_AVG[$i] += ${aBENCH_CPU[$i,$j]} )) @@ -678,15 +671,12 @@ aBENCH_RESULT_CPU_AVG[$i]=$(printf "%.${BENCH_RESULTS_CPU_SCALE}f" "$((${aBENCH_RESULT_CPU_AVG[$i]}*10/${aBENCH_CPU_INDEX[$i]}+1))e-3") aBENCH_RESULT_CPU_TEMP_START_AVG[$i]=$(( ${aBENCH_RESULT_CPU_TEMP_START_AVG[$i]} / ${aBENCH_CPU_INDEX[$i]} )) aBENCH_RESULT_CPU_TEMP_END_AVG[$i]=$(( ${aBENCH_RESULT_CPU_TEMP_END_AVG[$i]} / ${aBENCH_CPU_INDEX[$i]} )) - done - done # RootFS for i in "${!aBENCH_ROOTFS_INDEX[@]}" do - aBENCH_RESULT_ROOTFS_WRITE_MIN[$i]= aBENCH_RESULT_ROOTFS_WRITE_MAX[$i]= aBENCH_RESULT_ROOTFS_WRITE_AVG[$i]= @@ -696,7 +686,6 @@ for (( j=0; j<${aBENCH_ROOTFS_INDEX[$i]}; j++ )) do - (( ${aBENCH_ROOTFS_WRITE[$i,$j]} < ${aBENCH_RESULT_ROOTFS_WRITE_MIN[$i]:=${aBENCH_ROOTFS_WRITE[$i,$j]}} )) && aBENCH_RESULT_ROOTFS_WRITE_MIN[$i]=${aBENCH_ROOTFS_WRITE[$i,$j]} (( ${aBENCH_ROOTFS_WRITE[$i,$j]} > ${aBENCH_RESULT_ROOTFS_WRITE_MAX[$i]:=${aBENCH_ROOTFS_WRITE[$i,$j]}} )) && aBENCH_RESULT_ROOTFS_WRITE_MAX[$i]=${aBENCH_ROOTFS_WRITE[$i,$j]} (( aBENCH_RESULT_ROOTFS_WRITE_AVG[$i] += ${aBENCH_ROOTFS_WRITE[$i,$j]} )) @@ -709,15 +698,12 @@ (( $j == ${aBENCH_ROOTFS_INDEX[$i]} - 1 )) || continue aBENCH_RESULT_ROOTFS_WRITE_AVG[$i]=$(( ${aBENCH_RESULT_ROOTFS_WRITE_AVG[$i]} / ${aBENCH_ROOTFS_INDEX[$i]} )) aBENCH_RESULT_ROOTFS_READ_AVG[$i]=$(( ${aBENCH_RESULT_ROOTFS_READ_AVG[$i]} / ${aBENCH_ROOTFS_INDEX[$i]} )) - done - done # RAM for i in "${!aBENCH_RAM_INDEX[@]}" do - aBENCH_RESULT_RAM_WRITE_MIN[$i]= aBENCH_RESULT_RAM_WRITE_MAX[$i]= aBENCH_RESULT_RAM_WRITE_AVG[$i]= @@ -727,7 +713,6 @@ for (( j=0; j<${aBENCH_RAM_INDEX[$i]}; j++ )) do - (( ${aBENCH_RAM_WRITE[$i,$j]} < ${aBENCH_RESULT_RAM_WRITE_MIN[$i]:=${aBENCH_RAM_WRITE[$i,$j]}} )) && aBENCH_RESULT_RAM_WRITE_MIN[$i]=${aBENCH_RAM_WRITE[$i,$j]} (( ${aBENCH_RAM_WRITE[$i,$j]} > ${aBENCH_RESULT_RAM_WRITE_MAX[$i]:=${aBENCH_RAM_WRITE[$i,$j]}} )) && aBENCH_RESULT_RAM_WRITE_MAX[$i]=${aBENCH_RAM_WRITE[$i,$j]} (( aBENCH_RESULT_RAM_WRITE_AVG[$i] += ${aBENCH_RAM_WRITE[$i,$j]} )) @@ -740,22 +725,18 @@ (( $j == ${aBENCH_RAM_INDEX[$i]} - 1 )) || continue aBENCH_RESULT_RAM_WRITE_AVG[$i]=$(( ${aBENCH_RESULT_RAM_WRITE_AVG[$i]} / ${aBENCH_RAM_INDEX[$i]} )) aBENCH_RESULT_RAM_READ_AVG[$i]=$(( ${aBENCH_RESULT_RAM_READ_AVG[$i]} / ${aBENCH_RAM_INDEX[$i]} )) - done - done # LAN for i in "${!aBENCH_LAN_INDEX[@]}" do - aBENCH_RESULT_NET_LAN_SPEED_MIN[$i]= aBENCH_RESULT_NET_LAN_SPEED_MAX[$i]= aBENCH_RESULT_NET_LAN_SPEED_AVG[$i]= for (( j=0; j<${aBENCH_LAN_INDEX[$i]}; j++ )) do - (( ${aBENCH_NET_LAN_SPEED[$i,$j]} < ${aBENCH_RESULT_NET_LAN_SPEED_MIN[$i]:=${aBENCH_NET_LAN_SPEED[$i,$j]}} )) && aBENCH_RESULT_NET_LAN_SPEED_MIN[$i]=${aBENCH_NET_LAN_SPEED[$i,$j]} (( ${aBENCH_NET_LAN_SPEED[$i,$j]} > ${aBENCH_RESULT_NET_LAN_SPEED_MAX[$i]:=${aBENCH_NET_LAN_SPEED[$i,$j]}} )) && aBENCH_RESULT_NET_LAN_SPEED_MAX[$i]=${aBENCH_NET_LAN_SPEED[$i,$j]} (( aBENCH_RESULT_NET_LAN_SPEED_AVG[$i] += ${aBENCH_NET_LAN_SPEED[$i,$j]} )) @@ -763,15 +744,12 @@ # Last item in current array. Work out averages (( $j == ${aBENCH_LAN_INDEX[$i]} - 1 )) || continue aBENCH_RESULT_NET_LAN_SPEED_AVG[$i]=$(( ${aBENCH_RESULT_NET_LAN_SPEED_AVG[$i]} / ${aBENCH_LAN_INDEX[$i]} )) - done - done # CustomFS for i in "${!aBENCH_CUSTOMFS_INDEX[@]}" do - aBENCH_RESULT_CUSTOMFS_WRITE_MIN[$i]= aBENCH_RESULT_CUSTOMFS_WRITE_MAX[$i]= aBENCH_RESULT_CUSTOMFS_WRITE_AVG[$i]= @@ -781,7 +759,6 @@ for (( j=0; j<${aBENCH_CUSTOMFS_INDEX[$i]}; j++ )) do - (( ${aBENCH_CUSTOMFS_WRITE[$i,$j]} < ${aBENCH_RESULT_CUSTOMFS_WRITE_MIN[$i]:=${aBENCH_CUSTOMFS_WRITE[$i,$j]}} )) && aBENCH_RESULT_CUSTOMFS_WRITE_MIN[$i]=${aBENCH_CUSTOMFS_WRITE[$i,$j]} (( ${aBENCH_CUSTOMFS_WRITE[$i,$j]} > ${aBENCH_RESULT_CUSTOMFS_WRITE_MAX[$i]:=${aBENCH_CUSTOMFS_WRITE[$i,$j]}} )) && aBENCH_RESULT_CUSTOMFS_WRITE_MAX[$i]=${aBENCH_CUSTOMFS_WRITE[$i,$j]} (( aBENCH_RESULT_CUSTOMFS_WRITE_AVG[$i] += ${aBENCH_CUSTOMFS_WRITE[$i,$j]} )) @@ -794,9 +771,7 @@ (( $j == ${aBENCH_CUSTOMFS_INDEX[$i]} - 1 )) || continue aBENCH_RESULT_CUSTOMFS_WRITE_AVG[$i]=$(( ${aBENCH_RESULT_CUSTOMFS_WRITE_AVG[$i]} / ${aBENCH_CUSTOMFS_INDEX[$i]} )) aBENCH_RESULT_CUSTOMFS_READ_AVG[$i]=$(( ${aBENCH_RESULT_CUSTOMFS_READ_AVG[$i]} / ${aBENCH_CUSTOMFS_INDEX[$i]} )) - done - done # Create HTML file @@ -902,7 +877,7 @@

DietPi-Survey statistics

Uploads since: 2020-07-01 00:00:00 UTC +0100

-

Last update: $(TZ=UTC date '+%Y-%m-%d %T UTC')

+

Last update: $(date -u '+%Y-%m-%d %T UTC')


@@ -1067,18 +1042,8 @@ _EOF_ - # Move HTML page in place - if [[ $G_DEBUG == 1 ]]; then - - mv index.html /var/www/survey/debug.html - - else - - mv index.html /var/www/survey/index.html - - fi - + mv index.html /var/www/survey/index.html } #----------------------------------------------------------- From 2f0f8dd0fb5a39c582c0305cb484eca91927077a Mon Sep 17 00:00:00 2001 From: MichaIng Date: Mon, 29 Mar 2021 22:23:30 +0200 Subject: [PATCH 050/147] v7.1 + DietPi-Survey_report | Revert to manual file parsing, which allows to massively simplify server-side sanity checks --- .meta/dietpi-survey_report | 222 ++++++++++++++++++++++++------------- 1 file changed, 142 insertions(+), 80 deletions(-) diff --git a/.meta/dietpi-survey_report b/.meta/dietpi-survey_report index 6cb0064c8f..a7eba8de25 100644 --- a/.meta/dietpi-survey_report +++ b/.meta/dietpi-survey_report @@ -141,8 +141,10 @@ #----------------------------------------------------------- # Globals - Survey #----------------------------------------------------------- + DATE= SURVEY_COUNT_TOTAL=0 SURVEY_COUNT_OPTIN=0 + SURVEY_COUNT_OPTOUT=0 declare -A aDIETPI_VERSION declare -A aDEVICE_NAME @@ -499,106 +501,166 @@ aSOFTWARE_NAME7_1[$i]=${aSOFTWARE_NAME7_0[$i]} done - Main() + # $1 = File name + Process_File() { - # Copy files to RAM to speed up sourcing - #mkdir -p /tmp/dietpi-survey_report - #cp /home/dietpi-survey/survey/*.txt /tmp/dietpi-survey_report/ # cp: Argument list too long - rm -Rf /tmp/dietpi-survey_report || exit 1 - cp -R /home/dietpi-survey/survey /tmp/dietpi-survey_report || exit 1 - cd /tmp/dietpi-survey_report || exit 1 - - # Loop through files, including dot files, so that we can detect and sort out invalid file names - shopt -s dotglob - for file in * + local file=$1 version branch device arch cpu_count distro autostart automated iface raspbian software asoftware=() + local BENCH_VERSION BENCH_HW_MODEL BENCH_CPU BENCH_ROOTFS_WRITE BENCH_ROOTFS_READ BENCH_RAM_WRITE BENCH_RAM_READ BENCH_CUSTOMFS_WRITE BENCH_CUSTOMFS_READ BENCH_CPU_TEMP_START BENCH_CPU_TEMP_END BENCH_NET_LAN_SPEED + while read -r line do - # Skip and move match with invalid name, when not a file or unexpected first line - [[ $file =~ ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\.txt$ && -f $file && ( ! -s $file || $(<"$file") == '#!/bin/bash'* ) ]] || { mv -v "/home/dietpi-survey/survey/$file" /home/dietpi-survey/invalid/; continue; } + case line in + + '#'*) :;; # Pre-v7.1 + '((aDIETPI_VERSION['7.[[:digit:]]']++))'|'((aDIETPI_VERSION['6.[123][[:digit:]]']++))') version=${line#*'['} version=${line%']'*};; + '((aGIT_BRANCH['+([[:graph:]])']++))') version=${line#*'['} version=${line%']'*};; # since v6.17 + '((aDEVICE_NAME['+([[:print:]])']++))') device=${line#*'['} device=${line%']'*};; + '((aCPU_ARCH['+([[:graph:]])']++))') arch=${line#*'['} arch=${line%']'*};; + '((aCPU_COUNT['+([[:digit:]])']++))') cpu_count=${line#*'['} cpu_count=${line%']'*};; + '((aDISTRO_VERSION['+([[:alpha:]])']++))') distro=${line#*'['} distro=${line%']'*};; + '((aAUTOSTART_OPTION[${aAUTOSTART_NAME['+([[:digit:]])']:='+([[:digit:]])'}]++))') autostart=${line##*'['} autostart=${line%%']'*};; + '((aAUTO_SETUP_AUTOMATED['[01]']++))') automated=${line#*'['} automated=${line%']'*};; + '((aNETWORK_INTERFACE['+([[:graph:]])']++))') iface=${line#*'['} iface=${line%']'*};; + '((aRASPBIAN['[01]']++))') raspbian=${line#*'['} raspbian=${line%']'*};; # since v6.31 + '((aSOFTWARE[${aSOFTWARE_NAME'${version/./_}'['+([[:digit:]])']:='+([[:digit:]])'}]++))') software=${line##*'['} software=${line%%']'*};; + 'BENCH_VERSION='[12]) BENCH_VERSION=${line#*'='};; # 1 until v6.23, 2 afterwards + 'BENCH_HW_MODEL='+([[:digit:]])) BENCH_HW_MODEL=${line#*'='};; + 'BENCH_CPU=') BENCH_CPU=${line#*\'} BENCH_CPU=${line%\'};; + 'BENCH_ROOTFS_WRITE=') BENCH_ROOTFS_WRITE=${line#*\'} BENCH_ROOTFS_WRITE=${line%\'};; + 'BENCH_ROOTFS_READ=') BENCH_ROOTFS_READ=${line#*\'} BENCH_ROOTFS_READ=${line%\'};; + 'BENCH_RAM_WRITE=') BENCH_RAM_WRITE=${line#*\'} BENCH_RAM_WRITE=${line%\'};; + 'BENCH_RAM_READ=') BENCH_RAM_READ=${line#*\'} BENCH_RAM_READ=${line%\'};; + 'BENCH_CUSTOMFS_WRITE=') BENCH_CUSTOMFS_WRITE=${line#*\'} BENCH_CUSTOMFS_WRITE=${line%\'};; + 'BENCH_CUSTOMFS_READ=') BENCH_CUSTOMFS_READ=${line#*\'} BENCH_CUSTOMFS_READ=${line%\'};; + 'BENCH_CPU_TEMP_START=') BENCH_CPU_TEMP_START=${line#*\'} BENCH_CPU_TEMP_START=${line%\'};; + 'BENCH_CPU_TEMP_END=') BENCH_CPU_TEMP_END=${line#*\'} BENCH_CPU_TEMP_END=${line%\'};; + 'BENCH_NET_LAN_SPEED=') BENCH_NET_LAN_SPEED=${line#*\'} BENCH_NET_LAN_SPEED=${line%\'};; + *) mv -v "/home/dietpi-survey/survey/$file" /home/dietpi-survey/invalid/; return 1; # Invalid line + + esac + + # Validate and process software name if present + [[ $software ]] || continue + eval "software=\${aSOFTWARE_NAME${version/./_}[$software]}" + [[ $software ]] || { mv -v "/home/dietpi-survey/survey/$file" /home/dietpi-survey/invalid/; return 1; } + asoftware+=("$software") + unset -v software + + done < "$file" + + # Values that must exist + [[ $version && $device && $arch && $cpu_count && $distro && $autostart && ${aAUTOSTART_NAME[$autostart]} && $automated && $iface ]] || { mv -v "/home/dietpi-survey/survey/$file" /home/dietpi-survey/invalid/; return 1; } + + # Valid content + ((SURVEY_COUNT_OPTIN++)) + + # Add to global arrays + ((aDIETPI_VERSION["$version"]++)) + [[ $branch ]] && ((aGIT_BRANCH["$branch"]++)) + ((aDEVICE_NAME["$device"]++)) + ((aCPU_ARCH["$arch"]++)) + ((aCPU_COUNT["$cpu_count"]++)) + ((aAUTOSTART_OPTION[${aAUTOSTART_NAME["$autostart"]}]++)) + ((aAUTO_SETUP_AUTOMATED["$automated"]++)) + ((aNETWORK_INTERFACE["$iface"]++)) + ((aRASPBIAN["$raspbian"]++)) + ((aDIETPI_VERSION["$version"]++)) + for i in "${asoftware[@]}" + do + ((aSOFTWARE["$i"]++)) + done - # Count total and optin files - ((SURVEY_COUNT_TOTAL++)) - [[ -s $file ]] || continue - ((SURVEY_COUNT_OPTIN++)) + # Process benchmark results is present and hardware ID valid + [[ $BENCH_VERSION && $BENCH_HW_MODEL && ${aHW_NAME[$BENCH_HW_MODEL]} ]] || continue - # Source survey files - . "$file" + # CPU + # - BENCH_CPU: Remove decimal point, equals times 100 since CPU time is always in x.xx + BENCH_CPU=${BENCH_CPU/.} + if [[ $BENCH_CPU =~ ^[0-9]*[1-9][0-9]*$ && $BENCH_CPU_TEMP_START =~ ^[0-9]+$ && $BENCH_CPU_TEMP_END =~ ^[0-9]+$ ]]; then - # Add bench to array - [[ $BENCH_HW_MODEL =~ ^[0-9]+$ ]] || continue + aBENCH_CPU[$BENCH_HW_MODEL,${aBENCH_CPU_INDEX[$BENCH_HW_MODEL]:=0}]=$BENCH_CPU - # CPU - # - BENCH_CPU: Remove decimal point, equals times 100 since CPU time is always in x.xx - BENCH_CPU=${BENCH_CPU/.} - if [[ $BENCH_CPU =~ ^[0-9]*[1-9][0-9]*$ && $BENCH_CPU_TEMP_START =~ ^[0-9]+$ && $BENCH_CPU_TEMP_END =~ ^[0-9]+$ ]]; then + # Patch for 5 digit CPU temps: https://github.com/MichaIng/DietPi/issues/2715 + (( $BENCH_CPU_TEMP_START > 200 )) && (( BENCH_CPU_TEMP_START /= 1000 )) + (( $BENCH_CPU_TEMP_END > 200 )) && (( BENCH_CPU_TEMP_END /= 1000 )) - aBENCH_CPU[$BENCH_HW_MODEL,${aBENCH_CPU_INDEX[$BENCH_HW_MODEL]:=0}]=$BENCH_CPU + aBENCH_CPU_TEMP_START[$BENCH_HW_MODEL,${aBENCH_CPU_INDEX[$BENCH_HW_MODEL]}]=$BENCH_CPU_TEMP_START + aBENCH_CPU_TEMP_END[$BENCH_HW_MODEL,${aBENCH_CPU_INDEX[$BENCH_HW_MODEL]}]=$BENCH_CPU_TEMP_END + ((aBENCH_CPU_INDEX[$BENCH_HW_MODEL]++)) - # Patch for 5 digit CPU temps: https://github.com/MichaIng/DietPi/issues/2715 - (( $BENCH_CPU_TEMP_START > 200 )) && (( BENCH_CPU_TEMP_START /= 1000 )) - (( $BENCH_CPU_TEMP_END > 200 )) && (( BENCH_CPU_TEMP_END /= 1000 )) + fi - aBENCH_CPU_TEMP_START[$BENCH_HW_MODEL,${aBENCH_CPU_INDEX[$BENCH_HW_MODEL]}]=$BENCH_CPU_TEMP_START - aBENCH_CPU_TEMP_END[$BENCH_HW_MODEL,${aBENCH_CPU_INDEX[$BENCH_HW_MODEL]}]=$BENCH_CPU_TEMP_END - ((aBENCH_CPU_INDEX[$BENCH_HW_MODEL]++)) + # RootFS + # - Remove decimal places + BENCH_ROOTFS_WRITE=${BENCH_ROOTFS_WRITE%%.*} + BENCH_ROOTFS_READ=${BENCH_ROOTFS_READ%%.*} + if [[ $BENCH_ROOTFS_WRITE =~ ^[0-9]*[1-9][0-9]*$ && $BENCH_ROOTFS_READ =~ ^[0-9]*[1-9][0-9]*$ ]]; then - fi + aBENCH_ROOTFS_WRITE[$BENCH_HW_MODEL,${aBENCH_ROOTFS_INDEX[$BENCH_HW_MODEL]:=0}]=$BENCH_ROOTFS_WRITE + aBENCH_ROOTFS_READ[$BENCH_HW_MODEL,${aBENCH_ROOTFS_INDEX[$BENCH_HW_MODEL]}]=$BENCH_ROOTFS_READ + ((aBENCH_ROOTFS_INDEX[$BENCH_HW_MODEL]++)) - # RootFS - # - Remove decimal places - BENCH_ROOTFS_WRITE=${BENCH_ROOTFS_WRITE%%.*} - BENCH_ROOTFS_READ=${BENCH_ROOTFS_READ%%.*} - if [[ $BENCH_ROOTFS_WRITE =~ ^[0-9]*[1-9][0-9]*$ && $BENCH_ROOTFS_READ =~ ^[0-9]*[1-9][0-9]*$ ]]; then + fi - aBENCH_ROOTFS_WRITE[$BENCH_HW_MODEL,${aBENCH_ROOTFS_INDEX[$BENCH_HW_MODEL]:=0}]=$BENCH_ROOTFS_WRITE - aBENCH_ROOTFS_READ[$BENCH_HW_MODEL,${aBENCH_ROOTFS_INDEX[$BENCH_HW_MODEL]}]=$BENCH_ROOTFS_READ - ((aBENCH_ROOTFS_INDEX[$BENCH_HW_MODEL]++)) + # RAM + # - https://github.com/MichaIng/DietPi/issues/2715 | nullify this score and ignore it in min/max/avg processing. + # - Remove decimal places + BENCH_RAM_WRITE=${BENCH_RAM_WRITE%%.*} + BENCH_RAM_READ=${BENCH_RAM_READ%%.*} + if [[ $BENCH_VERSION =~ ^[0-9]+$ && $BENCH_RAM_WRITE =~ ^[0-9]*[1-9][0-9]*$ && $BENCH_RAM_READ =~ ^[0-9]*[1-9][0-9]*$ ]] && (( $BENCH_VERSION > 1 )); then - fi + aBENCH_RAM_WRITE[$BENCH_HW_MODEL,${aBENCH_RAM_INDEX[$BENCH_HW_MODEL]:=0}]=$BENCH_RAM_WRITE + aBENCH_RAM_READ[$BENCH_HW_MODEL,${aBENCH_RAM_INDEX[$BENCH_HW_MODEL]}]=$BENCH_RAM_READ + ((aBENCH_RAM_INDEX[$BENCH_HW_MODEL]++)) - # RAM - # - https://github.com/MichaIng/DietPi/issues/2715 | nullify this score and ignore it in min/max/avg processing. - # - Remove decimal places - BENCH_RAM_WRITE=${BENCH_RAM_WRITE%%.*} - BENCH_RAM_READ=${BENCH_RAM_READ%%.*} - if [[ $BENCH_VERSION =~ ^[0-9]+$ && $BENCH_RAM_WRITE =~ ^[0-9]*[1-9][0-9]*$ && $BENCH_RAM_READ =~ ^[0-9]*[1-9][0-9]*$ ]] && (( $BENCH_VERSION > 1 )); then + fi - aBENCH_RAM_WRITE[$BENCH_HW_MODEL,${aBENCH_RAM_INDEX[$BENCH_HW_MODEL]:=0}]=$BENCH_RAM_WRITE - aBENCH_RAM_READ[$BENCH_HW_MODEL,${aBENCH_RAM_INDEX[$BENCH_HW_MODEL]}]=$BENCH_RAM_READ - ((aBENCH_RAM_INDEX[$BENCH_HW_MODEL]++)) + # Custom FS + # - Remove decimal places + BENCH_CUSTOMFS_WRITE=${BENCH_CUSTOMFS_WRITE%%.*} + BENCH_CUSTOMFS_READ=${BENCH_CUSTOMFS_READ%%.*} + if [[ $BENCH_CUSTOMFS_WRITE =~ ^[0-9]*[1-9][0-9]*$ && $BENCH_CUSTOMFS_READ =~ ^[0-9]*[1-9][0-9]*$ ]]; then - fi + aBENCH_CUSTOMFS_WRITE[$BENCH_HW_MODEL,${aBENCH_CUSTOMFS_INDEX[$BENCH_HW_MODEL]:=0}]=$BENCH_CUSTOMFS_WRITE + aBENCH_CUSTOMFS_READ[$BENCH_HW_MODEL,${aBENCH_CUSTOMFS_INDEX[$BENCH_HW_MODEL]}]=$BENCH_CUSTOMFS_READ + ((aBENCH_CUSTOMFS_INDEX[$BENCH_HW_MODEL]++)) - # Custom FS - # - Remove decimal places - BENCH_CUSTOMFS_WRITE=${BENCH_CUSTOMFS_WRITE%%.*} - BENCH_CUSTOMFS_READ=${BENCH_CUSTOMFS_READ%%.*} - if [[ $BENCH_CUSTOMFS_WRITE =~ ^[0-9]*[1-9][0-9]*$ && $BENCH_CUSTOMFS_READ =~ ^[0-9]*[1-9][0-9]*$ ]]; then + fi - aBENCH_CUSTOMFS_WRITE[$BENCH_HW_MODEL,${aBENCH_CUSTOMFS_INDEX[$BENCH_HW_MODEL]:=0}]=$BENCH_CUSTOMFS_WRITE - aBENCH_CUSTOMFS_READ[$BENCH_HW_MODEL,${aBENCH_CUSTOMFS_INDEX[$BENCH_HW_MODEL]}]=$BENCH_CUSTOMFS_READ - ((aBENCH_CUSTOMFS_INDEX[$BENCH_HW_MODEL]++)) + # LAN + # - Remove decimal places + BENCH_NET_LAN_SPEED=${BENCH_NET_LAN_SPEED%%.*} + if [[ $BENCH_NET_LAN_SPEED =~ ^[0-9]*[1-9][0-9]*$ ]]; then + + aBENCH_NET_LAN_SPEED[$BENCH_HW_MODEL,${aBENCH_LAN_INDEX[$BENCH_HW_MODEL]:=0}]=$BENCH_NET_LAN_SPEED + ((aBENCH_LAN_INDEX[$BENCH_HW_MODEL]++)) - fi + fi + } - # LAN - # - Remove decimal places - BENCH_NET_LAN_SPEED=${BENCH_NET_LAN_SPEED%%.*} - if [[ $BENCH_NET_LAN_SPEED =~ ^[0-9]*[1-9][0-9]*$ ]]; then + Main() + { + # Copy files to RAM to speed up sourcing + #mkdir -p /tmp/dietpi-survey_report + #cp /home/dietpi-survey/survey/*.txt /tmp/dietpi-survey_report/ # cp: Argument list too long + rm -Rf /tmp/dietpi-survey_report || exit 1 + DATE=$(date -u '+%Y-%m-%d %T UTC') # Store date of last possible upload + cp -R /home/dietpi-survey/survey /tmp/dietpi-survey_report || exit 1 + cd /tmp/dietpi-survey_report || exit 1 - aBENCH_NET_LAN_SPEED[$BENCH_HW_MODEL,${aBENCH_LAN_INDEX[$BENCH_HW_MODEL]:=0}]=$BENCH_NET_LAN_SPEED - ((aBENCH_LAN_INDEX[$BENCH_HW_MODEL]++)) + # Loop through files, including dot files, so that we can detect and sort out invalid file names + shopt -s dotglob extglob + for file in * + do + # Skip and move away match with invalid name or when not a file + [[ $file =~ ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\.txt$ && -f $file ]] || { mv -v "/home/dietpi-survey/survey/$file" /home/dietpi-survey/invalid/; continue; } - fi + # Optout files + [[ -s $file ]] || { ((SURVEY_COUNT_OPTOUT++)); continue; } - # Done, clear vars - unset -v BENCH_VERSION BENCH_HW_MODEL - unset -v BENCH_CPU BENCH_CPU_TEMP_START BENCH_CPU_TEMP_END - unset -v BENCH_ROOTFS_WRITE BENCH_ROOTFS_READ - unset -v BENCH_RAM_WRITE BENCH_RAM_READ - unset -v BENCH_CUSTOMFS_WRITE BENCH_CUSTOMFS_READ - unset -v BENCH_NET_LAN_SPEED + # Process file + Process_File "$file" done - shopt -u dotglob + shopt -u dotglob extglob # Navigate to parent /tmp cd /tmp || exit 1 @@ -606,8 +668,8 @@ # Clean up reports dir rm -R /tmp/dietpi-survey_report || exit 1 - # Optin count - SURVEY_COUNT_EMPTY=$(( $SURVEY_COUNT_TOTAL - $SURVEY_COUNT_OPTIN )) + # Total count + SURVEY_COUNT_TOTAL=$(( $SURVEY_COUNT_OPTOUT + $SURVEY_COUNT_OPTIN )) # Merge old and new hardware model names for i in "${!aDEVICE_NAME[@]}" @@ -877,12 +939,12 @@

DietPi-Survey statistics

Uploads since: 2020-07-01 00:00:00 UTC +0100

-

Last update: $(date -u '+%Y-%m-%d %T UTC')

+

Last update: $DATE


Total system count$SURVEY_COUNT_TOTAL
- +
Total system count$SURVEY_COUNT_TOTAL
Systems sending survey data$SURVEY_COUNT_OPTIN$(( $SURVEY_COUNT_OPTIN * 100 / $SURVEY_COUNT_TOTAL ))%
Systems opted out DietPi-Survey$SURVEY_COUNT_EMPTY$(( $SURVEY_COUNT_EMPTY * 100 / $SURVEY_COUNT_TOTAL ))%
Systems opted out DietPi-Survey$SURVEY_COUNT_OPTOUT$(( $SURVEY_COUNT_EMPTY * 100 / $SURVEY_COUNT_TOTAL ))%

DietPi versions ¶

From 5b9a3cad4dec9e0aafa745964c472de9d3a36d8c Mon Sep 17 00:00:00 2001 From: MichaIng Date: Mon, 29 Mar 2021 23:23:41 +0200 Subject: [PATCH 051/147] v7.1 + DietPi-Survey_report | Syntax --- .meta/dietpi-survey_report | 49 +++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/.meta/dietpi-survey_report b/.meta/dietpi-survey_report index a7eba8de25..f33ef11947 100644 --- a/.meta/dietpi-survey_report +++ b/.meta/dietpi-survey_report @@ -1,4 +1,5 @@ #!/bin/bash +shopt -s extglob { # Created by MichaIng / micha@dietpi.com / dietpi.com @@ -508,33 +509,33 @@ local BENCH_VERSION BENCH_HW_MODEL BENCH_CPU BENCH_ROOTFS_WRITE BENCH_ROOTFS_READ BENCH_RAM_WRITE BENCH_RAM_READ BENCH_CUSTOMFS_WRITE BENCH_CUSTOMFS_READ BENCH_CPU_TEMP_START BENCH_CPU_TEMP_END BENCH_NET_LAN_SPEED while read -r line do - case line in + case "$line" in '#'*) :;; # Pre-v7.1 - '((aDIETPI_VERSION['7.[[:digit:]]']++))'|'((aDIETPI_VERSION['6.[123][[:digit:]]']++))') version=${line#*'['} version=${line%']'*};; - '((aGIT_BRANCH['+([[:graph:]])']++))') version=${line#*'['} version=${line%']'*};; # since v6.17 - '((aDEVICE_NAME['+([[:print:]])']++))') device=${line#*'['} device=${line%']'*};; - '((aCPU_ARCH['+([[:graph:]])']++))') arch=${line#*'['} arch=${line%']'*};; - '((aCPU_COUNT['+([[:digit:]])']++))') cpu_count=${line#*'['} cpu_count=${line%']'*};; - '((aDISTRO_VERSION['+([[:alpha:]])']++))') distro=${line#*'['} distro=${line%']'*};; - '((aAUTOSTART_OPTION[${aAUTOSTART_NAME['+([[:digit:]])']:='+([[:digit:]])'}]++))') autostart=${line##*'['} autostart=${line%%']'*};; - '((aAUTO_SETUP_AUTOMATED['[01]']++))') automated=${line#*'['} automated=${line%']'*};; - '((aNETWORK_INTERFACE['+([[:graph:]])']++))') iface=${line#*'['} iface=${line%']'*};; - '((aRASPBIAN['[01]']++))') raspbian=${line#*'['} raspbian=${line%']'*};; # since v6.31 - '((aSOFTWARE[${aSOFTWARE_NAME'${version/./_}'['+([[:digit:]])']:='+([[:digit:]])'}]++))') software=${line##*'['} software=${line%%']'*};; + '((aDIETPI_VERSION['7.[[:digit:]]']++))'|'((aDIETPI_VERSION['6.[123][[:digit:]]']++))') version=${line#*'['} version=${version%']'*};; + '((aGIT_BRANCH['+([[:graph:]])']++))') branch=${line#*'['} branch=${branch%']'*};; # since v6.17 + '((aDEVICE_NAME['+([[:print:]])']++))') device=${line#*'['} device=${device%']'*};; + '((aCPU_ARCH['+([[:graph:]])']++))') arch=${line#*'['} arch=${arch%']'*};; + '((aCPU_COUNT['+([[:digit:]])']++))') cpu_count=${line#*'['} cpu_count=${cpu_count%']'*};; + '((aDISTRO_VERSION['+([[:alpha:]])']++))') distro=${line#*'['} distro=${distro%']'*};; + '((aAUTOSTART_OPTION[${aAUTOSTART_NAME['+([[:digit:]])']:='+([[:digit:]])'}]++))') autostart=${line##*'['} autostart=${autostart%%']'*};; + '((aAUTO_SETUP_AUTOMATED['[01]']++))') automated=${line#*'['} automated=${automated%']'*};; + '((aNETWORK_INTERFACE['+([[:graph:]])']++))') iface=${line#*'['} iface=${iface%']'*};; + '((aRASPBIAN['[01]']++))') raspbian=${line#*'['} raspbian=${raspbian%']'*};; # since v6.31 + '((aSOFTWARE[${aSOFTWARE_NAME'${version/./_}'['+([[:digit:]])']:='+([[:digit:]])'}]++))') software=${line##*'['} software=${software%%']'*};; 'BENCH_VERSION='[12]) BENCH_VERSION=${line#*'='};; # 1 until v6.23, 2 afterwards 'BENCH_HW_MODEL='+([[:digit:]])) BENCH_HW_MODEL=${line#*'='};; - 'BENCH_CPU=') BENCH_CPU=${line#*\'} BENCH_CPU=${line%\'};; - 'BENCH_ROOTFS_WRITE=') BENCH_ROOTFS_WRITE=${line#*\'} BENCH_ROOTFS_WRITE=${line%\'};; - 'BENCH_ROOTFS_READ=') BENCH_ROOTFS_READ=${line#*\'} BENCH_ROOTFS_READ=${line%\'};; - 'BENCH_RAM_WRITE=') BENCH_RAM_WRITE=${line#*\'} BENCH_RAM_WRITE=${line%\'};; - 'BENCH_RAM_READ=') BENCH_RAM_READ=${line#*\'} BENCH_RAM_READ=${line%\'};; - 'BENCH_CUSTOMFS_WRITE=') BENCH_CUSTOMFS_WRITE=${line#*\'} BENCH_CUSTOMFS_WRITE=${line%\'};; - 'BENCH_CUSTOMFS_READ=') BENCH_CUSTOMFS_READ=${line#*\'} BENCH_CUSTOMFS_READ=${line%\'};; - 'BENCH_CPU_TEMP_START=') BENCH_CPU_TEMP_START=${line#*\'} BENCH_CPU_TEMP_START=${line%\'};; - 'BENCH_CPU_TEMP_END=') BENCH_CPU_TEMP_END=${line#*\'} BENCH_CPU_TEMP_END=${line%\'};; - 'BENCH_NET_LAN_SPEED=') BENCH_NET_LAN_SPEED=${line#*\'} BENCH_NET_LAN_SPEED=${line%\'};; - *) mv -v "/home/dietpi-survey/survey/$file" /home/dietpi-survey/invalid/; return 1; # Invalid line + 'BENCH_CPU=') BENCH_CPU=${line#*\'} BENCH_CPU=${BENCH_CPU%\'};; + 'BENCH_ROOTFS_WRITE=') BENCH_ROOTFS_WRITE=${line#*\'} BENCH_ROOTFS_WRITE=${BENCH_ROOTFS_WRITE%\'};; + 'BENCH_ROOTFS_READ=') BENCH_ROOTFS_READ=${line#*\'} BENCH_ROOTFS_READ=${BENCH_ROOTFS_READ%\'};; + 'BENCH_RAM_WRITE=') BENCH_RAM_WRITE=${line#*\'} BENCH_RAM_WRITE=${BENCH_RAM_WRITE%\'};; + 'BENCH_RAM_READ=') BENCH_RAM_READ=${line#*\'} BENCH_RAM_READ=${BENCH_RAM_READ%\'};; + 'BENCH_CUSTOMFS_WRITE=') BENCH_CUSTOMFS_WRITE=${line#*\'} BENCH_CUSTOMFS_WRITE=${BENCH_CUSTOMFS_WRITE%\'};; + 'BENCH_CUSTOMFS_READ=') BENCH_CUSTOMFS_READ=${line#*\'} BENCH_CUSTOMFS_READ=${BENCH_CUSTOMFS_READ%\'};; + 'BENCH_CPU_TEMP_START=') BENCH_CPU_TEMP_START=${line#*\'} BENCH_CPU_TEMP_START=${BENCH_CPU_TEMP_START%\'};; + 'BENCH_CPU_TEMP_END=') BENCH_CPU_TEMP_END=${line#*\'} BENCH_CPU_TEMP_END=${BENCH_CPU_TEMP_END%\'};; + 'BENCH_NET_LAN_SPEED=') BENCH_NET_LAN_SPEED=${line#*\'} BENCH_NET_LAN_SPEED=${BENCH_NET_LAN_SPEED%\'};; + *) mv -v "/home/dietpi-survey/survey/$file" /home/dietpi-survey/invalid/; return 1;; # Invalid line esac @@ -648,7 +649,7 @@ cd /tmp/dietpi-survey_report || exit 1 # Loop through files, including dot files, so that we can detect and sort out invalid file names - shopt -s dotglob extglob + shopt -s dotglob for file in * do # Skip and move away match with invalid name or when not a file From 86a1ba720991b7623abcca3b07ce556e8c4c5a71 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Tue, 30 Mar 2021 00:23:03 +0200 Subject: [PATCH 052/147] v7.1 + DietPi-Survey_report | Further syntax and old version handling --- .meta/dietpi-survey_report | 44 ++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/.meta/dietpi-survey_report b/.meta/dietpi-survey_report index f33ef11947..b69addeced 100644 --- a/.meta/dietpi-survey_report +++ b/.meta/dietpi-survey_report @@ -512,6 +512,8 @@ shopt -s extglob case "$line" in '#'*) :;; # Pre-v7.1 + '((aSURVEY_VERSION[6]++))') :;; # Pre-v6.22 + '((aSURVEY_SENTCOUNT['+([[:digit:]])']++))') :;; # Pre-v6.22 '((aDIETPI_VERSION['7.[[:digit:]]']++))'|'((aDIETPI_VERSION['6.[123][[:digit:]]']++))') version=${line#*'['} version=${version%']'*};; '((aGIT_BRANCH['+([[:graph:]])']++))') branch=${line#*'['} branch=${branch%']'*};; # since v6.17 '((aDEVICE_NAME['+([[:print:]])']++))') device=${line#*'['} device=${device%']'*};; @@ -519,22 +521,25 @@ shopt -s extglob '((aCPU_COUNT['+([[:digit:]])']++))') cpu_count=${line#*'['} cpu_count=${cpu_count%']'*};; '((aDISTRO_VERSION['+([[:alpha:]])']++))') distro=${line#*'['} distro=${distro%']'*};; '((aAUTOSTART_OPTION[${aAUTOSTART_NAME['+([[:digit:]])']:='+([[:digit:]])'}]++))') autostart=${line##*'['} autostart=${autostart%%']'*};; + '((aAUTOSTART_OPTION[${aAUTOSTART_NAME['+([[:digit:]])']}]++))') autostart=${line##*'['} autostart=${autostart%%']'*};; # Pre-v6.17 '((aAUTO_SETUP_AUTOMATED['[01]']++))') automated=${line#*'['} automated=${automated%']'*};; '((aNETWORK_INTERFACE['+([[:graph:]])']++))') iface=${line#*'['} iface=${iface%']'*};; '((aRASPBIAN['[01]']++))') raspbian=${line#*'['} raspbian=${raspbian%']'*};; # since v6.31 '((aSOFTWARE[${aSOFTWARE_NAME'${version/./_}'['+([[:digit:]])']:='+([[:digit:]])'}]++))') software=${line##*'['} software=${software%%']'*};; + '((aSOFTWARE[${aSOFTWARE_NAME'${version/./_}'['+([[:digit:]])']}]++))') software=${line##*'['} software=${software%%']'*};; # Pre-v6.17 'BENCH_VERSION='[12]) BENCH_VERSION=${line#*'='};; # 1 until v6.23, 2 afterwards 'BENCH_HW_MODEL='+([[:digit:]])) BENCH_HW_MODEL=${line#*'='};; - 'BENCH_CPU=') BENCH_CPU=${line#*\'} BENCH_CPU=${BENCH_CPU%\'};; - 'BENCH_ROOTFS_WRITE=') BENCH_ROOTFS_WRITE=${line#*\'} BENCH_ROOTFS_WRITE=${BENCH_ROOTFS_WRITE%\'};; - 'BENCH_ROOTFS_READ=') BENCH_ROOTFS_READ=${line#*\'} BENCH_ROOTFS_READ=${BENCH_ROOTFS_READ%\'};; - 'BENCH_RAM_WRITE=') BENCH_RAM_WRITE=${line#*\'} BENCH_RAM_WRITE=${BENCH_RAM_WRITE%\'};; - 'BENCH_RAM_READ=') BENCH_RAM_READ=${line#*\'} BENCH_RAM_READ=${BENCH_RAM_READ%\'};; - 'BENCH_CUSTOMFS_WRITE=') BENCH_CUSTOMFS_WRITE=${line#*\'} BENCH_CUSTOMFS_WRITE=${BENCH_CUSTOMFS_WRITE%\'};; - 'BENCH_CUSTOMFS_READ=') BENCH_CUSTOMFS_READ=${line#*\'} BENCH_CUSTOMFS_READ=${BENCH_CUSTOMFS_READ%\'};; - 'BENCH_CPU_TEMP_START=') BENCH_CPU_TEMP_START=${line#*\'} BENCH_CPU_TEMP_START=${BENCH_CPU_TEMP_START%\'};; - 'BENCH_CPU_TEMP_END=') BENCH_CPU_TEMP_END=${line#*\'} BENCH_CPU_TEMP_END=${BENCH_CPU_TEMP_END%\'};; - 'BENCH_NET_LAN_SPEED=') BENCH_NET_LAN_SPEED=${line#*\'} BENCH_NET_LAN_SPEED=${BENCH_NET_LAN_SPEED%\'};; + 'BENCH_HW_MODEL=-1') BENCH_HW_MODEL=22;; # Pre-v6.29: Migrate fallback "-1" to Generic Device + 'BENCH_CPU='*) BENCH_CPU=${line#*\'} BENCH_CPU=${BENCH_CPU%\'};; + 'BENCH_ROOTFS_WRITE='*) BENCH_ROOTFS_WRITE=${line#*\'} BENCH_ROOTFS_WRITE=${BENCH_ROOTFS_WRITE%\'};; + 'BENCH_ROOTFS_READ='*) BENCH_ROOTFS_READ=${line#*\'} BENCH_ROOTFS_READ=${BENCH_ROOTFS_READ%\'};; + 'BENCH_RAM_WRITE='*) BENCH_RAM_WRITE=${line#*\'} BENCH_RAM_WRITE=${BENCH_RAM_WRITE%\'};; + 'BENCH_RAM_READ='*) BENCH_RAM_READ=${line#*\'} BENCH_RAM_READ=${BENCH_RAM_READ%\'};; + 'BENCH_CUSTOMFS_WRITE='*) BENCH_CUSTOMFS_WRITE=${line#*\'} BENCH_CUSTOMFS_WRITE=${BENCH_CUSTOMFS_WRITE%\'};; + 'BENCH_CUSTOMFS_READ='*) BENCH_CUSTOMFS_READ=${line#*\'} BENCH_CUSTOMFS_READ=${BENCH_CUSTOMFS_READ%\'};; + 'BENCH_CPU_TEMP_START='*) BENCH_CPU_TEMP_START=${line#*\'} BENCH_CPU_TEMP_START=${BENCH_CPU_TEMP_START%\'};; + 'BENCH_CPU_TEMP_END='*) BENCH_CPU_TEMP_END=${line#*\'} BENCH_CPU_TEMP_END=${BENCH_CPU_TEMP_END%\'};; + 'BENCH_NET_LAN_SPEED='*) BENCH_NET_LAN_SPEED=${line#*\'} BENCH_NET_LAN_SPEED=${BENCH_NET_LAN_SPEED%\'};; *) mv -v "/home/dietpi-survey/survey/$file" /home/dietpi-survey/invalid/; return 1;; # Invalid line esac @@ -560,18 +565,19 @@ shopt -s extglob ((aDEVICE_NAME["$device"]++)) ((aCPU_ARCH["$arch"]++)) ((aCPU_COUNT["$cpu_count"]++)) + ((aDISTRO_VERSION["$distro"]++)) ((aAUTOSTART_OPTION[${aAUTOSTART_NAME["$autostart"]}]++)) ((aAUTO_SETUP_AUTOMATED["$automated"]++)) ((aNETWORK_INTERFACE["$iface"]++)) - ((aRASPBIAN["$raspbian"]++)) - ((aDIETPI_VERSION["$version"]++)) + [[ $raspbian ]] && ((aRASPBIAN["$raspbian"]++)) for i in "${asoftware[@]}" do ((aSOFTWARE["$i"]++)) done # Process benchmark results is present and hardware ID valid - [[ $BENCH_VERSION && $BENCH_HW_MODEL && ${aHW_NAME[$BENCH_HW_MODEL]} ]] || continue + [[ $BENCH_VERSION && $BENCH_HW_MODEL ]] || return 0 + [[ ${aHW_NAME[$BENCH_HW_MODEL]} ]] || { echo "Invalid hardware ID: $BENCH_HW_MODEL"; return 1; } # CPU # - BENCH_CPU: Remove decimal point, equals times 100 since CPU time is always in x.xx @@ -945,7 +951,7 @@ shopt -s extglob - +
Total system count$SURVEY_COUNT_TOTAL
Systems sending survey data$SURVEY_COUNT_OPTIN$(( $SURVEY_COUNT_OPTIN * 100 / $SURVEY_COUNT_TOTAL ))%
Systems opted out DietPi-Survey$SURVEY_COUNT_OPTOUT$(( $SURVEY_COUNT_EMPTY * 100 / $SURVEY_COUNT_TOTAL ))%
Systems opted out DietPi-Survey$SURVEY_COUNT_OPTOUT$(( $SURVEY_COUNT_OPTOUT * 100 / $SURVEY_COUNT_TOTAL ))%

DietPi versions ¶

@@ -1024,7 +1030,7 @@ shopt -s extglob Lowest Highest - $(for i in "${!aBENCH_CPU_INDEX[@]}"; do echo "${aHW_NAME[$i]:=$i}${aBENCH_CPU_INDEX[$i]} ${aBENCH_RESULT_CPU_AVG[$i]}${aBENCH_RESULT_CPU_MIN[$i]}${aBENCH_RESULT_CPU_MAX[$i]}${aBENCH_RESULT_CPU_TEMP_START_AVG[$i]}${aBENCH_RESULT_CPU_TEMP_START_MIN[$i]}${aBENCH_RESULT_CPU_TEMP_START_MAX[$i]}${aBENCH_RESULT_CPU_TEMP_END_AVG[$i]}${aBENCH_RESULT_CPU_TEMP_END_MIN[$i]}${aBENCH_RESULT_CPU_TEMP_END_MAX[$i]}"; done | sort -nk 2 -t ' ') + $(for i in "${!aBENCH_CPU_INDEX[@]}"; do echo "${aHW_NAME[$i]}${aBENCH_CPU_INDEX[$i]} ${aBENCH_RESULT_CPU_AVG[$i]}${aBENCH_RESULT_CPU_MIN[$i]}${aBENCH_RESULT_CPU_MAX[$i]}${aBENCH_RESULT_CPU_TEMP_START_AVG[$i]}${aBENCH_RESULT_CPU_TEMP_START_MIN[$i]}${aBENCH_RESULT_CPU_TEMP_START_MAX[$i]}${aBENCH_RESULT_CPU_TEMP_END_AVG[$i]}${aBENCH_RESULT_CPU_TEMP_END_MIN[$i]}${aBENCH_RESULT_CPU_TEMP_END_MAX[$i]}"; done | sort -nk 2 -t ' ')

DietPi-Benchmarks | RAM I/O ¶

@@ -1044,7 +1050,7 @@ shopt -s extglob Fastest Slowest - $(for i in "${!aBENCH_RAM_INDEX[@]}"; do echo "${aHW_NAME[$i]:=$i}${aBENCH_RAM_INDEX[$i]} ${aBENCH_RESULT_RAM_WRITE_AVG[$i]}${aBENCH_RESULT_RAM_WRITE_MAX[$i]}${aBENCH_RESULT_RAM_WRITE_MIN[$i]}${aBENCH_RESULT_RAM_READ_AVG[$i]}${aBENCH_RESULT_RAM_READ_MAX[$i]}${aBENCH_RESULT_RAM_READ_MIN[$i]}"; done | sort -nrk 2 -t ' ') + $(for i in "${!aBENCH_RAM_INDEX[@]}"; do echo "${aHW_NAME[$i]}${aBENCH_RAM_INDEX[$i]} ${aBENCH_RESULT_RAM_WRITE_AVG[$i]}${aBENCH_RESULT_RAM_WRITE_MAX[$i]}${aBENCH_RESULT_RAM_WRITE_MIN[$i]}${aBENCH_RESULT_RAM_READ_AVG[$i]}${aBENCH_RESULT_RAM_READ_MAX[$i]}${aBENCH_RESULT_RAM_READ_MIN[$i]}"; done | sort -nrk 2 -t ' ')

DietPi-Benchmarks | RootFS I/O ¶

@@ -1064,7 +1070,7 @@ shopt -s extglob Fastest Slowest - $(for i in "${!aBENCH_ROOTFS_INDEX[@]}"; do echo "${aHW_NAME[$i]:=$i}${aBENCH_ROOTFS_INDEX[$i]} ${aBENCH_RESULT_ROOTFS_WRITE_AVG[$i]}${aBENCH_RESULT_ROOTFS_WRITE_MAX[$i]}${aBENCH_RESULT_ROOTFS_WRITE_MIN[$i]}${aBENCH_RESULT_ROOTFS_READ_AVG[$i]}${aBENCH_RESULT_ROOTFS_READ_MAX[$i]}${aBENCH_RESULT_ROOTFS_READ_MIN[$i]}"; done | sort -nrk 2 -t ' ') + $(for i in "${!aBENCH_ROOTFS_INDEX[@]}"; do echo "${aHW_NAME[$i]}${aBENCH_ROOTFS_INDEX[$i]} ${aBENCH_RESULT_ROOTFS_WRITE_AVG[$i]}${aBENCH_RESULT_ROOTFS_WRITE_MAX[$i]}${aBENCH_RESULT_ROOTFS_WRITE_MIN[$i]}${aBENCH_RESULT_ROOTFS_READ_AVG[$i]}${aBENCH_RESULT_ROOTFS_READ_MAX[$i]}${aBENCH_RESULT_ROOTFS_READ_MIN[$i]}"; done | sort -nrk 2 -t ' ')

DietPi-Benchmarks | Custom FS I/O ¶

@@ -1084,7 +1090,7 @@ shopt -s extglob Fastest Slowest - $(for i in "${!aBENCH_CUSTOMFS_INDEX[@]}"; do echo "${aHW_NAME[$i]:=$i}${aBENCH_CUSTOMFS_INDEX[$i]} ${aBENCH_RESULT_CUSTOMFS_WRITE_AVG[$i]}${aBENCH_RESULT_CUSTOMFS_WRITE_MAX[$i]}${aBENCH_RESULT_CUSTOMFS_WRITE_MIN[$i]}${aBENCH_RESULT_CUSTOMFS_READ_AVG[$i]}${aBENCH_RESULT_CUSTOMFS_READ_MAX[$i]}${aBENCH_RESULT_CUSTOMFS_READ_MIN[$i]}"; done | sort -nrk 2 -t ' ') + $(for i in "${!aBENCH_CUSTOMFS_INDEX[@]}"; do echo "${aHW_NAME[$i]}${aBENCH_CUSTOMFS_INDEX[$i]} ${aBENCH_RESULT_CUSTOMFS_WRITE_AVG[$i]}${aBENCH_RESULT_CUSTOMFS_WRITE_MAX[$i]}${aBENCH_RESULT_CUSTOMFS_WRITE_MIN[$i]}${aBENCH_RESULT_CUSTOMFS_READ_AVG[$i]}${aBENCH_RESULT_CUSTOMFS_READ_MAX[$i]}${aBENCH_RESULT_CUSTOMFS_READ_MIN[$i]}"; done | sort -nrk 2 -t ' ')

DietPi-Benchmarks | LAN I/O ¶

@@ -1100,7 +1106,7 @@ shopt -s extglob Fastest Slowest - $(for i in "${!aBENCH_LAN_INDEX[@]}"; do echo "${aHW_NAME[$i]:=$i}${aBENCH_LAN_INDEX[$i]} ${aBENCH_RESULT_NET_LAN_SPEED_AVG[$i]}${aBENCH_RESULT_NET_LAN_SPEED_MAX[$i]}${aBENCH_RESULT_NET_LAN_SPEED_MIN[$i]}"; done | sort -nrk 2 -t ' ') + $(for i in "${!aBENCH_LAN_INDEX[@]}"; do echo "${aHW_NAME[$i]}${aBENCH_LAN_INDEX[$i]} ${aBENCH_RESULT_NET_LAN_SPEED_AVG[$i]}${aBENCH_RESULT_NET_LAN_SPEED_MAX[$i]}${aBENCH_RESULT_NET_LAN_SPEED_MIN[$i]}"; done | sort -nrk 2 -t ' ') From a7cc04f44116041bc94ba98df096d29326a70917 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Tue, 30 Mar 2021 00:46:54 +0200 Subject: [PATCH 053/147] v7.1 + DietPi-Survey_report | Sort out files that are older than 6 months from within this script --- .meta/dietpi-survey_report | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/.meta/dietpi-survey_report b/.meta/dietpi-survey_report index b69addeced..bbbabe8c78 100644 --- a/.meta/dietpi-survey_report +++ b/.meta/dietpi-survey_report @@ -142,7 +142,7 @@ shopt -s extglob #----------------------------------------------------------- # Globals - Survey #----------------------------------------------------------- - DATE= + DATE_NOW= SURVEY_COUNT_TOTAL=0 SURVEY_COUNT_OPTIN=0 SURVEY_COUNT_OPTOUT=0 @@ -556,6 +556,9 @@ shopt -s extglob # Values that must exist [[ $version && $device && $arch && $cpu_count && $distro && $autostart && ${aAUTOSTART_NAME[$autostart]} && $automated && $iface ]] || { mv -v "/home/dietpi-survey/survey/$file" /home/dietpi-survey/invalid/; return 1; } + # Sort out files that are > 6 months old + (( $DATE_NOW - $(date -u '+%s' -r "$file") < 15724800 )) || { mv "/home/dietpi-survey/survey/$file" /home/dietpi-survey/2020H2/; return 0; } + # Valid content ((SURVEY_COUNT_OPTIN++)) @@ -650,8 +653,8 @@ shopt -s extglob #mkdir -p /tmp/dietpi-survey_report #cp /home/dietpi-survey/survey/*.txt /tmp/dietpi-survey_report/ # cp: Argument list too long rm -Rf /tmp/dietpi-survey_report || exit 1 - DATE=$(date -u '+%Y-%m-%d %T UTC') # Store date of last possible upload - cp -R /home/dietpi-survey/survey /tmp/dietpi-survey_report || exit 1 + DATE_NOW=$(date -u '+%s') # Store date of last possible upload + cp -a /home/dietpi-survey/survey /tmp/dietpi-survey_report || exit 1 cd /tmp/dietpi-survey_report || exit 1 # Loop through files, including dot files, so that we can detect and sort out invalid file names @@ -662,7 +665,13 @@ shopt -s extglob [[ $file =~ ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\.txt$ && -f $file ]] || { mv -v "/home/dietpi-survey/survey/$file" /home/dietpi-survey/invalid/; continue; } # Optout files - [[ -s $file ]] || { ((SURVEY_COUNT_OPTOUT++)); continue; } + if [[ ! -s $file ]] + then + # Sort out files that are > 6 months old + (( $DATE_NOW - $(date -u '+%s' -r "$file") < 15724800 )) || { mv "/home/dietpi-survey/survey/$file" /home/dietpi-survey/2020H2/; continue; } + ((SURVEY_COUNT_OPTOUT++)) + continue + fi # Process file Process_File "$file" @@ -945,8 +954,8 @@ shopt -s extglob

DietPi-Survey statistics

-

Uploads since: 2020-07-01 00:00:00 UTC +0100

-

Last update: $DATE

+

Uploads since: $(date -u -d "@$(( $DATE_NOW - 15724800 ))" '+%Y-%m-%d %T %Z')

+

Last update: $(date -u -d "@$DATE_NOW" '+%Y-%m-%d %T %Z')


From bf7fcd46c527844978cc8390d2ce0a358f3bd7f6 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Wed, 31 Mar 2021 00:15:03 +0200 Subject: [PATCH 054/147] v7.1 + DietPi-Survey_report | Minor style and HTML enhancements, especially added an H1 tag --- .meta/dietpi-survey_report | 436 +++++++++++++++++++------------------ 1 file changed, 221 insertions(+), 215 deletions(-) diff --git a/.meta/dietpi-survey_report b/.meta/dietpi-survey_report index bbbabe8c78..88f6ce349f 100644 --- a/.meta/dietpi-survey_report +++ b/.meta/dietpi-survey_report @@ -162,196 +162,198 @@ shopt -s extglob aRASPBIAN=(0 0) # Convert autostart index to name array - aAUTOSTART_NAME=() - aAUTOSTART_NAME[0]='Console manual login' - aAUTOSTART_NAME[1]='Kodi' - aAUTOSTART_NAME[2]='Desktop auto login' - aAUTOSTART_NAME[3]='RetroPie' - aAUTOSTART_NAME[4]='OpenTyrian' - aAUTOSTART_NAME[5]='DietPi-Cloudshell' - aAUTOSTART_NAME[6]='Amiberry fast boot' - aAUTOSTART_NAME[7]='Console auto login' - aAUTOSTART_NAME[8]='Amiberry standard boot' - aAUTOSTART_NAME[9]='DXX-Rebirth' - aAUTOSTART_NAME[10]='CAVA Spectrum' - aAUTOSTART_NAME[11]='Chromium' - aAUTOSTART_NAME[14]='Custom' - aAUTOSTART_NAME[15]='JRiver' # shellcheck disable=SC2034 - aAUTOSTART_NAME[16]='Desktop LightDM login' + aAUTOSTART_NAME=( + [0]='Console manual login' + [1]='Kodi' + [2]='Desktop auto login' + [3]='RetroPie' + [4]='OpenTyrian' + [5]='DietPi-Cloudshell' + [6]='Amiberry fast boot' + [7]='Console auto login' + [8]='Amiberry standard boot' + [9]='DXX-Rebirth' + [10]='CAVA Spectrum' + [11]='Chromium' + [14]='Custom' + [15]='JRiver' + [16]='Desktop LightDM login' + ) # Convert software index to title array - aSOFTWARE_NAME=() - aSOFTWARE_NAME[0]='OpenSSH Client' - aSOFTWARE_NAME[1]='Samba Client' - aSOFTWARE_NAME[2]='Folding@Home' - aSOFTWARE_NAME[3]='MC' - aSOFTWARE_NAME[4]='ViFM' - aSOFTWARE_NAME[5]='ALSA' - aSOFTWARE_NAME[6]='X.Org X server' - aSOFTWARE_NAME[7]='FFmpeg' - aSOFTWARE_NAME[8]='Java' - aSOFTWARE_NAME[9]='Node.js' - aSOFTWARE_NAME[10]='iftop' - aSOFTWARE_NAME[11]='IPTraf' - aSOFTWARE_NAME[12]='Iperf' - aSOFTWARE_NAME[13]='MTR-Tiny' - aSOFTWARE_NAME[14]='nLoad' - aSOFTWARE_NAME[15]='tcpdump' - aSOFTWARE_NAME[16]='Build-Essentials' - aSOFTWARE_NAME[17]='Git Client' - aSOFTWARE_NAME[18]='Emacs' - aSOFTWARE_NAME[19]='Jed' - aSOFTWARE_NAME[20]='Vim' - aSOFTWARE_NAME[21]='Vim-Tiny' - aSOFTWARE_NAME[22]='QuiteRSS' - aSOFTWARE_NAME[23]='LXDE' - aSOFTWARE_NAME[24]='MATE' - aSOFTWARE_NAME[25]='Xfce' - aSOFTWARE_NAME[26]='GNUstep' - aSOFTWARE_NAME[27]='TightVNC Server' - aSOFTWARE_NAME[28]='TigerVNC Server' - aSOFTWARE_NAME[29]='XRDP' - aSOFTWARE_NAME[30]='NoMachine' - aSOFTWARE_NAME[31]='Kodi' - aSOFTWARE_NAME[32]='ympd' - aSOFTWARE_NAME[33]='Airsonic' - aSOFTWARE_NAME[34]='Subsonic' - aSOFTWARE_NAME[35]='Logitech Media Server' - aSOFTWARE_NAME[36]='Squeezelite' - aSOFTWARE_NAME[37]='Shairport Sync' - aSOFTWARE_NAME[38]='FreshRSS' - aSOFTWARE_NAME[39]='ReadyMedia' - aSOFTWARE_NAME[40]='Ampache' - aSOFTWARE_NAME[41]='Emby Server' - aSOFTWARE_NAME[42]='Plex Media Server' - aSOFTWARE_NAME[43]='Murmur' - aSOFTWARE_NAME[44]='Transmission' - aSOFTWARE_NAME[45]='Deluge' - aSOFTWARE_NAME[46]='qBittorrent' - aSOFTWARE_NAME[47]='ownCloud' - aSOFTWARE_NAME[48]='Pydio' - aSOFTWARE_NAME[49]='Gogs' - aSOFTWARE_NAME[50]='Syncthing' - aSOFTWARE_NAME[51]='OpenTyrian' - aSOFTWARE_NAME[52]='Cuberite' - aSOFTWARE_NAME[53]='MineOS' - aSOFTWARE_NAME[54]='phpBB' - aSOFTWARE_NAME[55]='Wordpress' - aSOFTWARE_NAME[56]='Single File PHP Gallery' - aSOFTWARE_NAME[57]='Baïkal' - aSOFTWARE_NAME[58]='OpenBazaar' - aSOFTWARE_NAME[59]='RPi Cam Control' - aSOFTWARE_NAME[60]='WiFi Hotspot' - aSOFTWARE_NAME[61]='Tor Hotspot' - aSOFTWARE_NAME[62]='DietPi-CloudShell' - aSOFTWARE_NAME[63]='LinuxDash' - aSOFTWARE_NAME[64]='phpSysInfo' - aSOFTWARE_NAME[65]='Netdata' - aSOFTWARE_NAME[66]='RPi-Monitor' - aSOFTWARE_NAME[67]='No-IP' - aSOFTWARE_NAME[68]='Remot3.it' - aSOFTWARE_NAME[69]='RPi.GPIO' - aSOFTWARE_NAME[70]='WiringPi' - aSOFTWARE_NAME[71]='WebIOPi' - aSOFTWARE_NAME[72]='I2C' - aSOFTWARE_NAME[73]='Fail2Ban' - aSOFTWARE_NAME[74]='InfluxDB' - aSOFTWARE_NAME[75]='LASP' - aSOFTWARE_NAME[76]='LAMP' - aSOFTWARE_NAME[77]='Grafana' - aSOFTWARE_NAME[78]='LESP' - aSOFTWARE_NAME[79]='LEMP' - aSOFTWARE_NAME[80]='Ubooquity' - aSOFTWARE_NAME[81]='LLSP' - aSOFTWARE_NAME[82]='LLMP' - aSOFTWARE_NAME[83]='Apache2' - aSOFTWARE_NAME[84]='Lighttpd' - aSOFTWARE_NAME[85]='Nginx' - aSOFTWARE_NAME[86]='Roon Extension Manager' - aSOFTWARE_NAME[87]='SQLite' - aSOFTWARE_NAME[88]='MariaDB' - aSOFTWARE_NAME[89]='PHP' - aSOFTWARE_NAME[90]='phpMyAdmin' - aSOFTWARE_NAME[91]='Redis' - aSOFTWARE_NAME[92]='Certbot' - aSOFTWARE_NAME[93]='Pi-hole' - aSOFTWARE_NAME[94]='ProFTPD' - aSOFTWARE_NAME[95]='vsftpd' - aSOFTWARE_NAME[96]='Samba Server' - aSOFTWARE_NAME[97]='OpenVPN' - aSOFTWARE_NAME[98]='HAProxy' - aSOFTWARE_NAME[99]='EmonPi' - aSOFTWARE_NAME[100]='PiJuice' - aSOFTWARE_NAME[101]='Logrotate' - aSOFTWARE_NAME[102]='Rsyslog' - aSOFTWARE_NAME[103]='DietPi-RAMlog' - aSOFTWARE_NAME[104]='Dropbear' - aSOFTWARE_NAME[105]='OpenSSH Server' - aSOFTWARE_NAME[106]='Lidarr' - aSOFTWARE_NAME[107]='rTorrent' - aSOFTWARE_NAME[108]='Amiberry' - aSOFTWARE_NAME[109]='NFS Server' - aSOFTWARE_NAME[110]='NFS Client' - aSOFTWARE_NAME[111]='UrBackup Server' - aSOFTWARE_NAME[112]='DXX-Rebirth' - aSOFTWARE_NAME[113]='Chromium' - aSOFTWARE_NAME[114]='Nextcloud' - aSOFTWARE_NAME[115]='Webmin' - aSOFTWARE_NAME[116]='SickRage' - aSOFTWARE_NAME[117]='PiVPN' - aSOFTWARE_NAME[118]='Mopidy' - aSOFTWARE_NAME[119]='CAVA' - aSOFTWARE_NAME[120]='RealVNC Server' - aSOFTWARE_NAME[121]='Roon Bridge' - aSOFTWARE_NAME[122]='Node-RED' - aSOFTWARE_NAME[123]='Mosquitto ' - aSOFTWARE_NAME[124]='NAA daemon' - aSOFTWARE_NAME[125]='Tomcat8' - aSOFTWARE_NAME[126]='LibSSL1.0.0' - aSOFTWARE_NAME[127]='NeoVim' - aSOFTWARE_NAME[128]='MPD' - aSOFTWARE_NAME[129]='O!MPD' - aSOFTWARE_NAME[130]='Python Pip' - aSOFTWARE_NAME[131]='Blynk Server' - aSOFTWARE_NAME[132]='Aria2' - aSOFTWARE_NAME[133]='YaCy' - aSOFTWARE_NAME[134]='Tonido' - aSOFTWARE_NAME[135]='IceCast' - aSOFTWARE_NAME[136]='MotionEye' - aSOFTWARE_NAME[137]='CloudPrint' - aSOFTWARE_NAME[138]='VirtualHere' - aSOFTWARE_NAME[139]='SABnzbd' - aSOFTWARE_NAME[140]='SDL2' - aSOFTWARE_NAME[141]='Spotify Connect Web' - aSOFTWARE_NAME[142]='CouchPotato' - aSOFTWARE_NAME[143]='Koel' - aSOFTWARE_NAME[144]='Sonarr' - aSOFTWARE_NAME[145]='Radarr' - aSOFTWARE_NAME[146]='Tautulli' - aSOFTWARE_NAME[147]='Jackett' - #aSOFTWARE_NAME[148]= - aSOFTWARE_NAME[149]='NZBGet' - aSOFTWARE_NAME[150]='Mono' - aSOFTWARE_NAME[151]='Nvidia' - aSOFTWARE_NAME[152]='Avahi-Daemon' - aSOFTWARE_NAME[153]='OctoPrint' - aSOFTWARE_NAME[154]='Roon Server' - aSOFTWARE_NAME[155]='HTPC Manager' - aSOFTWARE_NAME[156]='Steam' - aSOFTWARE_NAME[157]='Home Assistant' - aSOFTWARE_NAME[158]='MinIO' - aSOFTWARE_NAME[159]='Allo' - aSOFTWARE_NAME[160]='Allo_update' - aSOFTWARE_NAME[161]='FuguHub' - aSOFTWARE_NAME[162]='Docker' - aSOFTWARE_NAME[163]='GMediaRender' - aSOFTWARE_NAME[164]='Nukkit' - aSOFTWARE_NAME[165]='Gitea' - aSOFTWARE_NAME[166]='PI-SPC' - aSOFTWARE_NAME[167]='Raspotify' - #aSOFTWARE_NAME[168]= - aSOFTWARE_NAME[169]='Google AIY' + aSOFTWARE_NAME=( + [0]='OpenSSH Client' + [1]='Samba Client' + [2]='Folding@Home' + [3]='MC' + [4]='ViFM' + [5]='ALSA' + [6]='X.Org X server' + [7]='FFmpeg' + [8]='Java' + [9]='Node.js' + [10]='iftop' + [11]='IPTraf' + [12]='Iperf' + [13]='MTR-Tiny' + [14]='nLoad' + [15]='tcpdump' + [16]='Build-Essentials' + [17]='Git Client' + [18]='Emacs' + [19]='Jed' + [20]='Vim' + [21]='Vim-Tiny' + [22]='QuiteRSS' + [23]='LXDE' + [24]='MATE' + [25]='Xfce' + [26]='GNUstep' + [27]='TightVNC Server' + [28]='TigerVNC Server' + [29]='XRDP' + [30]='NoMachine' + [31]='Kodi' + [32]='ympd' + [33]='Airsonic' + [34]='Subsonic' + [35]='Logitech Media Server' + [36]='Squeezelite' + [37]='Shairport Sync' + [38]='FreshRSS' + [39]='ReadyMedia' + [40]='Ampache' + [41]='Emby Server' + [42]='Plex Media Server' + [43]='Murmur' + [44]='Transmission' + [45]='Deluge' + [46]='qBittorrent' + [47]='ownCloud' + [48]='Pydio' + [49]='Gogs' + [50]='Syncthing' + [51]='OpenTyrian' + [52]='Cuberite' + [53]='MineOS' + [54]='phpBB' + [55]='Wordpress' + [56]='Single File PHP Gallery' + [57]='Baïkal' + [58]='OpenBazaar' + [59]='RPi Cam Control' + [60]='WiFi Hotspot' + [61]='Tor Hotspot' + [62]='DietPi-CloudShell' + [63]='LinuxDash' + [64]='phpSysInfo' + [65]='Netdata' + [66]='RPi-Monitor' + [67]='No-IP' + [68]='Remot3.it' + [69]='RPi.GPIO' + [70]='WiringPi' + [71]='WebIOPi' + [72]='I2C' + [73]='Fail2Ban' + [74]='InfluxDB' + [75]='LASP' + [76]='LAMP' + [77]='Grafana' + [78]='LESP' + [79]='LEMP' + [80]='Ubooquity' + [81]='LLSP' + [82]='LLMP' + [83]='Apache2' + [84]='Lighttpd' + [85]='Nginx' + [86]='Roon Extension Manager' + [87]='SQLite' + [88]='MariaDB' + [89]='PHP' + [90]='phpMyAdmin' + [91]='Redis' + [92]='Certbot' + [93]='Pi-hole' + [94]='ProFTPD' + [95]='vsftpd' + [96]='Samba Server' + [97]='OpenVPN' + [98]='HAProxy' + [99]='EmonPi' + [100]='PiJuice' + [101]='Logrotate' + [102]='Rsyslog' + [103]='DietPi-RAMlog' + [104]='Dropbear' + [105]='OpenSSH Server' + [106]='Lidarr' + [107]='rTorrent' + [108]='Amiberry' + [109]='NFS Server' + [110]='NFS Client' + [111]='UrBackup Server' + [112]='DXX-Rebirth' + [113]='Chromium' + [114]='Nextcloud' + [115]='Webmin' + [116]='SickRage' + [117]='PiVPN' + [118]='Mopidy' + [119]='CAVA' + [120]='RealVNC Server' + [121]='Roon Bridge' + [122]='Node-RED' + [123]='Mosquitto ' + [124]='NAA daemon' + [125]='Tomcat8' + [126]='LibSSL1.0.0' + [127]='NeoVim' + [128]='MPD' + [129]='O!MPD' + [130]='Python Pip' + [131]='Blynk Server' + [132]='Aria2' + [133]='YaCy' + [134]='Tonido' + [135]='IceCast' + [136]='MotionEye' + [137]='CloudPrint' + [138]='VirtualHere' + [139]='SABnzbd' + [140]='SDL2' + [141]='Spotify Connect Web' + [142]='CouchPotato' + [143]='Koel' + [144]='Sonarr' + [145]='Radarr' + [146]='Tautulli' + [147]='Jackett' + #[148]= + [149]='NZBGet' + [150]='Mono' + [151]='Nvidia' + [152]='Avahi-Daemon' + [153]='OctoPrint' + [154]='Roon Server' + [155]='HTPC Manager' + [156]='Steam' + [157]='Home Assistant' + [158]='MinIO' + [159]='Allo' + [160]='Allo_update' + [161]='FuguHub' + [162]='Docker' + [163]='GMediaRender' + [164]='Nukkit' + [165]='Gitea' + [166]='PI-SPC' + [167]='Raspotify' + #[168]= + [169]='Google AIY' + ) # v6.14 (earliest version that can currently upload) + v6.15 aSOFTWARE_NAME6_14=() @@ -894,15 +896,13 @@ shopt -s extglob background-color: #181a1c; font-family: Arial, sans-serif; } - table { display: block; overflow-x: auto; } - td { border: 1px solid grey; padding: 5px; } - a { color: #ffffff; text-decoration: none; } - a:hover, a:focus, a:active { color: #c5ff00; } + a { + color: #ffffff; + text-decoration: none; + } nav a { - text-transform: uppercase; - font-size: 15px; line-height: 40px; - padding: 10px 14px; + padding: 10px 10px; border: 1px solid #181a1c; border-radius: 5px; transition: border-color 1s; @@ -910,7 +910,6 @@ shopt -s extglob nav a:hover, nav a:focus, nav a:active { - color: #ffffff; border-color: #c5ff00; } :target:before { @@ -919,6 +918,11 @@ shopt -s extglob height: 60px; margin-top: -60px; } + h1 { font-size: 24px; padding-top: 60px; } + h2 { text-size: 19px; } + h2 a:hover, h2 a:focus, h2 a:active { color: #c5ff00; } + table { display: block; overflow-x: auto; } + td { border: 1px solid grey; padding: 5px; } a.scrollup { position: fixed; bottom: 15px; @@ -945,15 +949,15 @@ shopt -s extglob -
Total system count$SURVEY_COUNT_TOTAL
Systems opted out DietPi-Survey$SURVEY_COUNT_OPTOUT$(( $SURVEY_COUNT_OPTOUT * 100 / $SURVEY_COUNT_TOTAL ))%
-

DietPi versions ¶

+

DietPi versions ¶

- $(for i in "${!aDIETPI_VERSION[@]}"; do echo ""; done | sort -nrk 1.17,1.20 -t ' ') + $(for i in "${!aDIETPI_VERSION[@]}"; do echo ""; done | sort -nr)
DietPi v$i ${aDIETPI_VERSION[$i]}$(( ${aDIETPI_VERSION[$i]} * 100 / $SURVEY_COUNT_OPTIN ))%
DietPi v$i${aDIETPI_VERSION[$i]}$(( ${aDIETPI_VERSION[$i]} * 100 / $SURVEY_COUNT_OPTIN ))%
-

Git branches ¶

+

Git branches ¶

$(for i in "${!aGIT_BRANCH[@]}"; do echo ""; done | sort -nrk 2 -t ' ')
$i ${aGIT_BRANCH[$i]}$(( ${aGIT_BRANCH[$i]} * 100 / $SURVEY_COUNT_OPTIN ))%
-

Devices ¶

+

Devices ¶

$(for i in "${!aDEVICE_NAME[@]}"; do echo ""; done | sort -nrk 2 -t ' ')
$i ${aDEVICE_NAME[$i]}$(( ${aDEVICE_NAME[$i]} * 100 / $SURVEY_COUNT_OPTIN ))%
-

CPU architectures ¶

+

CPU architectures ¶

$(for i in "${!aCPU_ARCH[@]}"; do echo ""; done | sort -nrk 2 -t ' ')
$i ${aCPU_ARCH[$i]}$(( ${aCPU_ARCH[$i]} * 100 / $SURVEY_COUNT_OPTIN ))%
-

CPU core counts ¶

+

CPU core counts ¶

$(for i in "${!aCPU_COUNT[@]}"; do echo ""; done | sort -nrk 2 -t ' ')
$i Core(s) ${aCPU_COUNT[$i]}$(( ${aCPU_COUNT[$i]} * 100 / $SURVEY_COUNT_OPTIN ))%
-

Distro versions ¶

+

Distro versions ¶

$(for i in "${!aDISTRO_VERSION[@]}"; do echo ""; done | sort -nrk 2 -t ' ')
$i ${aDISTRO_VERSION[$i]}$(( ${aDISTRO_VERSION[$i]} * 100 / $SURVEY_COUNT_OPTIN ))%
-

RPi Debian 64-bit vs Raspbian 32-bit ¶

+

RPi Debian 64-bit vs Raspbian 32-bit ¶

Debian (64-bit) is used by${aRASPBIAN[0]} of $(( ${aRASPBIAN[0]} + ${aRASPBIAN[1]} )) RPi systems$(( ${aRASPBIAN[0]} * 100 / ( ${aRASPBIAN[0]} + ${aRASPBIAN[1]} ) ))%
-

Autostart options ¶

+

Autostart options ¶

$(for i in "${!aAUTOSTART_OPTION[@]}"; do echo ""; done | sort -nrk 2 -t ' ')
$i ${aAUTOSTART_OPTION[$i]}$(( ${aAUTOSTART_OPTION[$i]} * 100 / $SURVEY_COUNT_OPTIN ))%
-

DietPi-Automation ¶

+

DietPi-Automation ¶

Used by${aAUTO_SETUP_AUTOMATED[1]} of $SURVEY_COUNT_OPTIN systems$(( ${aAUTO_SETUP_AUTOMATED[1]} * 100 / $SURVEY_COUNT_OPTIN ))%
-

Network interfaces ¶

+

Network interfaces ¶

$(for i in "${!aNETWORK_INTERFACE[@]}"; do echo ""; done | sort -nrk 2 -t ' ')
$i ${aNETWORK_INTERFACE[$i]}$(( ${aNETWORK_INTERFACE[$i]} * 100 / $SURVEY_COUNT_OPTIN ))%
-

Installed software titles ¶

+

Installed software titles ¶

$(for i in "${!aSOFTWARE[@]}"; do echo ""; done | sort -nrk 2 -t ' ')
$i ${aSOFTWARE[$i]}$(( ${aSOFTWARE[$i]} * 100 / $SURVEY_COUNT_OPTIN ))%
-

DietPi-Benchmarks | CPU ¶

+

DietPi-Benchmarks | CPU ¶

"; done | sort -nk 2 -t ' ')
@@ -1042,7 +1046,7 @@ shopt -s extglob $(for i in "${!aBENCH_CPU_INDEX[@]}"; do echo "
${aHW_NAME[$i]}${aBENCH_CPU_INDEX[$i]} ${aBENCH_RESULT_CPU_AVG[$i]}${aBENCH_RESULT_CPU_MIN[$i]}${aBENCH_RESULT_CPU_MAX[$i]}${aBENCH_RESULT_CPU_TEMP_START_AVG[$i]}${aBENCH_RESULT_CPU_TEMP_START_MIN[$i]}${aBENCH_RESULT_CPU_TEMP_START_MAX[$i]}${aBENCH_RESULT_CPU_TEMP_END_AVG[$i]}${aBENCH_RESULT_CPU_TEMP_END_MIN[$i]}${aBENCH_RESULT_CPU_TEMP_END_MAX[$i]}
-

DietPi-Benchmarks | RAM I/O ¶

+

DietPi-Benchmarks | RAM I/O ¶

"; done | sort -nrk 2 -t ' ')
@@ -1062,7 +1066,7 @@ shopt -s extglob $(for i in "${!aBENCH_RAM_INDEX[@]}"; do echo "
${aHW_NAME[$i]}${aBENCH_RAM_INDEX[$i]} ${aBENCH_RESULT_RAM_WRITE_AVG[$i]}${aBENCH_RESULT_RAM_WRITE_MAX[$i]}${aBENCH_RESULT_RAM_WRITE_MIN[$i]}${aBENCH_RESULT_RAM_READ_AVG[$i]}${aBENCH_RESULT_RAM_READ_MAX[$i]}${aBENCH_RESULT_RAM_READ_MIN[$i]}
-

DietPi-Benchmarks | RootFS I/O ¶

+

DietPi-Benchmarks | RootFS I/O ¶

"; done | sort -nrk 2 -t ' ')
@@ -1082,7 +1086,7 @@ shopt -s extglob $(for i in "${!aBENCH_ROOTFS_INDEX[@]}"; do echo "
${aHW_NAME[$i]}${aBENCH_ROOTFS_INDEX[$i]} ${aBENCH_RESULT_ROOTFS_WRITE_AVG[$i]}${aBENCH_RESULT_ROOTFS_WRITE_MAX[$i]}${aBENCH_RESULT_ROOTFS_WRITE_MIN[$i]}${aBENCH_RESULT_ROOTFS_READ_AVG[$i]}${aBENCH_RESULT_ROOTFS_READ_MAX[$i]}${aBENCH_RESULT_ROOTFS_READ_MIN[$i]}
-

DietPi-Benchmarks | Custom FS I/O ¶

+

DietPi-Benchmarks | Custom FS I/O ¶

"; done | sort -nrk 2 -t ' ')
@@ -1102,7 +1106,7 @@ shopt -s extglob $(for i in "${!aBENCH_CUSTOMFS_INDEX[@]}"; do echo "
${aHW_NAME[$i]}${aBENCH_CUSTOMFS_INDEX[$i]} ${aBENCH_RESULT_CUSTOMFS_WRITE_AVG[$i]}${aBENCH_RESULT_CUSTOMFS_WRITE_MAX[$i]}${aBENCH_RESULT_CUSTOMFS_WRITE_MIN[$i]}${aBENCH_RESULT_CUSTOMFS_READ_AVG[$i]}${aBENCH_RESULT_CUSTOMFS_READ_MAX[$i]}${aBENCH_RESULT_CUSTOMFS_READ_MIN[$i]}
-

DietPi-Benchmarks | LAN I/O ¶

+

DietPi-Benchmarks | LAN I/O ¶

$(for i in "${!aBENCH_LAN_INDEX[@]}"; do echo ""; done | sort -nrk 2 -t ' ')
@@ -1117,6 +1121,8 @@ shopt -s extglob
${aHW_NAME[$i]}${aBENCH_LAN_INDEX[$i]} ${aBENCH_RESULT_NET_LAN_SPEED_AVG[$i]}${aBENCH_RESULT_NET_LAN_SPEED_MAX[$i]}${aBENCH_RESULT_NET_LAN_SPEED_MIN[$i]}
+ + _EOF_ From 34e1ca97510ddd09fa185072c38f80ca7bc73abf Mon Sep 17 00:00:00 2001 From: MichaIng Date: Wed, 31 Mar 2021 00:19:14 +0200 Subject: [PATCH 055/147] v7.1 + DietPi-Survey_report | Tiny --- .meta/dietpi-survey_report | 127 +++++++++++++++++++------------------ 1 file changed, 64 insertions(+), 63 deletions(-) diff --git a/.meta/dietpi-survey_report b/.meta/dietpi-survey_report index 88f6ce349f..29dd6eb332 100644 --- a/.meta/dietpi-survey_report +++ b/.meta/dietpi-survey_report @@ -11,69 +11,70 @@ shopt -s extglob #----------------------------------------------------------- # NB: PLEASE ENSURE HW_MODEL INDEX ENTRIES MATCH : PREP, dietpi-obtain_hw_model, dietpi-survey_results, # NBB: DO NOT REORDER INDEX's. These are now fixed and will never change (due to survey results etc) - aHW_NAME=() - aHW_NAME[0]='Raspberry Pi 1 256M' - aHW_NAME[1]='Raspberry Pi 1/Zero 512M' - aHW_NAME[2]='Raspberry Pi 2' - aHW_NAME[3]='Raspberry Pi 3/3+' - aHW_NAME[4]='Raspberry Pi 4' - aHW_NAME[10]='Odroid C1' - aHW_NAME[11]='Odroid XU3/XU4/MC1/HC1/HC2' - aHW_NAME[12]='Odroid C2' - aHW_NAME[13]='Odroid U3' - aHW_NAME[14]='Odroid N1' - aHW_NAME[15]='Odroid N2' - aHW_NAME[16]='Odroid C4/HC4' - aHW_NAME[20]='x86_64 VM' - aHW_NAME[21]='x86_64 PC' - aHW_NAME[22]='Generic Device' - aHW_NAME[29]='Generic Amlogic S922X' - aHW_NAME[28]='Generic Amlogic S905' - aHW_NAME[27]='Generic Allwinner H6' - aHW_NAME[26]='Generic Allwinner H5' - aHW_NAME[25]='Generic Allwinner H3' - aHW_NAME[24]='Generic Rockchip RK3399' - aHW_NAME[23]='Generic Rockchip RK3328' - aHW_NAME[30]='OrangePi PC' - aHW_NAME[31]='OrangePi One' - aHW_NAME[32]='OrangePi Zero (H2+)' - aHW_NAME[33]='OrangePi Lite' - aHW_NAME[34]='OrangePi Plus' - aHW_NAME[35]='OrangePi Zero Plus 2 (H3/H5)' - aHW_NAME[36]='OrangePi Win' - aHW_NAME[37]='OrangePi Prime' - aHW_NAME[38]='OrangePi PC 2' - aHW_NAME[39]='LeMaker Guitar' - aHW_NAME[40]='PINE A64' - aHW_NAME[41]='OrangePi PC Plus' - aHW_NAME[42]='ROCKPro64' - aHW_NAME[43]='ROCK64' - aHW_NAME[44]='Pinebook' - aHW_NAME[45]='PINE H64' - aHW_NAME[50]='BananaPi M2+ (sinovoip)' - aHW_NAME[51]='BananaPi Pro (Lemaker)' - aHW_NAME[52]='ASUS Tinker Board' - aHW_NAME[53]='BananaPi (sinovoip)' - aHW_NAME[54]='NanoPi K2' - aHW_NAME[55]='NanoPi R2S' - aHW_NAME[56]='NanoPi NEO3' - aHW_NAME[57]='NanoPi NEO Plus2' - aHW_NAME[58]='NanoPi M4V2' - aHW_NAME[59]='ZeroPi' - aHW_NAME[60]='NanoPi NEO' - aHW_NAME[61]='NanoPi M2/T2' - aHW_NAME[62]='NanoPi M3/T3/Fire3' - aHW_NAME[63]='NanoPi M1/T1' - aHW_NAME[64]='NanoPi NEO Air' - aHW_NAME[65]='NanoPi NEO2' - aHW_NAME[66]='NanoPi M1 Plus' - aHW_NAME[67]='NanoPi K1 Plus' - aHW_NAME[68]='NanoPi M4/T4/NEO4' - aHW_NAME[69]='Firefly RK3399' - aHW_NAME[70]='Sparky SBC' - aHW_NAME[71]='BeagleBone Black' - aHW_NAME[72]='ROCK Pi 4' - aHW_NAME[73]='ROCK Pi S' + aHW_NAME=( + [0]='Raspberry Pi 1 256M' + [1]='Raspberry Pi 1/Zero 512M' + [2]='Raspberry Pi 2' + [3]='Raspberry Pi 3/3+' + [4]='Raspberry Pi 4' + [10]='Odroid C1' + [11]='Odroid XU3/XU4/MC1/HC1/HC2' + [12]='Odroid C2' + [13]='Odroid U3' + [14]='Odroid N1' + [15]='Odroid N2' + [16]='Odroid C4/HC4' + [20]='x86_64 VM' + [21]='x86_64 PC' + [22]='Generic Device' + [29]='Generic Amlogic S922X' + [28]='Generic Amlogic S905' + [27]='Generic Allwinner H6' + [26]='Generic Allwinner H5' + [25]='Generic Allwinner H3' + [24]='Generic Rockchip RK3399' + [23]='Generic Rockchip RK3328' + [30]='OrangePi PC' + [31]='OrangePi One' + [32]='OrangePi Zero (H2+)' + [33]='OrangePi Lite' + [34]='OrangePi Plus' + [35]='OrangePi Zero Plus 2 (H3/H5)' + [36]='OrangePi Win' + [37]='OrangePi Prime' + [38]='OrangePi PC 2' + [39]='LeMaker Guitar' + [40]='PINE A64' + [41]='OrangePi PC Plus' + [42]='ROCKPro64' + [43]='ROCK64' + [44]='Pinebook' + [45]='PINE H64' + [50]='BananaPi M2+ (sinovoip)' + [51]='BananaPi Pro (Lemaker)' + [52]='ASUS Tinker Board' + [53]='BananaPi (sinovoip)' + [54]='NanoPi K2' + [55]='NanoPi R2S' + [56]='NanoPi NEO3' + [57]='NanoPi NEO Plus2' + [58]='NanoPi M4V2' + [59]='ZeroPi' + [60]='NanoPi NEO' + [61]='NanoPi M2/T2' + [62]='NanoPi M3/T3/Fire3' + [63]='NanoPi M1/T1' + [64]='NanoPi NEO Air' + [65]='NanoPi NEO2' + [66]='NanoPi M1 Plus' + [67]='NanoPi K1 Plus' + [68]='NanoPi M4/T4/NEO4' + [69]='Firefly RK3399' + [70]='Sparky SBC' + [71]='BeagleBone Black' + [72]='ROCK Pi 4' + [73]='ROCK Pi S' + ) # Core Benchmarks aBENCH_CPU_INDEX=() From a5ef6bb072c0f44211e1f82d893cf2213c313967 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Wed, 31 Mar 2021 16:10:11 +0200 Subject: [PATCH 056/147] v7.1 + DietPi-Software | Gitea: Update fallback URL --- dietpi/dietpi-software | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index f650f65bf9..a8dd96e7c0 100644 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -6305,7 +6305,7 @@ If you want to update ${aSOFTWARE_NAME[$software_id]}, please use its internal u fi - local fallback_url="https://github.com/go-gitea/gitea/releases/download/v1.13.2/gitea-1.13.2-linux-$arch" + local fallback_url="https://github.com/go-gitea/gitea/releases/download/v1.13.6/gitea-1.13.6-linux-$arch" Download_Install "$(curl -sSfL 'https://api.github.com/repos/go-gitea/gitea/releases/latest' | grep "\"browser_download_url\": .*/gitea-[^\"/]*-linux-$arch\"" | cut -d \" -f 4)" /mnt/dietpi_userdata/gitea/gitea fi From 4c0173aabefca4fab05b9b05c2899f80a0e9c464 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Wed, 31 Mar 2021 16:33:42 +0200 Subject: [PATCH 057/147] v7.1 + DietPi-PREP | Restoring default base files before creating the "dietpi" user. Else its home directory is missing: https://github.com/MichaIng/DietPi/issues/4231 + DietPi-PREP | Remove Stretch target image specific checks and steps, since we only support it as pre-image but not as target image anymore --- PREP_SYSTEM_FOR_DIETPI.sh | 47 +++++++++++++++------------------------ 1 file changed, 18 insertions(+), 29 deletions(-) diff --git a/PREP_SYSTEM_FOR_DIETPI.sh b/PREP_SYSTEM_FOR_DIETPI.sh index 7c97412a0f..4ac8abd2d1 100644 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -23,7 +23,7 @@ # - PREIMAGE_INFO='Some GNU/Linux' # - HW_MODEL=0 (must match one of the supported IDs below) # - WIFI_REQUIRED=0 [01] - # - DISTRO_TARGET=5 [456] (Stretch: 4, Buster: 5, Bullseye: 6) + # - DISTRO_TARGET=5 [456] (Buster: 5, Bullseye: 6) #------------------------------------------------------------------------------------------------ # Core globals @@ -611,6 +611,7 @@ Currently installed: $G_DISTRO_NAME (ID: $G_DISTRO)"; then 'dirmngr' # GNU key management required for some APT installs via additional repos 'ethtool' # Force Ethernet link speed 'fake-hwclock' # Hardware clock emulation, to allow correct timestamps during boot before network time sync + 'fdisk' # Partitioning tool used by DietPi-FS_partition_resize and DietPi-Imager 'gnupg' # apt-key add / gpg 'htop' # System monitor 'ifupdown' # Network interface configuration @@ -648,6 +649,7 @@ Currently installed: $G_DISTRO_NAME (ID: $G_DISTRO)"; then else aPACKAGES_REQUIRED_INSTALL+=('dropbear-run') + # On Stretch pre-images we need to assure that apt-transport-https stays installed until the distro upgrade is done. (( $G_DISTRO < 5 )) && aPACKAGES_REQUIRED_INSTALL+=('apt-transport-https') fi @@ -656,10 +658,6 @@ Currently installed: $G_DISTRO_NAME (ID: $G_DISTRO)"; then # While the above needs to be checked against "current" distro to not break SSH or APT before distro upgrade, this one should be checked against "target" distro version. (( $DISTRO_TARGET > 5 )) && aPACKAGES_REQUIRED_INSTALL+=('systemd-timesyncd') - # - fdisk: Partitioning tool used by DietPi-FS_partition_resize and DietPi-Imager - # This has become an own package since Debian Buster: https://packages.debian.org/fdisk - (( $DISTRO_TARGET > 4 )) && aPACKAGES_REQUIRED_INSTALL+=('fdisk') - # G_HW_MODEL specific # - initramfs: Required for generic bootloader, but not required/used by RPi bootloader, on VM install tiny-initramfs with limited features but sufficient and much smaller + faster if (( $G_HW_MODEL == 20 )); then @@ -723,12 +721,10 @@ Currently installed: $G_DISTRO_NAME (ID: $G_DISTRO)"; then local apackages=('linux-image-amd64' 'os-prober') - # Grub EFI + # Grub EFI with secure boot compatibility if dpkg-query -s 'grub-efi-amd64' &> /dev/null || [[ -d '/boot/efi' ]]; then - apackages+=('grub-efi-amd64') - # On Buster+ enable secure boot compatibility: https://packages.debian.org/grub-efi-amd64-signed - (( $DISTRO_TARGET > 4 )) && apackages+=('grub-efi-amd64-signed' 'shim-signed') + apackages+=('grub-efi-amd64' 'grub-efi-amd64-signed' 'shim-signed') # Grub BIOS else @@ -1106,7 +1102,14 @@ _EOF_ rm -fv /etc/systemd/system/*getty@*.service.d/*autologin*.conf # - make_nas_processes_faster cron job on ROCK64 + NanoPi + PINE A64(?) images - [[ -f '/etc/cron.d/make_nas_processes_faster' ]] && rm /etc/cron.d/make_nas_processes_faster + [[ -f '/etc/cron.d/make_nas_processes_faster' ]] && rm -v /etc/cron.d/make_nas_processes_faster + + #----------------------------------------------------------------------------------- + G_DIETPI-NOTIFY 2 'Restoring default base files:' + # shellcheck disable=SC2114 + rm -Rfv /etc/{motd,profile,update-motd.d,issue{,.net}} /root /home /media /var/mail + G_AGI -o 'Dpkg::Options::=--force-confmiss,confnew' --reinstall base-files # Restore /etc/{update-motd.d,issue{,.net}} /root /home + G_EXEC /var/lib/dpkg/info/base-files.postinst configure # Restore /root/.{profile,bashrc} /etc/{motd,profile} /media /var/mail #----------------------------------------------------------------------------------- # https://www.debian.org/doc/debian-policy/ch-opersys.html#site-specific-programs @@ -1201,8 +1204,8 @@ _EOF_' [[ -f '/etc/udev/rules.d/70-persistent-net.rules' ]] && rm -v /etc/udev/rules.d/70-persistent-net.rules # Jessie pre-image G_DIETPI-NOTIFY 2 'Configuring DNS nameserver:' - # Failsafe: Assure that /etc/resolv.conf is not a symlink and disable systemd-resolved - systemctl disable --now systemd-resolved + # Failsafe: Assure that /etc/resolv.conf is not a symlink and disable systemd-resolved + systemd-networkd + systemctl disable --now systemd-{resolve,network}d rm -fv /etc/resolv.conf echo 'nameserver 9.9.9.9' > /etc/resolv.conf # Apply generic functional DNS nameserver, updated on next service start @@ -1252,15 +1255,11 @@ _EOF_' if (( $G_DISTRO > 5 )) then G_DIETPI-NOTIFY 2 'Disabling e2scrub services which are for LVM and require lvm2/lvcreate being installed' - G_EXEC systemctl disable --now e2scrub_all.timer - G_EXEC systemctl disable --now e2scrub_reap + G_EXEC systemctl disable --now e2scrub_{all.timer,reap} fi - if (( $G_DISTRO > 4 )) - then - G_DIETPI-NOTIFY 2 'Enabling weekly TRIM' - G_EXEC systemctl enable fstrim.timer - fi + G_DIETPI-NOTIFY 2 'Enabling weekly TRIM' + G_EXEC systemctl enable fstrim.timer (( $G_HW_MODEL > 9 )) && echo "$G_HW_MODEL" > /etc/.dietpi_hw_model_identifier G_EXEC_DESC='Generating /boot/dietpi/.hw_model' G_EXEC /boot/dietpi/func/dietpi-obtain_hw_model @@ -1275,12 +1274,6 @@ _EOF_' echo -e "Samba client: $info_use_drive_manager" > /mnt/samba/readme.txt echo -e "NFS client: $info_use_drive_manager" > /mnt/nfs_client/readme.txt - G_DIETPI-NOTIFY 2 'Restoring default base files:' - # shellcheck disable=SC2114 - rm -Rfv /etc/{motd,profile,update-motd.d,issue{,.net}} /root /home /media /var/mail - G_AGI -o 'Dpkg::Options::=--force-confmiss,confnew' --reinstall base-files # Restore /etc/{update-motd.d,issue{,.net}} /root /home - G_EXEC /var/lib/dpkg/info/base-files.postinst configure # Restore /root/.{profile,bashrc} /etc/{motd,profile} /media /var/mail - G_DIETPI-NOTIFY 2 'Resetting and adding dietpi.com SSH pub host key for DietPi-Survey/Bugreport uploads:' G_EXEC mkdir -p /root/.ssh echo 'ssh.dietpi.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDE6aw3r6aOEqendNu376iiCHr9tGBIWPgfrLkzjXjEsHGyVSUFNnZt6pftrDeK7UX+qX4FxOwQlugG4fymOHbimRCFiv6cf7VpYg1Ednquq9TLb7/cIIbX8a6AuRmX4fjdGuqwmBq3OG7ZksFcYEFKt5U4mAJIaL8hXiM2iXjgY02LqiQY/QWATsHI4ie9ZOnwrQE+Rr6mASN1BVFuIgyHIbwX54jsFSnZ/7CdBMkuAd9B8JkxppWVYpYIFHE9oWNfjh/epdK8yv9Oo6r0w5Rb+4qaAc5g+RAaknHeV6Gp75d2lxBdCm5XknKKbGma2+/DfoE8WZTSgzXrYcRlStYN' > /root/.ssh/known_hosts @@ -1288,10 +1281,6 @@ _EOF_' # ASUS TB WiFi: https://github.com/MichaIng/DietPi/issues/1760 (( $G_HW_MODEL == 52 )) && G_CONFIG_INJECT '8723bs' '8723bs' /etc/modules - # Fix wireless-tools bug on Stretch: https://bugs.debian.org/908886 - # shellcheck disable=SC2016 - [[ -f '/etc/network/if-pre-up.d/wireless-tools' ]] && sed -i '\|^[[:blank:]]ifconfig "$IFACE" up$|c\\t/sbin/ip link set dev "$IFACE" up' /etc/network/if-pre-up.d/wireless-tools - G_DIETPI-NOTIFY 2 'Tweaking DHCP timeout:' # https://github.com/MichaIng/DietPi/issues/711 G_CONFIG_INJECT 'timeout[[:blank:]]' 'timeout 10;' /etc/dhcp/dhclient.conf G_CONFIG_INJECT 'retry[[:blank:]]' 'retry 4;' /etc/dhcp/dhclient.conf From 128579acad6950f9b781220d41226de9dea9a117 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Thu, 1 Apr 2021 13:34:29 +0200 Subject: [PATCH 058/147] v7.1 + DietPi-Survey_results | Cleanup benchmark handling: Since final DietPi v6.17, those are uploaded, and did not contain I/O values with decimal places since then, but only on earlier versions which were never uploaded, and v6.17 early dev. Allow zero values, which are rounded down from below 0.5 MiB correctly. Similarly CPU time has fixed two decimal places since early versions (time -p), hence check for that explicitly and skip the obsolete BENCH_RESULTS_CPU_SCALE variable. + DietPi-Survey_results | Remove obsolete rel="home" attribute and link. This was never really implemented, is not documented anywhere relevant and has no effect on SEO. --- .meta/dietpi-survey_report | 108 +++++++++++++++---------------------- 1 file changed, 44 insertions(+), 64 deletions(-) diff --git a/.meta/dietpi-survey_report b/.meta/dietpi-survey_report index 29dd6eb332..2b5fe906ab 100644 --- a/.meta/dietpi-survey_report +++ b/.meta/dietpi-survey_report @@ -76,66 +76,58 @@ shopt -s extglob [73]='ROCK Pi S' ) - # Core Benchmarks + ## Benchmark data arrays: aBENCH_XX[$HW_MODEL,${aBENCH_XX_INDEX[$HW_MODEL]}] + + # Core benchmarks + # - CPU time in x.xx seconds aBENCH_CPU_INDEX=() + declare -A aBENCH_CPU + # - CPU temp in integer °C + declare -A aBENCH_CPU_TEMP_START + declare -A aBENCH_CPU_TEMP_END + # - I/O in integer MiB/s aBENCH_RAM_INDEX=() + declare -A aBENCH_RAM_WRITE + declare -A aBENCH_RAM_READ aBENCH_ROOTFS_INDEX=() - # Optional benchmarks - aBENCH_LAN_INDEX=() - aBENCH_CUSTOMFS_INDEX=() - - # [$HW_MODEL,${aBENCH_XX_INDEX[$HW_MODEL]}] - declare -A aBENCH_CPU declare -A aBENCH_ROOTFS_WRITE declare -A aBENCH_ROOTFS_READ - declare -A aBENCH_RAM_WRITE - declare -A aBENCH_RAM_READ - declare -A aBENCH_CPU_TEMP_START - declare -A aBENCH_CPU_TEMP_END # Optional benchmarks + aBENCH_CUSTOMFS_INDEX=() declare -A aBENCH_CUSTOMFS_WRITE declare -A aBENCH_CUSTOMFS_READ + aBENCH_LAN_INDEX=() declare -A aBENCH_NET_LAN_SPEED - # Results - BENCH_RESULTS_CPU_SCALE=2 + # Benchmark result arrays: min, max, average aBENCH_RESULT_CPU_MIN=() aBENCH_RESULT_CPU_MAX=() aBENCH_RESULT_CPU_AVG=() - - aBENCH_RESULT_ROOTFS_WRITE_MIN=() - aBENCH_RESULT_ROOTFS_WRITE_MAX=() - aBENCH_RESULT_ROOTFS_WRITE_AVG=() - - aBENCH_RESULT_ROOTFS_READ_MIN=() - aBENCH_RESULT_ROOTFS_READ_MAX=() - aBENCH_RESULT_ROOTFS_READ_AVG=() - - aBENCH_RESULT_RAM_WRITE_MIN=() - aBENCH_RESULT_RAM_WRITE_MAX=() - aBENCH_RESULT_RAM_WRITE_AVG=() - - aBENCH_RESULT_RAM_READ_MIN=() - aBENCH_RESULT_RAM_READ_MAX=() - aBENCH_RESULT_RAM_READ_AVG=() - aBENCH_RESULT_CPU_TEMP_START_MIN=() aBENCH_RESULT_CPU_TEMP_START_MAX=() aBENCH_RESULT_CPU_TEMP_START_AVG=() - aBENCH_RESULT_CPU_TEMP_END_MIN=() aBENCH_RESULT_CPU_TEMP_END_MAX=() aBENCH_RESULT_CPU_TEMP_END_AVG=() - - aBENCH_RESULT_CUSTOMFS_WRITE_MIN=() - aBENCH_RESULT_CUSTOMFS_WRITE_MAX=() - aBENCH_RESULT_CUSTOMFS_WRITE_AVG=() - + aBENCH_RESULT_RAM_READ_MIN=() + aBENCH_RESULT_RAM_READ_MAX=() + aBENCH_RESULT_RAM_READ_AVG=() + aBENCH_RESULT_RAM_WRITE_MIN=() + aBENCH_RESULT_RAM_WRITE_MAX=() + aBENCH_RESULT_RAM_WRITE_AVG=() + aBENCH_RESULT_ROOTFS_READ_MIN=() + aBENCH_RESULT_ROOTFS_READ_MAX=() + aBENCH_RESULT_ROOTFS_READ_AVG=() + aBENCH_RESULT_ROOTFS_WRITE_MIN=() + aBENCH_RESULT_ROOTFS_WRITE_MAX=() + aBENCH_RESULT_ROOTFS_WRITE_AVG=() aBENCH_RESULT_CUSTOMFS_READ_MIN=() aBENCH_RESULT_CUSTOMFS_READ_MAX=() aBENCH_RESULT_CUSTOMFS_READ_AVG=() - + aBENCH_RESULT_CUSTOMFS_WRITE_MIN=() + aBENCH_RESULT_CUSTOMFS_WRITE_MAX=() + aBENCH_RESULT_CUSTOMFS_WRITE_AVG=() aBENCH_RESULT_NET_LAN_SPEED_MIN=() aBENCH_RESULT_NET_LAN_SPEED_MAX=() aBENCH_RESULT_NET_LAN_SPEED_AVG=() @@ -581,18 +573,18 @@ shopt -s extglob ((aSOFTWARE["$i"]++)) done - # Process benchmark results is present and hardware ID valid + # Process benchmark results if present and hardware ID valid [[ $BENCH_VERSION && $BENCH_HW_MODEL ]] || return 0 + [[ $BENCH_VERSION =~ ^[0-9]+$ ]] || { echo "Invalid DietPi-Benchmark version: $BENCH_VERSION"; return 1; } [[ ${aHW_NAME[$BENCH_HW_MODEL]} ]] || { echo "Invalid hardware ID: $BENCH_HW_MODEL"; return 1; } # CPU - # - BENCH_CPU: Remove decimal point, equals times 100 since CPU time is always in x.xx - BENCH_CPU=${BENCH_CPU/.} - if [[ $BENCH_CPU =~ ^[0-9]*[1-9][0-9]*$ && $BENCH_CPU_TEMP_START =~ ^[0-9]+$ && $BENCH_CPU_TEMP_END =~ ^[0-9]+$ ]]; then + if [[ $BENCH_CPU =~ ^[0-9]+\.[0-9]{2}$ && $BENCH_CPU_TEMP_START =~ ^[0-9]+$ && $BENCH_CPU_TEMP_END =~ ^[0-9]+$ ]]; then - aBENCH_CPU[$BENCH_HW_MODEL,${aBENCH_CPU_INDEX[$BENCH_HW_MODEL]:=0}]=$BENCH_CPU + # CPU time: Remove decimal point, equals times 100 since it's always in x.xx + aBENCH_CPU[$BENCH_HW_MODEL,${aBENCH_CPU_INDEX[$BENCH_HW_MODEL]:=0}]=${BENCH_CPU/.} - # Patch for 5 digit CPU temps: https://github.com/MichaIng/DietPi/issues/2715 + # CPU temps: Patch for millidegree: https://github.com/MichaIng/DietPi/issues/2715 (( $BENCH_CPU_TEMP_START > 200 )) && (( BENCH_CPU_TEMP_START /= 1000 )) (( $BENCH_CPU_TEMP_END > 200 )) && (( BENCH_CPU_TEMP_END /= 1000 )) @@ -603,10 +595,7 @@ shopt -s extglob fi # RootFS - # - Remove decimal places - BENCH_ROOTFS_WRITE=${BENCH_ROOTFS_WRITE%%.*} - BENCH_ROOTFS_READ=${BENCH_ROOTFS_READ%%.*} - if [[ $BENCH_ROOTFS_WRITE =~ ^[0-9]*[1-9][0-9]*$ && $BENCH_ROOTFS_READ =~ ^[0-9]*[1-9][0-9]*$ ]]; then + if [[ $BENCH_ROOTFS_WRITE =~ ^[0-9]+$ && $BENCH_ROOTFS_READ =~ ^[0-9]+$ ]]; then aBENCH_ROOTFS_WRITE[$BENCH_HW_MODEL,${aBENCH_ROOTFS_INDEX[$BENCH_HW_MODEL]:=0}]=$BENCH_ROOTFS_WRITE aBENCH_ROOTFS_READ[$BENCH_HW_MODEL,${aBENCH_ROOTFS_INDEX[$BENCH_HW_MODEL]}]=$BENCH_ROOTFS_READ @@ -615,11 +604,8 @@ shopt -s extglob fi # RAM - # - https://github.com/MichaIng/DietPi/issues/2715 | nullify this score and ignore it in min/max/avg processing. - # - Remove decimal places - BENCH_RAM_WRITE=${BENCH_RAM_WRITE%%.*} - BENCH_RAM_READ=${BENCH_RAM_READ%%.*} - if [[ $BENCH_VERSION =~ ^[0-9]+$ && $BENCH_RAM_WRITE =~ ^[0-9]*[1-9][0-9]*$ && $BENCH_RAM_READ =~ ^[0-9]*[1-9][0-9]*$ ]] && (( $BENCH_VERSION > 1 )); then + # - Skip results prior to DietPi-Benchmark v2 (DietPi v6.23): https://github.com/MichaIng/DietPi/issues/2715 + if (( $BENCH_VERSION > 1 )) && [[ $BENCH_RAM_WRITE =~ ^[0-9]+$ && $BENCH_RAM_READ =~ ^[0-9]+$ ]]; then aBENCH_RAM_WRITE[$BENCH_HW_MODEL,${aBENCH_RAM_INDEX[$BENCH_HW_MODEL]:=0}]=$BENCH_RAM_WRITE aBENCH_RAM_READ[$BENCH_HW_MODEL,${aBENCH_RAM_INDEX[$BENCH_HW_MODEL]}]=$BENCH_RAM_READ @@ -628,10 +614,7 @@ shopt -s extglob fi # Custom FS - # - Remove decimal places - BENCH_CUSTOMFS_WRITE=${BENCH_CUSTOMFS_WRITE%%.*} - BENCH_CUSTOMFS_READ=${BENCH_CUSTOMFS_READ%%.*} - if [[ $BENCH_CUSTOMFS_WRITE =~ ^[0-9]*[1-9][0-9]*$ && $BENCH_CUSTOMFS_READ =~ ^[0-9]*[1-9][0-9]*$ ]]; then + if [[ $BENCH_CUSTOMFS_WRITE =~ ^[0-9]+$ && $BENCH_CUSTOMFS_READ =~ ^[0-9]+$ ]]; then aBENCH_CUSTOMFS_WRITE[$BENCH_HW_MODEL,${aBENCH_CUSTOMFS_INDEX[$BENCH_HW_MODEL]:=0}]=$BENCH_CUSTOMFS_WRITE aBENCH_CUSTOMFS_READ[$BENCH_HW_MODEL,${aBENCH_CUSTOMFS_INDEX[$BENCH_HW_MODEL]}]=$BENCH_CUSTOMFS_READ @@ -640,9 +623,7 @@ shopt -s extglob fi # LAN - # - Remove decimal places - BENCH_NET_LAN_SPEED=${BENCH_NET_LAN_SPEED%%.*} - if [[ $BENCH_NET_LAN_SPEED =~ ^[0-9]*[1-9][0-9]*$ ]]; then + if [[ $BENCH_NET_LAN_SPEED =~ ^[0-9]+$ ]]; then aBENCH_NET_LAN_SPEED[$BENCH_HW_MODEL,${aBENCH_LAN_INDEX[$BENCH_HW_MODEL]:=0}]=$BENCH_NET_LAN_SPEED ((aBENCH_LAN_INDEX[$BENCH_HW_MODEL]++)) @@ -747,9 +728,9 @@ shopt -s extglob # Last item in current array. Work out averages (( $j == ${aBENCH_CPU_INDEX[$i]} - 1 )) || continue # - Devide CPU times by 100 and scale to revert decimal point removal - aBENCH_RESULT_CPU_MIN[$i]=$(printf "%.${BENCH_RESULTS_CPU_SCALE}f" "${aBENCH_RESULT_CPU_MIN[$i]}e-2") - aBENCH_RESULT_CPU_MAX[$i]=$(printf "%.${BENCH_RESULTS_CPU_SCALE}f" "${aBENCH_RESULT_CPU_MAX[$i]}e-2") - aBENCH_RESULT_CPU_AVG[$i]=$(printf "%.${BENCH_RESULTS_CPU_SCALE}f" "$((${aBENCH_RESULT_CPU_AVG[$i]}*10/${aBENCH_CPU_INDEX[$i]}+1))e-3") + aBENCH_RESULT_CPU_MIN[$i]=$(printf '%.2f' "${aBENCH_RESULT_CPU_MIN[$i]}e-2") + aBENCH_RESULT_CPU_MAX[$i]=$(printf '%.2f' "${aBENCH_RESULT_CPU_MAX[$i]}e-2") + aBENCH_RESULT_CPU_AVG[$i]=$(printf '%.2f' "$((${aBENCH_RESULT_CPU_AVG[$i]}*10/${aBENCH_CPU_INDEX[$i]}+1))e-3") aBENCH_RESULT_CPU_TEMP_START_AVG[$i]=$(( ${aBENCH_RESULT_CPU_TEMP_START_AVG[$i]} / ${aBENCH_CPU_INDEX[$i]} )) aBENCH_RESULT_CPU_TEMP_END_AVG[$i]=$(( ${aBENCH_RESULT_CPU_TEMP_END_AVG[$i]} / ${aBENCH_CPU_INDEX[$i]} )) done @@ -861,7 +842,6 @@ shopt -s extglob - DietPi-Survey statistics @@ -951,7 +931,7 @@ shopt -s extglob