From 448ed9f5847e0c048793946821cf0621460befb7 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sun, 3 Apr 2022 20:37:18 +0200 Subject: [PATCH 01/59] Init v8.4 --- .meta/dietpi-survey_report | 10 +++++++++- .update/patches | 5 +++++ .update/version | 4 ++-- CHANGELOG.txt | 15 +++++++++++++-- dietpi/func/dietpi-globals | 4 ++-- 5 files changed, 31 insertions(+), 7 deletions(-) diff --git a/.meta/dietpi-survey_report b/.meta/dietpi-survey_report index 0b380d9790..26187663d3 100755 --- a/.meta/dietpi-survey_report +++ b/.meta/dietpi-survey_report @@ -595,6 +595,7 @@ shopt -s extglob aSOFTWARE_NAME8_2[142]='MicroK8s' unset -v 'aSOFTWARE_NAME8_2[151]' # Nvidia + # v8.3 aSOFTWARE_NAME8_3=() for i in "${!aSOFTWARE_NAME8_2[@]}" do @@ -602,8 +603,15 @@ shopt -s extglob done aSOFTWARE_NAME8_3[34]='PHP Composer' + # v8.4 + aSOFTWARE_NAME8_4=() + for i in "${!aSOFTWARE_NAME8_3[@]}" + do + aSOFTWARE_NAME8_4[$i]=${aSOFTWARE_NAME8_3[$i]} + done + # Pre-create software counter array so that we can see also software (available in newest version) with 0 installs - for i in "${aSOFTWARE_NAME8_3[@]}" + for i in "${aSOFTWARE_NAME8_4[@]}" do aSOFTWARE["$i"]=0 done diff --git a/.update/patches b/.update/patches index 3bdefddbd3..1b27256462 100755 --- a/.update/patches +++ b/.update/patches @@ -711,6 +711,11 @@ Patch_8_3() : } +Patch_8_4() +{ + : +} + # v6.35 => v7 migration if (( $G_DIETPI_VERSION_CORE == 6 && $G_DIETPI_VERSION_SUB > 34 )) then diff --git a/.update/version b/.update/version index 33faacf411..596b7be1e4 100644 --- a/.update/version +++ b/.update/version @@ -1,7 +1,7 @@ # Available DietPi version G_REMOTE_VERSION_CORE=8 -G_REMOTE_VERSION_SUB=3 -G_REMOTE_VERSION_RC=1 +G_REMOTE_VERSION_SUB=4 +G_REMOTE_VERSION_RC=-1 # Minimum DietPi version to allow update G_MIN_VERSION_CORE=6 G_MIN_VERSION_SUB=14 diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 1d224923fe..ecc7556aac 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,16 @@ +v8.4 +(2022-04-30) + +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 + +For all additional issues that may appear after release, please see the following link for active tickets: https://github.com/MichaIng/DietPi/issues + +----------------------------------------------------------------------------------------------------------- + v8.3 (2022-04-02) @@ -34,8 +47,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/5397 -For all additional issues that may appear after release, please see the following link for active tickets: https://github.com/MichaIng/DietPi/issues - ----------------------------------------------------------------------------------------------------------- v8.2 diff --git a/dietpi/func/dietpi-globals b/dietpi/func/dietpi-globals index 368bb2a439..318944ff68 100644 --- a/dietpi/func/dietpi-globals +++ b/dietpi/func/dietpi-globals @@ -56,8 +56,8 @@ [[ -f '/boot/dietpi/.version' ]] && . /boot/dietpi/.version # - Assign defaults/code version as fallback [[ $G_DIETPI_VERSION_CORE ]] || G_DIETPI_VERSION_CORE=8 - [[ $G_DIETPI_VERSION_SUB ]] || G_DIETPI_VERSION_SUB=3 - [[ $G_DIETPI_VERSION_RC ]] || G_DIETPI_VERSION_RC=1 + [[ $G_DIETPI_VERSION_SUB ]] || G_DIETPI_VERSION_SUB=4 + [[ $G_DIETPI_VERSION_RC ]] || G_DIETPI_VERSION_RC=-1 [[ $G_GITBRANCH ]] || G_GITBRANCH='master' [[ $G_GITOWNER ]] || G_GITOWNER='MichaIng' # - Save current version and Git branch From 542f1fe9029ef65cdfea9ac01ce06c6353b0b180 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Fri, 8 Apr 2022 17:36:18 +0200 Subject: [PATCH 02/59] v8.4 (#5402) - CI | Re-enable all optional shellcheck checks - Coding | Address all optional shellcheck annotations --- .build/images/dietpi-build | 21 +- .conf/dps_51/run | 4 +- .github/workflows/shellcheck.yml | 10 +- .meta/dietpi-fan_control | 39 +-- .meta/dietpi-imager | 60 ++-- .shellcheckrc | 1 - .update/patches | 2 + .update/version | 2 + PREP_SYSTEM_FOR_DIETPI.sh | 24 +- dietpi/dietpi-autostart | 31 +- dietpi/dietpi-backup | 1 + dietpi/dietpi-cleaner | 43 +-- dietpi/dietpi-cloudshell | 51 +-- dietpi/dietpi-config | 222 ++++++------- dietpi/dietpi-cpuinfo | 6 +- dietpi/dietpi-cron | 36 +-- dietpi/dietpi-ddns | 1 + dietpi/dietpi-drive_manager | 76 ++--- dietpi/dietpi-led_control | 14 +- dietpi/dietpi-letsencrypt | 16 +- dietpi/dietpi-login | 18 +- dietpi/dietpi-morsecode | 11 +- dietpi/dietpi-services | 21 +- dietpi/dietpi-software | 499 +++++++++++++++-------------- dietpi/dietpi-sync | 55 ++-- dietpi/dietpi-update | 10 +- dietpi/dietpi-vpn | 107 ++++--- dietpi/func/dietpi-banner | 3 + dietpi/func/dietpi-benchmark | 1 + dietpi/func/dietpi-globals | 2 + dietpi/func/dietpi-obtain_hw_model | 8 +- dietpi/func/dietpi-set_hardware | 1 + dietpi/func/dietpi-set_software | 53 ++- dietpi/func/dietpi-set_swapfile | 6 +- dietpi/func/dietpi-wifidb | 1 + dietpi/misc/dietpi-arr_to_RAM | 2 +- dietpi/misc/dietpi-justboom | 50 +-- dietpi/patch_file | 8 +- dietpi/postboot | 2 +- dietpi/pre-patch_file | 5 +- 40 files changed, 765 insertions(+), 758 deletions(-) diff --git a/.build/images/dietpi-build b/.build/images/dietpi-build index 6a67bc25e9..5e2fd95a64 100755 --- a/.build/images/dietpi-build +++ b/.build/images/dietpi-build @@ -10,6 +10,7 @@ then else [[ $G_GITOWNER && $G_GITBRANCH ]] || { echo '[FAILED] You must export or pass G_GITOWNER and G_GITBRANCH to the script'; exit 1; } curl -sSf "https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH/dietpi/func/dietpi-globals" -o /tmp/dietpi-globals || exit 1 + # shellcheck disable=SC1091 . /tmp/dietpi-globals G_EXEC_NOHALT=1 G_EXEC rm /tmp/dietpi-globals export G_GITOWNER G_GITBRANCH G_HW_ARCH_NAME=$(uname -m) @@ -196,7 +197,7 @@ G_EXEC fallocate -l "$((partition_start+efi_size+boot_size+root_size))M" "$OUTPU if [[ $PTTYPE == 'gpt' ]] then # GPT partition table and EFI partition - G_EXEC parted -s "$OUTPUT_IMG_NAME.img" unit MiB mklabel gpt mkpart 'EFI' fat32 $partition_start $((partition_start+efi_size)) set 1 esp on + G_EXEC parted -s "$OUTPUT_IMG_NAME.img" unit MiB mklabel gpt mkpart 'EFI' fat32 "$partition_start" $((partition_start+efi_size)) set 1 esp on # root partition G_EXEC parted -s "$OUTPUT_IMG_NAME.img" unit MiB mkpart 'root' "$FSTYPE" $((partition_start+efi_size)) 100% @@ -375,8 +376,8 @@ fi G_EXEC_DESC='Downloading current README.md to pack with image...' G_EXEC curl -sSf "https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH/README.md" -o README.md # 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. -limit_threads= -(( $(free -m | mawk '/Mem:/{print $2}') < 1750 && $(nproc) > 2 )) && limit_threads='-mmt2' +limit_threads=() +(( $(free -m | mawk '/Mem:/{print $2}') < 1750 && $(nproc) > 2 )) && limit_threads=('-mmt2') # Since qemu-img does not support VMDK and VHDX resizing, we need to resize the raw .img. It is usually done as sparse file, hence the actual disk usage does not change. G_EXEC qemu-img resize "$OUTPUT_IMG_NAME.img" 8G @@ -452,7 +453,7 @@ SHA1: $(sha1sum "$image_name.vmx" | mawk '{print $1}') SHA256: $(sha256sum "$image_name.vmx" | mawk '{print $1}') _EOF_ [[ ( -t 0 || -t 1 ) && $TERM != 'dumb' ]] && G_EXEC_OUTPUT=1 - G_EXEC_DESC='Creating VMware 7-Zip archive' G_EXEC 7zr a -bsp1 -bso1 -bse2 -m0=lzma2 -mx=9 $limit_threads "$image_name.7z" "$image_name.vmdk" "$image_name.vmx" hash.txt README.md + G_EXEC_DESC='Creating VMware 7-Zip archive' G_EXEC 7zr a -bsp1 -bso1 -bse2 -m0=lzma2 -mx=9 "${limit_threads[@]}" "$image_name.7z" "$image_name.vmdk" "$image_name.vmx" hash.txt README.md G_EXEC rm "$image_name.vmdk" "$image_name.vmx" [[ -x 'upload.sh' ]] && G_EXEC_OUTPUT=1 G_EXEC ./upload.sh "$image_name.7z" && G_EXEC rm "$image_name.7z" fi @@ -603,7 +604,7 @@ SHA1: $(sha1sum "$image_name.ova" | mawk '{print $1}') SHA256: $(sha256sum "$image_name.ova" | mawk '{print $1}') _EOF_ [[ ( -t 0 || -t 1 ) && $TERM != 'dumb' ]] && G_EXEC_OUTPUT=1 - G_EXEC_DESC='Creating VirtualBox 7-Zip archive' G_EXEC 7zr a -bsp1 -bso1 -bse2 -m0=lzma2 -mx=9 $limit_threads "$image_name.7z" "$image_name.ova" hash.txt README.md + G_EXEC_DESC='Creating VirtualBox 7-Zip archive' G_EXEC 7zr a -bsp1 -bso1 -bse2 -m0=lzma2 -mx=9 "${limit_threads[@]}" "$image_name.7z" "$image_name.ova" hash.txt README.md G_EXEC rm "$image_name.ova" [[ -x 'upload.sh' ]] && G_EXEC_OUTPUT=1 G_EXEC ./upload.sh "$image_name.7z" && G_EXEC rm "$image_name.7z" fi @@ -768,7 +769,7 @@ SHA1: $(sha1sum "$image_name.ova" | mawk '{print $1}') SHA256: $(sha256sum "$image_name.ova" | mawk '{print $1}') _EOF_ [[ ( -t 0 || -t 1 ) && $TERM != 'dumb' ]] && G_EXEC_OUTPUT=1 - G_EXEC_DESC='Creating VirtualBox 7-Zip archive' G_EXEC 7zr a -bsp1 -bso1 -bse2 -m0=lzma2 -mx=9 $limit_threads "$image_name.7z" "$image_name.ova" hash.txt README.md + G_EXEC_DESC='Creating VirtualBox 7-Zip archive' G_EXEC 7zr a -bsp1 -bso1 -bse2 -m0=lzma2 -mx=9 "${limit_threads[@]}" "$image_name.7z" "$image_name.ova" hash.txt README.md G_EXEC rm "$image_name.ova" [[ -x 'upload.sh' ]] && G_EXEC_OUTPUT=1 G_EXEC ./upload.sh "$image_name.7z" && G_EXEC rm "$image_name.7z" fi @@ -789,7 +790,7 @@ SHA1: $(sha1sum "$image_name.vhdx" | mawk '{print $1}') SHA256: $(sha256sum "$image_name.vhdx" | mawk '{print $1}') _EOF_ [[ ( -t 0 || -t 1 ) && $TERM != 'dumb' ]] && G_EXEC_OUTPUT=1 - G_EXEC_DESC='Creating Hyper-V 7-Zip archive' G_EXEC 7zr a -bsp1 -bso1 -bse2 -m0=lzma2 -mx=9 $limit_threads "$image_name.7z" "$image_name.vhdx" hash.txt README.md + G_EXEC_DESC='Creating Hyper-V 7-Zip archive' G_EXEC 7zr a -bsp1 -bso1 -bse2 -m0=lzma2 -mx=9 "${limit_threads[@]}" "$image_name.7z" "$image_name.vhdx" hash.txt README.md G_EXEC rm "$image_name.vhdx" [[ -x 'upload.sh' ]] && G_EXEC_OUTPUT=1 G_EXEC ./upload.sh "$image_name.7z" && G_EXEC rm "$image_name.7z" fi @@ -810,7 +811,7 @@ SHA1: $(sha1sum "$image_name.hds" | mawk '{print $1}') SHA256: $(sha256sum "$image_name.hds" | mawk '{print $1}') _EOF_ [[ ( -t 0 || -t 1 ) && $TERM != 'dumb' ]] && G_EXEC_OUTPUT=1 - G_EXEC_DESC='Creating Parallels 7-Zip archive' G_EXEC 7zr a -bsp1 -bso1 -bse2 -m0=lzma2 -mx=9 $limit_threads "$image_name.7z" "$image_name.hds" hash.txt README.md + G_EXEC_DESC='Creating Parallels 7-Zip archive' G_EXEC 7zr a -bsp1 -bso1 -bse2 -m0=lzma2 -mx=9 "${limit_threads[@]}" "$image_name.7z" "$image_name.hds" hash.txt README.md G_EXEC rm "$image_name.hds" [[ -x 'upload.sh' ]] && G_EXEC_OUTPUT=1 G_EXEC ./upload.sh "$image_name.7z" && G_EXEC rm "$image_name.7z" fi @@ -831,7 +832,7 @@ SHA1: $(sha1sum "$image_name.qcow2" | mawk '{print $1}') SHA256: $(sha256sum "$image_name.qcow2" | mawk '{print $1}') _EOF_ [[ ( -t 0 || -t 1 ) && $TERM != 'dumb' ]] && G_EXEC_OUTPUT=1 - G_EXEC_DESC='Creating Proxmox 7-Zip archive' G_EXEC 7zr a -bsp1 -bso1 -bse2 -m0=lzma2 -mx=9 $limit_threads "$image_name.7z" "$image_name.qcow2" hash.txt README.md + G_EXEC_DESC='Creating Proxmox 7-Zip archive' G_EXEC 7zr a -bsp1 -bso1 -bse2 -m0=lzma2 -mx=9 "${limit_threads[@]}" "$image_name.7z" "$image_name.qcow2" hash.txt README.md [[ $VMTYPE == 'all' ]] || G_EXEC rm "$image_name.qcow2" [[ -x 'upload.sh' ]] && G_EXEC_OUTPUT=1 G_EXEC ./upload.sh "$image_name.7z" && G_EXEC rm "$image_name.7z" fi @@ -1020,7 +1021,7 @@ SHA1: $(sha1sum "$image_name.utm/view.plist" | mawk '{print $1}') SHA256: $(sha256sum "$image_name.utm/view.plist" | mawk '{print $1}') _EOF_ [[ ( -t 0 || -t 1 ) && $TERM != 'dumb' ]] && G_EXEC_OUTPUT=1 - G_EXEC_DESC='Creating UTM 7-Zip archive' G_EXEC 7zr a -bsp1 -bso1 -bse2 -m0=lzma2 -mx=9 $limit_threads "$image_name.7z" "$image_name.utm" hash.txt README.md + G_EXEC_DESC='Creating UTM 7-Zip archive' G_EXEC 7zr a -bsp1 -bso1 -bse2 -m0=lzma2 -mx=9 "${limit_threads[@]}" "$image_name.7z" "$image_name.utm" hash.txt README.md G_EXEC rm -R "$image_name.utm" [[ -x 'upload.sh' ]] && G_EXEC_OUTPUT=1 G_EXEC ./upload.sh "$image_name.7z" && G_EXEC rm "$image_name.7z" fi diff --git a/.conf/dps_51/run b/.conf/dps_51/run index 82e0f08e2d..916ea14c0a 100644 --- a/.conf/dps_51/run +++ b/.conf/dps_51/run @@ -18,11 +18,11 @@ readonly FP_DIR='/usr/games/opentyrian' # X server already running if pgrep Xorg > /dev/null; then - exec $FP_DIR/opentyrian -t $FP_DIR/data + exec "$FP_DIR/opentyrian" -t "$FP_DIR/data" # No X, init it else - exec xinit $FP_DIR/opentyrian -t $FP_DIR/data + exec xinit "$FP_DIR/opentyrian" -t "$FP_DIR/data" fi diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index b9aa0baca9..8313145e66 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -14,6 +14,12 @@ jobs: curl -sSfL "$(curl -sSf 'https://api.github.com/repos/koalaman/shellcheck/releases/latest' | mawk -F\" '/"browser_download_url.*\.linux\.x86_64\.tar\.xz"/{print $4;exit}')" -o shellcheck.tar.xz tar --wildcards --strip-components=1 -xf shellcheck.tar.xz '*/shellcheck' rm shellcheck.tar.xz + - name: Setup DietPi-Globals + run: | + sudo mkdir -p /boot/dietpi/func + sudo cp dietpi/func/dietpi-globals /boot/dietpi/func/ + sudo ./dietpi/func/dietpi-obtain_hw_model + echo -e 'G_HW_MEMORY_SIZE=1024\nG_HW_ONBOARD_WIFI=1' | sudo tee -a /boot/dietpi/.hw_model - name: Run shellcheck run: | mapfile -t FILES < <(find . -not \( -path './.git' -prune \) -type f) # read all files to array @@ -23,6 +29,4 @@ jobs: [[ $(mawk 'NR==1 && $0 ~ /^#!.*sh([[:blank:]]|$)/{print;exit}' "${FILES[$i]}") ]] && continue # file has shell shebang unset -v "FILES[$i]" # else remove from array done - printf '%s\n' "${FILES[@]}" - # -o all - ./shellcheck -C "${FILES[@]}" + ./shellcheck -C -xo all "${FILES[@]}" diff --git a/.meta/dietpi-fan_control b/.meta/dietpi-fan_control index 59bf911c76..d22ee19981 100755 --- a/.meta/dietpi-fan_control +++ b/.meta/dietpi-fan_control @@ -49,10 +49,10 @@ dietpi-fan_control 1 => Non-interactively apply settings from $FP_SETTINGS. if ! [[ -e $FP_TEMP_CONTROLLED && -e $FP_TRIP_TEMPS && -e $FP_TRIP_SPEEDS && -e $FP_STATIC_SPEED ]]; then # DEBUG - echo "$FP_TEMP_CONTROLLED: $(<$FP_TEMP_CONTROLLED)" - echo "$FP_TRIP_TEMPS: $(<$FP_TRIP_TEMPS)" - echo "$FP_TRIP_SPEEDS: $(<$FP_TRIP_SPEEDS)" - echo "$FP_STATIC_SPEED: $(<$FP_STATIC_SPEED)" + echo "$FP_TEMP_CONTROLLED: $(<"$FP_TEMP_CONTROLLED")" + echo "$FP_TRIP_TEMPS: $(<"$FP_TRIP_TEMPS")" + echo "$FP_TRIP_SPEEDS: $(<"$FP_TRIP_SPEEDS")" + echo "$FP_STATIC_SPEED: $(<"$FP_STATIC_SPEED")" G_DIETPI-NOTIFY 1 'CPU fan control is not available on your device. Aborting...' exit 1 @@ -82,7 +82,7 @@ dietpi-fan_control 1 => Non-interactively apply settings from $FP_SETTINGS. Read_Control_Files(){ # Read current fan control toggle - TEMP_CONTROLLED_CURRENT=$(<$FP_TEMP_CONTROLLED) + TEMP_CONTROLLED_CURRENT=$(<"$FP_TEMP_CONTROLLED") # Read current trip point temperatures, assuming values of CPU0 for all CPUs local fp_target i=0 @@ -91,7 +91,7 @@ dietpi-fan_control 1 => Non-interactively apply settings from $FP_SETTINGS. do # Convert "XY000" to XY°C - TRIP_TEMPS_CURRENT+=" $(( $( Non-interactively apply settings from $FP_SETTINGS. # Read current trip point fan speeds TRIP_SPEEDS_CURRENT= - for i in $(<$FP_TRIP_SPEEDS) + for i in $(<"$FP_TRIP_SPEEDS") do # Convert 0-255 to 0-100% TRIP_SPEEDS_CURRENT+=" $(( $i * 100 / 255 ))" @@ -110,7 +110,7 @@ dietpi-fan_control 1 => Non-interactively apply settings from $FP_SETTINGS. # Read current static fan speed # - Convert 0-255 to 0-100% - STATIC_SPEED_CURRENT=$(( $(<$FP_STATIC_SPEED) * 100 / 255 )) + STATIC_SPEED_CURRENT=$(( $(<"$FP_STATIC_SPEED") * 100 / 255 )) } @@ -119,7 +119,8 @@ dietpi-fan_control 1 => Non-interactively apply settings from $FP_SETTINGS. # - $TRIP_TEMPS='XX YY ZZ'; XX°C YY°C ZZ°C # - $TRIP_SPEEDS='AAA BBB CCC DDD'; AAA*100/255 %... # - $STATIC_SPEED=EEE; EEE*100/255 % - Read_Settings(){ . $FP_SETTINGS; } + # shellcheck disable=SC1090 + Read_Settings(){ . "$FP_SETTINGS"; } # Verify valid settings, before applying Verify_Settings(){ @@ -164,12 +165,12 @@ dietpi-fan_control 1 => Non-interactively apply settings from $FP_SETTINGS. Write_Settings(){ # Write fan control toggle to settings file - echo "TEMP_CONTROLLED=$TEMP_CONTROLLED" > $FP_SETTINGS + echo "TEMP_CONTROLLED=$TEMP_CONTROLLED" > "$FP_SETTINGS" if (( $TEMP_CONTROLLED )); then # Write trip points and attached temperatures to settings file - cat << _EOF_ >> $FP_SETTINGS + cat << _EOF_ >> "$FP_SETTINGS" TRIP_TEMPS='$TRIP_TEMPS' TRIP_SPEEDS='$TRIP_SPEEDS' _EOF_ @@ -177,7 +178,7 @@ _EOF_ else # - Write static fan speed to settings file - echo "STATIC_SPEED=$STATIC_SPEED" >> $FP_SETTINGS + echo "STATIC_SPEED=$STATIC_SPEED" >> "$FP_SETTINGS" fi @@ -187,10 +188,10 @@ _EOF_ Apply_Settings(){ #----------------------------------------------------------------------------------- - G_DIETPI-NOTIFY 3 $G_PROGRAM_NAME 'Applying CPU fan settings' + G_DIETPI-NOTIFY 3 "$G_PROGRAM_NAME" 'Applying CPU fan settings' #----------------------------------------------------------------------------------- # Apply fan control toggle - echo "$TEMP_CONTROLLED" > $FP_TEMP_CONTROLLED + echo "$TEMP_CONTROLLED" > "$FP_TEMP_CONTROLLED" if (( $TEMP_CONTROLLED )); then @@ -208,7 +209,7 @@ _EOF_ [[ ! -e $fp_target ]] && G_DIETPI-NOTIFY 1 "Trip point temperature file missing: $fp_target. Skipping..." && break # Convert XY°C to XY000 - echo "${temp}000" > $fp_target + echo "${temp}000" > "$fp_target" ((j++)) done done @@ -222,13 +223,13 @@ _EOF_ done # - Remove leading white space trip_speeds_target=${trip_speeds_target# } - echo "$trip_speeds_target" > $FP_TRIP_SPEEDS + echo "$trip_speeds_target" > "$FP_TRIP_SPEEDS" else # Apply static fan speed # - Convert 0-100% to 0-255 - echo $(( $STATIC_SPEED * 255 / 100 )) > $FP_STATIC_SPEED + echo $(( $STATIC_SPEED * 255 / 100 )) > "$FP_STATIC_SPEED" fi @@ -241,7 +242,7 @@ _EOF_ if G_WHIP_YESNO 'Reset fan control settings\n\nYour fan control settings file will be removed and current selections purged. This will take effect after next reboot.\n\nDo you want to continue?'; then - [[ -f $FP_SETTINGS ]] && G_EXEC_DESC="Removing $FP_SETTINGS" G_EXEC rm $FP_SETTINGS + [[ -f $FP_SETTINGS ]] && G_EXEC_DESC="Removing $FP_SETTINGS" G_EXEC rm "$FP_SETTINGS" G_EXEC_DESC='Resetting current selections' G_EXEC unset TEMP_CONTROLLED TRIP_TEMPS TRIP_SPEEDS STATIC_SPEED fi @@ -260,7 +261,7 @@ EG: To have trip points at 35°C, 50°C and 65°C, enter\n \"35 50 65\"" && G_WHIP_DEFAULT_ITEM=$TRIP_SPEEDS G_WHIP_INPUTBOX "Please enter $(( $TRIP_POINT_COUNT + 1 )) space-separated fan speeds in % (percent) of the maximum possible speed. -EG: To disable the fan below $(( $(<$FP_TRIP_TEMPS) / 1000 ))°C, run it at 45% above, 70% after reaching $(( $(<${FP_TRIP_TEMPS/0_temp/1_temp}) / 1000 ))°C and 95% above $(( $(<${FP_TRIP_TEMPS/0_temp/2_temp}) / 1000 ))°C, enter +EG: To disable the fan below $(( $(<"$FP_TRIP_TEMPS") / 1000 ))°C, run it at 45% above, 70% after reaching $(( $(<"${FP_TRIP_TEMPS/0_temp/1_temp}") / 1000 ))°C and 95% above $(( $(<"${FP_TRIP_TEMPS/0_temp/2_temp}") / 1000 ))°C, enter \"0 45 70 95\"" && TRIP_SPEEDS=$G_WHIP_RETURNED_VALUE } diff --git a/.meta/dietpi-imager b/.meta/dietpi-imager index d710fbf199..30c2033cbc 100755 --- a/.meta/dietpi-imager +++ b/.meta/dietpi-imager @@ -23,6 +23,7 @@ else [[ $G_GITOWNER && $G_GITBRANCH ]] || { echo '[FAILED] You must export or pass G_GITOWNER and G_GITBRANCH to the script'; exit 1; } curl -sSf "https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH/dietpi/func/dietpi-globals" -o /tmp/dietpi-globals || exit 1 + # shellcheck disable=SC1091 . /tmp/dietpi-globals G_EXEC_NOHALT=1 G_EXEC rm /tmp/dietpi-globals fi @@ -73,15 +74,15 @@ { G_EXEC sync G_EXEC sleep 1 # Give the system 1 second to avoid "mount is busy" - G_EXEC umount -R $FP_MNT_TMP + G_EXEC umount -R "$FP_MNT_TMP" } Delete_Loopback(){ [[ $FP_SOURCE_IMG ]] && losetup "$FP_SOURCE" &> /dev/null && G_EXEC losetup -d "$FP_SOURCE"; } G_EXIT_CUSTOM() { - findmnt $FP_MNT_TMP > /dev/null && Unmount_tmp - [[ -d $FP_MNT_TMP ]] && G_EXEC rmdir $FP_MNT_TMP + findmnt "$FP_MNT_TMP" > /dev/null && Unmount_tmp + [[ -d $FP_MNT_TMP ]] && G_EXEC rmdir "$FP_MNT_TMP" Delete_Loopback [[ -e 'tmpiso' ]] && G_EXEC rm -R tmpiso } @@ -266,6 +267,7 @@ 'Target name') Menu_Target_Name;; 'Mount') [[ $MOUNT_IT == 'Off' ]] && MOUNT_IT='On' || MOUNT_IT='Off';; 'Start') main_menu_choice='Start';; + *) :;; esac } @@ -329,10 +331,10 @@ Run_fsck # Remount image for any required edits - G_EXEC mkdir $FP_MNT_TMP - G_EXEC mount "$FP_ROOT_DEV" $FP_MNT_TMP + G_EXEC mkdir "$FP_MNT_TMP" + G_EXEC mount "$FP_ROOT_DEV" "$FP_MNT_TMP" # - Remove bash history and DHCP leases, which are stored on shutdown, hence cannot be removed via DietPi-PREP - G_EXEC rm -f $FP_MNT_TMP/{root,home/*}/.bash_history $FP_MNT_TMP/var/lib/dhcp/*.leases + G_EXEC rm -f "$FP_MNT_TMP/"{root,home/*}/.bash_history "$FP_MNT_TMP/var/lib/dhcp/"*.leases if [[ $MOUNT_IT == 'On' ]] && G_WHIP_MSG "The ${SOURCE_TYPE,,} has been mounted to allow you reviewing or editing its content: - $FP_ROOT_DEV > $FP_MNT_TMP \nAn interactive bash subshell will open. @@ -342,7 +344,7 @@ local reallow_dietpi_login=1 [[ $G_DIETPI_LOGIN ]] && reallow_dietpi_login=0 export G_DIETPI_LOGIN=1 - G_EXEC cd $FP_MNT_TMP + G_EXEC cd "$FP_MNT_TMP" bash &> /dev/tty < /dev/tty G_EXEC cd "$FP_ORIGIN" (( $reallow_dietpi_login )) && unset -v G_DIETPI_LOGIN @@ -380,7 +382,7 @@ if (( $(<"/sys/class/block/${FP_ROOT_DEV##*/}/size") > $FS_SIZE * $BLOCK_SIZE * 2 + 8 )) # 512 byte sectors then FS_SIZE=$(( $FS_SIZE + 4096/$BLOCK_SIZE )) # blocks - G_EXEC resize2fs "$FP_ROOT_DEV" $FS_SIZE + G_EXEC resize2fs "$FP_ROOT_DEV" "$FS_SIZE" fi 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 @@ -401,18 +403,18 @@ #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 ${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_EXEC mkdir "${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_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 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" #Unmount_tmp # Assure root filesystem size is in 512 byte sectors, as this is what sfdisk assmes #FS_SIZE=$(( $FS_SIZE * $sector_size / 512 )) @@ -420,9 +422,9 @@ elif [[ $ROOT_FS_TYPE == 'btrfs' ]] then G_DIETPI-NOTIFY 2 'Shrinking root filesystem to minimum size...' - 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 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" Unmount_tmp FS_SIZE=$(( $FS_SIZE / 512 )) # bytes => 512 byte sectors fi @@ -448,15 +450,15 @@ [[ ( -t 0 || -t 1 ) && $TERM != 'dumb' ]] && G_EXEC_OUTPUT=1 G_EXEC zerofree -v "$path" else - G_EXEC mount "$path" $FP_MNT_TMP - G_EXEC_OUTPUT=1 G_EXEC fstrim -v $FP_MNT_TMP + G_EXEC mount "$path" "$FP_MNT_TMP" + G_EXEC_OUTPUT=1 G_EXEC fstrim -v "$FP_MNT_TMP" Unmount_tmp # shellcheck disable=SC2015 [[ $path == "$FP_ROOT_DEV" ]] && Run_fsck || G_EXEC_OUTPUT=1 G_EXEC fsck "$path" fi done < <(lsblk -rnpo NAME,FSTYPE "$FP_SOURCE"?*) - G_EXEC rmdir $FP_MNT_TMP + G_EXEC rmdir "$FP_MNT_TMP" # Only resize partition when new size would be less than current size if [[ $ROOT_FS_TYPE != 'f2fs' ]] && (( $(<"/sys/class/block/${FP_ROOT_DEV##*/}/size") > $FS_SIZE )) @@ -478,7 +480,7 @@ Delete_Loopback G_DIETPI-NOTIFY 2 "Truncating final image file to actually used size: $(( $IMAGE_SIZE / 1024**2 + 1 )) MiB" - G_EXEC truncate --size=$IMAGE_SIZE "$FP_SOURCE_IMG" + G_EXEC truncate --size="$IMAGE_SIZE" "$FP_SOURCE_IMG" # Rename if source image != output image yet [[ $PWD/$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT != "$(readlink -f "$FP_SOURCE_IMG")" ]] && G_EXEC mv "$FP_SOURCE_IMG" "$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT" @@ -503,9 +505,9 @@ # Install required packages # - We want Clonezilla 5.x for loop device support - local clonezilla= - [[ $(dpkg-query -Wf '${Version}' clonezilla 2> /dev/null) != '5'* ]] && G_EXEC curl -fL 'https://deb.debian.org/debian/pool/main/c/clonezilla/clonezilla_5.0.3-1_all.deb' -o clonezilla.deb && clonezilla='./clonezilla.deb' - G_AG_CHECK_INSTALL_PREREQ unzip $clonezilla partclone xz-utils syslinux-common xorriso isolinux + local clonezilla=() + [[ $(dpkg-query -Wf '${Version}' clonezilla 2> /dev/null) != '5'* ]] && G_EXEC curl -fL 'https://deb.debian.org/debian/pool/main/c/clonezilla/clonezilla_5.0.3-1_all.deb' -o clonezilla.deb && clonezilla=('./clonezilla.deb') + G_AG_CHECK_INSTALL_PREREQ unzip "${clonezilla[@]}" partclone xz-utils syslinux-common xorriso isolinux [[ -f 'clonezilla.deb' ]] && G_EXEC rm clonezilla.deb # Get latest version of Clonezilla Live @@ -645,12 +647,12 @@ _EOF_ # Generate 7z archive # 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' + 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" [[ ( -t 0 || -t 1 ) && $TERM != 'dumb' ]] && G_EXEC_OUTPUT=1 # 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 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_DESC='Creating final 7zip archive' 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_DIETPI-NOTIFY 0 "DietPi-Imager has successfully finished. diff --git a/.shellcheckrc b/.shellcheckrc index aacd8a8168..3e714ce943 100644 --- a/.shellcheckrc +++ b/.shellcheckrc @@ -1,3 +1,2 @@ # https://github.com/koalaman/shellcheck/wiki/Checks disable=SC2004,SC2119,SC2155,SC2188,SC2243,SC2244,SC2250,SC2312 -source=dietpi/func/dietpi-globals diff --git a/.update/patches b/.update/patches index 1b27256462..c9bea2536d 100755 --- a/.update/patches +++ b/.update/patches @@ -51,6 +51,8 @@ Patch_7_1() if [[ -f '/var/lib/dietpi/dietpi-vpn/settings_dietpi.conf' ]] then G_EXEC sed -Ei 's/^NORDVPN_(SERVER|USERNAME|PASSWORD)=/VPN_\1=/' /var/lib/dietpi/dietpi-vpn/settings_dietpi.conf + local PROTOCOL VPN_SERVER + # shellcheck disable=SC1091 . /var/lib/dietpi/dietpi-vpn/settings_dietpi.conf [[ -f '/etc/openvpn/client.ovpn' ]] || G_EXEC cp -a "/etc/openvpn/ovpn_$PROTOCOL/$VPN_SERVER" /etc/openvpn/client.ovpn unset -v VPN_SERVER PROTOCOL VPN_USERNAME VPN_PASSWORD diff --git a/.update/version b/.update/version index 596b7be1e4..3f53e1f3e4 100644 --- a/.update/version +++ b/.update/version @@ -1,3 +1,5 @@ +#!/bin/bash +# shellcheck disable=SC2034 # Available DietPi version G_REMOTE_VERSION_CORE=8 G_REMOTE_VERSION_SUB=4 diff --git a/PREP_SYSTEM_FOR_DIETPI.sh b/PREP_SYSTEM_FOR_DIETPI.sh index a270dc0416..43b82f848a 100755 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -156,6 +156,7 @@ _EOF_ rm -fv /boot/dietpi/.hw_model # Load + # shellcheck source-path=dietpi/func source-path=/boot/dietpi/func if ! . ./dietpi-globals then echo -e '[FAILED] Unable to load dietpi-globals. Aborting...\n' @@ -519,6 +520,7 @@ _EOF_ G_EXEC mv "DietPi-$G_GITBRANCH/LICENSE" /boot/dietpi-LICENSE.txt # Reading version string for later use + # shellcheck source=.update/version source=/boot/dietpi/.version . "DietPi-$G_GITBRANCH/.update/version" G_DIETPI_VERSION_CORE=$G_REMOTE_VERSION_CORE G_DIETPI_VERSION_SUB=$G_REMOTE_VERSION_SUB @@ -791,7 +793,9 @@ _EOF_ # Compile U-Boot config G_EXEC mkimage -C none -A arm64 -T script -d /boot/boot.cmd /boot/boot.scr # Flash U-Boot + # shellcheck disable=SC1091 . /usr/lib/u-boot/platform_install.sh + # shellcheck disable=SC2154 write_uboot_platform "$DIR" "$(lsblk -npo PKNAME "$(findmnt -Ufnro SOURCE -M /)")" # - Armbian grab currently installed packages @@ -1388,8 +1392,8 @@ _EOF_' G_DIETPI-NOTIFY 2 'Disabling apt-daily services to prevent random APT cache lock' for i in apt-daily{,-upgrade}.{service,timer} do - G_EXEC systemctl disable --now $i - G_EXEC systemctl mask $i + G_EXEC systemctl disable --now "$i" + G_EXEC systemctl mask "$i" done if command -v e2scrub > /dev/null @@ -1407,8 +1411,8 @@ _EOF_' G_EXEC_DESC='Generating /etc/fstab' G_EXEC /boot/dietpi/dietpi-drive_manager 4 # Create and navigate to "/tmp/$G_PROGRAM_NAME" working directory, now assured to be tmpfs - G_EXEC mkdir -p /tmp/$G_PROGRAM_NAME - G_EXEC cd /tmp/$G_PROGRAM_NAME + G_EXEC mkdir -p "/tmp/$G_PROGRAM_NAME" + G_EXEC cd "/tmp/$G_PROGRAM_NAME" local info_use_drive_manager='Can be installed and setup by DietPi-Drive_Manager.\nSimply run "dietpi-drive_manager" and select "Add network drive".' echo -e "Samba client: $info_use_drive_manager" > /mnt/samba/readme.txt @@ -1815,10 +1819,10 @@ _EOF_ /boot/dietpi/func/dietpi-set_hardware bluetooth disable G_DIETPI-NOTIFY 2 "$tmp_info onboard WiFi modules by default" - /boot/dietpi/func/dietpi-set_hardware wifimodules onboard_$tmp_mode + /boot/dietpi/func/dietpi-set_hardware wifimodules "onboard_$tmp_mode" G_DIETPI-NOTIFY 2 "$tmp_info generic WiFi by default" - /boot/dietpi/func/dietpi-set_hardware wifimodules $tmp_mode + /boot/dietpi/func/dietpi-set_hardware wifimodules "$tmp_mode" fi # - x86_64: GRUB install and config @@ -1831,16 +1835,16 @@ _EOF_ then # Force GRUB installation to the EFI removable media path, if no (other) bootloader is installed there yet, which is checked via single case-insensitive glob shopt -s nocaseglob - local efi_fallback= + local efi_fallback=() # shellcheck disable=SC2043 for i in /boot/efi/EFI/boot/bootx64.efi do - [[ -d $i ]] && break - efi_fallback='--force-extra-removable' + [[ -e $i ]] && break + efi_fallback=('--force-extra-removable') debconf-set-selections <<< 'grub-efi-amd64 grub2/force_efi_extra_removable boolean true' done shopt -u nocaseglob - G_EXEC_DESC='Installing GRUB for UEFI' G_EXEC_OUTPUT=1 G_EXEC grub-install --recheck --target=x86_64-efi --efi-directory=/boot/efi $efi_fallback --uefi-secure-boot + G_EXEC_DESC='Installing GRUB for UEFI' G_EXEC_OUTPUT=1 G_EXEC grub-install --recheck --target=x86_64-efi --efi-directory=/boot/efi "${efi_fallback[@]}" --uefi-secure-boot # BIOS else diff --git a/dietpi/dietpi-autostart b/dietpi/dietpi-autostart index 80e151d530..7fb84d767a 100755 --- a/dietpi/dietpi-autostart +++ b/dietpi/dietpi-autostart @@ -52,14 +52,14 @@ local fp_svc1='/etc/systemd/system/getty@tty1.service.d' if [[ -d $fp_svc1 ]] then - [[ -f $fp_svc1/dietpi-autologin.conf ]] && rm $fp_svc1/dietpi-autologin.conf - rmdir --ignore-fail-on-non-empty $fp_svc1 + [[ -f $fp_svc1/dietpi-autologin.conf ]] && rm "$fp_svc1/dietpi-autologin.conf" + rmdir --ignore-fail-on-non-empty "$fp_svc1" fi local fp_svc2='/etc/systemd/system/console-getty.service.d' if [[ -d $fp_svc2 ]] then - [[ -f $fp_svc2/dietpi-autologin.conf ]] && rm $fp_svc2/dietpi-autologin.conf - rmdir --ignore-fail-on-non-empty $fp_svc2 + [[ -f $fp_svc2/dietpi-autologin.conf ]] && rm "$fp_svc2/dietpi-autologin.conf" + rmdir --ignore-fail-on-non-empty "$fp_svc2" fi #---------------------------------------------------------------------- @@ -136,8 +136,8 @@ _EOF_ # - Kodi elif (( $ID_AUTOSTART == 1 )) then - G_EXEC usermod -aG tty,input,video,audio $user - getent group render > /dev/null && G_EXEC usermod -aG render $user + G_EXEC usermod -aG tty,input,video,audio "$user" + getent group render > /dev/null && G_EXEC usermod -aG render "$user" # - Desktop autologin: As non-root user, it's LightDM-based elif (( $ID_AUTOSTART == 2 )) @@ -159,31 +159,32 @@ _EOF_ # - CAVA: Copy config and font from root, created on install elif (( $ID_AUTOSTART == 10 )) then - [[ ! -d ~$user/.config/cava ]] && mkdir -p ~$user/.config && cp /root/.config/cava ~$user/.config/cava && chown -R $user: ~$user/.config - [[ ! -f ~$user/cava.psf ]] && cp /root/cava.psf ~$user/cava.psf && chown $user: ~$user/cava.psf + local home=$(eval "echo ~$user") + [[ ! -d $home/.config/cava ]] && mkdir -p "$home/.config" && cp /root/.config/cava "$home/.config/cava" && chown -R "$user:" "$home/.config" + [[ ! -f $home/cava.psf ]] && cp /root/cava.psf "$home/cava.psf" && chown "$user:" "$home/cava.psf" fi # Apply to TTY1 getty: Skip for LightDM-based autologin if [[ $ID_AUTOSTART != 2 || $user == 'root' ]] then - G_EXEC mkdir -p $fp_svc1 $fp_svc2 - cat << _EOF_ > $fp_svc1/dietpi-autologin.conf + G_EXEC mkdir -p "$fp_svc1" "$fp_svc2" + cat << _EOF_ > "$fp_svc1/dietpi-autologin.conf" [Service] ExecStart= ExecStart=-/sbin/agetty -a $user -J %I \$TERM _EOF_ - cat << _EOF_ > $fp_svc2/dietpi-autologin.conf + cat << _EOF_ > "$fp_svc2/dietpi-autologin.conf" [Service] ExecStart= ExecStart=-/sbin/agetty -a $user -J -s console 115200,38400,9600 \$TERM _EOF_ fi else - [[ -f $FP_SETTINGS ]] && G_EXEC rm $FP_SETTINGS + [[ -f $FP_SETTINGS ]] && G_EXEC rm "$FP_SETTINGS" fi # Save boot index, if not default 0 - (( $ID_AUTOSTART )) && echo $ID_AUTOSTART > $FP_SETTINGS + (( $ID_AUTOSTART )) && echo "$ID_AUTOSTART" > "$FP_SETTINGS" G_EXEC systemctl daemon-reload } @@ -196,7 +197,7 @@ _EOF_ Menu_Main() { # Existing boot flag - [[ -f $FP_SETTINGS ]] && ID_AUTOSTART=$(<$FP_SETTINGS) + [[ -f $FP_SETTINGS ]] && ID_AUTOSTART=$(<"$FP_SETTINGS") G_WHIP_MENU_ARRAY=( @@ -220,7 +221,6 @@ _EOF_ '14' ': Custom script (background, no autologin)' '17' ': Custom script (foreground, with autologin)' '5' ': DietPi-CloudShell' - ) G_WHIP_BUTTON_CANCEL_TEXT='Exit' @@ -259,6 +259,7 @@ _EOF_ 14) local custom_mode_desc='background at the end of the boot sequence. \nYou can run \"journalctl -u dietpi-autostart_custom\" at any time to see the script output';; 17) local custom_mode_desc='foreground of your main screen after being automatically logged in with the chosen user';; + *) G_DIETPI-NOTIFY 1 'An invalid "case" option was used. This is a bug, please report at: https://github.com/MichaIng/DietPi/issues'; exit 1;; esac G_WHIP_MSG "A template script has been created:\n - /var/lib/dietpi/dietpi-autostart/custom.sh diff --git a/dietpi/dietpi-backup b/dietpi/dietpi-backup index 4a0e8bce05..932cb77943 100755 --- a/dietpi/dietpi-backup +++ b/dietpi/dietpi-backup @@ -411,6 +411,7 @@ AMOUNT=$AMOUNT _EOF_ } + # shellcheck disable=SC1090 Read_Settings_File(){ [[ -f $FP_SETTINGS ]] && . "$FP_SETTINGS"; } #///////////////////////////////////////////////////////////////////////////////////// diff --git a/dietpi/dietpi-cleaner b/dietpi/dietpi-cleaner index bebfffe0be..c3fddf5cd5 100755 --- a/dietpi/dietpi-cleaner +++ b/dietpi/dietpi-cleaner @@ -88,20 +88,11 @@ G_WHIP_MSG "$G_PROGRAM_NAME is a program that allows you to remove unwanted junk from your DietPi system, freeing up filesystem space in the process.\n Simply enable the cleaners you require, then select \"Test\" to see what will happen, without modifying your system.\nOnce your satisfied with the Test results, select \"Run\" to clean your system.\n Further information:\n - https://dietpi.com/docs/dietpi_tools/#dietpi-cleaner" - ;; - ' - Files') - - TARGETMENUID=2 - - ;; + ' - Files') TARGETMENUID=2;; - Cleaners) - - TARGETMENUID=1 - - ;; + Cleaners) TARGETMENUID=1;; Test) @@ -127,7 +118,6 @@ Further information:\n - https://dietpi.com/docs/dietpi_tools/#dietpi-cleaner" G_WHIP_MSG "$G_PROGRAM_NAME could not be run as there are no enabled cleaners. Please go to cleaners, then select which you would like to enable." fi - ;; Run) @@ -155,9 +145,10 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners G_WHIP_MSG "$G_PROGRAM_NAME could not be run as there are no enabled cleaners. Please go to cleaners, then select which you would like to enable." fi - ;; + *) G_DIETPI-NOTIFY 1 'An invalid "case" option was used. This is a bug, please report at: https://github.com/MichaIng/DietPi/issues'; exit 1;; + esac else @@ -250,16 +241,16 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners (( $INCLUDE_MNT )) && INCLUDE_MNT=0 || INCLUDE_MNT=1 TARGETMENUID=2 # Files menu - ;; "$option_2_text") - nano $FP_CUSTOM + nano "$FP_CUSTOM" TARGETMENUID=2 # Files menu - ;; + *) G_DIETPI-NOTIFY 1 'An invalid "case" option was used. This is a bug, please report at: https://github.com/MichaIng/DietPi/issues'; exit 1;; + esac } @@ -385,7 +376,7 @@ $G_PROGRAM_NAME simulation has finished: Press any key to continue..." Banner_Cleaning # Generate list of files to include. Remove lines with (#) or (space) or (empty) from list - sed -E '/([#[:blank:]]|^$)/d' $FP_CUSTOM > $FP_TMP + sed -E '/([#[:blank:]]|^$)/d' "$FP_CUSTOM" > "$FP_TMP" # Check if include file has any left content if [[ -s $FP_TMP ]]; then @@ -399,7 +390,7 @@ $G_PROGRAM_NAME simulation has finished: Press any key to continue..." [[ ${afiles[0]} ]] && afiles+=('-o') afiles+=('-name' "$line") - done < $FP_TMP + done < "$FP_TMP" echo 'Please wait...' @@ -407,11 +398,11 @@ $G_PROGRAM_NAME simulation has finished: Press any key to continue..." # - Skip traversing /mnt if not selected for inclusion if (( $INCLUDE_MNT )); then - find / -type f "${afiles[@]}" > $FP_TMP + find / -type f "${afiles[@]}" > "$FP_TMP" else - find / ! \( -path /mnt -prune \) -type f "${afiles[@]}" > $FP_TMP + find / ! \( -path /mnt -prune \) -type f "${afiles[@]}" > "$FP_TMP" fi @@ -433,7 +424,7 @@ $G_PROGRAM_NAME simulation has finished: Press any key to continue..." # Else remove and print result rm "$line" && echo "- $line ..Deleted!" || echo "- $line ..Failed!" - done < $FP_TMP + done < "$FP_TMP" else @@ -441,7 +432,7 @@ $G_PROGRAM_NAME simulation has finished: Press any key to continue..." fi - rm $FP_TMP + rm "$FP_TMP" } @@ -476,10 +467,10 @@ $G_PROGRAM_NAME simulation has finished: Press any key to continue..." #///////////////////////////////////////////////////////////////////////////////////// Read_Settings_File(){ - [[ -f $FP_SETTINGS ]] && mapfile -t aEnabledCleaners < $FP_SETTINGS + [[ -f $FP_SETTINGS ]] && mapfile -t aEnabledCleaners < "$FP_SETTINGS" # Custom filescan options - [[ -f $FP_CUSTOM ]] || cat << '_EOF_' > $FP_CUSTOM + [[ -f $FP_CUSTOM ]] || cat << '_EOF_' > "$FP_CUSTOM" # ------------------------------------------------------------------ # Specify filenames or extentions to match during filescan removals. # @@ -506,11 +497,11 @@ _EOF_ Write_Settings_File(){ # Enabled/Disabled Cleaner Settings - > $FP_SETTINGS + > "$FP_SETTINGS" local i for ((i=0; i<$MAX_CLEANERS; i++)) do - echo "${aEnabledCleaners[$i]}" >> $FP_SETTINGS + echo "${aEnabledCleaners[$i]}" >> "$FP_SETTINGS" done } diff --git a/dietpi/dietpi-cloudshell b/dietpi/dietpi-cloudshell index a16d5aaf09..ff78b2a5af 100755 --- a/dietpi/dietpi-cloudshell +++ b/dietpi/dietpi-cloudshell @@ -41,7 +41,7 @@ # This will only work if dietpi-cloudshell was started via dietpi-autostart/dietpi-login, as the setterm power options can only be applied when the command originates from the same terminal without redirects. RUN_BLANK_SCREEN_AT_SPECIFIC_TIME(){ - local current_hour=$(date +%-H) + local current_hour=$(date '+%-H') # Turn screen off if (( ! $BLANK_SCREEN_ACTIVE )); then @@ -402,8 +402,8 @@ # df will endless hang when NFS server is down: https://github.com/MichaIng/DietPi/issues/395 # - So lets run it as another thread so we can kill it if it hangs. local df_failed=0 pid - [[ -f $FP_TMP ]] && rm $FP_TMP - df -Ph > $FP_TMP & pid=$! + [[ -f $FP_TMP ]] && rm "$FP_TMP" + df -Ph > "$FP_TMP" & pid=$! # - Wait X seconds before terminating the df thread local max_seconds=4 @@ -416,7 +416,7 @@ G_DIETPI-NOTIFY 1 'DF failed, unable to obtain drive data' sleep 2 - kill $pid + kill "$pid" df_failed=1 echo -e "$(date) | df failed to respond" >> /var/log/dietpi-cloudshell.log break @@ -445,12 +445,12 @@ for ((i=$index_start; i<=$index_end; i++)) do - if grep -q "${STORAGE_PATH[$i]}\$" $FP_TMP; then + if grep -q "${STORAGE_PATH[$i]}\$" "$FP_TMP"; then - STORAGE_TOTAL[$i]=$(grep -m1 "${STORAGE_PATH[$i]}\$" $FP_TMP | mawk '{print $2}'); STORAGE_TOTAL[$i]+='B' - STORAGE_USED[$i]=$(grep -m1 "${STORAGE_PATH[$i]}\$" $FP_TMP | mawk '{print $3}'); STORAGE_USED[$i]+='B' - STORAGE_FREE[$i]=$(grep -m1 "${STORAGE_PATH[$i]}\$" $FP_TMP | mawk '{print $4}'); STORAGE_FREE[$i]+='B' - STORAGE_PERCENT[$i]=$(grep -m1 "${STORAGE_PATH[$i]}\$" $FP_TMP | mawk '{print $5}' | sed 's/%//g') + STORAGE_TOTAL[$i]=$(grep -m1 "${STORAGE_PATH[$i]}\$" "$FP_TMP" | mawk '{print $2}'); STORAGE_TOTAL[$i]+='B' + STORAGE_USED[$i]=$(grep -m1 "${STORAGE_PATH[$i]}\$" "$FP_TMP" | mawk '{print $3}'); STORAGE_USED[$i]+='B' + STORAGE_FREE[$i]=$(grep -m1 "${STORAGE_PATH[$i]}\$" "$FP_TMP" | mawk '{print $4}'); STORAGE_FREE[$i]+='B' + STORAGE_PERCENT[$i]=$(grep -m1 "${STORAGE_PATH[$i]}\$" "$FP_TMP" | mawk '{print $5}' | sed 's/%//g') Percent_To_Graph "${STORAGE_PERCENT[$i]}" STORAGE_PERCENT[$i]=$C_PERCENT_GRAPH @@ -635,13 +635,13 @@ MEMORY_SWAPERCENT=0 Obtain_MEMORY(){ - # Write to temp - free -m > $FP_TMP + # Write to tmp + free -m > "$FP_TMP" # RAM MiB - MEMORY_TOTAL=$(mawk '/Mem: /{print $2;exit}' $FP_TMP) - MEMORY_USED=$(mawk '/Mem: /{print $3;exit}' $FP_TMP) - MEMORY_FREE=$(mawk '/Mem: /{print $7;exit}' $FP_TMP) + MEMORY_TOTAL=$(mawk '/Mem: /{print $2;exit}' "$FP_TMP") + MEMORY_USED=$(mawk '/Mem: /{print $3;exit}' "$FP_TMP") + MEMORY_FREE=$(mawk '/Mem: /{print $7;exit}' "$FP_TMP") MEMORY_PERCENT=$(mawk "{print $MEMORY_USED * 100 / $MEMORY_TOTAL}" <<< '') # convert to interger and graph it @@ -649,12 +649,12 @@ MEMORY_PERCENT=$C_PERCENT_GRAPH # SWAP MiB - MEMORY_SWAPTOTAL=$(mawk '/Swap: /{print $2;exit}' $FP_TMP) + MEMORY_SWAPTOTAL=$(mawk '/Swap: /{print $2;exit}' "$FP_TMP") # - Swap available and active if (( $MEMORY_SWAPTOTAL > 0 )); then - MEMORY_SWAPUSED=$(mawk '/Swap: /{print $3;exit}' $FP_TMP) - MEMORY_SWAPFREE=$(mawk '/Swap: /{print $4;exit}' $FP_TMP) + MEMORY_SWAPUSED=$(mawk '/Swap: /{print $3;exit}' "$FP_TMP") + MEMORY_SWAPFREE=$(mawk '/Swap: /{print $4;exit}' "$FP_TMP") MEMORY_SWAPERCENT=$(mawk "{print $MEMORY_SWAPUSED * 100 / $MEMORY_SWAPTOTAL}" <<< '') # convert to interger and graph it @@ -1049,11 +1049,12 @@ #///////////////////////////////////////////////////////////////////////////////////// readonly FP_SETTINGS='/boot/dietpi/.dietpi-cloudshell' - Read_Settings_File(){ [[ -f $FP_SETTINGS ]] && . $FP_SETTINGS; } + # shellcheck disable=SC1090 + Read_Settings_File(){ [[ -f $FP_SETTINGS ]] && . "$FP_SETTINGS"; } Write_Settings_File(){ - cat << _EOF_ > $FP_SETTINGS + cat << _EOF_ > "$FP_SETTINGS" REFRESH_RATE=$REFRESH_RATE USER_COLOUR_INDEX=$USER_COLOUR_INDEX TEMPERATURE_OUTPUT_TYPE=$TEMPERATURE_OUTPUT_TYPE @@ -1069,14 +1070,14 @@ _EOF_ # Add enabled scenes for ((i=0; i<$MAX_SCENES; i++)) do - echo "aEnabledScenes[$i]=${aEnabledScenes[$i]}" >> $FP_SETTINGS + echo "aEnabledScenes[$i]=${aEnabledScenes[$i]}" >> "$FP_SETTINGS" done # Add Drive Paths and Names for ((i=0; i<$MAX_STORAGE; i++)) do - echo "STORAGE_PATH[$i]='${STORAGE_PATH[$i]}'" >> $FP_SETTINGS - echo "STORAGE_NAME[$i]='${STORAGE_NAME[$i]}'" >> $FP_SETTINGS + echo "STORAGE_PATH[$i]='${STORAGE_PATH[$i]}'" >> "$FP_SETTINGS" + echo "STORAGE_NAME[$i]='${STORAGE_NAME[$i]}'" >> "$FP_SETTINGS" done } @@ -1250,12 +1251,12 @@ _EOF_ # Normal scene update else - Update_Scene_$SCENE_CURRENT + "Update_Scene_$SCENE_CURRENT" fi # Apply refresh rate delay - sleep $REFRESH_RATE + sleep "$REFRESH_RATE" fi @@ -1375,6 +1376,8 @@ _EOF_ 'Scenes') TARGETMENUID=3;; + *) G_DIETPI-NOTIFY 1 'An invalid "case" option was used. This is a bug, please report at: https://github.com/MichaIng/DietPi/issues'; exit 1;; + esac else diff --git a/dietpi/dietpi-config b/dietpi/dietpi-config index e2d4a61cf1..bc6c88e7d6 100755 --- a/dietpi/dietpi-config +++ b/dietpi/dietpi-config @@ -704,7 +704,7 @@ A long (or insufficiently manufactured) cable may required a higher boost settin 'PC1' ': 1024 x 768' 'PC2' ': 800 x 640' 'PC3' ': 640 x 480' - 'DietPi-Cloudshell' ': 320 x 240' + 'DietPi-CloudShell' ': 320 x 240' 'sdtv_mode=0' ': Composite NTSC' 'sdtv_mode=1' ': Composite Japanese NTSC' 'sdtv_mode=2' ': Composite PAL' @@ -762,14 +762,14 @@ Re-enabling HDMI requires a reboot. If you need emergency HDMI output, edit the 'sdtv_mode'*) - # Enable SDTV on RPi4, apply to all RPi to allow SDcard switch + # Enable SDTV on RPi4, apply to all RPi to allow SD card switch G_CONFIG_INJECT 'enable_tvout=' 'enable_tvout=1' /boot/config.txt G_CONFIG_INJECT 'sdtv_mode=' "$G_WHIP_RETURNED_VALUE" /boot/config.txt framebuffer_x=720 framebuffer_y=576 ;; - 'DietPi-Cloudshell') + 'DietPi-CloudShell') framebuffer_x=320 framebuffer_y=240 @@ -817,9 +817,11 @@ Re-enabling HDMI requires a reboot. If you need emergency HDMI output, edit the framebuffer_y=480 ;; + *) G_DIETPI-NOTIFY 1 'An invalid "case" option was used. This is a bug, please report at: https://github.com/MichaIng/DietPi/issues'; exit 1;; + esac - # Apply framebuffer size and ondemand Chromium resolution + # Apply framebuffer size and Chromium autostart resolution G_CONFIG_INJECT 'framebuffer_width=' "framebuffer_width=$framebuffer_x" /boot/config.txt G_CONFIG_INJECT 'framebuffer_height=' "framebuffer_height=$framebuffer_y" /boot/config.txt G_CONFIG_INJECT 'SOFTWARE_CHROMIUM_RES_X=' "SOFTWARE_CHROMIUM_RES_X=$framebuffer_x" /boot/dietpi.txt @@ -1064,7 +1066,7 @@ Re-enabling HDMI requires a reboot. If you need emergency HDMI output, edit the local toggle='enable' [[ ${aSTATE[${G_WHIP_RETURNED_VALUE%% *}]} == 'On' ]] && toggle='disable' - /boot/dietpi/func/dietpi-set_hardware serialconsole $toggle "${G_WHIP_RETURNED_VALUE%% *}" + /boot/dietpi/func/dietpi-set_hardware serialconsole "$toggle" "${G_WHIP_RETURNED_VALUE%% *}" fi @@ -1134,6 +1136,7 @@ Re-enabling HDMI requires a reboot. If you need emergency HDMI output, edit the if dpkg -s 'rpi-eeprom' &> /dev/null; then rpi-eeprom-update -m version_eeprom + # shellcheck disable=SC1091 . ./version_eeprom rm version_eeprom G_WHIP_MENU_ARRAY+=('Update RPi4 EEPROM firmware' ": [Bootloader: ${BOOTLOADER_CURRENT:-N/A} | VL805: ${VL805_CURRENT:-N/A}]") @@ -1340,15 +1343,15 @@ Further information: https://www.raspberrypi.org/documentation/hardware/raspberr # All devices local current_cpu_governor='N/A' local fp_current_cpu_governor='/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor' - [[ -f $fp_current_cpu_governor ]] && current_cpu_governor=$(<$fp_current_cpu_governor) + [[ -f $fp_current_cpu_governor ]] && current_cpu_governor=$(<"$fp_current_cpu_governor") local frequency_min_cpu_governor='N/A' local fp_frequency_min_cpu_governor='/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq' - [[ -f $fp_frequency_min_cpu_governor ]] && frequency_min_cpu_governor=$(( $(<$fp_frequency_min_cpu_governor) / 1000 )) + [[ -f $fp_frequency_min_cpu_governor ]] && frequency_min_cpu_governor=$(( $(<"$fp_frequency_min_cpu_governor") / 1000 )) local frequency_max_cpu_governor='N/A' local fp_frequency_max_cpu_governor='/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq' - [[ -f $fp_frequency_max_cpu_governor ]] && frequency_max_cpu_governor=$(( $(<$fp_frequency_max_cpu_governor) / 1000 )) + [[ -f $fp_frequency_max_cpu_governor ]] && frequency_max_cpu_governor=$(( $(<"$fp_frequency_max_cpu_governor") / 1000 )) local cpu_temp=$(G_OBTAIN_CPU_TEMP) local cpu_temp_f='N/A' @@ -1464,7 +1467,7 @@ Further information: https://www.raspberrypi.org/documentation/hardware/raspberr MIN_VALUE=1 MAX_VALUE=200 G_WHIP_DEFAULT_ITEM=$current_cpu_down_factor if G_WHIP_INPUTBOX "After Ondemand throttles up, how long before the next sample to check if CPU clocks can be reduced.\n\n - This value * 'Ondemand Sample Rate' = total miliseconds\n - Lower values may help reduce power consumption, however, a 500-1000ms value is recommended to prevent excessive sampling.\n - Valid range: $MIN_VALUE - $MAX_VALUE\n -If unsure, set any value, 'Ondemand Down Factor' option on the next screen will list the calculated miliseconds." && G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" $MIN_VALUE $MAX_VALUE; then +If unsure, set any value, 'Ondemand Down Factor' option on the next screen will list the calculated miliseconds." && G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" "$MIN_VALUE" "$MAX_VALUE"; then G_CONFIG_INJECT 'CONFIG_CPU_ONDEMAND_SAMPLE_DOWNFACTOR=' "CONFIG_CPU_ONDEMAND_SAMPLE_DOWNFACTOR=$G_WHIP_RETURNED_VALUE" /boot/dietpi.txt /boot/dietpi/func/dietpi-set_cpu @@ -1504,7 +1507,7 @@ If unsure, set any value, 'Ondemand Down Factor' option on the next screen will MAX_VALUE=300 G_WHIP_DEFAULT_ITEM=$current_cpu_sample_rate if G_WHIP_INPUTBOX "Please enter a sample rate in milliseconds, for Ondemand to check if it needs to increase CPU clocks.\nA lower value will make the system more responsive. - - Valid range: $MIN_VALUE - $MAX_VALUE" && G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" $MIN_VALUE $MAX_VALUE; then + - Valid range: $MIN_VALUE - $MAX_VALUE" && G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" "$MIN_VALUE" "$MAX_VALUE"; then G_CONFIG_INJECT 'CONFIG_CPU_ONDEMAND_SAMPLE_RATE=' "CONFIG_CPU_ONDEMAND_SAMPLE_RATE=$(( $G_WHIP_RETURNED_VALUE * 1000 ))" /boot/dietpi.txt /boot/dietpi/func/dietpi-set_cpu @@ -1597,43 +1600,43 @@ Current setting: $user_frequency_min_text" && G_CONFIG_INJECT 'CONFIG_CPU_MIN_FR local Description='CPU Governor: https://www.kernel.org/doc/html/latest/admin-guide/pm/cpufreq.html#generic-scaling-governors' G_WHIP_MENU_ARRAY=() - if grep -qi 'schedutil' $fp_governor; then + if grep -qi 'schedutil' "$fp_governor"; then G_WHIP_MENU_ARRAY+=('schedutil' ": Scales CPU frequency between $frequency_min_cpu_governor MHz and $frequency_max_cpu_governor MHz") Description+='\nSchedutil | Dynamic CPU frequency based on CPU scheduler metrics (recommended on modern kernels)' fi - if grep -qi 'ondemand' $fp_governor; then + if grep -qi 'ondemand' "$fp_governor"; then G_WHIP_MENU_ARRAY+=('ondemand' ": Scales CPU frequency between $frequency_min_cpu_governor MHz and $frequency_max_cpu_governor MHz") Description+='\nOndemand | Dynamic CPU frequency based on usage (recommended on older kernels)' fi - if grep -qi 'interactive' $fp_governor; then + if grep -qi 'interactive' "$fp_governor"; then G_WHIP_MENU_ARRAY+=('interactive' ": Scales CPU frequency between $frequency_min_cpu_governor MHz and $frequency_max_cpu_governor MHz") Description+='\nInteractive | Same as ondemand. Bias towards low latency, faster scaling' fi - if grep -qi 'conservative' $fp_governor; then + if grep -qi 'conservative' "$fp_governor"; then G_WHIP_MENU_ARRAY+=('conservative' ": Scales CPU frequency between $frequency_min_cpu_governor MHz and $frequency_max_cpu_governor MHz") Description+='\nConservative | Same as ondemand. Bias towards powersaving, slower scaling' fi - if grep -qi 'powersave' $fp_governor; then + if grep -qi 'powersave' "$fp_governor"; then G_WHIP_MENU_ARRAY+=('powersave' ": Limits CPU frequency to $frequency_min_cpu_governor MHz") Description+='\nPowersave | Static. Reduces energy consumption, heat, performance' fi - if grep -qi 'performance' $fp_governor; then + if grep -qi 'performance' "$fp_governor"; then G_WHIP_MENU_ARRAY+=('performance' ": Forces CPU frequency to $frequency_max_cpu_governor MHz") Description+='\nPerformance | Static. Increases energy consumption, heat, performance' fi - if grep -qi 'userspace' $fp_governor; then + if grep -qi 'userspace' "$fp_governor"; then G_WHIP_MENU_ARRAY+=('userspace' ": No-op governor, allows setting frequency manually") Description+='\nUserspace | No-op. Governor does not touch CPU frequency at all' @@ -1656,7 +1659,7 @@ Current setting: $user_frequency_min_text" && G_CONFIG_INJECT 'CONFIG_CPU_MIN_FR MIN_VALUE=30 MAX_VALUE=95 G_WHIP_DEFAULT_ITEM=$current_cpu_throttle_up if G_WHIP_INPUTBOX "When the CPU usage (%) is greater than this value, the CPU frequency will increase from $frequency_min_cpu_governor MHz to $frequency_max_cpu_governor MHz. - - Valid range: $MIN_VALUE - $MAX_VALUE\n - Recommended settings: Desktop = 50%, Server = 85%" && G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" $MIN_VALUE $MAX_VALUE; then + - Valid range: $MIN_VALUE - $MAX_VALUE\n - Recommended settings: Desktop = 50%, Server = 85%" && G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" "$MIN_VALUE" "$MAX_VALUE"; then G_CONFIG_INJECT 'CONFIG_CPU_USAGE_THROTTLE_UP=' "CONFIG_CPU_USAGE_THROTTLE_UP=$G_WHIP_RETURNED_VALUE" /boot/dietpi.txt /boot/dietpi/func/dietpi-set_cpu @@ -1670,7 +1673,7 @@ Current setting: $user_frequency_min_text" && G_CONFIG_INJECT 'CONFIG_CPU_MIN_FR MIN_VALUE=45 MAX_VALUE=85 G_WHIP_DEFAULT_ITEM=$temp_limit if G_WHIP_INPUTBOX "When the ARM temperature ('c) reaches this value, the ARM will underclock to reduce heat. - - Recommended value: 65\n - Valid range: $MIN_VALUE - $MAX_VALUE" && G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" $MIN_VALUE $MAX_VALUE; then + - Recommended value: 65\n - Valid range: $MIN_VALUE - $MAX_VALUE" && G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" "$MIN_VALUE" "$MAX_VALUE"; then (( $G_WHIP_RETURNED_VALUE > 75 )) && G_WHIP_MSG "Higher operating temperatures will reduce the life of your ARM SoC. Heat also dissipates through the PCB into other components, decreasing the lifespan of the whole device. Use at your own risk.\n\nDietPi recommends 65'c as a safe value (75'c for RPi 3/4).\n\nMore info: https://github.com/MichaIng/DietPi/issues/356" G_CONFIG_INJECT 'temp_limit=' "temp_limit=$G_WHIP_RETURNED_VALUE" /boot/config.txt && REBOOT_REQUIRED=1 @@ -1687,7 +1690,7 @@ Current setting: $user_frequency_min_text" && G_CONFIG_INJECT 'CONFIG_CPU_MIN_FR - Current value: $arm_freq_min\n - Recommended value: 300\n - Minimum value: $MIN_VALUE - Default value: $DEF_VALUE\n - Setting a value below the minimum will reset to RPi defaults."; then - if disable_error=1 G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" $MIN_VALUE; then + if disable_error=1 G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" "$MIN_VALUE"; then G_CONFIG_INJECT 'arm_freq_min=' "arm_freq_min=$G_WHIP_RETURNED_VALUE" /boot/config.txt @@ -1709,7 +1712,7 @@ Current setting: $user_frequency_min_text" && G_CONFIG_INJECT 'CONFIG_CPU_MIN_FR if G_WHIP_INPUTBOX "Amount of seconds on boot, where the CPU runs at highest clock, before it starts to respect the CPU governor. This reduces boot time quite much since RPi boots with powersave governor until the chosen one is applied at later boot stage. - Recommended value: 20\n - Valid range: $MIN_VALUE - $MAX_VALUE\n - Setting a value outside of range will disable this feature."; then - if disable_error=1 G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" $MIN_VALUE $MAX_VALUE; then + if disable_error=1 G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" "$MIN_VALUE" "$MAX_VALUE"; then G_CONFIG_INJECT 'initial_turbo=' "initial_turbo=$G_WHIP_RETURNED_VALUE" /boot/config.txt @@ -1724,6 +1727,8 @@ Current setting: $user_frequency_min_text" && G_CONFIG_INJECT 'CONFIG_CPU_MIN_FR ;; + *) G_DIETPI-NOTIFY 1 'An invalid "case" option was used. This is a bug, please report at: https://github.com/MichaIng/DietPi/issues'; exit 1;; + esac fi @@ -1835,6 +1840,7 @@ Current setting: $user_frequency_min_text" && G_CONFIG_INJECT 'CONFIG_CPU_MIN_FR 'Headless') /boot/dietpi/func/dietpi-set_hardware headless 1 && REBOOT_REQUIRED=1;; 'Default') /boot/dietpi/func/dietpi-set_hardware headless 0 && REBOOT_REQUIRED=1;; + *) G_DIETPI-NOTIFY 1 'An invalid "case" option was used. This is a bug, please report at: https://github.com/MichaIng/DietPi/issues'; exit 1;; esac @@ -1902,6 +1908,8 @@ Current setting: $user_frequency_min_text" && G_CONFIG_INJECT 'CONFIG_CPU_MIN_FR ;; + *) G_DIETPI-NOTIFY 1 'An invalid "case" option was used. This is a bug, please report at: https://github.com/MichaIng/DietPi/issues'; exit 1;; + esac else @@ -2370,7 +2378,7 @@ NB: All Ethernet connections will be dropped!' && Network_ApplyChanges fi (( $i < 3 )) && mask+=. done - echo $mask + echo "$mask" } # Eth @@ -2642,6 +2650,8 @@ NB: All Ethernet connections will be dropped!' && Network_ApplyChanges ;; + *) :;; + esac # Cancel @@ -2774,6 +2784,8 @@ NB: Auto-negotiation is highly recommended as long as you do not have issues wit ;; + *) :;; + esac fi @@ -2926,21 +2938,18 @@ NB: Auto-negotiation is highly recommended as long as you do not have issues wit WiFi_Monitor_Enable fi - ;; 'Key') G_WHIP_DEFAULT_ITEM=$HOTSPOT_KEY G_WHIP_INPUTBOX 'Please enter a key/password for the WiFi hotspot\n - NB: Minimum of 8 characters' && HOTSPOT_KEY=$G_WHIP_RETURNED_VALUE - ;; 'SSID') G_WHIP_DEFAULT_ITEM=$HOTSPOT_SSID G_WHIP_INPUTBOX 'Please enter a SSID for the WiFi hotspot' && HOTSPOT_SSID=$G_WHIP_RETURNED_VALUE - ;; 'Channel') @@ -2958,21 +2967,15 @@ NB: Auto-negotiation is highly recommended as long as you do not have issues wit G_WHIP_DEFAULT_ITEM=$HOTSPOT_CHANNEL G_WHIP_MENU 'Please select a WiFi channel for the hotspot.' && HOTSPOT_CHANNEL=$G_WHIP_RETURNED_VALUE - ;; '802.11 N') (( $hotspot_n_enabled )) && hotspot_n_enabled=0 || hotspot_n_enabled=1 G_CONFIG_INJECT 'ieee80211n=' "ieee80211n=$hotspot_n_enabled" /etc/hostapd/hostapd.conf - ;; - 'Country') - - Change_WifiCountryCode - - ;; + 'Country') Change_WifiCountryCode;; 'Disable') @@ -2981,14 +2984,9 @@ NB: Auto-negotiation is highly recommended as long as you do not have issues wit WiFi_Monitor_Disable Network_ApplyChanges TARGETMENUID=8 # Return to main adapters menu - ;; - 'Scan') - - /boot/dietpi/func/dietpi-wifidb - - ;; + 'Scan') /boot/dietpi/func/dietpi-wifidb;; 'Change Mode') @@ -2999,7 +2997,6 @@ NB: Auto-negotiation is highly recommended as long as you do not have issues wit G_WHIP_MSG 'Information for STATIC IP:\n\nWhen using STATIC IP, please ensure only 1 SSID entry exists in the "Scan" menu. Else, WiFi will most likely fail, and, the IP conflict committee will be displeased ;)' fi - ;; 'Apply') @@ -3024,38 +3021,17 @@ NB: Auto-negotiation is highly recommended as long as you do not have issues wit Wifi_Reconnect fi - - ;; - - 'Copy') - - Network_WIFI_CopyCurrentToStatic - ;; - 'Static IP') + 'Copy') Network_WIFI_CopyCurrentToStatic;; - Change_StaticIp 1 + 'Static IP') Change_StaticIp 1;; - ;; + 'Static Gateway') Change_StaticGateway 1;; - 'Static Gateway') - - Change_StaticGateway 1 - - ;; - - 'Static Mask') + 'Static Mask') Change_StaticMask 1;; - Change_StaticMask 1 - - ;; - - 'Static DNS') - - Change_StaticDns 1 - - ;; + 'Static DNS') Change_StaticDns 1;; 'State') @@ -3068,9 +3044,10 @@ NB: Auto-negotiation is highly recommended as long as you do not have issues wit G_EXEC systemctl start hostapd fi - ;; + *) :;; + esac fi @@ -3093,17 +3070,9 @@ NB: Auto-negotiation is highly recommended as long as you do not have issues wit case "$G_WHIP_RETURNED_VALUE" in - 'Benchmarks') - - TARGETMENUID=12 - - ;; - - 'Stress Test') - - TARGETMENUID=15 - - ;; + 'Benchmarks') TARGETMENUID=12;; + 'Stress Test') TARGETMENUID=15;; + *) G_DIETPI-NOTIFY 1 'An invalid "case" option was used. This is a bug, please report at: https://github.com/MichaIng/DietPi/issues'; exit 1;; esac @@ -3118,6 +3087,7 @@ NB: Auto-negotiation is highly recommended as long as you do not have issues wit # Init/load previous bench results [[ -f '/var/lib/dietpi/dietpi-benchmark/results' ]] || /boot/dietpi/func/dietpi-benchmark 0 + # shellcheck disable=SC1091 . /var/lib/dietpi/dietpi-benchmark/results # Sanity for beta testing. As this value won't exist until re-save of /var/lib/dietpi/dietpi-benchmark/results @@ -3134,7 +3104,8 @@ NB: Auto-negotiation is highly recommended as long as you do not have issues wit ) G_WHIP_DEFAULT_ITEM='DietPi-Benchmark' - if G_WHIP_MENU "\ + # shellcheck disable=SC2154 + G_WHIP_MENU "\ DietPi-Benchmark | https://dietpi.com/survey#benchmark : - CPU Performance : Duration = $BENCH_CPU seconds (lower is faster) - CPU Temp : Idle = ${BENCH_CPU_TEMP_START}'c | Full load = ${BENCH_CPU_TEMP_END}'c @@ -3143,59 +3114,53 @@ DietPi-Benchmark | https://dietpi.com/survey#benchmark : Additional benchmarks: - Custom Filesystem : Write = $BENCH_CUSTOMFS_WRITE MB/s | Read = $BENCH_CUSTOMFS_READ MB/s - - Network LAN : Transfer rate = $BENCH_NET_LAN_SPEED MB/s"; then + - Network LAN : Transfer rate = $BENCH_NET_LAN_SPEED MB/s" || return 0 - TARGETMENUID=12 # Return to this menu + TARGETMENUID=12 # Return to this menu - case "$G_WHIP_RETURNED_VALUE" in - - 'DietPi-Benchmark') + case "$G_WHIP_RETURNED_VALUE" in - /boot/dietpi/func/dietpi-benchmark 2 + 'DietPi-Benchmark') /boot/dietpi/func/dietpi-benchmark 2;; - ;; + 'Network LAN') - 'Network LAN') - - G_WHIP_MENU_ARRAY=( - - 'Server' ': Run this device as the server' - 'Client' ': Connect to an existing server, to begin the test' + G_WHIP_MENU_ARRAY=( - ) + 'Server' ': Run this device as the server' + 'Client' ': Connect to an existing server, to begin the test' - if G_WHIP_MENU 'Please select an option:\n\n - Server: Run a server on the current device. Another system can then use the "Client" option to connect and begin the test.\n\n - Client: Connect to an existing server and begin the test.'; then + ) - if [[ $G_WHIP_RETURNED_VALUE == 'Server' ]]; then + if G_WHIP_MENU 'Please select an option:\n\n - Server: Run a server on the current device. Another system can then use the "Client" option to connect and begin the test.\n\n - Client: Connect to an existing server and begin the test.'; then - /boot/dietpi/func/dietpi-benchmark 3 + if [[ $G_WHIP_RETURNED_VALUE == 'Server' ]]; then - elif [[ $G_WHIP_RETURNED_VALUE == 'Client' ]]; then + /boot/dietpi/func/dietpi-benchmark 3 - /boot/dietpi/func/dietpi-benchmark 4 + elif [[ $G_WHIP_RETURNED_VALUE == 'Client' ]]; then - fi + /boot/dietpi/func/dietpi-benchmark 4 fi - ;; + fi + ;; - 'Custom Filesystem') + 'Custom Filesystem') - /boot/dietpi/dietpi-drive_manager 1 - local fp_fsbench_custom_mount=$( $fp_log + > "$fp_log" # Check if system supports temp readouts local cpu_supports_temp=0 cpu_temp=$(G_OBTAIN_CPU_TEMP) @@ -3884,7 +3856,7 @@ Additional benchmarks: fi log_text+=" | $(( $STRESS_TEST_DURATION + $start_time_epoch - $(date '+%s') )) seconds remaining" echo "$log_text" - echo "$log_text" > $fp_log + echo "$log_text" > "$fp_log" sleep 1 done @@ -3952,7 +3924,7 @@ Additional benchmarks: local min=0 max=60 G_WHIP_DEFAULT_ITEM=$check_url_timeout if G_WHIP_INPUTBOX "This setting tells DietPi how long to wait, before DietPi-internal connection and URL checks assume a dead connection attempt (and failure).\nIncrease this value if you have a 'flaky' connection.\n -Please enter a value in seconds between $min and $max. \"0\" means unlimited, however this is not recommended to avoid unlimited background job hang." && G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" $min $max; then +Please enter a value in seconds between $min and $max. \"0\" means unlimited, however this is not recommended to avoid unlimited background job hang." && G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" "$min" "$max"; then G_CONFIG_INJECT 'CONFIG_G_CHECK_URL_TIMEOUT=' "CONFIG_G_CHECK_URL_TIMEOUT=$G_WHIP_RETURNED_VALUE" /boot/dietpi.txt @@ -3965,7 +3937,7 @@ Please enter a value in seconds between $min and $max. \"0\" means unlimited, ho local min=1 max=10 G_WHIP_DEFAULT_ITEM=$check_url_attempts if G_WHIP_INPUTBOX "This setting tells DietPi how many times to test a connection or URL, before assuming a dead connection or URL link (and failure).\nIncrease this value if you have a 'flaky' connection.\n -Please enter a value between $min and $max." && G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" $min $max; then +Please enter a value between $min and $max." && G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" "$min" "$max"; then G_CONFIG_INJECT 'CONFIG_G_CHECK_URL_ATTEMPTS=' "CONFIG_G_CHECK_URL_ATTEMPTS=$G_WHIP_RETURNED_VALUE" /boot/dietpi.txt @@ -4101,18 +4073,17 @@ NB: If you need to use *.pool.ntp.org servers, enter the base domain only. The s 'Dynamic DNS') /boot/dietpi/dietpi-ddns;; + *) :;; + esac # Cancel else # Exit DietPi-Config on back to previous menu? - if (( $EXITONBACK == 1 )); then - - TARGETMENUID=16 # Return to this menu - Menu_Exit - - fi + (( $EXITONBACK == 1 )) || return 0 + TARGETMENUID=16 # Return to this menu + Menu_Exit fi @@ -4133,6 +4104,7 @@ NB: If you need to use *.pool.ntp.org servers, enter the base domain only. The s if [[ -f '/etc/bashrc.d/dietpi-proxy.sh' ]]; then PROXY_ENABLED=1 + # shellcheck disable=SC1091 . /etc/bashrc.d/dietpi-proxy.sh else @@ -4187,18 +4159,13 @@ NB: If you need to use *.pool.ntp.org servers, enter the base domain only. The s case "$G_WHIP_RETURNED_VALUE" in - 'State') - - (( $PROXY_ENABLED )) && PROXY_ENABLED=0 || PROXY_ENABLED=1 - - ;; + 'State') (( $PROXY_ENABLED )) && PROXY_ENABLED=0 || PROXY_ENABLED=1;; 'Address') G_WHIP_DEFAULT_ITEM=$PROXY_ADDRESS G_WHIP_INPUTBOX 'Please enter the proxy URL or IP address\n - eg: MyProxy.com' && PROXY_ADDRESS=$G_WHIP_RETURNED_VALUE G_CONFIG_INJECT 'CONFIG_PROXY_ADDRESS=' "CONFIG_PROXY_ADDRESS=$PROXY_ADDRESS" /boot/dietpi.txt - ;; 'Port') @@ -4206,7 +4173,6 @@ NB: If you need to use *.pool.ntp.org servers, enter the base domain only. The s G_WHIP_DEFAULT_ITEM=$PROXY_PORT G_WHIP_INPUTBOX 'Please enter the proxy port number\n - eg: 1234' && PROXY_PORT=$G_WHIP_RETURNED_VALUE G_CONFIG_INJECT 'CONFIG_PROXY_PORT=' "CONFIG_PROXY_PORT=$PROXY_PORT" /boot/dietpi.txt - ;; 'Username') @@ -4214,7 +4180,6 @@ NB: If you need to use *.pool.ntp.org servers, enter the base domain only. The s G_WHIP_DEFAULT_ITEM=$PROXY_USERNAME G_WHIP_INPUTBOX 'Please enter the proxy username\n - eg: JoeBloggs\n - Leave blank if not required' && PROXY_USERNAME=$G_WHIP_RETURNED_VALUE G_CONFIG_INJECT 'CONFIG_PROXY_USERNAME=' "CONFIG_PROXY_USERNAME=$PROXY_USERNAME" /boot/dietpi.txt - ;; 'Password') @@ -4222,9 +4187,10 @@ NB: If you need to use *.pool.ntp.org servers, enter the base domain only. The s G_WHIP_DEFAULT_ITEM=$PROXY_PASSWORD G_WHIP_INPUTBOX 'Please enter the proxy password\n - eg: LetMeIn\n - Leave blank if not required' && PROXY_PASSWORD=$G_WHIP_RETURNED_VALUE G_CONFIG_INJECT 'CONFIG_PROXY_PASSWORD=' "CONFIG_PROXY_PASSWORD=$PROXY_PASSWORD" /boot/dietpi.txt - ;; + *) G_DIETPI-NOTIFY 1 'An invalid "case" option was used. This is a bug, please report at: https://github.com/MichaIng/DietPi/issues'; exit 1;; + esac # Add export settings diff --git a/dietpi/dietpi-cpuinfo b/dietpi/dietpi-cpuinfo index 811ceab547..3ae61c2c00 100755 --- a/dietpi/dietpi-cpuinfo +++ b/dietpi/dietpi-cpuinfo @@ -145,17 +145,17 @@ Obtain_Cpu_Scaling_Freq # Export to file - > $FP_CPU_SCALINGAVAILABLE_FREQ + > "$FP_CPU_SCALINGAVAILABLE_FREQ" if (( $CPU_SCALINGSUPPORTED )); then for i in "${aCPU_SCALINGAVAILABLE_FREQ[@]}" do - echo "$i" >> $FP_CPU_SCALINGAVAILABLE_FREQ + echo "$i" >> "$FP_CPU_SCALINGAVAILABLE_FREQ" done # Order, remove dupes - sort -u -n $FP_CPU_SCALINGAVAILABLE_FREQ -o $FP_CPU_SCALINGAVAILABLE_FREQ + sort -u -n "$FP_CPU_SCALINGAVAILABLE_FREQ" -o "$FP_CPU_SCALINGAVAILABLE_FREQ" fi diff --git a/dietpi/dietpi-cron b/dietpi/dietpi-cron index 91cdb29d78..b1026dbd95 100755 --- a/dietpi/dietpi-cron +++ b/dietpi/dietpi-cron @@ -106,7 +106,7 @@ _EOF_ if G_WHIP_INPUTBOX "Please enter the execution interval in minutes:\n - Valid range: $min - $max - Enter \"0\" to disable this job."; then - G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" $min $max && value=$G_WHIP_RETURNED_VALUE + G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" "$min" "$max" && value=$G_WHIP_RETURNED_VALUE fi @@ -121,7 +121,7 @@ _EOF_ G_WHIP_DEFAULT_ITEM=$value if G_WHIP_INPUTBOX "Please enter the execution minute:\n - Valid range: $min - $max"; then - G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" $min $max && value=$G_WHIP_RETURNED_VALUE + G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" "$min" "$max" && value=$G_WHIP_RETURNED_VALUE fi @@ -136,7 +136,7 @@ _EOF_ G_WHIP_DEFAULT_ITEM=$value if G_WHIP_INPUTBOX "Please enter the execution hour in 24h format:\n - Valid range: $min - $max"; then - G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" $min $max && value=$G_WHIP_RETURNED_VALUE + G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" "$min" "$max" && value=$G_WHIP_RETURNED_VALUE fi @@ -175,7 +175,7 @@ _EOF_ G_WHIP_DEFAULT_ITEM=$value if G_WHIP_INPUTBOX "Please enter the execution day of month:\n - Valid range: $min - $max"; then - G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" $min $max && value=$G_WHIP_RETURNED_VALUE + G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" "$min" "$max" && value=$G_WHIP_RETURNED_VALUE fi @@ -252,7 +252,6 @@ _EOF_ 'cron.monthly' ": Every $monthly_dom day of month at $monthly_time" '' '●─ Save changes ' 'Apply' ': Save and apply above cron settings' - ) G_WHIP_DEFAULT_ITEM=$PREVIOUS_MENU_SELECTION @@ -264,53 +263,50 @@ _EOF_ case "$G_WHIP_RETURNED_VALUE" in - 'Mailto') - - Input_Mailto "$MAILTO" - ;; + 'Mailto') Input_Mailto "$MAILTO";; 'cron.minutely') - Input_Minutely_Minute ${aCRON_TIME[9]} + Input_Minutely_Minute "${aCRON_TIME[9]}" aCRON_TIME[9]=$? ;; 'cron.hourly') - Input_Minute ${aCRON_TIME[0]} + Input_Minute "${aCRON_TIME[0]}" aCRON_TIME[0]=$? ;; 'cron.daily') - Input_Hour ${aCRON_TIME[2]} + Input_Hour "${aCRON_TIME[2]}" aCRON_TIME[2]=$? - Input_Minute ${aCRON_TIME[1]} + Input_Minute "${aCRON_TIME[1]}" aCRON_TIME[1]=$? ;; 'cron.weekly') - Input_DayOfWeek ${aCRON_TIME[5]} + Input_DayOfWeek "${aCRON_TIME[5]}" aCRON_TIME[5]=$? - Input_Hour ${aCRON_TIME[4]} + Input_Hour "${aCRON_TIME[4]}" aCRON_TIME[4]=$? - Input_Minute ${aCRON_TIME[3]} + Input_Minute "${aCRON_TIME[3]}" aCRON_TIME[3]=$? ;; 'cron.monthly') - Input_DayOfMonth ${aCRON_TIME[8]} + Input_DayOfMonth "${aCRON_TIME[8]}" aCRON_TIME[8]=$? - Input_Hour ${aCRON_TIME[7]} + Input_Hour "${aCRON_TIME[7]}" aCRON_TIME[7]=$? - Input_Minute ${aCRON_TIME[6]} + Input_Minute "${aCRON_TIME[6]}" aCRON_TIME[6]=$? ;; @@ -320,6 +316,8 @@ _EOF_ G_WHIP_MSG 'Cron start times have been saved and applied.' ;; + *) :;; + esac else diff --git a/dietpi/dietpi-ddns b/dietpi/dietpi-ddns index 44e1cdf6c1..f920cc6262 100755 --- a/dietpi/dietpi-ddns +++ b/dietpi/dietpi-ddns @@ -401,6 +401,7 @@ Menu_Main() 'Timespan') Menu_Timespan;; 'Apply') Apply;; 'Remove') Remove;; + *) :;; esac return 0 diff --git a/dietpi/dietpi-drive_manager b/dietpi/dietpi-drive_manager index 5c694c6026..d8b7cdc9b6 100755 --- a/dietpi/dietpi-drive_manager +++ b/dietpi/dietpi-drive_manager @@ -105,7 +105,7 @@ # Create tmp fstab local fp_fstab_tmp='.fstab' - cp -a /etc/fstab $fp_fstab_tmp + cp -a /etc/fstab "$fp_fstab_tmp" # Special mounts local swap_mounts tmpfs_mounts misc_mounts net_mounts @@ -120,12 +120,12 @@ tmpfs /var/log tmpfs size=${var_log_size:-50}M,noatime,lazytime,nodev,nosuid,mod # Else: Grab current mounts else - swap_mounts=$(grep '^[[:blank:]]*[^#].*[[:blank:]]swap[[:blank:]]' $fp_fstab_tmp) - tmpfs_mounts=$(grep '^[[:blank:]]*tmpfs[[:blank:]]' $fp_fstab_tmp) + swap_mounts=$(grep '^[[:blank:]]*[^#].*[[:blank:]]swap[[:blank:]]' "$fp_fstab_tmp") + tmpfs_mounts=$(grep '^[[:blank:]]*tmpfs[[:blank:]]' "$fp_fstab_tmp") # ecryptfs, vboxsf, glusterfs, bind, Btrfs subvolume mounts - misc_mounts=$(grep -E '^[[:blank:]]*[^#].*([[:blank:]](ecryptfs|vboxsf|glusterfs)[[:blank:]]|[[:blank:],]bind[[:blank:],]|[[:blank:]]btrfs[[:blank:]]+(.+,)?subvol=)' $fp_fstab_tmp) + misc_mounts=$(grep -E '^[[:blank:]]*[^#].*([[:blank:]](ecryptfs|vboxsf|glusterfs)[[:blank:]]|[[:blank:],]bind[[:blank:],]|[[:blank:]]btrfs[[:blank:]]+(.+,)?subvol=)' "$fp_fstab_tmp") # CurlFtpFS, CIFS/SMB/Samba, NFS, SSHFS - net_mounts=$(grep -E '^[[:blank:]]*(curlftpfs|sshfs#|[^#].*[[:blank:]](cifs|nfs4?|fuse.sshfs)[[:blank:]])' $fp_fstab_tmp) + net_mounts=$(grep -E '^[[:blank:]]*(curlftpfs|sshfs#|[^#].*[[:blank:]](cifs|nfs4?|fuse.sshfs)[[:blank:]])' "$fp_fstab_tmp") fi @@ -153,7 +153,7 @@ $swap_mounts #---------------------------------------------------------------- # PHYSICAL DRIVES -#----------------------------------------------------------------" > $fp_fstab_tmp +#----------------------------------------------------------------" > "$fp_fstab_tmp" G_DIETPI-NOTIFY 2 'Detecting drives, please wait...' @@ -269,7 +269,7 @@ $swap_mounts fi - echo "$dev_entry ${aDRIVE_MOUNT_TARGET[$index]} ${aDRIVE_FSTYPE[$index]:-auto} noatime,lazytime$options" >> $fp_fstab_tmp + echo "$dev_entry ${aDRIVE_MOUNT_TARGET[$index]} ${aDRIVE_FSTYPE[$index]:-auto} noatime,lazytime$options" >> "$fp_fstab_tmp" fi @@ -328,7 +328,7 @@ $swap_mounts done < <(lsblk -nro NAME | sed '/^mtdblock[0-9]/d') # Set required global flags and deps for all drives found - local need_ext need_ntfs need_hfs need_exfat + local deps=() for i in "${!aDRIVE_MOUNT_SOURCE[@]}" do # Detect and set ROM drives @@ -337,15 +337,15 @@ $swap_mounts # Collect required APT packages for FS R/W access if [[ ${aDRIVE_FSTYPE[$i]} == 'ext'[2-4] ]]; then - need_ext='e2fsprogs' + deps+=('e2fsprogs') elif [[ ${aDRIVE_FSTYPE[$i]} == 'ntfs' ]]; then - need_ntfs='ntfs-3g' + deps+=('ntfs-3g') elif [[ ${aDRIVE_FSTYPE[$i]} =~ 'hfs' ]]; then - need_hfs='hfsplus' + deps+=('hfsplus') elif [[ ${aDRIVE_FSTYPE[$i]} == 'exfat' ]]; then @@ -355,7 +355,7 @@ $swap_mounts dpkg-query -s 'exfat-fuse' &> /dev/null && G_AGP exfat-fuse [[ -L '/sbin/mount.exfat' && ! -e '/sbin/mount.exfat' ]] && G_EXEC rm /sbin/mount.exfat else - need_exfat='exfat-fuse' + deps+=('exfat-fuse') fi fi @@ -364,20 +364,20 @@ $swap_mounts # Remove x-systemd.automount if not supported by kernel: https://github.com/MichaIng/DietPi/issues/1607#issuecomment-372030565 if ! modprobe -nq autofs4 then - sed -Ei '/x-systemd\.automount/s/,(noauto|x-systemd\.automount)//g' $fp_fstab_tmp + sed -Ei '/x-systemd\.automount/s/,(noauto|x-systemd\.automount)//g' "$fp_fstab_tmp" G_DIETPI-NOTIFY 2 'autofs4 module not available in kernel, x-systemd.automount has been disabled, all drives will be mounted at boot instead' fi Update_Menu_Drive_Index # Move new fstab in place and reload systemd generators - G_EXEC mv $fp_fstab_tmp /etc/fstab + 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_ext$need_ntfs$need_hfs$need_exfat ]] && G_AG_CHECK_INSTALL_PREREQ $need_ext $need_ntfs $need_hfs $need_exfat && APT_CHECK=1 + [[ $APT_CHECK == 0 && ${deps[0]} ]] && G_AG_CHECK_INSTALL_PREREQ "${deps[@]}" && APT_CHECK=1 # Workaround for exfat-fuse on Bullseye: https://github.com/MichaIng/DietPi/issues/5166 - [[ $need_exfat && $G_DISTRO -ge 6 && ! -e '/sbin/mount.exfat' ]] && G_EXEC ln -sf mount.exfat-fuse /sbin/mount.exfat + [[ $G_DISTRO -ge 6 && -e '/sbin/mount.exfat-fuse' && ! -e '/sbin/mount.exfat' ]] && G_EXEC ln -sf mount.exfat-fuse /sbin/mount.exfat G_EXEC sync @@ -589,7 +589,7 @@ Do you wish to ignore this warning, and, mount the drive regardless?" || return (( $FORMAT_GPT )) || parition_table_type='msdos' G_DIETPI-NOTIFY 2 "Creating partition table, with target type: $parition_table_type" - 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]}" 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]}" @@ -933,7 +933,7 @@ Do you wish to ignore this warning, and, mount the drive regardless?" || return (( $G_DISTRO > 5 )) && spindown_setting='force_spindown_time' G_DIETPI-NOTIFY 2 'Applying spindown timeout to all drives now...' - hdparm -B $apm -S "$G_WHIP_RETURNED_VALUE" /dev/[sh]d[a-z] + hdparm -B "$apm" -S "$G_WHIP_RETURNED_VALUE" /dev/[sh]d[a-z] G_DIETPI-NOTIFY 2 'Applying spindown timeout to /etc/hdparm.conf to be effective from next boot on...' echo -e "apm = $apm\n$spindown_setting = $G_WHIP_RETURNED_VALUE" > /etc/hdparm.conf @@ -1230,7 +1230,7 @@ Please choose another drive or format this one with another filesystem, e.g. ext \nSwap file has a swappiness 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 + if G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" "$min" "$max"; then local fp_target_swapfile="${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]}/.swapfile" [[ ${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]} == '/' ]] && fp_target_swapfile='/var/swap' @@ -1497,7 +1497,7 @@ Please choose another drive or format this one with another filesystem, e.g. ext elif [[ $G_WHIP_RETURNED_VALUE == 'I/O Scheduler' ]]; then local udev_rules='/etc/udev/rules.d/99-dietpi-io_schedulers.rules' - [[ -f $udev_rules ]] && grep -q "KERNEL==\"${aDRIVE_SOURCE_DEVICE[$MENU_DRIVE_INDEX]}\"" $udev_rules && G_WHIP_MENU_ARRAY=('Reset' ': Reset to system defaults') || G_WHIP_MENU_ARRAY=() + [[ -f $udev_rules ]] && grep -q "KERNEL==\"${aDRIVE_SOURCE_DEVICE[$MENU_DRIVE_INDEX]}\"" "$udev_rules" && G_WHIP_MENU_ARRAY=('Reset' ': Reset to system defaults') || G_WHIP_MENU_ARRAY=() for i in "${aio_schedulers[@]}"; do G_WHIP_MENU_ARRAY+=("$i"); done G_WHIP_DEFAULT_ITEM=$io_scheduler_current if G_WHIP_MENU "Please select an I/O scheduler.\n @@ -1507,14 +1507,14 @@ Read more about I/O scheduling: https://wiki.archlinux.org/index.php/Improving_p if [[ $G_WHIP_RETURNED_VALUE == 'Reset' ]]; then - sed -i "/KERNEL==\"${aDRIVE_SOURCE_DEVICE[$MENU_DRIVE_INDEX]}\"/d" $udev_rules - grep -q '^ACTION' $udev_rules || rm $udev_rules + sed -i "/KERNEL==\"${aDRIVE_SOURCE_DEVICE[$MENU_DRIVE_INDEX]}\"/d" "$udev_rules" + grep -q '^ACTION' "$udev_rules" || rm "$udev_rules" G_WHIP_YESNO '[ INFO ] A reboot is required to reset the I/O scheduler to default.\n\nDo you wish to reboot now?' && reboot else - [[ -f $udev_rules ]] || echo '# Please run "dietpi-drive_manager" to adjust I/O schedulers' > $udev_rules - G_CONFIG_INJECT "ACTION==\"add\|change\", KERNEL==\"${aDRIVE_SOURCE_DEVICE[$MENU_DRIVE_INDEX]}\"" "ACTION==\"add|change\", KERNEL==\"${aDRIVE_SOURCE_DEVICE[$MENU_DRIVE_INDEX]}\", ATTR{queue/scheduler}=\"$G_WHIP_RETURNED_VALUE\"" $udev_rules + [[ -f $udev_rules ]] || echo '# Please run "dietpi-drive_manager" to adjust I/O schedulers' > "$udev_rules" + G_CONFIG_INJECT "ACTION==\"add\|change\", KERNEL==\"${aDRIVE_SOURCE_DEVICE[$MENU_DRIVE_INDEX]}\"" "ACTION==\"add|change\", KERNEL==\"${aDRIVE_SOURCE_DEVICE[$MENU_DRIVE_INDEX]}\", ATTR{queue/scheduler}=\"$G_WHIP_RETURNED_VALUE\"" "$udev_rules" echo "$G_WHIP_RETURNED_VALUE" > "$io_schedulers" fi @@ -1762,7 +1762,7 @@ NB: If you are planning to dedicate the drive to this system, it is recommended # Mount now G_EXEC mkdir -p "$samba_fp_mount_target" - > $fp_tmp + > "$fp_tmp" # - Mount attempts from highest CIFS version to lowest, until one succeeds # 3.1.1 supported on Buster only: https://manpages.debian.org/buster/cifs-utils/mount.cifs.8.en.html#OPTIONS @@ -1770,7 +1770,7 @@ NB: If you are planning to dedicate the drive to this system, it is recommended for i in '3.1.1' '3.0' '2.1' '2.0' '1.0' do G_DIETPI-NOTIFY 2 "Attempting to mount with CIFS version: $i" - if mount -t cifs -o username="$samba_clientuser",password="$samba_clientpassword",iocharset=utf8,uid=dietpi,gid=dietpi,file_mode=0770,dir_mode=0770,vers=$i "//$samba_clientname/$samba_clientshare" "$samba_fp_mount_target" &>> $fp_tmp; then + if mount -t cifs -o "username=$samba_clientuser,password=$samba_clientpassword,iocharset=utf8,uid=dietpi,gid=dietpi,file_mode=0770,dir_mode=0770,vers=$i" "//$samba_clientname/$samba_clientshare" "$samba_fp_mount_target" &>> "$fp_tmp"; then # Create credentials file G_EXEC mkdir -p /var/lib/dietpi/dietpi-drive_manager @@ -1793,16 +1793,16 @@ _EOF_ TARGETMENUID=1 # Drive menu G_WHIP_MSG "Mount completed. The new mount can be accessed at:\n - $samba_fp_mount_target\n - CIFS vers=$i" - rm $fp_tmp + rm "$fp_tmp" return 0 fi done # Failure - sed -i '1i\[FAILED] Samba mount failed with the following error output:\n' $fp_tmp - G_WHIP_VIEWFILE $fp_tmp - rm $fp_tmp + sed -i '1i\[FAILED] Samba mount failed with the following error output:\n' "$fp_tmp" + G_WHIP_VIEWFILE "$fp_tmp" + rm "$fp_tmp" rmdir --ignore-fail-on-non-empty "$samba_fp_mount_target" } @@ -1895,7 +1895,7 @@ _EOF_ # Mount now [[ -d $nfs_fp_mount_target ]] || G_EXEC mkdir "$nfs_fp_mount_target" - if mount -vt nfs -o port=2049 "$nfs_server_ip:$nfs_fp_server_share" "$nfs_fp_mount_target" &> $fp_tmp + if mount -vt nfs -o port=2049 "$nfs_server_ip:$nfs_fp_server_share" "$nfs_fp_mount_target" &> "$fp_tmp" then # Apply to fstab sed -i "\#[[:blank:]]${nfs_fp_mount_target}[[:blank:]]#d" /etc/fstab @@ -1906,14 +1906,14 @@ _EOF_ TARGETMENUID=1 # Drive menu G_WHIP_MSG "Mount completed. The new mount can be accessed at:\n - $nfs_fp_mount_target" - rm $fp_tmp + rm "$fp_tmp" return 0 fi # Failure - sed -i '1i\[FAILED] NFS mount failed with the following error output:\n' $fp_tmp - G_WHIP_VIEWFILE $fp_tmp - rm $fp_tmp + sed -i '1i\[FAILED] NFS mount failed with the following error output:\n' "$fp_tmp" + G_WHIP_VIEWFILE "$fp_tmp" + rm "$fp_tmp" rmdir --ignore-fail-on-non-empty "$nfs_fp_mount_target" } @@ -1937,7 +1937,7 @@ _EOF_ local fp_mount_selection='/tmp/dietpi-drive_manager_selmnt' # Remove last selection - [[ -f $fp_mount_selection ]] && rm $fp_mount_selection + [[ -f $fp_mount_selection ]] && rm "$fp_mount_selection" # Generate menu G_WHIP_MENU_ARRAY=() @@ -1951,7 +1951,7 @@ _EOF_ G_WHIP_MENU 'Please select a mount location to use:' || exit 1 G_DIETPI-NOTIFY 0 "Drive mount selected: $G_WHIP_RETURNED_VALUE" - echo "$G_WHIP_RETURNED_VALUE" > $fp_mount_selection + echo "$G_WHIP_RETURNED_VALUE" > "$fp_mount_selection" exit 0 } @@ -2005,6 +2005,6 @@ _EOF_ fi done #----------------------------------------------------------------------------------- - exit $EXIT_CODE + exit "$EXIT_CODE" #----------------------------------------------------------------------------------- } diff --git a/dietpi/dietpi-led_control b/dietpi/dietpi-led_control index a67967cedf..94d32ba298 100755 --- a/dietpi/dietpi-led_control +++ b/dietpi/dietpi-led_control @@ -46,8 +46,8 @@ aTRIGGER_CURRENT[$i]=${aTRIGGER_CURRENT[$i]%%]*} # shellcheck disable=SC2180 aTRIGGERS_AVAILABLE[$i]=${aTRIGGERS_AVAILABLE[$i]//[][]} - [[ -f $FP_UDEV_RULES && $(<$FP_UDEV_RULES) == *KERNEL==\"${aNAME[$i]}\"* ]] || continue - aTRIGGER_SELECTED[$i]=$(sed -n "/KERNEL==\"${aNAME[$i]}\"/{s/^.*ATTR{trigger}=\"//;s/\".*$//p;q}" $FP_UDEV_RULES) + [[ -f $FP_UDEV_RULES && $(<"$FP_UDEV_RULES") == *KERNEL==\"${aNAME[$i]}\"* ]] || continue + aTRIGGER_SELECTED[$i]=$(sed -n "/KERNEL==\"${aNAME[$i]}\"/{s/^.*ATTR{trigger}=\"//;s/\".*$//p;q}" "$FP_UDEV_RULES") done @@ -83,7 +83,7 @@ elif [[ $G_WHIP_RETURNED_VALUE == 'Reset' ]]; then - [[ ! -f $FP_UDEV_RULES ]] || G_EXEC_NOHALT=1 G_EXEC rm $FP_UDEV_RULES || return 1 + [[ ! -f $FP_UDEV_RULES ]] || G_EXEC_NOHALT=1 G_EXEC rm "$FP_UDEV_RULES" || return 1 aTRIGGER_SELECTED=() G_WHIP_MSG 'All LED triggers have been reset to system defaults.\n\nThis will take effect from the next restart.' @@ -118,18 +118,18 @@ elif [[ $G_WHIP_RETURNED_VALUE == 'Reset' ]]; then - G_EXEC_NOHALT=1 G_EXEC sed -i "/KERNEL==\"${aNAME[$SELECTED_LED]}\"/d" $FP_UDEV_RULES || return 1 + G_EXEC_NOHALT=1 G_EXEC sed -i "/KERNEL==\"${aNAME[$SELECTED_LED]}\"/d" "$FP_UDEV_RULES" || return 1 unset -v "aTRIGGER_SELECTED[$SELECTED_LED]" G_WHIP_MSG "LED trigger for ${aNAME[$SELECTED_LED]} has been reset to system defaults.\n\nThis will become active from next reboot." - [[ ${aTRIGGER_SELECTED[*]} || ! -f $FP_UDEV_RULES ]] || G_EXEC_NOHALT=1 G_EXEC rm $FP_UDEV_RULES || return 1 + [[ ${aTRIGGER_SELECTED[*]} || ! -f $FP_UDEV_RULES ]] || G_EXEC_NOHALT=1 G_EXEC rm "$FP_UDEV_RULES" || return 1 else G_DIETPI-NOTIFY 2 "Applying trigger \e[33m$G_WHIP_RETURNED_VALUE\e[90m to LED \e[33m${aNAME[$SELECTED_LED]}" echo "$G_WHIP_RETURNED_VALUE" > "/sys/class/leds/${aNAME[$SELECTED_LED]}/trigger" || return 1 aTRIGGER_CURRENT[$SELECTED_LED]=$G_WHIP_RETURNED_VALUE - [[ -f $FP_UDEV_RULES ]] || G_EXEC_NOHALT=1 G_EXEC touch $FP_UDEV_RULES || return 1 - G_CONFIG_INJECT "SUBSYSTEM==\"leds\", KERNEL==\"${aNAME[$SELECTED_LED]}\"" "SUBSYSTEM==\"leds\", KERNEL==\"${aNAME[$SELECTED_LED]}\", ACTION==\"add\", ATTR{trigger}=\"${aTRIGGER_CURRENT[$SELECTED_LED]}\"" $FP_UDEV_RULES + [[ -f $FP_UDEV_RULES ]] || G_EXEC_NOHALT=1 G_EXEC touch "$FP_UDEV_RULES" || return 1 + G_CONFIG_INJECT "SUBSYSTEM==\"leds\", KERNEL==\"${aNAME[$SELECTED_LED]}\"" "SUBSYSTEM==\"leds\", KERNEL==\"${aNAME[$SELECTED_LED]}\", ACTION==\"add\", ATTR{trigger}=\"${aTRIGGER_CURRENT[$SELECTED_LED]}\"" "$FP_UDEV_RULES" aTRIGGER_SELECTED[$SELECTED_LED]=${aTRIGGER_CURRENT[$SELECTED_LED]} fi diff --git a/dietpi/dietpi-letsencrypt b/dietpi/dietpi-letsencrypt index 150c73674e..5c98f5dc4b 100755 --- a/dietpi/dietpi-letsencrypt +++ b/dietpi/dietpi-letsencrypt @@ -359,18 +359,18 @@ _EOF_ Read_Settings(){ - LETSENCRYPT_DOMAINS=$(mawk 'NR==1' $FP_SETTINGS) - LETSENCRYPT_EMAIL=$(mawk 'NR==2' $FP_SETTINGS) - LETSENCRYPT_REDIRECT=$(mawk 'NR==3' $FP_SETTINGS) - LETSENCRYPT_HSTS=$(mawk 'NR==4' $FP_SETTINGS) - LETSENCRYPT_KEYSIZE=$(mawk 'NR==5' $FP_SETTINGS) - LETSENCRYPT_OCSP=$(mawk 'NR==6' $FP_SETTINGS) + LETSENCRYPT_DOMAINS=$(mawk 'NR==1' "$FP_SETTINGS") + LETSENCRYPT_EMAIL=$(mawk 'NR==2' "$FP_SETTINGS") + LETSENCRYPT_REDIRECT=$(mawk 'NR==3' "$FP_SETTINGS") + LETSENCRYPT_HSTS=$(mawk 'NR==4' "$FP_SETTINGS") + LETSENCRYPT_KEYSIZE=$(mawk 'NR==5' "$FP_SETTINGS") + LETSENCRYPT_OCSP=$(mawk 'NR==6' "$FP_SETTINGS") } Write_Settings(){ - cat << _EOF_ > $FP_SETTINGS + cat << _EOF_ > "$FP_SETTINGS" $LETSENCRYPT_DOMAINS $LETSENCRYPT_EMAIL $LETSENCRYPT_REDIRECT @@ -500,6 +500,8 @@ Press any key to return to the $G_PROGRAM_NAME menu ..." ;; + *) :;; + esac else diff --git a/dietpi/dietpi-login b/dietpi/dietpi-login index 2d5a1a6af7..a535e9d029 100755 --- a/dietpi/dietpi-login +++ b/dietpi/dietpi-login @@ -114,7 +114,7 @@ rm -f /etc/systemd/system/{getty@tty1,console-getty}.service.d/dietpi-autologin.conf local pid_loginerror=$$ - [[ -f $FP_DIETPI_FIRSTRUNSETUP_ERR ]] && pid_loginerror=$(<$FP_DIETPI_FIRSTRUNSETUP_ERR) + [[ -f $FP_DIETPI_FIRSTRUNSETUP_ERR ]] && pid_loginerror=$(<"$FP_DIETPI_FIRSTRUNSETUP_ERR") if [[ $pid_loginerror != "$$" ]]; then G_WHIP_BUTTON_OK_TEXT='Take over' G_WHIP_BUTTON_CANCEL_TEXT='Retry' @@ -122,11 +122,11 @@ \nYou can the error handling on this screen and kill the other DietPi-Login session. \nElse you can finish the error handling on the other DietPi-Login session and the login script on this session afterwards." || return kill -9 "$pid_loginerror" - [[ -f $FP_DIETPI_FIRSTRUNSETUP_PID ]] && rm $FP_DIETPI_FIRSTRUNSETUP_PID + [[ -f $FP_DIETPI_FIRSTRUNSETUP_PID ]] && rm "$FP_DIETPI_FIRSTRUNSETUP_PID" fi - echo $$ > $FP_DIETPI_FIRSTRUNSETUP_ERR + echo $$ > "$FP_DIETPI_FIRSTRUNSETUP_ERR" if G_WHIP_DEFAULT_ITEM='yes' G_WHIP_YESNO "[FAILED] Unknown install state/First run setup failed\n An error has occurred either during first run update or installs.\n First run setup will now attempt to re-apply the last step, forced as interactive run. @@ -134,13 +134,13 @@ If this repeatedly fails, please collect all terminal output and the content of Would you like to restart the first run setup and installation?"; then # Reset and force re-run of first run setup - rm $FP_DIETPI_FIRSTRUNSETUP_ERR + rm "$FP_DIETPI_FIRSTRUNSETUP_ERR" killall -qw dietpi-software dietpi-update echo 0 > /boot/dietpi/.install_stage else - rm $FP_DIETPI_FIRSTRUNSETUP_ERR + rm "$FP_DIETPI_FIRSTRUNSETUP_ERR" exit 1 fi @@ -155,7 +155,7 @@ Would you like to restart the first run setup and installation?"; then # Prompt and wait if this script runs in other session already local pid_firstrunsetup=$$ - [[ -f $FP_DIETPI_FIRSTRUNSETUP_PID ]] && pid_firstrunsetup=$(<$FP_DIETPI_FIRSTRUNSETUP_PID) + [[ -f $FP_DIETPI_FIRSTRUNSETUP_PID ]] && pid_firstrunsetup=$(<"$FP_DIETPI_FIRSTRUNSETUP_PID") # Unknown install state/First run setup failed in other session, forcing interactive whiptail prompt. Allow to take over and repeat on this session. if [[ -f $FP_DIETPI_FIRSTRUNSETUP_ERR ]]; then @@ -171,7 +171,7 @@ Would you like to restart the first run setup and installation?"; then local restart_loop_delay=5 G_DIETPI-NOTIFY 2 "Waiting $restart_loop_delay seconds before checking again. Please wait... (Press CTRL+C to abort)" - sleep $restart_loop_delay + sleep "$restart_loop_delay" elif (( $UID )); then @@ -185,7 +185,7 @@ Please login again as user "root" with password "dietpi", respectively the one y else # Prevent re-run from another session. - echo $$ > $FP_DIETPI_FIRSTRUNSETUP_PID + echo $$ > "$FP_DIETPI_FIRSTRUNSETUP_PID" # - Always remove PID file when script is exited/terminated/killed trap '[[ -f $FP_DIETPI_FIRSTRUNSETUP_PID ]] && rm $FP_DIETPI_FIRSTRUNSETUP_PID' EXIT @@ -204,7 +204,7 @@ Please login again as user "root" with password "dietpi", respectively the one y elif (( $G_DIETPI_INSTALL_STAGE == 1 )); then # Start DietPi-Software - /boot/dietpi/dietpi-software 2>&1 | tee $FP_DIETPI_FIRSTRUNSETUP_LOG # Sets /boot/dietpi/.install_stage > G_DIETPI_INSTALL_STAGE=2 + /boot/dietpi/dietpi-software 2>&1 | tee "$FP_DIETPI_FIRSTRUNSETUP_LOG" # Sets /boot/dietpi/.install_stage > G_DIETPI_INSTALL_STAGE=2 # Prompt on failure (( $( $FP_INCLUDE_EXCLUDE + [[ -f $FP_INCLUDE_EXCLUDE ]] || cat << '_EOF_' > "$FP_INCLUDE_EXCLUDE" # DietPi-Services Include/Exclude configuration # Include custom service (Use '+ servicename' without the comments to enable DietPi control of that service) @@ -313,7 +315,7 @@ _EOF_ fi - done < $FP_INCLUDE_EXCLUDE + done < "$FP_INCLUDE_EXCLUDE" } @@ -467,7 +469,7 @@ _EOF_ do # Skip masked services, if not to be unmasked [[ ${aSERVICE_MODE[$i]} == 'masked' && $systemctl_cmd != 'unmask' ]] && { G_DIETPI-NOTIFY 2 "skip : ${aSERVICE_NAME[$i]} (due to mask)"; continue; } - systemctl $systemctl_cmd "${aSERVICE_NAME[$i]}" &> /dev/null + systemctl "$systemctl_cmd" "${aSERVICE_NAME[$i]}" &> /dev/null Print_Status "$command" "${aSERVICE_NAME[$i]}" $? done @@ -543,6 +545,7 @@ _EOF_ # - [Service] line throws a harmless error that we can simply hidden. # - All values are single word strings, so bash assigns them correctly. local CPUAffinity CPUSchedulingPolicy Nice CPUSchedulingPriority IOSchedulingClass IOSchedulingPriority + # shellcheck disable=SC1090 . "$fp" &> /dev/null [[ $CPUAffinity ]] && aCPU_AFFINITY[$index]=$CPUAffinity @@ -683,7 +686,7 @@ _EOF_ aFP_SERVICE[$new_index]=$i aSERVICE_MODE[$new_index]=$(systemctl is-enabled "$G_WHIP_RETURNED_VALUE" 2> /dev/null) Load_Process_Tool "$new_index" - G_CONFIG_INJECT "+ ${aSERVICE_NAME[$new_index]}" "+ ${aSERVICE_NAME[$new_index]}" $FP_INCLUDE_EXCLUDE + G_CONFIG_INJECT "+ ${aSERVICE_NAME[$new_index]}" "+ ${aSERVICE_NAME[$new_index]}" "$FP_INCLUDE_EXCLUDE" break 2 done @@ -852,22 +855,22 @@ This affects starts/stops/restarts during DietPi-Software installs, DietPi-Updat if [[ $G_WHIP_RETURNED_VALUE == 'Include' ]]; then # If service is listed here, it was excluded via include/exclude file. - sed -i "/^- ${aSERVICE_NAME[$MENU_SERVICE_INDEX]}/d" $FP_INCLUDE_EXCLUDE + sed -i "/^- ${aSERVICE_NAME[$MENU_SERVICE_INDEX]}/d" "$FP_INCLUDE_EXCLUDE" aSERVICE_EXCLUDED[MENU_SERVICE_INDEX]=0 else # Remove include entry, if existent, else add exclude entry. - if grep -q "^+ ${aSERVICE_NAME[$MENU_SERVICE_INDEX]}" $FP_INCLUDE_EXCLUDE; then + if grep -q "^+ ${aSERVICE_NAME[$MENU_SERVICE_INDEX]}" "$FP_INCLUDE_EXCLUDE"; then - sed -i "/^+ ${aSERVICE_NAME[$MENU_SERVICE_INDEX]}/d" $FP_INCLUDE_EXCLUDE + sed -i "/^+ ${aSERVICE_NAME[$MENU_SERVICE_INDEX]}/d" "$FP_INCLUDE_EXCLUDE" unset -v "aSERVICE_NAME[$MENU_SERVICE_INDEX]" # Service needs to be re-added from main menu MENU_TARGETID=0 # Return to main menu else - G_CONFIG_INJECT "- ${aSERVICE_NAME[$MENU_SERVICE_INDEX]}" "- ${aSERVICE_NAME[$MENU_SERVICE_INDEX]}" $FP_INCLUDE_EXCLUDE + G_CONFIG_INJECT "- ${aSERVICE_NAME[$MENU_SERVICE_INDEX]}" "- ${aSERVICE_NAME[$MENU_SERVICE_INDEX]}" "$FP_INCLUDE_EXCLUDE" # Keep in menu like other excluded known services aSERVICE_EXCLUDED[MENU_SERVICE_INDEX]=1 @@ -1159,6 +1162,8 @@ NB: This only has an effect on drives handled by the CFQ scheduler."; then ;; + *) :;; + esac else diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index c4fc513718..ad5980275f 100755 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -180,6 +180,8 @@ INDEX_BROWSER=$INDEX_BROWSER" fi # Encrypt + # https://github.com/koalaman/shellcheck/issues/1009 + # shellcheck disable=SC2248 [[ $encrypt == 1 ]] && openssl enc -e -a -md sha256 -aes-256-cbc -iter 10000 -salt -pass pass:'DietPiRocks!' -out /var/lib/dietpi/dietpi-software/.GLOBAL_PW.bin <<< $GLOBAL_PW # Apply safe permissions @@ -2207,7 +2209,7 @@ _EOF_ fi - echo $output + echo "$output" } @@ -2215,9 +2217,9 @@ _EOF_ # Download_Install 'https://file.com/file' [/path/to/target] # dps_index=$software_id Download_Install 'conf_0' /etc/conf.conf # Optional input variables: - # fallback_url='http...' = URL to use if e.g. grabbing URL from api.github.com fails: https://dietpi.com/phpbb/viewtopic.php?p=17390#p17390 - # dps_index=$software_id = Download from DietPi GitHub repo based on software ID/index - # DEPS_LIST='pkg1 ...' = Install APT dependency packages + # fallback_url='http...' = URL to use if e.g. grabbing URL from api.github.com fails: https://dietpi.com/phpbb/viewtopic.php?p=17390#p17390 + # dps_index=$software_id = Download from DietPi GitHub repo based on software ID/index + # aDEPS=('pkg1' 'pkg2' ...) = Install APT dependency packages # NB: This does not support installs that require user input (e.g.: a whiptail prompt for deb installs) Download_Install(){ @@ -2249,7 +2251,7 @@ _EOF_ G_EXEC cd "$G_WORKING_DIR" # Failsafe # Download file - if [[ $DEPS_LIST ]] + if [[ ${aDEPS[0]} ]] then # Check URL before starting background download, as a failure does not terminate the install # shellcheck disable=SC2154 @@ -2258,8 +2260,8 @@ _EOF_ # Download as background thread if dependencies are to be installed G_THREAD_START curl -sSfL "$url" -o "$file" # shellcheck disable=SC2086 - G_AGI $DEPS_LIST - DEPS_LIST= + G_AGI "${aDEPS[@]}" + aDEPS=() G_THREAD_WAIT else G_EXEC curl -sSfL "$url" -o "$file" @@ -2351,6 +2353,7 @@ _EOF_ local file=$1 service=$2 local timeout=${3:-25} # Optional local output=$4 pid # Optional, if timeout is set, hence for startups which may take long so that showing some process becomes reasonable + # shellcheck disable=SC2154 local content=$CREATE_CONFIG_CONTENT # Optional unset -v CREATE_CONFIG_CONTENT @@ -2376,7 +2379,7 @@ _EOF_ done # Stop journal prints - [[ $output ]] && { kill $pid; wait $pid; } 2> /dev/null + [[ $output ]] && { kill "$pid"; wait "$pid"; } 2> /dev/null # Stop service sleep 1 @@ -2408,15 +2411,15 @@ _EOF_ # Run marked software installs Install_Software(){ - local software_id DEPS_LIST + local software_id aDEPS=() # Configure iptables to use nf_tables or legacy API, depending on which is supported by kernel Configure_iptables() { local alt='nft' iptables-nft -L &> /dev/null || alt='legacy' - G_EXEC update-alternatives --set iptables /usr/sbin/iptables-$alt - G_EXEC update-alternatives --set ip6tables /usr/sbin/ip6tables-$alt + G_EXEC update-alternatives --set iptables "/usr/sbin/iptables-$alt" + G_EXEC update-alternatives --set ip6tables "/usr/sbin/ip6tables-$alt" } Enable_memory_cgroup() @@ -2456,17 +2459,17 @@ _EOF_ Banner_Installing # 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 mesa-utils mesa-utils-extra' + aDEPS=('xserver-xorg-core' 'xserver-xorg-input-libinput' 'xinit' 'dbus-x11' 'xfonts-base' 'x11-xserver-utils' 'x11-utils' 'mesa-utils' 'mesa-utils-extra') # RPi: Add fbdev display driver for legacy framebuffer graphics support, as modesetting requires KMS driver overlay for /dev/dri/card0 to exists. - (( $G_HW_MODEL > 9 )) || DEPS_LIST+=' xserver-xorg-video-fbdev' + (( $G_HW_MODEL > 9 )) || aDEPS+=('xserver-xorg-video-fbdev') # VM if (( $G_HW_MODEL == 20 )) then # If KMS/DRM is supported, add VMware DDX, which offers slightly better performance compared to modesetting. VirtualBox can emulate it as well, which is even the nowadays recommended default. # Else (e.g. Hyper-V) add classic framebuffer DDX - [[ -e '/dev/dri' ]] && DEPS_LIST+=' xserver-xorg-video-vmware' || DEPS_LIST+=' xserver-xorg-video-fbdev' + [[ -e '/dev/dri' ]] && aDEPS+=('xserver-xorg-video-vmware') || aDEPS+=('xserver-xorg-video-fbdev') fi # Disable DPMS and screen blanking @@ -2492,14 +2495,14 @@ _EOF_ # Odroid C2 legacy elif (( $G_HW_MODEL == 12 )) && [[ $G_DISTRO -le 5 || ! -e '/dev/dri' ]] then - apt-cache dumpavail | grep -q '^Package: mali450-odroid$' && DEPS_LIST='mali450-odroid' + apt-cache dumpavail | grep -q '^Package: mali450-odroid$' && aDEPS=('mali450-odroid') if apt-cache dumpavail | grep -q '^Package: xf86-video-fbturbo-odroid$' then - DEPS_LIST+=' libump-odroid xf86-video-fbturbo-odroid' + aDEPS+=('libump-odroid' 'xf86-video-fbturbo-odroid') G_BACKUP_FP /etc/X11/xorg.conf dps_index=$software_id Download_Install 'xorg_c2.conf' /etc/X11/xorg.conf else - DEPS_LIST+=' xserver-xorg-video-fbdev' + aDEPS+=('xserver-xorg-video-fbdev') fi # Odroid N2 legacy: https://dietpi.com/phpbb/viewtopic.php?t=9206 @@ -2844,8 +2847,9 @@ unix_socket_directories = '/run/postgresql'" > "$i/00dietpi.conf" G_EXEC chown -R dietpi:audio /mnt/dietpi_userdata/beets G_EXEC chmod -R g+w /mnt/dietpi_userdata/beets - # Load central beets config all interactive bash shells + # Load global beets config in all interactive bash shells echo 'export BEETSDIR=/mnt/dietpi_userdata/beets' > /etc/bashrc.d/dietpi-beets.sh + # shellcheck disable=SC1091 . /etc/bashrc.d/dietpi-beets.sh # Install @@ -2902,7 +2906,7 @@ unix_socket_directories = '/run/postgresql'" > "$i/00dietpi.conf" (( $G_HW_MODEL > 9 )) || (( $G_RASPBIAN == 0 )) || version=11 fi - G_AGI openjdk-$version-jre-headless + G_AGI "openjdk-$version-jre-headless" fi @@ -2928,7 +2932,7 @@ unix_socket_directories = '/run/postgresql'" > "$i/00dietpi.conf" (( $G_HW_MODEL > 9 )) || (( $G_RASPBIAN == 0 )) || version=11 fi - G_AGI openjdk-$version-jdk-headless + G_AGI "openjdk-$version-jdk-headless" fi @@ -2938,16 +2942,16 @@ unix_socket_directories = '/run/postgresql'" > "$i/00dietpi.conf" Banner_Installing # Deps: https://github.com/MichaIng/DietPi/issues/3614 - DEPS_LIST='libatomic1' + aDEPS=('libatomic1') # Download installer Download_Install 'https://raw.githubusercontent.com/MichaIng/nodejs-linux-installer/master/node-install.sh' G_EXEC chmod +x node-install.sh # ARMv6: Use unofficial builds to get the latest version: https://github.com/MichaIng/nodejs-linux-installer/pull/2 - local unofficial= - (( $G_HW_ARCH == 1 )) && unofficial='-u' - G_EXEC_OUTPUT=1 G_EXEC ./node-install.sh $unofficial + local unofficial=() + (( $G_HW_ARCH == 1 )) && unofficial=('-u') + G_EXEC_OUTPUT=1 G_EXEC ./node-install.sh "${unofficial[@]}" G_EXEC_NOHALT=1 G_EXEC rm node-install.sh fi @@ -2969,7 +2973,7 @@ unix_socket_directories = '/run/postgresql'" > "$i/00dietpi.conf" fi # Perform pip3 install (which includes setuptools and wheel modules) - DEPS_LIST='python3-dev' Download_Install 'https://bootstrap.pypa.io/get-pip.py' + aDEPS=('python3-dev') Download_Install 'https://bootstrap.pypa.io/get-pip.py' G_EXEC_OUTPUT=1 G_EXEC python3 get-pip.py G_EXEC_NOHALT=1 G_EXEC rm get-pip.py @@ -3033,6 +3037,7 @@ unix_socket_directories = '/run/postgresql'" > "$i/00dietpi.conf" export GOPATH=/mnt/dietpi_userdata/go export PATH="$PATH:/usr/local/go/bin:$GOPATH/bin" _EOF_ + # shellcheck disable=SC1091 . /etc/bashrc.d/go.sh fi @@ -3405,23 +3410,24 @@ _EOF_ # - Remove previous disk cache dir or symlink G_EXEC rm -Rf /var/cache/samba # - Pre-create RAM cache dir - G_EXEC mkdir -p /run/samba-cache + [[ -d '/run/samba-cache' ]] || G_EXEC mkdir /run/samba-cache # - Link disk cache to RAM G_EXEC ln -s /run/samba-cache /var/cache/samba # - Create RAM cache dir automatically on boot echo 'd /run/samba-cache' > /etc/tmpfiles.d/dietpi-samba_cache.conf + # Config: Preserve on reinstall + if [[ ! -f '/etc/samba/smb.conf' ]] + then + dps_index=$software_id Download_Install 'conf' /etc/samba/smb.conf + G_CONFIG_INJECT 'max connections =' "max connections = $(( $G_HW_CPU_CORES * 2 ))" /etc/samba/smb.conf + fi + G_AGI samba G_EXEC systemctl stop nmbd smbd echo -e "$GLOBAL_PW\n$GLOBAL_PW" | smbpasswd -s -a dietpi - local fp_conf='/etc/samba/smb.conf' - G_BACKUP_FP $fp_conf - dps_index=$software_id Download_Install 'conf' $fp_conf - - G_CONFIG_INJECT 'max connections =' "max connections = $(( $G_HW_CPU_CORES * 2 ))" $fp_conf - fi software_id=95 # vsftpd @@ -3579,8 +3585,7 @@ _EOF_ Banner_Installing - local deflate= - local openssl= + local deflate=() openssl=() # Migrate existing configs in case of distro upgrades if [[ -f '/etc/lighttpd/lighttpd.conf' ]] @@ -3598,14 +3603,14 @@ _EOF_ G_DIETPI-NOTIFY 2 'Bullseye upgrade detected: Migrating from mod_compress to mod_deflate' G_EXEC sed -Ei '/^compress\..*=[[:blank:]]*["(].*[")]$/d' /etc/lighttpd/lighttpd.conf G_EXEC sed -i '/^[[:blank:]]*"mod_compress",$/d' /etc/lighttpd/lighttpd.conf - deflate='lighttpd-mod-deflate' + deflate=('lighttpd-mod-deflate') fi # Bullseye: Install OpenSSL module if DietPi-LetsEncrypt was used if [[ $G_DISTRO -gt 5 && -f '/boot/dietpi/.dietpi-letsencrypt' ]] then G_DIETPI-NOTIFY 2 'DietPi-LetsEncrypt usage detected: Installing OpenSSL module' - openssl='lighttpd-mod-openssl' + openssl=('lighttpd-mod-openssl') [[ -f '/etc/lighttpd/conf-available/50-dietpi-https.conf' ]] && ! grep -q '"mod_openssl"' /etc/lighttpd/conf-available/50-dietpi-https.conf && G_EXEC sed -i '1iserver.modules += ( "mod_openssl" )' /etc/lighttpd/conf-available/50-dietpi-https.conf fi fi @@ -3614,13 +3619,13 @@ _EOF_ INDEX_WEBSERVER=-2 # perl is required for lighty-enable-mod, it has been degraded to recommends only with Buster. - G_AGI lighttpd perl $deflate $openssl + G_AGI lighttpd perl "${deflate[@]}" "${openssl[@]}" G_EXEC systemctl stop lighttpd Remove_SysV lighttpd # Enable mod_deflate, if flagged - [[ $deflate && ! -f '/etc/lighttpd/conf-enabled/20-deflate.conf' ]] && G_EXEC lighty-enable-mod deflate + [[ ${deflate[0]} && ! -f '/etc/lighttpd/conf-enabled/20-deflate.conf' ]] && G_EXEC lighty-enable-mod deflate # Change webroot from /var/www/html to /var/www G_CONFIG_INJECT 'server.document-root' 'server.document-root = "/var/www"' /etc/lighttpd/lighttpd.conf @@ -3775,13 +3780,13 @@ _EOF_ # We create our own PHP mod to add DietPi specific configs. target_php_ini="/etc/php/$PHP_VERSION/mods-available/dietpi.ini" - echo -e '; DietPi PHP settings\n; priority=97' > $target_php_ini + echo -e '; DietPi PHP settings\n; priority=97' > "$target_php_ini" # Session files need to be outside of /tmp and /var/tmp due to PrivateTmp=true, else phpsessionclean.service cannot clean sessions G_EXEC mkdir -p /run/php_sessions G_EXEC chmod 1733 /run/php_sessions echo -e '# Pre-create PHP sessions dir\nd /run/php_sessions 1733' > /etc/tmpfiles.d/dietpi-php_sessions.conf - G_CONFIG_INJECT 'session.save_path[[:blank:]=]' 'session.save_path="/run/php_sessions"' $target_php_ini + G_CONFIG_INJECT 'session.save_path[[:blank:]=]' 'session.save_path="/run/php_sessions"' "$target_php_ini" # File uploads: https://github.com/MichaIng/DietPi/issues/546 # - This is especially relevant for cloud software like ownCloud/Nextcloud. @@ -3790,20 +3795,20 @@ _EOF_ # - ownCloud/Nextcloud do/did override this limit to 512 MiB, a reasonable limit which can usually still be hold in RAM without issues. # - Low RAM devices (RPi1 256 MiB model) require a swap file for this, however, it is still better to cause disk writes through swap file during large file uploads only, then doing this for each and every uploaded file. # - When larger file uploads are required, it depends on the system total RAM, rootfs disk and available external drives if/where to move tmp file uploads, resize or move swap file. This should be then left to user. - G_CONFIG_INJECT 'upload_tmp_dir[[:blank:]=]' 'upload_tmp_dir="/tmp"' $target_php_ini - G_CONFIG_INJECT 'upload_max_filesize[[:blank:]=]' 'upload_max_filesize=512M' $target_php_ini - G_CONFIG_INJECT 'post_max_size[[:blank:]=]' 'post_max_size=512M' $target_php_ini + G_CONFIG_INJECT 'upload_tmp_dir[[:blank:]=]' 'upload_tmp_dir="/tmp"' "$target_php_ini" + G_CONFIG_INJECT 'upload_max_filesize[[:blank:]=]' 'upload_max_filesize=512M' "$target_php_ini" + G_CONFIG_INJECT 'post_max_size[[:blank:]=]' 'post_max_size=512M' "$target_php_ini" # - Nginx: https://github.com/MichaIng/DietPi/issues/546 => https://github.com/MichaIng/DietPi/blob/dev/.conf/dps_85/nginx.conf # Cache settings local cache_size=$(( $RAM_PHYS / 30 )) (( $cache_size < 16 )) && cache_size=16 # - OPcache - G_CONFIG_INJECT 'opcache.memory_consumption[[:blank:]=]' "opcache.memory_consumption=$cache_size" $target_php_ini - G_CONFIG_INJECT 'opcache.revalidate_freq[[:blank:]=]' 'opcache.revalidate_freq=60' $target_php_ini # 1 minute + G_CONFIG_INJECT 'opcache.memory_consumption[[:blank:]=]' "opcache.memory_consumption=$cache_size" "$target_php_ini" + G_CONFIG_INJECT 'opcache.revalidate_freq[[:blank:]=]' 'opcache.revalidate_freq=60' "$target_php_ini" # 1 minute # - APCu - G_CONFIG_INJECT 'apc.shm_size[[:blank:]=]' "apc.shm_size=$(( $cache_size / 2 ))M" $target_php_ini - G_CONFIG_INJECT 'apc.ttl[[:blank:]=]' 'apc.ttl=259200' $target_php_ini # 3 days + G_CONFIG_INJECT 'apc.shm_size[[:blank:]=]' "apc.shm_size=$(( $cache_size / 2 ))M" "$target_php_ini" + G_CONFIG_INJECT 'apc.ttl[[:blank:]=]' 'apc.ttl=259200' "$target_php_ini" # 3 days # Enable all available PHP modules local amodules=() @@ -3843,9 +3848,9 @@ _EOF_ # Install required PHP modules: https://docs.phpmyadmin.net/en/latest/require.html#php # - Add JSON module for PHP7, as it does not exist (embedded in core package) on PHP8 - local json= - [[ $PHP_VERSION == 8* ]] || json="php$PHP_VERSION-json" - G_AGI php$PHP_VERSION-{curl,gd,mbstring,xml,zip} $json + local json=() + [[ $PHP_VERSION == 8* ]] || json=("php$PHP_VERSION-json") + G_AGI "php$PHP_VERSION"-{curl,gd,mbstring,xml,zip} "${json[@]}" # Quick install: https://docs.phpmyadmin.net/en/latest/setup.html#quick-install # - Get latest version name @@ -3861,7 +3866,7 @@ _EOF_ G_EXEC mv "phpMyAdmin-$version-english" /var/www/phpmyadmin # Enable required PHP modules: https://docs.phpmyadmin.net/en/latest/require.html#php - G_EXEC phpenmod ctype curl gd mbstring xml zip ${json##*-} + G_EXEC phpenmod ctype curl gd mbstring xml zip "${json[@]##*-}" # Install and enable webserver config # - Apache @@ -4400,7 +4405,7 @@ _EOF_ if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - DEPS_LIST="php$PHP_VERSION-intl" # https://doc.owncloud.com/server/next/admin_manual/installation/manual_installation/manual_installation_prerequisites.html#php-extensions + aDEPS=("php$PHP_VERSION-intl") # https://doc.owncloud.com/server/next/admin_manual/installation/manual_installation/manual_installation_prerequisites.html#php-extensions if [[ -f '/var/www/owncloud/occ' ]]; then @@ -4425,15 +4430,15 @@ _EOF_ fi - [[ $DEPS_LIST ]] && { G_DIETPI-NOTIFY 2 'Installing required PHP modules'; G_AGI $DEPS_LIST; DEPS_LIST=''; } + [[ ${aDEPS[0]} ]] && { G_DIETPI-NOTIFY 2 'Installing required PHP modules'; G_AGI "${aDEPS[@]}"; aDEPS=(); } G_DIETPI-NOTIFY 2 'Enabling required PHP modules' # - Add JSON module for PHP7, as it does not exist (embedded in core package) on PHP8 - local json= - [[ $PHP_VERSION == 8* ]] || json='json' - G_EXEC phpenmod ctype curl dom gd iconv intl mbstring pdo_mysql posix simplexml xmlreader xmlwriter zip fileinfo opcache apcu redis exif $json + local json=() + [[ $PHP_VERSION == 8* ]] || json=('json') + G_EXEC phpenmod ctype curl dom gd iconv intl mbstring pdo_mysql posix simplexml xmlreader xmlwriter zip fileinfo opcache apcu redis exif "${json[@]}" G_DIETPI-NOTIFY 2 'Enabling APCu memory cache for PHP command line usage (CLI) as well, including ownCloud occ command and cron jobs.' - echo -e '; ownCloud PHP settings\n; priority=98\napc.enable_cli=1' > /etc/php/$PHP_VERSION/mods-available/dietpi-owncloud.ini + echo -e '; ownCloud PHP settings\n; priority=98\napc.enable_cli=1' > "/etc/php/$PHP_VERSION/mods-available/dietpi-owncloud.ini" G_EXEC phpenmod dietpi-owncloud if (( ${aSOFTWARE_INSTALL_STATE[83]} > 0 )); then @@ -4447,7 +4452,7 @@ _EOF_ G_WHIP_MSG "Existing ownCloud Apache configuration found, will preserve the old one and save the new one for review and comparison to: $owncloud_conf" fi - dps_index=$software_id Download_Install 'apache.owncloud.conf' $owncloud_conf + dps_index=$software_id Download_Install 'apache.owncloud.conf' "$owncloud_conf" a2ensite dietpi-owncloud 1> /dev/null # Cal/CardDAV redirects to ownCloud DAV endpoint if [[ ! -f '/etc/apache2/conf-available/dietpi-dav_redirect.conf' ]]; then @@ -4475,7 +4480,7 @@ Redirect 301 /.well-known/caldav /owncloud/remote.php/dav' > /etc/apache2/conf- G_WHIP_MSG "Existing ownCloud Lighttpd configuration found, will preserve the old one and save the new one for review and comparison to: $owncloud_conf" fi - dps_index=$software_id Download_Install 'lighttpd.owncloud.conf' $owncloud_conf + dps_index=$software_id Download_Install 'lighttpd.owncloud.conf' "$owncloud_conf" G_EXEC_POST_FUNC(){ [[ $exit_code == 2 ]] && exit_code=0; } # Do not fail if modules are enabled already G_EXEC lighty-enable-mod rewrite dietpi-owncloud @@ -4502,7 +4507,7 @@ url.redirect += ( G_WHIP_MSG "Existing ownCloud Nginx configuration found, will preserve the old one and save the new one for review and comparison to: $owncloud_conf" fi - dps_index=$software_id Download_Install 'nginx.owncloud.conf' $owncloud_conf + dps_index=$software_id Download_Install 'nginx.owncloud.conf' "$owncloud_conf" # Cal/CardDAV redirects to ownCloud DAV endpoint if [[ ! -f '/etc/nginx/sites-dietpi/dietpi-dav_redirect.conf' ]]; then @@ -4557,15 +4562,15 @@ The install script will now exit. After applying one of the the above, rerun die elif [[ -f $datadir/dietpi-owncloud-database-backup.sql ]]; then 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}') + 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" # Adjust database data directory entry, in case it changed due to server migration - local datadir_old=$(grep -m1 "^[[:blank:]]*'datadirectory'" $config_php | mawk -F\' '{print $4}') + local datadir_old=$(grep -m1 "^[[:blank:]]*'datadirectory'" "$config_php" | mawk -F\' '{print $4}') G_EXEC mysql -e "update owncloud.oc_storages set id='local::$datadir/' where id rlike 'local::$datadir_old';" - elif ! grep -q "'installed' => true," $config_php 2>/dev/null; then + elif ! grep -q "'installed' => true," "$config_php" 2>/dev/null; then local username=$(sed -n '/^[[:blank:]]*SOFTWARE_OWNCLOUD_NEXTCLOUD_USERNAME=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) [[ $username ]] || username='admin' @@ -4581,7 +4586,7 @@ The install script will now exit. After applying one of the the above, rerun die # - 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_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 "${oc_password//?/X}" --admin-user "$username" --admin-pass "${GLOBAL_PW//?/X}" --data-dir "$datadir" G_EXEC mysql -e 'drop user tmp_root@localhost;' unset -v oc_password @@ -4592,43 +4597,43 @@ The install script will now exit. After applying one of the the above, rerun die fi # Enable ownCloud to use 4-byte database - G_CONFIG_INJECT "'mysql.utf8mb4'" "'mysql.utf8mb4' => true," $config_php "'dbpassword'" + G_CONFIG_INJECT "'mysql.utf8mb4'" "'mysql.utf8mb4' => true," "$config_php" "'dbpassword'" # Add local IP and hostname to trusted domains. # If "1 => '" does not exist, the config.php is not copied e.g. from older instance, so we add entries. - if ! grep -q "1 => '" $config_php; then + if ! grep -q "1 => '" "$config_php"; then - sed -i "/0 => 'localhost'/a 1 => '$(G_GET_NET ip)'," $config_php - sed -i "/1 => '/a 2 => '$( 'localhost'/a 1 => '$(G_GET_NET ip)'," "$config_php" + sed -i "/1 => '/a 2 => '$( 0 )); then - GCI_PRESERVE=1 G_CONFIG_INJECT "'htaccess.RewriteBase'" "'htaccess.RewriteBase' => '/owncloud'," $config_php "'overwrite.cli.url'" + GCI_PRESERVE=1 G_CONFIG_INJECT "'htaccess.RewriteBase'" "'htaccess.RewriteBase' => '/owncloud'," "$config_php" "'overwrite.cli.url'" occ maintenance:update:htaccess fi # APCu Memcache - GCI_PRESERVE=1 G_CONFIG_INJECT "'memcache.local'" "'memcache.local' => '\\\\OC\\\\Memcache\\\\APCu'," $config_php "'version'" + GCI_PRESERVE=1 G_CONFIG_INJECT "'memcache.local'" "'memcache.local' => '\\\\OC\\\\Memcache\\\\APCu'," "$config_php" "'version'" # Redis for transactional file locking: G_DIETPI-NOTIFY 2 'Enabling Redis for transactional file locking.' # https://doc.owncloud.org/server/administration_manual/configuration/server/caching_configuration.html#configuring-transactional-file-locking local redis_conf='/etc/redis/redis.conf' # - Enable Redis socket and grant www-data access to it - GCI_PRESERVE=1 G_CONFIG_INJECT 'unixsocket[[:blank:]]' 'unixsocket /run/redis/redis-server.sock' $redis_conf - G_CONFIG_INJECT 'unixsocketperm[[:blank:]]' 'unixsocketperm 770' $redis_conf + GCI_PRESERVE=1 G_CONFIG_INJECT 'unixsocket[[:blank:]]' 'unixsocket /run/redis/redis-server.sock' "$redis_conf" + G_CONFIG_INJECT 'unixsocketperm[[:blank:]]' 'unixsocketperm 770' "$redis_conf" G_EXEC usermod -aG redis www-data G_EXEC systemctl restart redis-server # - Enable ownCloud to use Redis socket for transactional file locking: - G_CONFIG_INJECT "'filelocking.enabled'" "'filelocking.enabled' => true," $config_php "'memcache.local'" - local redis_sock=$(grep -m1 '^[[:blank:]]*unixsocket[[:blank:]]' $redis_conf | mawk '{print $2}') # Re-estimate in case of existing custom path - GCI_PRESERVE=1 GCI_NEWLINE=1 G_CONFIG_INJECT "'memcache.locking'" "'memcache.locking' => '\\\\OC\\\\Memcache\\\\Redis',\n'redis' => array ('host' => '$redis_sock', 'port' => 0,)," $config_php "'filelocking.enabled'" + G_CONFIG_INJECT "'filelocking.enabled'" "'filelocking.enabled' => true," "$config_php" "'memcache.local'" + local redis_sock=$(grep -m1 '^[[:blank:]]*unixsocket[[:blank:]]' "$redis_conf" | mawk '{print $2}') # Re-estimate in case of existing custom path + GCI_PRESERVE=1 GCI_NEWLINE=1 G_CONFIG_INJECT "'memcache.locking'" "'memcache.locking' => '\\\\OC\\\\Memcache\\\\Redis',\n'redis' => array ('host' => '$redis_sock', 'port' => 0,)," "$config_php" "'filelocking.enabled'" # Enable ownCloud background cron job: crontab -u www-data -l 2> /dev/null | grep -q '/var/www/owncloud/.*cron' || ( crontab -u www-data -l 2> /dev/null ; echo '*/15 * * * * php /var/www/owncloud/occ system:cron' ) | crontab -u www-data - @@ -4643,7 +4648,7 @@ The install script will now exit. After applying one of the the above, rerun die if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - DEPS_LIST="php$PHP_VERSION-intl" # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation + aDEPS=("php$PHP_VERSION-intl") # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation if [[ -f '/var/www/nextcloud/occ' ]]; then @@ -4671,18 +4676,18 @@ The install script will now exit. After applying one of the the above, rerun die fi - [[ $DEPS_LIST ]] && { G_DIETPI-NOTIFY 2 'Installing required PHP modules'; G_AGI $DEPS_LIST; DEPS_LIST=''; } + [[ ${aDEPS[0]} ]] && { G_DIETPI-NOTIFY 2 'Installing required PHP modules'; G_AGI "${aDEPS[@]}"; aDEPS=(); } G_DIETPI-NOTIFY 2 'Enabling required PHP modules' # - Add JSON module for PHP7, as it does not exist (embedded in core package) on PHP8 - local json= - [[ $PHP_VERSION == 8* ]] || json='json' - G_EXEC phpenmod ctype curl dom gd intl mbstring pdo_mysql posix simplexml xmlreader xmlwriter zip fileinfo opcache apcu redis exif $json + local json=() + [[ $PHP_VERSION == 8* ]] || json=('json') + G_EXEC phpenmod ctype curl dom gd intl mbstring pdo_mysql posix simplexml xmlreader xmlwriter zip fileinfo opcache apcu redis exif "${json[@]}" G_DIETPI-NOTIFY 2 'Apply PHP override settings for Nextcloud.' # https://docs.nextcloud.com/server/stable/admin_manual/installation/server_tuning.html#enable-php-opcache - local memory_consumption=$(sed -n '/^[[:blank:]]*opcache.memory_consumption=/{s/^[^=]*=//p;q}' /etc/php/$PHP_VERSION/mods-available/dietpi.ini) + local memory_consumption=$(sed -n '/^[[:blank:]]*opcache.memory_consumption=/{s/^[^=]*=//p;q}' "/etc/php/$PHP_VERSION/mods-available/dietpi.ini") (( $memory_consumption < 64 )) && memory_consumption='\nopcache.memory_consumption=64' || memory_consumption= - echo -e "; Nextcloud PHP settings\n; priority=98\nmemory_limit=512M$memory_consumption\nopcache.revalidate_freq=5\napc.enable_cli=1" > /etc/php/$PHP_VERSION/mods-available/dietpi-nextcloud.ini + echo -e "; Nextcloud PHP settings\n; priority=98\nmemory_limit=512M$memory_consumption\nopcache.revalidate_freq=5\napc.enable_cli=1" > "/etc/php/$PHP_VERSION/mods-available/dietpi-nextcloud.ini" G_EXEC phpenmod dietpi-nextcloud if (( ${aSOFTWARE_INSTALL_STATE[83]} > 0 )); then @@ -4696,7 +4701,7 @@ The install script will now exit. After applying one of the the above, rerun die G_WHIP_MSG "Existing Nextcloud Apache configuration found, will preserve the old one and save the new one for review and comparison to: $nextcloud_conf" fi - dps_index=$software_id Download_Install 'apache.nextcloud.conf' $nextcloud_conf + dps_index=$software_id Download_Install 'apache.nextcloud.conf' "$nextcloud_conf" a2ensite dietpi-nextcloud 1> /dev/null # Cal/CardDAV redirects to Nextcloud DAV endpoint if [[ ! -f '/etc/apache2/conf-available/dietpi-dav_redirect.conf' ]]; then @@ -4724,7 +4729,7 @@ Redirect 301 /.well-known/caldav /nextcloud/remote.php/dav' > /etc/apache2/conf G_WHIP_MSG "Existing Nextcloud Lighttpd configuration found, will preserve the old one and save the new one for review and comparison to: $nextcloud_conf" fi - dps_index=$software_id Download_Install 'lighttpd.nextcloud.conf' $nextcloud_conf + dps_index=$software_id Download_Install 'lighttpd.nextcloud.conf' "$nextcloud_conf" G_EXEC_POST_FUNC(){ [[ $exit_code == 2 ]] && exit_code=0; } # Do not fail if modules are enabled already G_EXEC lighty-enable-mod rewrite dietpi-nextcloud @@ -4751,7 +4756,7 @@ url.redirect += ( G_WHIP_MSG "Existing Nextcloud Nginx configuration found, will preserve the old one and save the new one for review and comparison to: $nextcloud_conf" fi - dps_index=$software_id Download_Install 'nginx.nextcloud.conf' $nextcloud_conf + dps_index=$software_id Download_Install 'nginx.nextcloud.conf' "$nextcloud_conf" # Cal/CardDAV redirects to Nextcloud DAV endpoint if [[ ! -f '/etc/nginx/sites-dietpi/dietpi-dav_redirect.conf' ]]; then @@ -4806,15 +4811,15 @@ The install script will now exit. After applying one of the the above, rerun die 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 -F\' '{print $4}') - local dbpass=$(grep -m1 "^[[:blank:]]*'dbpassword'" $config_php | mawk -F\' '{print $4}') + 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" # Adjust database data directory entry, in case it changed due to server migration - local datadir_old=$(grep -m1 "^[[:blank:]]*'datadirectory'" $config_php | mawk -F\' '{print $4}') + local datadir_old=$(grep -m1 "^[[:blank:]]*'datadirectory'" "$config_php" | mawk -F\' '{print $4}') G_EXEC mysql -e "update nextcloud.oc_storages set id='local::$datadir/' where id rlike 'local::$datadir_old';" - elif ! grep -q "'installed' => true," $config_php 2>/dev/null; then + elif ! grep -q "'installed' => true," "$config_php" 2>/dev/null; then local username=$(sed -n '/^[[:blank:]]*SOFTWARE_OWNCLOUD_NEXTCLOUD_USERNAME=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) [[ $username ]] || username='admin' @@ -4835,11 +4840,11 @@ The install script will now exit. After applying one of the the above, rerun die 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=255 + grep -qi 'Stack trace' "$fp_log" && exit_code=255 fi @@ -4854,41 +4859,41 @@ The install script will now exit. After applying one of the the above, rerun die fi # Enable Nextcloud to use 4-byte database - G_CONFIG_INJECT "'mysql.utf8mb4'" "'mysql.utf8mb4' => true," $config_php "'dbpassword'" + G_CONFIG_INJECT "'mysql.utf8mb4'" "'mysql.utf8mb4' => true," "$config_php" "'dbpassword'" # Disable trusted_domains. - grep -q "1 => '*'" $config_php || sed -i "/0 => 'localhost'/a 1 => '*'," $config_php + grep -q "1 => '*'" "$config_php" || sed -i "/0 => 'localhost'/a 1 => '*'," "$config_php" # Set CLI URL to Nextcloud sub directory: - G_EXEC sed -i "s|'http://localhost'|'http://localhost/nextcloud'|" $config_php + G_EXEC sed -i "s|'http://localhost'|'http://localhost/nextcloud'|" "$config_php" # Set pretty URLs (without /index.php/) on Apache: if (( ${aSOFTWARE_INSTALL_STATE[83]} > 0 )); then - GCI_PRESERVE=1 G_CONFIG_INJECT "'htaccess.RewriteBase'" "'htaccess.RewriteBase' => '/nextcloud'," $config_php "'overwrite.cli.url'" + GCI_PRESERVE=1 G_CONFIG_INJECT "'htaccess.RewriteBase'" "'htaccess.RewriteBase' => '/nextcloud'," "$config_php" "'overwrite.cli.url'" ncc maintenance:update:htaccess fi # APCu Memcache - GCI_PRESERVE=1 G_CONFIG_INJECT "'memcache.local'" "'memcache.local' => '\\\\OC\\\\Memcache\\\\APCu'," $config_php "'version'" + GCI_PRESERVE=1 G_CONFIG_INJECT "'memcache.local'" "'memcache.local' => '\\\\OC\\\\Memcache\\\\APCu'," "$config_php" "'version'" # Redis for transactional file locking: G_DIETPI-NOTIFY 2 'Enabling Redis for transactional file locking.' # https://docs.nextcloud.com/server/stable/admin_manual/configuration_files/files_locking_transactional.html local redis_conf="/etc/redis/redis.conf" # - Enable Redis socket and grant www-data access to it - GCI_PRESERVE=1 G_CONFIG_INJECT 'unixsocket[[:blank:]]' 'unixsocket /run/redis/redis-server.sock' $redis_conf - G_CONFIG_INJECT 'unixsocketperm[[:blank:]]' 'unixsocketperm 770' $redis_conf + GCI_PRESERVE=1 G_CONFIG_INJECT 'unixsocket[[:blank:]]' 'unixsocket /run/redis/redis-server.sock' "$redis_conf" + G_CONFIG_INJECT 'unixsocketperm[[:blank:]]' 'unixsocketperm 770' "$redis_conf" G_EXEC usermod -aG redis www-data G_EXEC systemctl restart redis-server # - Enable Nextcloud to use Redis socket: - G_CONFIG_INJECT "'filelocking.enabled'" "'filelocking.enabled' => true," $config_php "'memcache.local'" - local redis_sock=$(grep -m1 '^[[:blank:]]*unixsocket[[:blank:]]' $redis_conf | mawk '{print $2}') # Re-estimate in case of existing custom path - GCI_PRESERVE=1 GCI_NEWLINE=1 G_CONFIG_INJECT "'memcache.locking'" "'memcache.locking' => '\\\\OC\\\\Memcache\\\\Redis',\n'redis' => array ('host' => '$redis_sock', 'port' => 0,)," $config_php "'filelocking.enabled'" + G_CONFIG_INJECT "'filelocking.enabled'" "'filelocking.enabled' => true," "$config_php" "'memcache.local'" + local redis_sock=$(grep -m1 '^[[:blank:]]*unixsocket[[:blank:]]' "$redis_conf" | mawk '{print $2}') # Re-estimate in case of existing custom path + GCI_PRESERVE=1 GCI_NEWLINE=1 G_CONFIG_INJECT "'memcache.locking'" "'memcache.locking' => '\\\\OC\\\\Memcache\\\\Redis',\n'redis' => array ('host' => '$redis_sock', 'port' => 0,)," "$config_php" "'filelocking.enabled'" # Tweak Argon2 hashing # - Use all available CPU threads - GCI_PRESERVE=1 G_CONFIG_INJECT "'hashingThreads'" "'hashingThreads' => ${G_HW_CPU_CORES}," $config_php "'version'" + GCI_PRESERVE=1 G_CONFIG_INJECT "'hashingThreads'" "'hashingThreads' => ${G_HW_CPU_CORES}," "$config_php" "'version'" # - ToDo: Configure the other settings after getting some clarifications: https://github.com/nextcloud/server/pull/19023#issuecomment-660071524 #GCI_PRESERVE=1 G_CONFIG_INJECT "'hashingMemoryCost'" "'hashingMemoryCost' => 65536," $config_php "'hashingThreads'" #GCI_PRESERVE=1 G_CONFIG_INJECT "'hashingTimeCost'" "'hashingTimeCost' => 4," $config_php "'hashingMemoryCost'" @@ -5007,7 +5012,7 @@ NB: This port needs to be forwarded by your router and/or opened in your firewal if [[ ! -d '/var/www/nextcloud/apps/spreed' ]]; then # Succeed if app is already installed and on "Cannot declare class" bug: https://github.com/MichaIng/DietPi/issues/3499#issuecomment-622955490 - G_EXEC_POST_FUNC(){ [[ $exit_code != 0 && $(<$fp_log) =~ (' already installed'$|' Cannot declare class ') ]] && exit_code=0; } + G_EXEC_POST_FUNC(){ [[ $exit_code != 0 && $(<"$fp_log") =~ (' already installed'$|' Cannot declare class ') ]] && exit_code=0; } G_EXEC ncc app:install spreed fi @@ -5058,7 +5063,7 @@ NB: This port needs to be forwarded by your router and/or opened in your firewal # We have no Buster binaries yet, so always use Stretch binaries binary_name+='_stretch' - G_EXEC mv $binary_name /usr/bin/ympd + G_EXEC mv "$binary_name" /usr/bin/ympd G_EXEC chmod +x /usr/bin/ympd G_EXEC_NOHALT=1 G_EXEC rm ympd_* @@ -5233,7 +5238,7 @@ _EOF_ G_THREAD_START curl -sSfL 'https://dietpi.com/downloads/binaries/all/cava.psf' -o /root/cava.psf # Font for nice bars - DEPS_LIST='libpulse0 libfftw3-3 libncursesw5' Download_Install "$url" + aDEPS=('libpulse0' 'libfftw3-3' 'libncursesw5') Download_Install "$url" # CAVA conf, preserve existing [[ -f '/root/.config/cava/config' ]] || dps_index=$software_id Download_Install 'cava.conf' /root/.config/cava/config @@ -5341,9 +5346,9 @@ _EOF_ if [[ $G_DISTRO -ge 6 || $G_HW_MODEL == 4 || $(dpkg --print-architecture) == 'arm64' ]] then # Enhance 4k support on RPi 4 - local cma= - (( $G_HW_MODEL == 4 )) && cma=512 - /boot/dietpi/func/dietpi-set_hardware rpi-opengl vc4-kms-v3d $cma + local cma=() + (( $G_HW_MODEL == 4 )) && cma=(512) + /boot/dietpi/func/dietpi-set_hardware rpi-opengl vc4-kms-v3d "${cma[@]}" (( $G_DISTRO < 6 )) || apackages+=('libgl1-mesa-dri' 'libgles2') # Missing dependencies on Bullseye package # Else legacy framebuffer driver @@ -5520,7 +5525,7 @@ _EOF_ # Libraries # - wget: Used for WHDLoad database update: https://github.com/midwan/amiberry/commit/d6c103e3310bcf75c2d72a15849fbdf5eb7432b5 - DEPS_LIST='libxml2 libfreetype6 libflac8 libmpeg2-4 libmpg123-0 wget' # libpng16-16 pulled by libfreetype6 + aDEPS=('libxml2' 'libfreetype6' 'libflac8' 'libmpeg2-4' 'libmpg123-0' 'wget') # libpng16-16 pulled by libfreetype6 # Platform and GPU drivers # - RPi @@ -5529,19 +5534,19 @@ _EOF_ local platform='rpi1' # Include ID -1 + 0 (( $G_HW_MODEL > 1 )) && platform="rpi$G_HW_MODEL" /boot/dietpi/func/dietpi-set_hardware rpi-opengl vc4-fkms-v3d - DEPS_LIST+=' libegl1 libgles2 libgl1-mesa-dri libraspberrypi0' + aDEPS+=('libegl1' 'libgles2' 'libgl1-mesa-dri' 'libraspberrypi0') # - Odroid XU4: https://dietpi.com/meveric/pool/main/s/setup-odroid/ elif (( $G_HW_MODEL == 11 )); then local platform='xu4' - apt-cache dumpavail | grep -q '^Package: malit628-odroid$' && DEPS_LIST+=' malit628-odroid' || DEPS_LIST+=' libegl1 libgles2 libgl1-mesa-dri' + apt-cache dumpavail | grep -q '^Package: malit628-odroid$' && aDEPS+=('malit628-odroid') || aDEPS+=('libegl1' 'libgles2' 'libgl1-mesa-dri') # - ASUS Tinker Board elif (( $G_HW_MODEL == 52 )); then local platform='RK3288' - DEPS_LIST+=' libegl1 libgles2 libgl1-mesa-dri' + aDEPS+=('libegl1' 'libgles2' 'libgl1-mesa-dri') fi @@ -5585,7 +5590,7 @@ _EOF_ Banner_Installing - DEPS_LIST='libsdl-mixer1.2 libsdl1.2debian libphysfs1' + aDEPS=('libsdl-mixer1.2' 'libsdl1.2debian' 'libphysfs1') Download_Install 'https://dietpi.com/downloads/binaries/rpi/dxx-rebirth.7z' /mnt/dietpi_userdata # Symlink savegames to root @@ -5659,7 +5664,7 @@ _EOF_ Banner_Installing - DEPS_LIST='libsdl1.2debian libsdl-net1.2' + aDEPS=('libsdl1.2debian' 'libsdl-net1.2') Download_Install 'https://dietpi.com/downloads/binaries/rpi/opentyrian_armhf.zip' / # Move to /usr/games @@ -5686,7 +5691,7 @@ _EOF_ Banner_Installing - DEPS_LIST='gpac motion' + aDEPS=('gpac' 'motion') Download_Install 'https://github.com/silvanmelchior/RPi_Cam_Web_Interface/archive/master.tar.gz' G_EXEC cd RPi_Cam_Web_Interface-master @@ -5902,7 +5907,7 @@ _EOF_ Banner_Installing - DEPS_LIST='python3' Download_Install 'https://yt-dl.org/downloads/latest/youtube-dl' /usr/local/bin/youtube-dl + aDEPS=('python3') Download_Install 'https://yt-dl.org/downloads/latest/youtube-dl' /usr/local/bin/youtube-dl G_EXEC chmod +x /usr/local/bin/youtube-dl # youtube-dl supports Python 2 and Python 3, but its shebang calls Python 2, else fails: https://github.com/ytdl-org/youtube-dl/issues/27649 @@ -6329,7 +6334,7 @@ _EOF_ fi # Dependencies: https://github.com/pi-hole/pi-hole/blob/development/automated%20install/basic-install.sh#L250 - G_AGI php$PHP_VERSION-{xml,sqlite3,intl} + G_AGI "php$PHP_VERSION-"{xml,sqlite3,intl} # Unbound: Switch port to 5335 if it was installed before, else it got just configured within its install step above if (( ${aSOFTWARE_INSTALL_STATE[182]} == 2 )) && grep -q '^[[:blank:]]*port:[[:blank:]][[:blank:]]*53$' /etc/unbound/unbound.conf.d/dietpi.conf @@ -6457,7 +6462,7 @@ _EOF_ Banner_Installing # Deps: apache2-utils is required for htpasswd command to create bcrypt password hashes - DEPS_LIST='apache2-utils' + aDEPS=('apache2-utils') if [[ -f '/mnt/dietpi_userdata/adguardhome/AdGuardHome' ]] then @@ -6465,9 +6470,8 @@ _EOF_ - If you want to update ${aSOFTWARE_NAME[$software_id]}, please use the internal updater from web UI. - If you need to reinstall (e.g. broken instance), please manually remove the executable \"/mnt/dietpi_userdata/adguardhome/AdGuardHome\" and rerun \"dietpi-software (re)install $software_id\"." - # shellcheck disable=SC2086 - G_AGI $DEPS_LIST - unset -v DEPS_LIST + G_AGI "${aDEPS[@]}" + aDEPS=() else # ARMv6 local url='https://static.adguard.com/adguardhome/release/AdGuardHome_linux_armv6.tar.gz' @@ -7029,7 +7033,7 @@ _EOF_ Banner_Installing # RPi: Install build deps for the "onoff" Node module - (( $G_HW_MODEL > 9 )) || DEPS_LIST='python3 make g++' + (( $G_HW_MODEL > 9 )) || aDEPS=('python3' 'make' 'g++') # ARMv6: Install Java 8 build and apply Log4Shell mitigation as the last Java 8 build does not contain it yet: https://github.com/Peterkn2001/blynk-server/releases if (( $G_HW_ARCH == 1 )) @@ -7143,7 +7147,7 @@ _EOF_ local reinstall=0 [[ -f '/etc/webiopi/config' ]] && reinstall=1 - DEPS_LIST='python3-dev python3-setuptools patch' + aDEPS=('python3-dev' 'python3-setuptools' 'patch') Download_Install 'https://github.com/Freenove/WebIOPi/archive/master.tar.gz' G_EXEC cd WebIOPi-master/WebIOPi-* @@ -7178,7 +7182,7 @@ After=network-online.target [Service] SyslogIdentifier=WebIOPi -ExecStart=$(which python3) -m webiopi -c /etc/webiopi/config +ExecStart=$(command -v python3) -m webiopi -c /etc/webiopi/config # Hardening PrivateTmp=true @@ -7195,11 +7199,11 @@ _EOF_ Banner_Installing local version='2.5.1' # https://www.haproxy.org/download/ - DEPS_LIST='libpcre3-dev libssl-dev zlib1g-dev libsystemd-dev' + aDEPS=('libpcre3-dev' 'libssl-dev' 'zlib1g-dev' 'libsystemd-dev') Download_Install "https://www.haproxy.org/download/${version%.*}/src/haproxy-$version.tar.gz" # Compile - G_EXEC cd haproxy-$version + G_EXEC cd "haproxy-$version" G_EXEC_OUTPUT=1 G_EXEC make -j "$G_HW_CPU_CORES" TARGET=linux-glibc CPU=generic USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1 USE_SYSTEMD=1 ADDLIB='-Wl,--no-as-needed -lgcc_s -Wl,--as-needed' DEBUG_CFLAGS='-g0 -O3' LDFLAGS='-Wl,-z,relro -Wl,-z,now -Wl,--as-needed' # Strip binary size G_EXEC strip --remove-section=.comment --remove-section=.note haproxy @@ -7212,9 +7216,9 @@ _EOF_ # - Error pages G_EXEC cd "$G_WORKING_DIR" G_EXEC mkdir -p /etc/haproxy/errors - G_EXEC mv haproxy-$version/examples/errorfiles/*.http /etc/haproxy/errors/ + G_EXEC mv "haproxy-$version/examples/errorfiles/"*.http /etc/haproxy/errors/ # Clean up - G_EXEC_NOHALT=1 G_EXEC rm -R haproxy-$version + G_EXEC_NOHALT=1 G_EXEC rm -R "haproxy-$version" # Jail directory G_EXEC mkdir -p /var/lib/haproxy @@ -7348,10 +7352,10 @@ _EOF_ Banner_Installing # Install required PHP modules: https://github.com/FreshRSS/FreshRSS#example-of-full-installation-on-linux-debianubuntu - DEPS_LIST="php$PHP_VERSION-curl php$PHP_VERSION-gmp php$PHP_VERSION-intl php$PHP_VERSION-mbstring php$PHP_VERSION-xml php$PHP_VERSION-zip" + aDEPS=("php$PHP_VERSION-curl" "php$PHP_VERSION-gmp" "php$PHP_VERSION-intl" "php$PHP_VERSION-mbstring" "php$PHP_VERSION-xml" "php$PHP_VERSION-zip") # - Add JSON module for PHP7, as it does not exist (embedded in core package) on PHP8 - local json= - [[ $PHP_VERSION == 8* ]] || DEPS_LIST+=" php$PHP_VERSION-json" json='json' + local json=() + [[ $PHP_VERSION == 8* ]] || aDEPS+=("php$PHP_VERSION-json") json=('json') # Reinstall: Skip download and install, advice to use internal updater from web UI if [[ -d '/opt/FreshRSS' ]] @@ -7360,16 +7364,15 @@ _EOF_ - If you want to update ${aSOFTWARE_NAME[$software_id]}, please use the internal updater from web UI. - If you need to reinstall (e.g. broken instance), please manually backup your config files+data, remove the install dir and rerun \"dietpi-software (re)install $software_id\"." - # shellcheck disable=SC2086 - G_AGI $DEPS_LIST - unset -v DEPS_LIST + G_AGI "${aDEPS[@]}" + aDEPS=() else Download_Install 'https://github.com/FreshRSS/FreshRSS/archive/master.tar.gz' /opt G_EXEC mv /opt/FreshRSS-master /opt/FreshRSS fi # Enable required PHP modules: https://github.com/FreshRSS/FreshRSS#requirements - G_EXEC phpenmod curl gmp intl pdo_mysql ctype dom mbstring xml zip $json + G_EXEC phpenmod curl gmp intl pdo_mysql ctype dom mbstring xml zip "${json[@]}" # Apache configuration if (( ${aSOFTWARE_INSTALL_STATE[83]} > 0 )); then @@ -7826,7 +7829,7 @@ _EOF_ Banner_Installing # Install required PHP modules: https://sye.dk/sfpg/ - DEPS_LIST="php$PHP_VERSION-gd" + aDEPS=("php$PHP_VERSION-gd") Download_Install 'https://sye.dk/sfpg/Single_File_PHP_Gallery_4.8.1.zip' /var/www/gallery # Enable required PHP modules @@ -7859,10 +7862,10 @@ _EOF_ Banner_Installing # https://github.com/ampache/ampache/wiki/Installation # Required PHP modules: https://github.com/ampache/ampache/wiki/Installation#prerequisites - DEPS_LIST="php$PHP_VERSION-curl php$PHP_VERSION-intl php$PHP_VERSION-xml" + aDEPS=("php$PHP_VERSION-curl" "php$PHP_VERSION-intl" "php$PHP_VERSION-xml") # - Add JSON module for PHP7, as it does not exist (embedded in core package) on PHP8 - local json= - [[ $PHP_VERSION == 8* ]] || DEPS_LIST+=" php$PHP_VERSION-json" json='json' + local json=() + [[ $PHP_VERSION == 8* ]] || aDEPS+=("php$PHP_VERSION-json") json=('json') # Bullseye+ if (( $G_DISTRO > 5 )) @@ -7897,7 +7900,7 @@ _EOF_ Download_Test_Media # Enable required PHP modules: https://github.com/ampache/ampache/wiki/Installation#prerequisites - G_EXEC phpenmod curl intl xml $json + G_EXEC phpenmod curl intl xml "${json[@]}" # Import our pre-made Ampache database, if not existent already if [[ ! -d '/mnt/dietpi_userdata/mysql/ampache' ]]; then @@ -8310,7 +8313,7 @@ _EOF_ Banner_Installing # Install required PHP modules - DEPS_LIST="php$PHP_VERSION-apcu php$PHP_VERSION-gd php$PHP_VERSION-intl php$PHP_VERSION-mbstring php$PHP_VERSION-opcache php$PHP_VERSION-xml" + aDEPS=("php$PHP_VERSION-apcu" "php$PHP_VERSION-gd" "php$PHP_VERSION-intl" "php$PHP_VERSION-mbstring" "php$PHP_VERSION-opcache" "php$PHP_VERSION-xml") # Reinstall: Skip download and install, advice to use internal updater from web UI if [[ -d '/var/www/pydio' ]] @@ -8319,9 +8322,8 @@ _EOF_ - If you want to update ${aSOFTWARE_NAME[$software_id]}, please use the internal updater from web UI. - If you need to reinstall (e.g. broken instance), please manually backup your config files+data, remove the install dir and rerun \"dietpi-software (re)install $software_id\"." - # shellcheck disable=SC2086 - G_AGI $DEPS_LIST - DEPS_LIST= + G_AGI "${aDEPS[@]}" + aDEPS=() else Download_Install 'https://download.pydio.com/pub/core/ci/pydio-latest.tar.gz' G_EXEC mv pydio-latest /var/www/pydio @@ -8372,19 +8374,19 @@ _EOF_ [[ -e '/var/www/pydio/data' ]] && G_EXEC rm -R /var/www/pydio/data else # Move data structure - [[ -e $data_dir || -L $data_dir ]] && G_EXEC rm -R $data_dir + [[ -e $data_dir || -L $data_dir ]] && G_EXEC rm -R "$data_dir" if [[ -d '/var/www/pydio/data' ]] then - G_EXEC mv /var/www/pydio/data $data_dir + G_EXEC mv /var/www/pydio/data "$data_dir" else - G_EXEC mkdir $data_dir + G_EXEC mkdir "$data_dir" fi fi # - Create symlink - G_EXEC ln -sf $data_dir /var/www/pydio/data + G_EXEC ln -sf "$data_dir" /var/www/pydio/data # Permissions: Fix some files being 444 mode, breaking internal updater - G_EXEC chown -R www-data:www-data /var/www/pydio $data_dir + G_EXEC chown -R www-data:www-data /var/www/pydio "$data_dir" G_EXEC chmod -R u+w /var/www/pydio fi @@ -8467,7 +8469,7 @@ _EOF_ Banner_Installing # APT deps: https://github.com/sabre-io/Baikal/wiki/Baïkal-dependencies - DEPS_LIST="php$PHP_VERSION-xml php$PHP_VERSION-mbstring php$PHP_VERSION-mysql" + aDEPS=("php$PHP_VERSION-xml" "php$PHP_VERSION-mbstring" "php$PHP_VERSION-mysql") local fallback_url='https://github.com/sabre-io/Baikal/releases/download/0.9.1/baikal-0.9.1.zip' Download_Install "$(curl -sSfL 'https://api.github.com/repos/sabre-io/Baikal/releases/latest' | mawk -F\" '/"browser_download_url": .*\/baikal-[^"\/]*\.zip"/{print $4}')" @@ -8677,11 +8679,11 @@ _EOF_ G_CHECK_URL "$url" # Python 3 is not pulled by rdiff-backup on Buster, but required to compile Node.js posix. - local python= - (( $G_DISTRO > 5 )) || python='python3' + local python=() + (( $G_DISTRO > 5 )) || python=('python3') # APT deps - G_AGI rdiff-backup rsync screen $python + G_AGI rdiff-backup rsync screen "${python[@]}" # Download/Update MineOS [[ -d '/mnt/dietpi_userdata/mineos' ]] || G_EXEC mkdir /mnt/dietpi_userdata/mineos @@ -8934,7 +8936,7 @@ _EOF_ Banner_Installing - DEPS_LIST='rtorrent mediainfo' + aDEPS=('rtorrent' 'mediainfo') # Install ruTorrent: Web UI for rTorrent # - Grab current version @@ -9275,7 +9277,7 @@ _EOF_ Banner_Installing - DEPS_LIST='mediainfo python3' + aDEPS=('mediainfo' 'python3') # Reinstall: Skip download and install, advice to use internal updater from web UI if [[ -d '/mnt/dietpi_userdata/medusa' ]] @@ -9284,9 +9286,8 @@ _EOF_ - If you want to update ${aSOFTWARE_NAME[$software_id]}, please use the internal updater from web UI. - If you need to reinstall (e.g. broken instance), please manually backup your config files+data, remove the install dir and rerun \"dietpi-software (re)install $software_id\"." - # shellcheck disable=SC2086 - G_AGI $DEPS_LIST - DEPS_LIST= + G_AGI "${aDEPS[@]}" + aDEPS=() else Download_Install 'https://github.com/pymedusa/Medusa/archive/master.tar.gz' /mnt/dietpi_userdata G_EXEC mv /mnt/dietpi_userdata/{Medusa-master,medusa} @@ -9498,9 +9499,9 @@ _EOF_ Banner_Installing # Build dependencies - DEPS_LIST='make cmake gcc libc6-dev libjpeg-dev' + aDEPS=('make' 'cmake' 'gcc' 'libc6-dev' 'libjpeg-dev') # - On RPi, add RPi Camera support by default - (( $G_HW_MODEL > 9 )) || DEPS_LIST+=' libraspberrypi-dev' + (( $G_HW_MODEL > 9 )) || aDEPS+=('libraspberrypi-dev') # Download sources Download_Install 'https://github.com/jacksonliam/mjpg-streamer/archive/master.tar.gz' @@ -9613,9 +9614,9 @@ _EOF_ Banner_Installing # https://sabnzbd.org/wiki/installation/install-off-modules # APT deps - DEPS_LIST='par2 p7zip-full' + aDEPS=('par2' 'p7zip-full') # ARMv8: No sabyenc3 wheels available: https://pypi.org/project/sabyenc3/#files - (( $G_HW_ARCH == 3 )) && DEPS_LIST+=' gcc' + (( $G_HW_ARCH == 3 )) && aDEPS+=('gcc') # Download Download_Install 'https://github.com/sabnzbd/sabnzbd/archive/master.tar.gz' @@ -9700,15 +9701,15 @@ _EOF_ Banner_Installing # Dependencies: https://github.com/mozilla-services/syncserver#quickstart - DEPS_LIST='python-virtualenv python-dev libmariadb-dev' + aDEPS=('python-virtualenv' 'python-dev' 'libmariadb-dev') # - Additional module compiling required on ARM - (( $G_HW_ARCH < 10 )) && DEPS_LIST+=' libffi-dev libssl-dev' + (( $G_HW_ARCH < 10 )) && aDEPS+=('libffi-dev' 'libssl-dev') # Download & Install local commit='c116417d653432db9470098236fb117adb349c36' # https://github.com/MichaIng/DietPi/issues/3774#issuecomment-703230290 Download_Install "https://github.com/mozilla-services/syncserver/archive/$commit.tar.gz" [[ -d '/opt/firefox-sync' ]] && G_EXEC rm -R /opt/firefox-sync - G_EXEC mv syncserver-$commit /opt/firefox-sync + G_EXEC mv "syncserver-$commit" /opt/firefox-sync # Build G_EXEC cd /opt/firefox-sync @@ -9728,12 +9729,12 @@ _EOF_ local ffsync_conf='/mnt/dietpi_userdata/firefox-sync/syncserver.ini' if [[ ! -f $ffsync_conf ]]; then - G_EXEC cp -a /opt/firefox-sync/syncserver.ini $ffsync_conf + G_EXEC cp -a /opt/firefox-sync/syncserver.ini "$ffsync_conf" local ffsync_ip=$(G_GET_NET ip) - G_CONFIG_INJECT 'host =' "host = $ffsync_ip" $ffsync_conf - G_CONFIG_INJECT 'port =' 'port = 5002' $ffsync_conf # Avoid port conflict with Shairport Sync - G_CONFIG_INJECT 'public_url =' "public_url = http://$ffsync_ip:5002/" $ffsync_conf - G_CONFIG_INJECT 'sqluri = sqlite:' 'sqluri = sqlite:////mnt/dietpi_userdata/firefox-sync/FF-Sync-DB.db' $ffsync_conf + G_CONFIG_INJECT 'host =' "host = $ffsync_ip" "$ffsync_conf" + G_CONFIG_INJECT 'port =' 'port = 5002' "$ffsync_conf" # Avoid port conflict with Shairport Sync + G_CONFIG_INJECT 'public_url =' "public_url = http://$ffsync_ip:5002/" "$ffsync_conf" + G_CONFIG_INJECT 'sqluri = sqlite:' 'sqluri = sqlite:////mnt/dietpi_userdata/firefox-sync/FF-Sync-DB.db' "$ffsync_conf" fi @@ -9774,7 +9775,7 @@ _EOF_ Banner_Installing # Dependencies: https://github.com/dani-garcia/vaultwarden/wiki/Building-binary#dependencies - DEPS_LIST='pkg-config libssl-dev' + aDEPS=('pkg-config' 'libssl-dev') # Download local version=$(curl -sSfL 'https://api.github.com/repos/dani-garcia/vaultwarden/releases/latest' | mawk -F\" '/"tag_name": /{print $4}') @@ -9971,10 +9972,10 @@ _EOF_ # APT dependencies: https://docs.koel.dev/#server > https://laravel.com/docs/master/deployment#server-requirements # - Additionally the PHP SQLite modules are required for the composer install step, despite MariaDB being used. - DEPS_LIST="php$PHP_VERSION-bcmath php$PHP_VERSION-curl php$PHP_VERSION-mbstring php$PHP_VERSION-sqlite3 php$PHP_VERSION-xml" + aDEPS=("php$PHP_VERSION-bcmath" "php$PHP_VERSION-curl" "php$PHP_VERSION-mbstring" "php$PHP_VERSION-sqlite3" "php$PHP_VERSION-xml") # - Add JSON module for PHP7, as it does not exist (embedded in core package) on PHP8 - local json= - [[ $PHP_VERSION == 8* ]] || DEPS_LIST+=" php$PHP_VERSION-json" json='json' + local json=() + [[ $PHP_VERSION == 8* ]] || aDEPS+=("php$PHP_VERSION-json") json=('json') # Grab latest release local fallback_url='https://github.com/koel/koel/releases/download/v5.1.13/koel-v5.1.13.tar.gz' @@ -9989,7 +9990,7 @@ _EOF_ G_EXEC mv koel /mnt/dietpi_userdata/koel # Enable required PHP modules - G_EXEC phpenmod bcmath ctype curl fileinfo mbstring pdo_mysql pdo_sqlite sqlite3 tokenizer xml $json + G_EXEC phpenmod bcmath ctype curl fileinfo mbstring pdo_mysql pdo_sqlite sqlite3 tokenizer xml "${json[@]}" # Install Koel G_EXEC cd /mnt/dietpi_userdata/koel @@ -10032,8 +10033,8 @@ _EOF_ Download_Test_Media # Init - G_EXEC_OUTPUT=1 G_EXEC sudo -u koel php$PHP_VERSION artisan koel:init -n --no-assets - G_EXEC_OUTPUT=1 G_EXEC sudo -u koel php$PHP_VERSION artisan koel:sync + G_EXEC_OUTPUT=1 G_EXEC sudo -u koel "php$PHP_VERSION" artisan koel:init -n --no-assets + G_EXEC_OUTPUT=1 G_EXEC sudo -u koel "php$PHP_VERSION" artisan koel:sync G_EXEC cd "$G_WORKING_DIR" # Service: Run on port 8003 by default to avoid conflict with IceCast @@ -10048,7 +10049,7 @@ After=network-online.target SyslogIdentifier=Koel User=koel WorkingDirectory=/mnt/dietpi_userdata/koel -ExecStart=$(command -v php$PHP_VERSION) /mnt/dietpi_userdata/koel/artisan serve --host 0.0.0.0 --port 8003 +ExecStart=$(command -v "php$PHP_VERSION") /mnt/dietpi_userdata/koel/artisan serve --host 0.0.0.0 --port 8003 [Install] WantedBy=multi-user.target @@ -10136,15 +10137,15 @@ _EOF_ Banner_Installing # APT dependencies - DEPS_LIST='mediainfo' + aDEPS=('mediainfo') # - .NET: https://packages.microsoft.com/debian/ if (( $G_HW_ARCH != 1 )) then if (( $G_DISTRO == 5 )) then - DEPS_LIST+=' libicu63' + aDEPS+=('libicu63') else - DEPS_LIST+=' libicu67' + aDEPS+=('libicu67') fi fi @@ -10155,9 +10156,8 @@ _EOF_ - If you want to update ${aSOFTWARE_NAME[$software_id]}, please use the internal updater from web UI. - If you need to reinstall (e.g. broken instance), please manually remove the install dir and rerun \"dietpi-software reinstall $software_id\"." - # shellcheck disable=SC2086 - G_AGI $DEPS_LIST - DEPS_LIST= + G_AGI "${aDEPS[@]}" + aDEPS=() else # ARMv6 local url=$(curl -sSfL 'https://api.github.com/repos/Radarr/Radarr/releases/latest' | mawk -F\" '/"browser_download_url": .*linux\.tar\.gz"/{print $4}') @@ -10245,15 +10245,15 @@ _EOF_ Banner_Installing # APT dependencies - DEPS_LIST='mediainfo' + aDEPS=('mediainfo') # - .NET: https://packages.microsoft.com/debian/ if (( $G_HW_ARCH != 1 )) then if (( $G_DISTRO == 5 )) then - DEPS_LIST+=' libicu63' + aDEPS+=('libicu63') else - DEPS_LIST+=' libicu67' + aDEPS+=('libicu67') fi fi @@ -10267,9 +10267,8 @@ _EOF_ - If you want to update ${aSOFTWARE_NAME[$software_id]}, please use the internal updater from web UI. - If you need to reinstall (e.g. broken instance), please manually remove the install dir and rerun \"dietpi-software reinstall $software_id\"." - # shellcheck disable=SC2086 - G_AGI $DEPS_LIST - DEPS_LIST= + G_AGI "${aDEPS[@]}" + aDEPS=() else # ARMv6 local url=$(curl -sSfL 'https://api.github.com/repos/Lidarr/Lidarr/releases/latest' | mawk -F\" '/"browser_download_url": .*linux\.tar\.gz"/{print $4}') @@ -10520,12 +10519,12 @@ _EOF_ # .NET dependencies: https://packages.microsoft.com/debian/ if (( $G_HW_ARCH != 1 )) then - DEPS_LIST='liblttng-ust0' + aDEPS=('liblttng-ust0') if (( $G_DISTRO == 5 )) then - DEPS_LIST+=' libicu63' + aDEPS+=('libicu63') else - DEPS_LIST+=' libicu67' + aDEPS+=('libicu67') fi fi @@ -10761,9 +10760,9 @@ _EOF_ # .NET dependency: https://packages.microsoft.com/debian/ if (( $G_DISTRO == 5 )) then - DEPS_LIST='libicu63' + aDEPS=('libicu63') else - DEPS_LIST='libicu67' + aDEPS=('libicu67') fi # Reinstall: Skip download and install, advice to use internal updater @@ -10773,8 +10772,8 @@ _EOF_ - If you want to update ${aSOFTWARE_NAME[$software_id]}, please use the internal updater. - If you need to reinstall (e.g. broken instance), please manually remove the install dir and rerun \"dietpi-software (re)install $software_id\"." - G_AGI $DEPS_LIST - DEPS_LIST= + G_AGI "${aDEPS[@]}" + aDEPS=() else Download_Install 'https://download.roonlabs.com/builds/RoonServer_linuxx64.tar.bz2' G_EXEC mv RoonServer /opt/roonserver @@ -10834,9 +10833,9 @@ _EOF_ # Add i386 arch: https://packages.debian.org/bullseye/steam [[ $(dpkg --print-foreign-architectures) == *'i386'* ]] || { G_EXEC dpkg --add-architecture i386; G_AGUP; } # Add Nvidia i386 driver libs if Nvidia driver is detected - local nvidia= - [[ -e '/sys/module/nvidia/version' ]] && nvidia='nvidia-driver-libs:i386' - G_AGI steam $nvidia + local nvidia=() + [[ -e '/sys/module/nvidia/version' ]] && nvidia=('nvidia-driver-libs:i386') + G_AGI steam "${nvidia[@]}" # ARM: Install repacked Debian i386 package for armhf elif [[ $G_HW_ARCH == 2 ]] @@ -11138,7 +11137,7 @@ _EOF_ Banner_Installing # APT dependencies: https://github.com/hzeller/gmrender-resurrect/blob/master/INSTALL.md - DEPS_LIST='libupnp13 gstreamer1.0-alsa gstreamer1.0-libav gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly' + aDEPS=('libupnp13' 'gstreamer1.0-alsa' 'gstreamer1.0-libav' 'gstreamer1.0-plugins-good' 'gstreamer1.0-plugins-bad' 'gstreamer1.0-plugins-ugly') Download_Install "https://dietpi.com/downloads/binaries/$G_DISTRO_NAME/gmediarender_$G_HW_ARCH_NAME.7z" /usr/local/bin G_EXEC chmod +x /usr/local/bin/gmediarender @@ -11325,6 +11324,7 @@ _EOF_ G_EXEC cp systemd/alsa-init.service /etc/systemd/system/ #G_EXEC cp systemd/ntpdate.service /etc/systemd/system/ + # shellcheck disable=SC1091 source env/bin/activate # Enable default app for service start @@ -11360,7 +11360,7 @@ _EOF_ fi # APT deps - DEPS_LIST='vorbis-tools' + aDEPS=('vorbis-tools') # Pre-create global config to reflect correct data dir and audio settings within install # - Overwrite existing config, user should use /mnt/dietpi_userdata/mycroft-data/.mycroft/mycroft.conf instead to override. @@ -11445,7 +11445,7 @@ _EOF_ G_EXEC chown -R roon-extension-manager:root /mnt/dietpi_userdata/roon-extension-manager # Store installer to data dir, so we can reuse it on uninstall - DEPS_LIST='wget' Download_Install 'https://raw.githubusercontent.com/TheAppgineer/roon-extension-manager/v1.x/rem-setup.sh' /mnt/dietpi_userdata/roon-extension-manager/rem-setup.sh + aDEPS=('wget') Download_Install 'https://raw.githubusercontent.com/TheAppgineer/roon-extension-manager/v1.x/rem-setup.sh' /mnt/dietpi_userdata/roon-extension-manager/rem-setup.sh G_EXEC cd /mnt/dietpi_userdata/roon-extension-manager G_EXEC chmod +x rem-setup.sh @@ -11511,7 +11511,7 @@ _EOF_ Banner_Installing # APT deps - DEPS_LIST='cmake python3-minimal' + aDEPS=('cmake' 'python3-minimal') # Download local version=$(curl -sSfL 'https://api.github.com/repos/ptitSeb/box86/tags' | mawk -F\" '/"name": /{print $4;exit}') @@ -11519,8 +11519,8 @@ _EOF_ Download_Install "https://github.com/ptitSeb/box86/archive/$version.tar.gz" # Build - G_EXEC mkdir box86-${version#v}/build - G_EXEC cd box86-${version#v}/build + G_EXEC mkdir "box86-${version#v}/build" + G_EXEC cd "box86-${version#v}/build" # - RPi 2 if [[ $G_HW_MODEL == 2 ]] then @@ -11555,7 +11555,7 @@ _EOF_ Banner_Installing # APT deps - DEPS_LIST='cmake python3-minimal' + aDEPS=('cmake' 'python3-minimal') # Download local version=$(curl -sSfL 'https://api.github.com/repos/ptitSeb/box64/tags' | mawk -F\" '/"name": /{print $4;exit}') @@ -11563,8 +11563,8 @@ _EOF_ Download_Install "https://github.com/ptitSeb/box64/archive/$version.tar.gz" # Build - G_EXEC mkdir box64-${version#v}/build - G_EXEC cd box64-${version#v}/build + G_EXEC mkdir "box64-${version#v}/build" + G_EXEC cd "box64-${version#v}/build" # - RPi 4 if [[ $G_HW_MODEL == 4 ]] then @@ -11591,7 +11591,7 @@ _EOF_ Banner_Installing # Install required PHP modules - DEPS_LIST="php$PHP_VERSION-curl php$PHP_VERSION-zip" # https://github.com/reloxx13/TasmoAdmin#linux + aDEPS=("php$PHP_VERSION-curl" "php$PHP_VERSION-zip") # https://github.com/reloxx13/TasmoAdmin#linux # Reinstall: Skip download and install, advice to use internal updater from web UI if [[ -d '/var/www/tasmoadmin' ]] @@ -11600,9 +11600,8 @@ _EOF_ - If you want to update ${aSOFTWARE_NAME[$software_id]}, please use the internal updater from web UI. - If you need to reinstall (e.g. broken instance), please manually backup your config files+data, remove the install dir and rerun \"dietpi-software (re)install $software_id\"." - # shellcheck disable=SC2086 - G_AGI $DEPS_LIST - DEPS_LIST= + G_AGI "${aDEPS[@]}" + aDEPS=() else local fallback_url="https://github.com/TasmoAdmin/TasmoAdmin/releases/download/v1.8.0/tasmoadmin_v1.8.0.tar.gz" Download_Install "$(curl -sSfL 'https://api.github.com/repos/TasmoAdmin/TasmoAdmin/releases/latest' | mawk -F\" '/"browser_download_url": ".*\/tasmoadmin_v[^"\/]*\.tar\.gz"$/{print $4}')" @@ -11622,7 +11621,7 @@ _EOF_ G_WHIP_MSG "Existing TasmoAdmin Apache configuration found, will preserve the old one and save the new one for review and comparison to: $tasmoadmin_conf" fi - dps_index=$software_id Download_Install 'apache.tasmoadmin.conf' $tasmoadmin_conf + dps_index=$software_id Download_Install 'apache.tasmoadmin.conf' "$tasmoadmin_conf" a2ensite dietpi-tasmoadmin 1> /dev/null elif (( ${aSOFTWARE_INSTALL_STATE[84]} > 0 )); then @@ -11635,7 +11634,7 @@ _EOF_ G_WHIP_MSG "Existing TasmoAdmin Lighttpd configuration found, will preserve the old one and save the new one for review and comparison to: $tasmoadmin_conf" fi - dps_index=$software_id Download_Install 'lighttpd.tasmoadmin.conf' $tasmoadmin_conf + dps_index=$software_id Download_Install 'lighttpd.tasmoadmin.conf' "$tasmoadmin_conf" # Enable required modules + our config G_EXEC_POST_FUNC(){ [[ $exit_code == 2 ]] && exit_code=0; } # Do not fail if modules are enabled already G_EXEC lighty-enable-mod rewrite dietpi-tasmoadmin @@ -11650,7 +11649,7 @@ _EOF_ G_WHIP_MSG "Existing TasmoAdmin Nginx configuration found, will preserve the old one and save the new one for review and comparison to: $tasmoadmin_conf" fi - dps_index=$software_id Download_Install 'nginx.tasmoadmin.conf' $tasmoadmin_conf + dps_index=$software_id Download_Install 'nginx.tasmoadmin.conf' "$tasmoadmin_conf" fi @@ -11672,10 +11671,10 @@ _EOF_ G_DIETPI-NOTIFY 2 "pyenv Python version: $ha_python_version" # User - Create_User -G dialout,gpio,i2c -d $ha_home $ha_user + Create_User -G dialout,gpio,i2c -d "$ha_home" "$ha_user" # Start with fresh instance, to allow clean pyenv and Python updates and fix broken instances. All userdata and configs are preserved in: /mnt/dietpi_userdata/homeassistant - [[ -d $ha_home/.pyenv ]] && G_EXEC rm -R $ha_home/.pyenv + [[ -d $ha_home/.pyenv ]] && G_EXEC rm -R "$ha_home/.pyenv" [[ -d '/srv/homeassistant' ]] && G_EXEC rm -R /srv/homeassistant # pre-v6-27 # Dependencies @@ -11685,25 +11684,26 @@ _EOF_ local custom_pip_deps=$(sed -n '/^[[:blank:]]*SOFTWARE_HOMEASSISTANT_PIP_DEPS=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) # - All: gcc, libc6-dev, make, libssl-dev, zlib1g-dev for Python build and libbz2-dev, libreadline-dev, libsqlite3-dev to suppress warnings # - All: libffi-dev to solve "ModuleNotFoundError: No module named '_ctypes'", for python-slugify==4.0.1 build on ARMv8/x86_64 and cffi build on ARMv6/7 Buster - DEPS_LIST="gcc libc6-dev make libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev libffi-dev $custom_apt_deps" + aDEPS=('gcc' 'libc6-dev' 'make' 'libssl-dev' 'zlib1g-dev' 'libbz2-dev' 'libreadline-dev' 'libsqlite3-dev' 'libffi-dev') + mapfile -t -d' ' -O "${#aDEPS[@]}" aDEPS < <(echo -n "$custom_apt_deps") # - ARMv6/7 - G_EXEC mkdir -p $ha_home - G_EXEC chown $ha_user:$ha_user $ha_home + G_EXEC mkdir -p "$ha_home" + G_EXEC chown "$ha_user:$ha_user" "$ha_home" if [[ $G_HW_ARCH == [12] ]] then - G_EXEC mkdir -p $ha_home/.pip + G_EXEC mkdir -p "$ha_home/.pip" # Bullseye if (( $G_DISTRO == 6 )) then # Create pip config to pull wheels from piwheels.org G_EXEC eval "echo -e '[global]\nextra-index-url=https://www.piwheels.org/simple/' > $ha_home/.pip/pip.conf" # libopenjp2-7, libtiff5, libxcb1 for runtime - DEPS_LIST+=' libopenjp2-7 libtiff5 libxcb1' + aDEPS+=('libopenjp2-7' 'libtiff5' 'libxcb1') else # piwheels.org Python 3.9 wheels depend on shared libraries from Bullseye. Unset extra-index-url explicitly, as /etc/pip.conf could set it. G_EXEC eval "echo -e '[global]\nextra-index-url=' > $ha_home/.pip/pip.conf" # libjpeg-dev for Pillow - DEPS_LIST+=' libjpeg-dev' + aDEPS+=('libjpeg-dev') # Rust for cryptography G_EXEC curl -sSfL 'https://sh.rustup.rs' -o rustup-init.sh G_EXEC chmod +x rustup-init.sh @@ -11714,8 +11714,8 @@ _EOF_ # Install pyenv to $ha_home Download_Install 'https://github.com/pyenv/pyenv/archive/master.tar.gz' - G_EXEC mv pyenv-master $ha_home/.pyenv - G_EXEC chown -R $ha_user:$ha_user $ha_home/.pyenv + G_EXEC mv pyenv-master "$ha_home/.pyenv" + G_EXEC chown -R "$ha_user:$ha_user" "$ha_home/.pyenv" # Generate script to activate pyenv: This must be sourced from the originating shell, hence it does not require execute permissions. echo "#!/bin/dash @@ -11728,10 +11728,10 @@ export PYENV_ROOT='$ha_home/.pyenv' export PATH=\"\$PYENV_ROOT/bin:\$PATH\" eval \"\$(pyenv init --path)\" eval \"\$(pyenv init -)\" -[ -f '.cargo/env' ] && . .cargo/env" > $ha_home/pyenv-activate.sh +[ -f '.cargo/env' ] && . .cargo/env" > "$ha_home/pyenv-activate.sh" G_EXEC_DESC='Installing Python with Home Assistant module into pyenv' - G_EXEC_OUTPUT=1 G_EXEC sudo -u $ha_user dash -c " + G_EXEC_OUTPUT=1 G_EXEC sudo -u "$ha_user" dash -c " $ha_pyenv_activation pyenv install $ha_python_version pyenv local $ha_python_version @@ -11742,13 +11742,13 @@ exec pip3 install --no-cache-dir homeassistant" # Generate script to launch HA using pyenv echo "#!/bin/dash $ha_pyenv_activation -exec hass -c '/mnt/dietpi_userdata/homeassistant'" > $ha_home/homeassistant-start.sh - G_EXEC chmod +x $ha_home/homeassistant-start.sh +exec hass -c '/mnt/dietpi_userdata/homeassistant'" > "$ha_home/homeassistant-start.sh" + G_EXEC chmod +x "$ha_home/homeassistant-start.sh" # Generate script to update HA within pyenv echo "#!/bin/dash -exec sudo -u $ha_user dash -c '$ha_pyenv_activation; exec pip3 install --no-cache-dir -U homeassistant'" > $ha_home/homeassistant-update.sh - G_EXEC chmod +x $ha_home/homeassistant-update.sh +exec sudo -u $ha_user dash -c '$ha_pyenv_activation; exec pip3 install --no-cache-dir -U homeassistant'" > "$ha_home/homeassistant-update.sh" + G_EXEC chmod +x "$ha_home/homeassistant-update.sh" cat << '_EOF_' > /etc/systemd/system/home-assistant.service [Unit] @@ -11812,7 +11812,7 @@ _EOF_ fi # Minecraft rcon client for remote administration and server maintenance scripts - DEPS_LIST='gcc libc6-dev' + aDEPS=('gcc' 'libc6-dev') Download_Install 'https://github.com/Tiiffi/mcrcon/archive/master.tar.gz' G_EXEC gcc -g0 -O3 mcrcon-master/mcrcon.c -o /usr/local/bin/mcrcon G_EXEC rm -R mcrcon-master @@ -11878,7 +11878,7 @@ _EOF_ Banner_Installing # APT deps - DEPS_LIST='libusb-0.1 libcurl3-gnutls' + aDEPS=('libusb-0.1' 'libcurl3-gnutls') # Reinstall: Clean old install dir [[ -d '/opt/domoticz' ]] && G_EXEC rm -R /opt/domoticz @@ -12075,13 +12075,14 @@ _EOF_ fallback_url="https://github.com/Spotifyd/spotifyd/releases/download/v0.3.3/spotifyd-linux-full.tar.gz" file='spotifyd-linux-full' ;; + *) :;; esac # Reinstall: Remove old install dir [[ -d '/opt/spotifyd' ]] && G_EXEC rm -R /opt/spotifyd # x86_64 only deps: Both ARM binaries are not compiled against these. dbus would be required for MPRIS support, but let's keep it slim for now. - (( $G_HW_ARCH == 10 )) && DEPS_LIST='libdbus-1-3 libpulse0' + (( $G_HW_ARCH == 10 )) && aDEPS=('libdbus-1-3' 'libpulse0') Download_Install "$(curl -sSfL 'https://api.github.com/repos/Spotifyd/spotifyd/releases/latest' | mawk -F\" "/\"browser_download_url\": .*\/$file\.tar\.gz\"/{print \$4}")" /opt/spotifyd @@ -12499,7 +12500,7 @@ If no WireGuard (auto)start is included, but you require it, please do the follo (( $current_gpu_mem < $suggest_gpu_mem )) && G_WHIP_DEFAULT_ITEM='Ok' G_WHIP_YESNO "[ INFO ] DietPi has detected an increased GPU memory is required for your installed software: - Current: $current_gpu_mem MiB\n - Recommended: $suggest_gpu_mem MiB\n\nWould you like DietPi to apply the recommended GPU memory split?\n\nIf unsure, select 'Ok'." || return 0 - /boot/dietpi/func/dietpi-set_hardware gpumemsplit $suggest_gpu_mem + /boot/dietpi/func/dietpi-set_hardware gpumemsplit "$suggest_gpu_mem" } @@ -12651,10 +12652,10 @@ If no WireGuard (auto)start is included, but you require it, please do the follo mysql -e "drop user $dbuser@$dbhost;" mysql -e "drop user $dbuser;" 2> /dev/null # - Perform database backup if existent, otherwise skip to not overwrite existing one - [[ -d '/mnt/dietpi_userdata/mysql/owncloud' ]] && mysqldump owncloud > $datadir/dietpi-owncloud-database-backup.sql + [[ -d '/mnt/dietpi_userdata/mysql/owncloud' ]] && mysqldump owncloud > "$datadir/dietpi-owncloud-database-backup.sql" mysqladmin drop owncloud -f # Backup ownCloud installation folder - cp -a /var/www/owncloud/. $datadir/dietpi-owncloud-installation-backup/ + cp -a /var/www/owncloud/. "$datadir/dietpi-owncloud-installation-backup/" # Remove ownCloud installation folder rm -R /var/www/owncloud # Remove redirect configs @@ -12714,10 +12715,10 @@ If no WireGuard (auto)start is included, but you require it, please do the follo mysql -e "drop user $dbuser@$dbhost;" mysql -e "drop user $dbuser;" 2> /dev/null # - Perform database backup if existent, otherwise skip to not overwrite existing one - [[ -d '/mnt/dietpi_userdata/mysql/nextcloud' ]] && mysqldump nextcloud > $datadir/dietpi-nextcloud-database-backup.sql + [[ -d '/mnt/dietpi_userdata/mysql/nextcloud' ]] && mysqldump nextcloud > "$datadir/dietpi-nextcloud-database-backup.sql" mysqladmin drop nextcloud -f # Backup Nextcloud installation folder - cp -a /var/www/nextcloud/. $datadir/dietpi-nextcloud-installation-backup/ + cp -a /var/www/nextcloud/. "$datadir/dietpi-nextcloud-installation-backup/" # Remove Nextcloud installation folder rm -R /var/www/nextcloud # Remove redirect configs @@ -15213,9 +15214,9 @@ _EOF_ [[ -d '/var/urbackup' ]] && G_EXEC rm -R /var/urbackup [[ -f '/etc/default/urbackupsrv' ]] && G_EXEC rm /etc/default/urbackupsrv [[ -f '/etc/logrotate.d/urbackupsrv' ]] && G_EXEC rm /etc/logrotate.d/urbackupsrv - command -v urbackupsrv > /dev/null && G_EXEC rm "$(which -a urbackupsrv)" - command -v urbackup_mount_helper > /dev/null && G_EXEC rm "$(which -a urbackup_mount_helper)" - command -v urbackup_snapshot_helper > /dev/null && G_EXEC rm "$(which -a urbackup_snapshot_helper)" + command -v urbackupsrv > /dev/null && G_EXEC rm "$(command -v urbackupsrv)" + command -v urbackup_mount_helper > /dev/null && G_EXEC rm "$(command -v urbackup_mount_helper)" + command -v urbackup_snapshot_helper > /dev/null && G_EXEC rm "$(command -v urbackup_snapshot_helper)" fi @@ -15605,6 +15606,7 @@ _EOF_ /boot/dietpi/dietpi-services unmask # Stop all services + # shellcheck disable=SC2154 [[ $G_SERVICE_CONTROL == 0 ]] || /boot/dietpi/dietpi-services stop # Update package cache: Skip when flag was set by first run setup @@ -15873,7 +15875,7 @@ This requires an account at: https://remote.it/ findmnt /var/log > /dev/null && G_EXEC mount -o remount /var/log # Set time sync mode if no container system - (( $G_HW_MODEL == 75 )) || /boot/dietpi/func/dietpi-set_software ntpd-mode $AUTOINSTALL_TIMESYNCMODE + (( $G_HW_MODEL == 75 )) || /boot/dietpi/func/dietpi-set_software ntpd-mode "$AUTOINSTALL_TIMESYNCMODE" # Apply choice and preference system settings Apply_SSHServer_Choices "$AUTOINSTALL_SSHINDEX" @@ -15887,6 +15889,7 @@ This requires an account at: https://remote.it/ '-1') (( ${aSOFTWARE_INSTALL_STATE[94]} == 2 )) || aSOFTWARE_INSTALL_STATE[94]=1;; '-2') (( ${aSOFTWARE_INSTALL_STATE[96]} == 2 )) || aSOFTWARE_INSTALL_STATE[96]=1;; + *) :;; esac @@ -15974,7 +15977,7 @@ This requires an account at: https://remote.it/ fi (( $i < 3 )) && mask+=. done - echo $mask + echo "$mask" } # Get Ethernet index @@ -16982,6 +16985,8 @@ List of installed software and their online documentation URLs: 'Install') Menu_StartInstall;; + *) :;; + esac # Exit/Abort Setup diff --git a/dietpi/dietpi-sync b/dietpi/dietpi-sync index 9d0053448a..0f4811dc2d 100755 --- a/dietpi/dietpi-sync +++ b/dietpi/dietpi-sync @@ -53,7 +53,7 @@ Create_Filter_Include_Exclude(){ # Exclude files by name - cat << _EOF_ > $FP_FILTER_INCLUDE_EXCLUDE + cat << _EOF_ > "$FP_FILTER_INCLUDE_EXCLUDE" - $FP_LOG - $FP_FILTER_INCLUDE_EXCLUDE - .swap* @@ -78,13 +78,13 @@ _EOF_ for i in "${aexclude[@]}" do # Exclude only, if inside source location, via path, relative to source location - [[ $i == ${FP_SOURCE}/* ]] && echo "- $(realpath --relative-to="$FP_SOURCE" "$i")" >> $FP_FILTER_INCLUDE_EXCLUDE + [[ $i == ${FP_SOURCE}/* ]] && echo "- $(realpath --relative-to="$FP_SOURCE" "$i")" >> "$FP_FILTER_INCLUDE_EXCLUDE" done unset aexclude # Add users additional list - [[ -f $FP_USER_FILTER_INCLUDE_EXCLUDE ]] && cat $FP_USER_FILTER_INCLUDE_EXCLUDE >> $FP_FILTER_INCLUDE_EXCLUDE + [[ -f $FP_USER_FILTER_INCLUDE_EXCLUDE ]] && cat "$FP_USER_FILTER_INCLUDE_EXCLUDE" >> "$FP_FILTER_INCLUDE_EXCLUDE" } @@ -100,16 +100,16 @@ _EOF_ # Pre-create target dir, which also checks R/W access # - Remove previous mkdir log - [[ -f $FP_LOG_ALT ]] && rm $FP_LOG_ALT - mkdir -p "$FP_TARGET" &> $FP_LOG + [[ -f $FP_LOG_ALT ]] && rm "$FP_LOG_ALT" + mkdir -p "$FP_TARGET" &> "$FP_LOG" # Error: Dir not found if [[ ! -d $FP_TARGET ]]; then - G_WHIP_MSG "[FAILED] Unable to pre-create target directory: $FP_TARGET\n\n\"mkdir\" reported the following error:\n$(<$FP_LOG)" + G_WHIP_MSG "[FAILED] Unable to pre-create target directory: $FP_TARGET\n\n\"mkdir\" reported the following error:\n$(<"$FP_LOG")" # We cannot log to target dir, use $FP_LOG_ALT instead - echo "$(date +"%Y-%m-%d_%T") [FAILED] Unable to pre-create target directory: $FP_TARGET" >> $FP_LOG - mv $FP_LOG $FP_LOG_ALT + echo "$(date +"%Y-%m-%d_%T") [FAILED] Unable to pre-create target directory: $FP_TARGET" >> "$FP_LOG" + mv "$FP_LOG" "$FP_LOG_ALT" # Error: Empty source dir elif [[ ! $(ls -A "$FP_SOURCE") ]]; then @@ -137,7 +137,7 @@ _EOF_ (( $SYNC_DELETE_MODE )) && aoptions+=('--delete' '--delete-excluded') # Dry run - G_DIETPI-NOTIFY 3 $G_PROGRAM_NAME "Dry run $FP_SOURCE > $FP_TARGET" + G_DIETPI-NOTIFY 3 "$G_PROGRAM_NAME" "Dry run $FP_SOURCE > $FP_TARGET" rsync --dry-run --stats "${aoptions[@]}" "$FP_SOURCE"/ "$FP_TARGET"/ > .dietpi-sync_result EXIT_CODE=$? if (( ! $EXIT_CODE )); then @@ -156,7 +156,7 @@ _EOF_ local menu_test="[ OK ] Dry run completed (NO changes made):\n - $FP_SOURCE > $FP_TARGET" G_WHIP_DEFAULT_ITEM='Sync' - if ! G_CHECK_FREESPACE "$FP_TARGET" $end_result; then + if ! G_CHECK_FREESPACE "$FP_TARGET" "$end_result"; then if (( $INPUT == 1 )); then @@ -188,7 +188,7 @@ Continue only if you know what you are doing and after checking the log!" if [[ $G_WHIP_RETURNED_VALUE == 'Log' ]]; then - G_WHIP_VIEWFILE $FP_LOG + G_WHIP_VIEWFILE "$FP_LOG" G_WHIP_DEFAULT_ITEM='Log' elif [[ $G_WHIP_RETURNED_VALUE == 'Sync' || $INPUT == 1 ]]; then @@ -203,30 +203,30 @@ Continue only if you know what you are doing and after checking the log!" done # Sync - G_DIETPI-NOTIFY 3 $G_PROGRAM_NAME "Sync $FP_SOURCE > $FP_TARGET" + G_DIETPI-NOTIFY 3 "$G_PROGRAM_NAME" "Sync $FP_SOURCE > $FP_TARGET" # - Clear log file from dry run - > $FP_LOG + > "$FP_LOG" rsync "${aoptions[@]}" "$FP_SOURCE"/ "$FP_TARGET"/ EXIT_CODE=$? fi - G_DIETPI-NOTIFY -1 $EXIT_CODE $G_PROGRAM_NAME + G_DIETPI-NOTIFY -1 "$EXIT_CODE" "$G_PROGRAM_NAME" if (( $EXIT_CODE )); then - echo "$(date +"%Y-%m-%d_%T") [FAILED] Please see the log file for more information: $FP_TARGET/$FP_LOG" >> $FP_LOG + echo "$(date +"%Y-%m-%d_%T") [FAILED] Please see the log file for more information: $FP_TARGET/$FP_LOG" >> "$FP_LOG" G_WHIP_MSG "[FAILED] $FP_SOURCE > $FP_TARGET\n\nYou will given an option to view the logfile on the next screen. Please check it for information and/or errors." else - echo "$(date +"%Y-%m-%d_%T") [ OK ] Sync completed" >> $FP_LOG + echo "$(date +"%Y-%m-%d_%T") [ OK ] Sync completed" >> "$FP_LOG" G_WHIP_MSG "[ OK ] Sync completed:\n - $FP_SOURCE > $FP_TARGET" fi - log=1 G_WHIP_VIEWFILE $FP_LOG - mv $FP_LOG "$FP_TARGET"/ + log=1 G_WHIP_VIEWFILE "$FP_LOG" + mv "$FP_LOG" "$FP_TARGET/" fi @@ -249,7 +249,7 @@ Continue only if you know what you are doing and after checking the log!" #///////////////////////////////////////////////////////////////////////////////////// Write_Settings_File(){ - cat << _EOF_ > $FP_SETTINGS + cat << _EOF_ > "$FP_SETTINGS" FP_SOURCE='$FP_SOURCE' FP_TARGET='$FP_TARGET' SYNC_DELETE_MODE=$SYNC_DELETE_MODE @@ -258,7 +258,8 @@ _EOF_ } - Read_Settings_File(){ [[ -f $FP_SETTINGS ]] && . $FP_SETTINGS; } + # shellcheck disable=SC1090 + Read_Settings_File(){ [[ -f $FP_SETTINGS ]] && . "$FP_SETTINGS"; } #///////////////////////////////////////////////////////////////////////////////////// # MENUS @@ -281,7 +282,7 @@ _EOF_ elif [[ -f $FP_LOG_ALT ]]; then - local sync_last_status=$(tail -1 $FP_LOG_ALT) + local sync_last_status=$(tail -1 "$FP_LOG_ALT") else @@ -327,6 +328,8 @@ More information:\n - https://dietpi.com/docs/dietpi_tools/#dietpi-sync';; 'Dry run + Sync') Run_Sync;; + *) :;; + esac else @@ -401,7 +404,6 @@ More information:\n - https://dietpi.com/docs/dietpi_tools/#dietpi-sync';; TARGETMENUID=0 fi - ;; 'Manual') Input_User_Directory;; @@ -427,9 +429,10 @@ More information:\n - https://dietpi.com/docs/dietpi_tools/#dietpi-sync';; Prompt_Setup_Samba_Mount fi - ;; + *) G_DIETPI-NOTIFY 1 'An invalid "case" option was used. This is a bug, please report at: https://github.com/MichaIng/DietPi/issues'; exit 1;; + esac else @@ -508,7 +511,7 @@ If files are in the Target location that do not exist in the Source, they will b else - declare -g $fp_mode="${G_WHIP_RETURNED_VALUE%/}" + declare -g "$fp_mode=${G_WHIP_RETURNED_VALUE%/}" TARGETMENUID=0 return @@ -537,7 +540,7 @@ If files are in the Target location that do not exist in the Source, they will b # Generate optional user include/exclude file if [[ ! -f $FP_USER_FILTER_INCLUDE_EXCLUDE ]]; then - cat << _EOF_ > $FP_USER_FILTER_INCLUDE_EXCLUDE + cat << _EOF_ > "$FP_USER_FILTER_INCLUDE_EXCLUDE" #$G_PROGRAM_NAME | Custom include/exclude filters # #To EXCLUDE (-) all files by name: @@ -586,6 +589,6 @@ _EOF_ fi #----------------------------------------------------------------------------------- - exit $EXIT_CODE + exit "$EXIT_CODE" #----------------------------------------------------------------------------------- } diff --git a/dietpi/dietpi-update b/dietpi/dietpi-update index 7fd737e264..5b3ad4777b 100755 --- a/dietpi/dietpi-update +++ b/dietpi/dietpi-update @@ -93,6 +93,7 @@ if curl -sSfLO "$url"; then # Source file + # shellcheck disable=SC1091 . version # Check if remote version consists of valid integers @@ -189,7 +190,7 @@ G_DIETPI-NOTIFY 2 "$INFO_CURRENT_VERSION" G_DIETPI-NOTIFY 2 "$INFO_REMOTE_VERSION" - return $result + return "$result" } @@ -279,7 +280,7 @@ then G_EXEC_DESC='Downloading pre-patches' G_EXEC curl -sSfLO "https://raw.githubusercontent.com/$GITOWNER_TARGET/DietPi/$GITBRANCH_TARGET/dietpi/pre-patch_file" G_EXEC_DESC='Applying execute permission' G_EXEC chmod +x pre-patch_file - if ! ./pre-patch_file $G_DIETPI_VERSION_SUB + if ! ./pre-patch_file "$G_DIETPI_VERSION_SUB" then G_DIETPI-NOTIFY 1 "An error occurred during pre-patch $?. Please check the above log or $FP_LOG for errors, and rerun \"dietpi-update\" after the cause has been solved." exit 1 @@ -289,7 +290,7 @@ else G_EXEC_DESC='Downloading pre-patches' G_EXEC curl -sSfLO "https://raw.githubusercontent.com/$GITOWNER_TARGET/DietPi/$GITBRANCH_TARGET/.update/pre-patches" G_EXEC_DESC='Applying execute permission' G_EXEC chmod +x pre-patches - if ! ./pre-patches $G_DIETPI_VERSION_CORE $G_DIETPI_VERSION_SUB + if ! ./pre-patches "$G_DIETPI_VERSION_CORE" "$G_DIETPI_VERSION_SUB" then G_DIETPI-NOTIFY 1 "An error occurred during pre-patching. Please check the above log or $FP_LOG for errors, and rerun \"dietpi-update\" after the cause has been solved." exit 1 @@ -507,7 +508,7 @@ Do you wish to continue and update DietPi to v$G_REMOTE_VERSION_CORE.$G_REMOTE_V # Run_DietPi_Update: https://github.com/MichaIng/DietPi/issues/1877#issuecomment-403866204 # - Log to file by redirecting to subshell instead of piping, else G_EXEC cannot exit the script via "kill -INT $$": https://github.com/MichaIng/DietPi/issues/3127 - Run_DietPi_Update &> >(tee $FP_LOG); wait $! + Run_DietPi_Update &> >(tee "$FP_LOG"); wait $! # Mark 1st run update as completed Apply_1st_Run_Update_Success @@ -572,6 +573,7 @@ Do you wish to continue and update DietPi to v$G_REMOTE_VERSION_CORE.$G_REMOTE_V if [[ $INPUT == 1 && $mode == 2 ]] then G_AGUP -v + # shellcheck disable=SC2154 if (( $G_AGUP_COUNT )) then G_AGUG &> >(tee /var/tmp/dietpi/logs/dietpi-upgrade_apt.log) diff --git a/dietpi/dietpi-vpn b/dietpi/dietpi-vpn index 8c2cca166c..8551721ecf 100755 --- a/dietpi/dietpi-vpn +++ b/dietpi/dietpi-vpn @@ -72,7 +72,7 @@ Available commands: Check_Connected() { - [[ $(ip r l dev $IFACE 2> /dev/null) ]] && VPN_CONNECTED=1 || VPN_CONNECTED=0 + [[ $(ip r l dev "$IFACE" 2> /dev/null) ]] && VPN_CONNECTED=1 || VPN_CONNECTED=0 return $(( ! $VPN_CONNECTED )) } @@ -81,13 +81,13 @@ Available commands: RX='N/A' if [[ -f /sys/class/net/$IFACE/statistics/rx_bytes ]] then - local rx=$( $FP_PROTONVPN_SERVERS + [[ -d $FP_PROTONVPN ]] && G_EXEC_DESC='Removing old ProtonVPN server configs' G_EXEC rm -R "$FP_PROTONVPN" + G_EXEC mkdir -p "$FP_PROTONVPN" + sed 's/"Domain":"/\n/g' logicals | mawk -F\" 'NR % 2 == 0 {print $1}' > "$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 + G_EXEC curl -sSfL "https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH/.conf/dpv/protonvpn.template" -o "$FP_PROTONVPN_TEMPLATE" elif [[ $VPN_PROVIDER == 'IPVanish' ]] then @@ -126,9 +126,9 @@ Available commands: [[ $1 != '-f' ]] || G_WHIP_YESNO 'This will remove all IPVanish server files and perform a fresh download of IPVanish server configurations. Once completed, you will need to reselect a IPVanish server from the new list.\n\nDo you want to continue?' || return 0 G_EXEC curl -sSfLO 'https://www.ipvanish.com/software/configs/configs.zip' VPN_SERVER= - [[ -d $FP_IPVANISH ]] && G_EXEC_DESC='Removing old IPVanish server configs' G_EXEC rm -R $FP_IPVANISH - G_EXEC mkdir -p $FP_IPVANISH - G_EXEC unzip -o configs.zip -d $FP_IPVANISH + [[ -d $FP_IPVANISH ]] && G_EXEC_DESC='Removing old IPVanish server configs' G_EXEC rm -R "$FP_IPVANISH" + G_EXEC mkdir -p "$FP_IPVANISH" + G_EXEC unzip -o configs.zip -d "$FP_IPVANISH" G_EXEC_NOEXIT=1 G_EXEC rm configs.zip || : elif [[ $VPN_PROVIDER == 'PIA' ]] @@ -137,9 +137,9 @@ Available commands: [[ $1 != '-f' ]] || G_WHIP_YESNO 'This will remove all PIA server files and perform a fresh download of PIA server configurations. Once completed, you will need to reselect a PIA server from the new list.\n\nDo you want to continue?' || return 0 G_EXEC curl -sSfLO 'https://www.privateinternetaccess.com/openvpn/openvpn-strong.zip' VPN_SERVER= - [[ -d $FP_PIA ]] && G_EXEC_DESC='Removing old PIA server configs' G_EXEC rm -R $FP_PIA - G_EXEC mkdir -p $FP_PIA - G_EXEC unzip -o openvpn-strong.zip -d $FP_PIA + [[ -d $FP_PIA ]] && G_EXEC_DESC='Removing old PIA server configs' G_EXEC rm -R "$FP_PIA" + G_EXEC mkdir -p "$FP_PIA" + G_EXEC unzip -o openvpn-strong.zip -d "$FP_PIA" G_EXEC_NOEXIT=1 G_EXEC rm openvpn-strong.zip || : elif [[ $VPN_PROVIDER == 'Custom' ]] @@ -148,25 +148,26 @@ Available commands: 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 + cat << _EOF_ > "$FP_STATIC_UP" #!/bin/bash # Disable IPv6 on connect to prevent IPv6 leakage sysctl -w net.ipv6.conf.all.disable_ipv6=1 @@ -193,7 +194,7 @@ then iptables-restore < <(envsubst < $FP_SETTINGS/killswitch.rules) fi _EOF_ - cat << _EOF_ > $FP_STATIC_DOWN + cat << _EOF_ > "$FP_STATIC_DOWN" #!/bin/dash # If enabled, turn off killswitch if [ -f $FP_SETTINGS/killswitch.rules ] @@ -208,7 +209,7 @@ then sysctl -w net.ipv6.conf.default.disable_ipv6=0 fi _EOF_ - G_EXEC chmod +x $FP_STATIC_UP $FP_STATIC_DOWN + G_EXEC chmod +x "$FP_STATIC_UP" "$FP_STATIC_DOWN" # Assure files are generated with strict modes right form the start G_EXEC umask 0077 @@ -223,32 +224,32 @@ _EOF_ elif [[ $VPN_PROVIDER == 'NordVPN' ]] then VPN_PORT=1194 - G_EXEC cp -f "$FP_NORDVPN/ovpn_$PROTOCOL/$VPN_SERVER" $FP_CLIENT_OVPN + G_EXEC cp -f "$FP_NORDVPN/ovpn_$PROTOCOL/$VPN_SERVER" "$FP_CLIENT_OVPN" elif [[ $VPN_PROVIDER == 'IPVanish' ]] then VPN_PORT=1194 - G_EXEC cp -f "$FP_IPVANISH/$VPN_SERVER" $FP_CLIENT_OVPN + G_EXEC cp -f "$FP_IPVANISH/$VPN_SERVER" "$FP_CLIENT_OVPN" # Fix CA path, as it is in subdirectory now - G_CONFIG_INJECT 'ca[[:blank:]]' "ca $FP_IPVANISH/ca.ipvanish.com.crt" $FP_CLIENT_OVPN + G_CONFIG_INJECT 'ca[[:blank:]]' "ca $FP_IPVANISH/ca.ipvanish.com.crt" "$FP_CLIENT_OVPN" # Set protocol and port: UDP port 443 is default, but TCP 1194 and UDP 1194 are supported as well. - G_CONFIG_INJECT 'proto[[:blank:]]' "proto $PROTOCOL" $FP_CLIENT_OVPN - G_EXEC sed -i '/^[[:blank:]]*remote[[:blank:]]/s/[[:blank:]][0-9][0-9]*$/ 1194/' $FP_CLIENT_OVPN + G_CONFIG_INJECT 'proto[[:blank:]]' "proto $PROTOCOL" "$FP_CLIENT_OVPN" + G_EXEC sed -i '/^[[:blank:]]*remote[[:blank:]]/s/[[:blank:]][0-9][0-9]*$/ 1194/' "$FP_CLIENT_OVPN" elif [[ $VPN_PROVIDER == 'PIA' ]] then - G_EXEC cp -f "$FP_PIA/$VPN_SERVER" $FP_CLIENT_OVPN + G_EXEC cp -f "$FP_PIA/$VPN_SERVER" "$FP_CLIENT_OVPN" # Set protocol and port: UDP on 1197 is default but TCP on 501 is supported as well. - G_CONFIG_INJECT 'proto[[:blank:]]' "proto $PROTOCOL" $FP_CLIENT_OVPN + G_CONFIG_INJECT 'proto[[:blank:]]' "proto $PROTOCOL" "$FP_CLIENT_OVPN" [[ $PROTOCOL == 'udp' ]] && VPN_PORT=1197 || VPN_PORT=501 - G_EXEC sed -i "/^[[:blank:]]*remote[[:blank:]]/s/[[:blank:]][0-9][0-9]*\$/ $VPN_PORT/" $FP_CLIENT_OVPN + G_EXEC sed -i "/^[[:blank:]]*remote[[:blank:]]/s/[[:blank:]][0-9][0-9]*\$/ $VPN_PORT/" "$FP_CLIENT_OVPN" fi - cat << _EOF_ > $FP_SETTINGS_OVPN + cat << _EOF_ > "$FP_SETTINGS_OVPN" ${VPN_USERNAME//\'/\'\\\'\'} ${VPN_PASSWORD//\'/\'\\\'\'} _EOF_ - cat << _EOF_ > $FP_SETTINGS_DIETPI + cat << _EOF_ > "$FP_SETTINGS_DIETPI" VPN_PROVIDER='$VPN_PROVIDER' VPN_USERNAME='${VPN_USERNAME//\'/\'\\\'\'}' VPN_PASSWORD='${VPN_PASSWORD//\'/\'\\\'\'}' @@ -257,22 +258,22 @@ PROTOCOL='$PROTOCOL' VPN_PORT='$VPN_PORT' _EOF_ 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 + 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 + 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:]]' + 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 config # shellcheck disable=SC2015 - [[ -f $FP_CUSTOM_UP ]] && G_CONFIG_INJECT 'route-up[[:blank:]]' "route-up $FP_CUSTOM_UP" $FP_CLIENT_OVPN 'up[[:blank:]]' || G_EXEC sed -i '/^[[:blank:]]*route-up[[:blank:]]/d' $FP_CLIENT_OVPN + [[ -f $FP_CUSTOM_UP ]] && G_CONFIG_INJECT 'route-up[[:blank:]]' "route-up $FP_CUSTOM_UP" "$FP_CLIENT_OVPN" 'up[[:blank:]]' || G_EXEC sed -i '/^[[:blank:]]*route-up[[:blank:]]/d' "$FP_CLIENT_OVPN" # shellcheck disable=SC2015 - [[ -f $FP_CUSTOM_DOWN ]] && G_CONFIG_INJECT 'route-pre-down[[:blank:]]' "route-pre-down $FP_CUSTOM_DOWN" $FP_CLIENT_OVPN 'down[[:blank:]]' || G_EXEC sed -i '/^[[:blank:]]*route-pre-down[[:blank:]]/d' $FP_CLIENT_OVPN + [[ -f $FP_CUSTOM_DOWN ]] && G_CONFIG_INJECT 'route-pre-down[[:blank:]]' "route-pre-down $FP_CUSTOM_DOWN" "$FP_CLIENT_OVPN" 'down[[:blank:]]' || G_EXEC sed -i '/^[[:blank:]]*route-pre-down[[:blank:]]/d' "$FP_CLIENT_OVPN" # Establish and test connection G_AG_CHECK_INSTALL_PREREQ openvpn @@ -378,13 +379,13 @@ _EOF_ 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 + [[ -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 + G_EXEC_NOEXIT=1 G_EXEC chmod 0700 "$fp" else - G_EXEC_NOEXIT=1 G_EXEC rm $fp + G_EXEC_NOEXIT=1 G_EXEC rm "$fp" fi elif [[ $G_WHIP_RETURNED_VALUE == 'Autostart' ]] @@ -400,10 +401,10 @@ _EOF_ then if (( $killswitch_enabled )) then - G_EXEC rm $FP_SETTINGS/killswitch.rules + G_EXEC rm "$FP_SETTINGS/killswitch.rules" else G_AG_CHECK_INSTALL_PREREQ iptables - cat << '_EOF_' > $FP_SETTINGS/killswitch.rules + cat << '_EOF_' > "$FP_SETTINGS/killswitch.rules" *filter :INPUT DROP [0:0] :FORWARD DROP [0:0] @@ -501,7 +502,7 @@ _EOF_ 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 $FP_IPVANISH $FP_PIA + G_EXEC rm -Rf "$FP_CLIENT_OVPN" "$FP_SETTINGS" "$FP_NORDVPN" "$FP_PROTONVPN" "$FP_IPVANISH" "$FP_PIA" # Offer to purge OpenVPN, if neither OpenVPN (server) nor PiVPN is installed ! grep -qE '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[(9|11)7\]=2' /boot/dietpi/.installed && G_WHIP_YESNO 'Do you want to have the underlying OpenVPN package purged as well?' && G_AGP openvpn exit 0 @@ -536,7 +537,7 @@ _EOF_ exit 1 else Read_Settings - [[ -d $FP_SETTINGS ]] || G_EXEC mkdir -p $FP_SETTINGS + [[ -d $FP_SETTINGS ]] || G_EXEC mkdir -p "$FP_SETTINGS" [[ $VPN_PROVIDER ]] || Menu_Provider || exit 0 Update_WAN_IP diff --git a/dietpi/func/dietpi-banner b/dietpi/func/dietpi-banner index d219693f9a..9203c5e0a7 100755 --- a/dietpi/func/dietpi-banner +++ b/dietpi/func/dietpi-banner @@ -78,6 +78,7 @@ ) # Load settings here, to have chosen ${aCOLOUR[0]} applied to below strings + # shellcheck disable=SC1090 [[ -f $FP_SAVEFILE ]] && . "$FP_SAVEFILE" GREEN_LINE=" ${aCOLOUR[0]}─────────────────────────────────────────────────────$COLOUR_RESET" @@ -238,6 +239,7 @@ $GREEN_LINE" Print_Header # Large Format Hostname + # shellcheck disable=SC1091 (( ${aENABLED[14]} == 1 )) && . /boot/dietpi/func/dietpi-print_large "$( /dev/null && [[ $motd ]] && echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[12]} $GREEN_SEPARATOR $motd" fi echo -e "$GREEN_LINE\n" diff --git a/dietpi/func/dietpi-benchmark b/dietpi/func/dietpi-benchmark index b648f9b0ea..72898d1bd2 100755 --- a/dietpi/func/dietpi-benchmark +++ b/dietpi/func/dietpi-benchmark @@ -50,6 +50,7 @@ BENCH_CPU_TEMP_END='Not tested' BENCH_NET_LAN_SPEED='Not tested' + # shellcheck disable=SC1091 Load_Results(){ [[ -f '/var/lib/dietpi/dietpi-benchmark/results' ]] && . /var/lib/dietpi/dietpi-benchmark/results; } Save_Results(){ diff --git a/dietpi/func/dietpi-globals b/dietpi/func/dietpi-globals index 318944ff68..526d6ad708 100644 --- a/dietpi/func/dietpi-globals +++ b/dietpi/func/dietpi-globals @@ -1,4 +1,5 @@ #!/bin/bash +# shellcheck disable=SC2034,SC2154 { #//////////////////////////////////// # DietPi-Globals @@ -53,6 +54,7 @@ [[ -f '/boot/dietpi/.hw_model' ]] && . /boot/dietpi/.hw_model # DietPi version and Git branch + # shellcheck disable=SC1091 [[ -f '/boot/dietpi/.version' ]] && . /boot/dietpi/.version # - Assign defaults/code version as fallback [[ $G_DIETPI_VERSION_CORE ]] || G_DIETPI_VERSION_CORE=8 diff --git a/dietpi/func/dietpi-obtain_hw_model b/dietpi/func/dietpi-obtain_hw_model index 7cffe0014d..b14b47c6ea 100755 --- a/dietpi/func/dietpi-obtain_hw_model +++ b/dietpi/func/dietpi-obtain_hw_model @@ -142,6 +142,7 @@ # PCB revision G_HW_PCB_REVISION=${G_HW_REVISION: -1:1} # RPi model + # shellcheck disable=SC2249 case ${G_HW_REVISION: -3:2} in 00) G_HW_MODEL_NAME='RPi A';; 01) G_HW_MODEL_NAME='RPi B';; @@ -163,6 +164,7 @@ 14) G_HW_MODEL_NAME='RPi CM 4' G_HW_MODEL=4;; esac # Manufacturer + # shellcheck disable=SC2249 case ${G_HW_REVISION: -5:1} in 0) G_HW_MANUFACTURER='Sony UK';; 1) G_HW_MANUFACTURER='Egoman';; @@ -305,7 +307,7 @@ # Systems that use /etc/.dietpi_hw_model_identifier for G_HW_MODEL if [[ -f $FP_G_HW_MODEL_IDENTIFIER ]]; then - G_HW_MODEL=$(mawk 'NR==1' $FP_G_HW_MODEL_IDENTIFIER) + G_HW_MODEL=$(mawk 'NR==1' "$FP_G_HW_MODEL_IDENTIFIER") if (( $G_HW_MODEL == 75 )); then @@ -518,7 +520,7 @@ elif [[ $G_HW_MODEL != 22 ]]; then G_HW_MODEL=22 - echo $G_HW_MODEL > $FP_G_HW_MODEL_IDENTIFIER + echo "$G_HW_MODEL" > "$FP_G_HW_MODEL_IDENTIFIER" fi @@ -531,7 +533,7 @@ # No hardware identifier and no RPi, revert to "Generic Device" else - echo $G_HW_MODEL > $FP_G_HW_MODEL_IDENTIFIER + echo "$G_HW_MODEL" > "$FP_G_HW_MODEL_IDENTIFIER" fi diff --git a/dietpi/func/dietpi-set_hardware b/dietpi/func/dietpi-set_hardware index f7729bc043..d44ac8e35f 100755 --- a/dietpi/func/dietpi-set_hardware +++ b/dietpi/func/dietpi-set_hardware @@ -1865,6 +1865,7 @@ Do you want to continue and DISABLE Bluetooth now?' || return 1 echo 4 > /proc/irq/63/smp_affinity echo 8 > /proc/irq/62/smp_affinity _EOF_ + # shellcheck disable=SC1091 . /var/lib/dietpi/postboot.d/c2_smp.sh fi diff --git a/dietpi/func/dietpi-set_software b/dietpi/func/dietpi-set_software index ea1304c5c6..7844edb7eb 100755 --- a/dietpi/func/dietpi-set_software +++ b/dietpi/func/dietpi-set_software @@ -149,13 +149,13 @@ deb $INPUT_MODE_VALUE $G_DISTRO_NAME-backports main contrib non-free' > /etc/apt if [[ $INPUT_MODE_VALUE == 'reset' ]]; then - [[ -f $fp ]] && rm $fp + [[ -f $fp ]] && rm "$fp" [[ -d '/tmp/apt' ]] && rm -R /tmp/apt return 0 fi - [[ -f $fp ]] || echo '# Please use "dietpi-config" > "Advanded Options" > "APT Cache" to edit these settings.' > $fp + [[ -f $fp ]] || echo '# Please use "dietpi-config" > "Advanded Options" > "APT Cache" to edit these settings.' > "$fp" if [[ $INPUT_MODE_VALUE == 'clean' ]]; then @@ -165,23 +165,23 @@ deb $INPUT_MODE_VALUE $G_DISTRO_NAME-backports main contrib non-free' > /etc/apt if [[ $INPUT_ADDITIONAL_1 == 'disable' ]]; then - G_CONFIG_INJECT 'Dir::Cache[[:blank:]]' 'Dir::Cache "/tmp/apt";' $fp + G_CONFIG_INJECT 'Dir::Cache[[:blank:]]' 'Dir::Cache "/tmp/apt";' "$fp" # Leave archives on disk by default - GCI_PRESERVE=1 G_CONFIG_INJECT 'Dir::Cache::archives[[:blank:]]' 'Dir::Cache::archives "/var/cache/apt/archives";' $fp - G_CONFIG_INJECT 'Dir::Cache::pkgcache[[:blank:]]' 'Dir::Cache::pkgcache "";' $fp - G_CONFIG_INJECT 'Dir::Cache::srcpkgcache[[:blank:]]' 'Dir::Cache::srcpkgcache "";' $fp + GCI_PRESERVE=1 G_CONFIG_INJECT 'Dir::Cache::archives[[:blank:]]' 'Dir::Cache::archives "/var/cache/apt/archives";' "$fp" + G_CONFIG_INJECT 'Dir::Cache::pkgcache[[:blank:]]' 'Dir::Cache::pkgcache "";' "$fp" + G_CONFIG_INJECT 'Dir::Cache::srcpkgcache[[:blank:]]' 'Dir::Cache::srcpkgcache "";' "$fp" [[ -d '/var/cache/apt' ]] && rm -R /var/cache/apt elif [[ $INPUT_ADDITIONAL_1 == 'ram' ]]; then - G_CONFIG_INJECT 'Dir::Cache[[:blank:]]' 'Dir::Cache "/tmp/apt";' $fp - GCI_PRESERVE=1 G_CONFIG_INJECT 'Dir::Cache::archives[[:blank:]]' 'Dir::Cache::archives "/var/cache/apt/archives";' $fp - sed -i '/pkgcache[[:blank:]]/d' $fp + G_CONFIG_INJECT 'Dir::Cache[[:blank:]]' 'Dir::Cache "/tmp/apt";' "$fp" + GCI_PRESERVE=1 G_CONFIG_INJECT 'Dir::Cache::archives[[:blank:]]' 'Dir::Cache::archives "/var/cache/apt/archives";' "$fp" + sed -i '/pkgcache[[:blank:]]/d' "$fp" [[ -d '/var/cache/apt' ]] && rm -R /var/cache/apt elif [[ $INPUT_ADDITIONAL_1 == 'disk' ]]; then - sed -i '/^Dir::Cache/d' $fp + sed -i '/^Dir::Cache/d' "$fp" [[ -d '/tmp/apt' ]] && rm -R /tmp/apt fi @@ -190,14 +190,14 @@ deb $INPUT_MODE_VALUE $G_DISTRO_NAME-backports main contrib non-free' > /etc/apt if [[ $INPUT_ADDITIONAL_1 == 'ram' ]]; then - G_CONFIG_INJECT 'Dir::State[[:blank:]]' 'Dir::State "/tmp/apt";' $fp - G_CONFIG_INJECT 'Dir::State::extended_states[[:blank:]]' 'Dir::State::extended_states "/var/lib/apt/extended_states";' $fp - G_CONFIG_INJECT 'Dir::State::status[[:blank:]]' 'Dir::State::status "/var/lib/dpkg/status";' $fp + G_CONFIG_INJECT 'Dir::State[[:blank:]]' 'Dir::State "/tmp/apt";' "$fp" + G_CONFIG_INJECT 'Dir::State::extended_states[[:blank:]]' 'Dir::State::extended_states "/var/lib/apt/extended_states";' "$fp" + G_CONFIG_INJECT 'Dir::State::status[[:blank:]]' 'Dir::State::status "/var/lib/dpkg/status";' "$fp" rm -Rf /var/lib/apt/{lists,mirrors,periodic,cdroms.list} elif [[ $INPUT_ADDITIONAL_1 == 'disk' ]]; then - sed -i '/^Dir::State/d' $fp + sed -i '/^Dir::State/d' "$fp" [[ -d '/tmp/apt' ]] && rm -R /tmp/apt fi @@ -207,13 +207,13 @@ deb $INPUT_MODE_VALUE $G_DISTRO_NAME-backports main contrib non-free' > /etc/apt if [[ $INPUT_ADDITIONAL_1 == 'ram' ]]; then # Cache needs to be in RAM as well for this to work reliable - G_CONFIG_INJECT 'Dir::Cache[[:blank:]]' 'Dir::Cache "/tmp/apt";' $fp - G_CONFIG_INJECT 'Dir::Cache::archives[[:blank:]]' 'Dir::Cache::archives "/tmp/apt/archives";' $fp + G_CONFIG_INJECT 'Dir::Cache[[:blank:]]' 'Dir::Cache "/tmp/apt";' "$fp" + G_CONFIG_INJECT 'Dir::Cache::archives[[:blank:]]' 'Dir::Cache::archives "/tmp/apt/archives";' "$fp" [[ -d '/var/cache/apt' ]] && rm -R /var/cache/apt elif [[ $INPUT_ADDITIONAL_1 == 'disk' ]]; then - G_CONFIG_INJECT 'Dir::Cache::archives[[:blank:]]' 'Dir::Cache::archives "/var/cache/apt/archives";' $fp + G_CONFIG_INJECT 'Dir::Cache::archives[[:blank:]]' 'Dir::Cache::archives "/var/cache/apt/archives";' "$fp" [[ -d '/tmp/apt/archives' ]] && rm -R /tmp/apt/archives fi @@ -223,12 +223,12 @@ deb $INPUT_MODE_VALUE $G_DISTRO_NAME-backports main contrib non-free' > /etc/apt if [[ -f $fp ]]; then # Remove drop-in config if it does not contain any setting - if ! grep -q '^Dir' $fp; then + if ! grep -q '^Dir' "$fp"; then - rm $fp + rm "$fp" # Re-create default cache dir if archives on disk while cache in RAM, since parent dirs are not auto-created - elif grep -q '/var/cache/apt/archives' $fp; then + elif grep -q '/var/cache/apt/archives' "$fp"; then mkdir -p /var/cache/apt/archives @@ -300,20 +300,20 @@ deb $INPUT_MODE_VALUE $G_DISTRO_NAME-backports main contrib non-free' > /etc/apt fi # Since Bullseye, systemd-timesyncd is a dedicated package - local timesyncd - (( $G_DISTRO < 6 )) || timesyncd='systemd-timesyncd' + local timesyncd=() + (( $G_DISTRO < 6 )) || timesyncd=('systemd-timesyncd') # Daemon mode: dbus required for timedatectl which users may expect if [[ $INPUT_MODE_VALUE == 4 ]] then - G_AG_CHECK_INSTALL_PREREQ $timesyncd dbus + G_AG_CHECK_INSTALL_PREREQ "${timesyncd[@]}" dbus G_EXEC systemctl unmask systemd-timesyncd # Failsafe G_EXEC systemctl enable --now systemd-timesyncd # Oneshot modes: Enable systemd-timesyncd to start early at boot, but stop it now elif [[ $INPUT_MODE_VALUE == [123] ]] then - [[ $timesyncd ]] && G_AG_CHECK_INSTALL_PREREQ $timesyncd + [[ ${timesyncd[0]} ]] && G_AG_CHECK_INSTALL_PREREQ "${timesyncd[@]}" G_EXEC systemctl unmask systemd-timesyncd # Failsafe G_EXEC systemctl enable systemd-timesyncd G_EXEC systemctl stop systemd-timesyncd @@ -601,8 +601,7 @@ It is highly recommended to change this password, ideally, it should be differen fi #----------------------------------------------------------------------------------- - G_DIETPI-NOTIFY -1 $EXIT_CODE "$INPUT_MODE_NAME $INPUT_MODE_VALUE" - #----------------------------------------------------------------------------------- - exit $EXIT_CODE + G_DIETPI-NOTIFY -1 "$EXIT_CODE" "$INPUT_MODE_NAME $INPUT_MODE_VALUE" + exit "$EXIT_CODE" #----------------------------------------------------------------------------------- } diff --git a/dietpi/func/dietpi-set_swapfile b/dietpi/func/dietpi-set_swapfile index 1ead58d011..b141887714 100755 --- a/dietpi/func/dietpi-set_swapfile +++ b/dietpi/func/dietpi-set_swapfile @@ -118,7 +118,7 @@ G_DIETPI-NOTIFY 2 'Swap file generation via "fallocate" failed, falling back to "dd"...' G_EXEC swapoff -a - G_EXEC dd if=/dev/zero of="$SWAP_PATH" bs=1M count=$SWAP_SIZE + G_EXEC dd if=/dev/zero of="$SWAP_PATH" bs=1M "count=$SWAP_SIZE" G_EXEC mkswap "$SWAP_PATH" G_EXEC swapon "$SWAP_PATH" @@ -193,7 +193,7 @@ Error_Reset 'Insufficient RAM size for desired zram-swap size' - elif [[ $SWAP_FS != 'zram' ]] && ! G_CHECK_FREESPACE "$SWAP_DIR" $SWAP_SIZE; then + elif [[ $SWAP_FS != 'zram' ]] && ! G_CHECK_FREESPACE "$SWAP_DIR" "$SWAP_SIZE"; then Error_Reset 'Insufficient free space for desired swap files size' @@ -206,6 +206,6 @@ Update_DietPi_Conf Update_Tmp #----------------------------------------------------------------------------------- - exit $EXIT_CODE + exit "$EXIT_CODE" #----------------------------------------------------------------------------------- } diff --git a/dietpi/func/dietpi-wifidb b/dietpi/func/dietpi-wifidb index 7319cdc939..cf3cb7d962 100755 --- a/dietpi/func/dietpi-wifidb +++ b/dietpi/func/dietpi-wifidb @@ -65,6 +65,7 @@ $FP_SCRIPT 1 Applies WiFi creds from DB store to system [[ -f '/boot/dietpi-wifi.txt' ]] && mv /boot/dietpi-wifi.txt /var/lib/dietpi/dietpi-wifi.db # - load [[ -f '/var/lib/dietpi/dietpi-wifi.db' ]] || return 0 + # shellcheck disable=SC1091 . /var/lib/dietpi/dietpi-wifi.db rm /var/lib/dietpi/dietpi-wifi.db diff --git a/dietpi/misc/dietpi-arr_to_RAM b/dietpi/misc/dietpi-arr_to_RAM index 116c06e4d2..7f0a7369c4 100755 --- a/dietpi/misc/dietpi-arr_to_RAM +++ b/dietpi/misc/dietpi-arr_to_RAM @@ -322,6 +322,6 @@ $USAGE" fi #----------------------------------------------------------------------------------- - exit $EXIT_CODE + exit "$EXIT_CODE" #----------------------------------------------------------------------------------- } diff --git a/dietpi/misc/dietpi-justboom b/dietpi/misc/dietpi-justboom index 778d3ad555..36494f79b0 100755 --- a/dietpi/misc/dietpi-justboom +++ b/dietpi/misc/dietpi-justboom @@ -96,23 +96,23 @@ Please select a sound card via 'dietpi-config' or install ALSA, or ideally an au # MPD specific if (( $MPD_INSTALLED )); then - OUTPUT_FREQ=$(grep -m1 '^[[:blank:]]*format' $FP_MPD_CONF | sed 's/\"//g' | sed 's/:/ /g' | mawk '{print $2}') + OUTPUT_FREQ=$(grep -m1 '^[[:blank:]]*format' "$FP_MPD_CONF" | sed 's/\"//g' | sed 's/:/ /g' | mawk '{print $2}') [[ $OUTPUT_FREQ ]] || OUTPUT_FREQ='*' - OUTPUT_BITRATE=$(grep -m1 '^[[:blank:]]*format' $FP_MPD_CONF | sed 's/\"//g' | sed 's/:/ /g' | mawk '{print $3}') + OUTPUT_BITRATE=$(grep -m1 '^[[:blank:]]*format' "$FP_MPD_CONF" | sed 's/\"//g' | sed 's/:/ /g' | mawk '{print $3}') [[ $OUTPUT_BITRATE ]] || OUTPUT_BITRATE='*' - OUTPUT_CHANNELS=$(grep -m1 '^[[:blank:]]*format' $FP_MPD_CONF | sed 's/\"//g' | sed 's/:/ /g' | mawk '{print $4}') + OUTPUT_CHANNELS=$(grep -m1 '^[[:blank:]]*format' "$FP_MPD_CONF" | sed 's/\"//g' | sed 's/:/ /g' | mawk '{print $4}') [[ $OUTPUT_CHANNELS ]] || OUTPUT_CHANNELS='*' - SOXR_ENABLED=$(grep -cm1 '^[[:blank:]]*samplerate_converter[[:blank:]][[:blank:]]*\"soxr' $FP_MPD_CONF) + SOXR_ENABLED=$(grep -cm1 '^[[:blank:]]*samplerate_converter[[:blank:]][[:blank:]]*\"soxr' "$FP_MPD_CONF") if [[ $SOXR_ENABLED ]] then - SOXR_QUALITY=$(grep -Ecm1 '^[[:blank:]]*samplerate_converter[[:blank:]]+\"soxr' $FP_MPD_CONF | sed 's/\"//g' | mawk '{for(i=3;i<=NF;i++){printf "%s ", $i}; printf "\n"}' | sed 's/ *$//') + SOXR_QUALITY=$(grep -Ecm1 '^[[:blank:]]*samplerate_converter[[:blank:]]+\"soxr' "$FP_MPD_CONF" | sed 's/\"//g' | mawk '{for(i=3;i<=NF;i++){printf "%s ", $i}; printf "\n"}' | sed 's/ *$//') [[ $SOXR_QUALITY ]] || SOXR_QUALITY='very high' fi - MPD_AUDIO_BUFFER_SIZE=$(grep -m1 '^[[:blank:]]*audio_buffer_size' $FP_MPD_CONF | mawk '{print $2}' | sed 's/\"//g') + MPD_AUDIO_BUFFER_SIZE=$(grep -m1 '^[[:blank:]]*audio_buffer_size' "$FP_MPD_CONF" | mawk '{print $2}' | sed 's/\"//g') [[ $MPD_AUDIO_BUFFER_SIZE ]] || MPD_AUDIO_BUFFER_SIZE='*' fi @@ -120,11 +120,11 @@ Please select a sound card via 'dietpi-config' or install ALSA, or ideally an au # CAVA specific if (( $CAVA_INSTALLED )); then - CAVA_FRAMERATE=$(mawk '/framerate =/{print $NF;exit}' $FP_CAVA_CONF) - CAVA_COLOUR_BG=$(mawk '/background =/{print $NF;exit}' $FP_CAVA_CONF) - CAVA_COLOUR_FG=$(mawk '/foreground =/{print $NF;exit}' $FP_CAVA_CONF) - CAVA_BAR_GRAVITY=$(mawk '/gravity =/{print $NF;exit}' $FP_CAVA_CONF) - CAVA_BAR_WIDTH=$(mawk '/bar_width =/{print $NF;exit}' $FP_CAVA_CONF) + CAVA_FRAMERATE=$(mawk '/framerate =/{print $NF;exit}' "$FP_CAVA_CONF") + CAVA_COLOUR_BG=$(mawk '/background =/{print $NF;exit}' "$FP_CAVA_CONF") + CAVA_COLOUR_FG=$(mawk '/foreground =/{print $NF;exit}' "$FP_CAVA_CONF") + CAVA_BAR_GRAVITY=$(mawk '/gravity =/{print $NF;exit}' "$FP_CAVA_CONF") + CAVA_BAR_WIDTH=$(mawk '/bar_width =/{print $NF;exit}' "$FP_CAVA_CONF") fi @@ -146,31 +146,31 @@ Please select a sound card via 'dietpi-config' or install ALSA, or ideally an au if (( $MPD_INSTALLED )); then # Output format: Apply only if any value is enforced - G_EXEC sed -Ei '/^[[:blank:]]*type[[:blank:]]+"alsa"/,/^[[:blank:]]*}$/{/^[[:blank:]#]*format[[:blank:]]/d}' $FP_MPD_CONF - [[ $OUTPUT_FREQ$OUTPUT_BITRATE$OUTPUT_CHANNELS == '***' ]] || G_EXEC sed -Ei "/^[[:blank:]]*type[[:blank:]]+\"alsa\"/a\ format \"$OUTPUT_FREQ:$OUTPUT_BITRATE:$OUTPUT_CHANNELS\"" $FP_MPD_CONF + G_EXEC sed -Ei '/^[[:blank:]]*type[[:blank:]]+"alsa"/,/^[[:blank:]]*}$/{/^[[:blank:]#]*format[[:blank:]]/d}' "$FP_MPD_CONF" + [[ $OUTPUT_FREQ$OUTPUT_BITRATE$OUTPUT_CHANNELS == '***' ]] || G_EXEC sed -Ei "/^[[:blank:]]*type[[:blank:]]+\"alsa\"/a\ format \"$OUTPUT_FREQ:$OUTPUT_BITRATE:$OUTPUT_CHANNELS\"" "$FP_MPD_CONF" if (( $SOXR_ENABLED )); then - G_CONFIG_INJECT 'samplerate_converter[[:blank:]]' "samplerate_converter \"soxr $SOXR_QUALITY\"" $FP_MPD_CONF + G_CONFIG_INJECT 'samplerate_converter[[:blank:]]' "samplerate_converter \"soxr $SOXR_QUALITY\"" "$FP_MPD_CONF" if [[ $OUTPUT_FREQ$OUTPUT_BITRATE$OUTPUT_CHANNELS == '***' ]] then - G_EXEC sed -i '/audio_output_format[[:blank:]]/d' $FP_MPD_CONF + G_EXEC sed -i '/audio_output_format[[:blank:]]/d' "$FP_MPD_CONF" else - G_CONFIG_INJECT 'audio_output_format[[:blank:]]' "audio_output_format \"$OUTPUT_FREQ:$OUTPUT_BITRATE:$OUTPUT_CHANNELS\"" $FP_MPD_CONF + G_CONFIG_INJECT 'audio_output_format[[:blank:]]' "audio_output_format \"$OUTPUT_FREQ:$OUTPUT_BITRATE:$OUTPUT_CHANNELS\"" "$FP_MPD_CONF" fi else - G_EXEC sed -i '/samplerate_converter[[:blank:]]/d' $FP_MPD_CONF - G_EXEC sed -i '/audio_output_format[[:blank:]]/d' $FP_MPD_CONF + G_EXEC sed -i '/samplerate_converter[[:blank:]]/d' "$FP_MPD_CONF" + G_EXEC sed -i '/audio_output_format[[:blank:]]/d' "$FP_MPD_CONF" fi # Buffer if [[ $MPD_AUDIO_BUFFER_SIZE == '*' ]] then - G_EXEC sed -i '/audio_buffer_size[[:blank:]]/d' $FP_MPD_CONF + G_EXEC sed -i '/audio_buffer_size[[:blank:]]/d' "$FP_MPD_CONF" else - G_CONFIG_INJECT 'audio_buffer_size[[:blank:]]' "audio_buffer_size \"$MPD_AUDIO_BUFFER_SIZE\"" $FP_MPD_CONF + G_CONFIG_INJECT 'audio_buffer_size[[:blank:]]' "audio_buffer_size \"$MPD_AUDIO_BUFFER_SIZE\"" "$FP_MPD_CONF" fi G_EXEC systemctl restart mpd @@ -180,11 +180,11 @@ Please select a sound card via 'dietpi-config' or install ALSA, or ideally an au # CAVA specific if (( $CAVA_INSTALLED )); then - G_CONFIG_INJECT 'framerate =' "framerate = $CAVA_FRAMERATE" $FP_CAVA_CONF - G_CONFIG_INJECT 'background =' "background = $CAVA_COLOUR_BG" $FP_CAVA_CONF - G_CONFIG_INJECT 'foreground =' "foreground = $CAVA_COLOUR_FG" $FP_CAVA_CONF - G_CONFIG_INJECT 'gravity =' "gravity = $CAVA_BAR_GRAVITY" $FP_CAVA_CONF - G_CONFIG_INJECT 'bar_width =' "bar_width = $CAVA_BAR_WIDTH" $FP_CAVA_CONF + G_CONFIG_INJECT 'framerate =' "framerate = $CAVA_FRAMERATE" "$FP_CAVA_CONF" + G_CONFIG_INJECT 'background =' "background = $CAVA_COLOUR_BG" "$FP_CAVA_CONF" + G_CONFIG_INJECT 'foreground =' "foreground = $CAVA_COLOUR_FG" "$FP_CAVA_CONF" + G_CONFIG_INJECT 'gravity =' "gravity = $CAVA_BAR_GRAVITY" "$FP_CAVA_CONF" + G_CONFIG_INJECT 'bar_width =' "bar_width = $CAVA_BAR_WIDTH" "$FP_CAVA_CONF" fi diff --git a/dietpi/patch_file b/dietpi/patch_file index 4132c55b96..73602efed2 100755 --- a/dietpi/patch_file +++ b/dietpi/patch_file @@ -171,7 +171,7 @@ _EOF_ else G_DIETPI-NOTIFY 0 'Everything done! Terminating the obsolete DietPi-Update parent instance...\n' - kill $PPID + kill "$PPID" exit fi @@ -652,7 +652,7 @@ Do you still want to keep "p7zip-full"?'; then G_EXEC cd /var/www/html/admin git reset --hard HEAD - G_EXEC cd /tmp/$G_PROGRAM_NAME + G_EXEC cd "$G_WORKING_DIR" fi #------------------------------------------------------------------------------- @@ -840,6 +840,8 @@ Further info and usage: https://dietpi.com/phpbb/viewtopic.php?t=5828' # NordVPN: Tiny fix for doubled auth-user-pass entry: https://github.com/MichaIng/DietPi/commit/847a016638c6929153dc16e7ce054d3dce5e4c60 if [[ -f '/var/lib/dietpi/dietpi-software/installed/dietpi-nordvpn/settings_dietpi.conf' ]]; then + local PROTOCOL NORDVPN_SERVER + # shellcheck disable=SC1091 . /var/lib/dietpi/dietpi-software/installed/dietpi-nordvpn/settings_dietpi.conf if [[ -f /etc/openvpn/ovpn_$PROTOCOL/$NORDVPN_SERVER && $(grep -c '^auth-user-pass' "/etc/openvpn/ovpn_$PROTOCOL/$NORDVPN_SERVER") == 2 ]]; then @@ -1906,7 +1908,7 @@ _EOF_ local gpu_mem_current=$(sed -n "/^[[:blank:]]*gpu_mem_$value=/{s/^[^=]*=//p;q}" /boot/config.txt) # override setting [[ $gpu_mem_current ]] || gpu_mem_current=$(sed -n "/^[[:blank:]]*gpu_mem=/{s/^[^=]*=//p;q}" /boot/config.txt) # base setting [[ $gpu_mem_current ]] || gpu_mem_current=64 # default value - (( $gpu_mem_current < 32 )) && /boot/dietpi/func/dietpi-set_hardware gpumemsplit $gpu_mem_current + (( $gpu_mem_current < 32 )) && /boot/dietpi/func/dietpi-set_hardware gpumemsplit "$gpu_mem_current" #------------------------------------------------------------------------------- # RPi CM 3+: Update USBridgeSig Ethernet driver via postinst kernel script, until it has been merged into official RPi kernel: https://github.com/allocom/USBridgeSig/tree/master/ethernet cat << '_EOF_' > /etc/kernel/postinst.d/dietpi-USBridgeSig diff --git a/dietpi/postboot b/dietpi/postboot index 816baa5f19..1dfd560941 100755 --- a/dietpi/postboot +++ b/dietpi/postboot @@ -69,6 +69,6 @@ fi #----------------------------------------------------------------------------------- - exit $EXIT_CODE + exit "$EXIT_CODE" #----------------------------------------------------------------------------------- } diff --git a/dietpi/pre-patch_file b/dietpi/pre-patch_file index ae3cc600c0..f5f79078a2 100755 --- a/dietpi/pre-patch_file +++ b/dietpi/pre-patch_file @@ -33,6 +33,7 @@ # Obtain HW model if [[ -f '/DietPi/dietpi/.hw_model' ]] && grep -q '^G_HW_MODEL=' /DietPi/dietpi/.hw_model; then + # shellcheck disable=SC1091 . /DietPi/dietpi/.hw_model elif [[ -f '/boot/dietpi/.hw_model' ]] && grep -q '^G_HW_MODEL=' /boot/dietpi/.hw_model; then @@ -41,7 +42,7 @@ else - # shellcheck disable=SC2015 + # shellcheck disable=SC1091,SC2015 G_HW_MODEL=$([[ -f '/DietPi/dietpi/.hw_model' ]] && mawk 'NR==1' /DietPi/dietpi/.hw_model || mawk 'NR==1' /boot/dietpi/.hw_model) fi @@ -106,7 +107,7 @@ /DietPi/dietpi/dietpi-update 1 || exit 6 echo -e '\e[90m[\e[0m\e[32m OK \e[90m]\e[0m Everything done! Terminating the obsolete DietPi-Update parent instance...' - kill $PPID + kill "$PPID" exit fi From 65b3d6a9c86406fb9de4b0b39b9f9fb6182dd0d3 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Fri, 8 Apr 2022 17:41:58 +0200 Subject: [PATCH 03/59] v8.4 - README | Remove CodeFactor batch, as we switched to run ShellCheck via GitHub actions --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 203ef3b695..672e473d74 100644 --- a/README.md +++ b/README.md @@ -182,7 +182,6 @@ along with this program. If not, see https://www.gnu.org/licenses/ - Source: https://github.com/MichaIng/DietPi - Build: Not applicable, as DietPi uses Bash scripts only, no building or compiling is required. -- [![CodeFactor](https://www.codefactor.io/repository/github/michaing/dietpi/badge)](https://www.codefactor.io/repository/github/michaing/dietpi) ### DietPi Files From c2ec686d58d5f7e4b77e12546cc04b6bf78a2399 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Fri, 8 Apr 2022 18:35:34 +0200 Subject: [PATCH 04/59] v8.4 - Network | Resolved an issue on some Armbian based systems where the network interface naming changed unintentionally after a kernel upgrade: https://dietpi.com/phpbb/viewtopic.php?t=10229 --- .update/patches | 7 ++++++- CHANGELOG.txt | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.update/patches b/.update/patches index c9bea2536d..a21023cef5 100755 --- a/.update/patches +++ b/.update/patches @@ -715,7 +715,12 @@ Patch_8_3() Patch_8_4() { - : + # https://dietpi.com/phpbb/viewtopic.php?t=10229 + if [[ -f '/boot/armbianEnv.txt' ]] && grep -q 'extraargs="net.ifnames=0"' /boot/armbianEnv.txt + then + G_DIETPI-NOTIFY 2 'Fixing syntax for legacy network interface nameing (eth0/wlan0). \e[33mNB: If you rely on "predictable" interface naming (enp0s0/wlp0s0), remove "net.ifnames=0" from /boot/armbianEnv.txt!' + G_EXEC sed -i 's/extraargs="net.ifnames=0"/extraargs=net.ifnames=0/' /boot/armbianEnv.txt + fi } # v6.35 => v7 migration diff --git a/CHANGELOG.txt b/CHANGELOG.txt index ecc7556aac..5a9eaab7ce 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -4,6 +4,7 @@ v8.4 Changes: Fixes: +- Network | Resolved an issue on some Armbian based systems where the network interface naming changed unintentionally after a kernel upgrade: https://dietpi.com/phpbb/viewtopic.php?t=10229 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 b2a0db3205c9ad3f3f83245352b2467e45dd5ba0 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sat, 9 Apr 2022 23:15:59 +0200 Subject: [PATCH 05/59] v8.4 - DietPi-Set_hardware | Mute visual-only syntax error on non-RPi systems --- dietpi/func/dietpi-set_hardware | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dietpi/func/dietpi-set_hardware b/dietpi/func/dietpi-set_hardware index d44ac8e35f..08ad766d18 100755 --- a/dietpi/func/dietpi-set_hardware +++ b/dietpi/func/dietpi-set_hardware @@ -1340,7 +1340,7 @@ Do you want to continue and disable the serial login console?' || return 1 local aWIFI_MODULES=('cfg80211') # + RPi with onboard WiFi and NanoPi NEO Air - if (( $G_HW_ONBOARD_WIFI || $G_HW_MODEL == 64 )); then + if (( ${G_HW_ONBOARD_WIFI:-0} || $G_HW_MODEL == 64 )); then aWIFI_MODULES+=('brcmfmac' 'brcmutil') From 217ebdb3aef6b5336d45cd4288a61fd88bbe5579 Mon Sep 17 00:00:00 2001 From: Joulinar <47155374+Joulinar@users.noreply.github.com> Date: Sun, 10 Apr 2022 00:45:25 +0200 Subject: [PATCH 06/59] v8.4 (#5416) - DietPi-Software | Chromium: Resolved an issue on Raspberry Pi Buster systems where the installation failed because of a syntax error. Many thanks to @bbmak for reporting this issue: https://dietpi.com/phpbb/viewtopic.php?t=10258 --- CHANGELOG.txt | 1 + dietpi/dietpi-software | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 5a9eaab7ce..eccab68e15 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -5,6 +5,7 @@ Changes: Fixes: - Network | Resolved an issue on some Armbian based systems where the network interface naming changed unintentionally after a kernel upgrade: https://dietpi.com/phpbb/viewtopic.php?t=10229 +- DietPi-Software | Chromium: Resolved an issue on Raspberry Pi Buster systems where the installation failed because of a syntax error. Many thanks to @bbmak for reporting this issue: https://dietpi.com/phpbb/viewtopic.php?t=10258 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 diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index ad5980275f..185dd107a3 100755 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -9464,7 +9464,7 @@ STARTX='xinit' exec "$STARTX" "$FP_CHROMIUM" $CHROMIUM_OPTS "${URL:-https://dietpi.com/}" _EOF_ - [[ $path == 'chromium.d' ]] || G_EXEC sed -i 's/chromium\.d/chromium-browser/customizations/' /var/lib/dietpi/dietpi-software/installed/chromium-autostart.sh + [[ $path == 'chromium.d' ]] || G_EXEC sed -i 's|chromium\.d|chromium-browser/customizations|' /var/lib/dietpi/dietpi-software/installed/chromium-autostart.sh G_EXEC chmod +x /var/lib/dietpi/dietpi-software/installed/chromium-autostart.sh fi From 9407a8d68fa5bb98534dd6301a7759608d564ef6 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sun, 10 Apr 2022 19:26:31 +0200 Subject: [PATCH 07/59] v8.4 - DietPi-Software | Tor/Unbound: Resolved an issue where IPv6 usage was assumed only based on the dietpi.txt setting instead of on whether IPv6 can really be used for Internet connections. E.g. when a VPN connection is established, usually IPv6 is disabled to prevent IPv6 leaks, without changing the general dietpi.txt setting. Tor and Unbound service starts however fail then, trying to bind to the IPv6 port. If the adapter has an IPv6 address assigned, but no IPv6 default route, binding to the IPv6 port succeeds, but Internet connections via IPv6 are not possible, which isn't better. On the other hand, using IPv4 only while IPv6 is enabled, has no real downsides. Many thanks to @Wgsem for reporting this issue: https://github.com/MichaIng/DietPi/issues/5412 --- CHANGELOG.txt | 1 + dietpi/dietpi-software | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index eccab68e15..d6e563854b 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -6,6 +6,7 @@ Changes: Fixes: - Network | Resolved an issue on some Armbian based systems where the network interface naming changed unintentionally after a kernel upgrade: https://dietpi.com/phpbb/viewtopic.php?t=10229 - DietPi-Software | Chromium: Resolved an issue on Raspberry Pi Buster systems where the installation failed because of a syntax error. Many thanks to @bbmak for reporting this issue: https://dietpi.com/phpbb/viewtopic.php?t=10258 +- DietPi-Software | Tor/Unbound: Resolved an issue where IPv6 usage was assumed only based on the dietpi.txt setting instead of on whether IPv6 can really be used for Internet connections. E.g. when a VPN connection is established, usually IPv6 is disabled to prevent IPv6 leaks, without changing the general dietpi.txt setting. Tor and Unbound service starts however fail then, trying to bind to the IPv6 port. If the adapter has an IPv6 address assigned, but no IPv6 default route, binding to the IPv6 port succeeds, but Internet connections via IPv6 are not possible, which isn't better. On the other hand, using IPv4 only while IPv6 is enabled, has no real downsides. Many thanks to @Wgsem for reporting this issue: https://github.com/MichaIng/DietPi/issues/5412 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 diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index 185dd107a3..43fe04ad55 100755 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -6077,7 +6077,7 @@ _EOF_ done local ipv6= - if grep -q '^[[:blank:]]*CONFIG_ENABLE_IPV6=1' /boot/dietpi.txt + if G_GET_NET -6 -q gateway > /dev/null then for i in $(hostname -I) do @@ -6259,12 +6259,12 @@ _EOF_ # Download base configuration if it does not exist yet [[ -f '/etc/unbound/unbound.conf.d/dietpi.conf' ]] || dps_index=$software_id Download_Install 'unbound.conf' /etc/unbound/unbound.conf.d/dietpi.conf - # Toggle IPv6 preference based on dietpi.txt settings - if grep -q '^[[:blank:]]*CONFIG_ENABLE_IPV6=0' /boot/dietpi.txt + # Toggle IPv6 preference based whether there is an IPv6 default route + if G_GET_NET -6 -q gateway > /dev/null then - G_CONFIG_INJECT 'do-ip6:[[:blank:]]' ' do-ip6: no' /etc/unbound/unbound.conf.d/dietpi.conf - else G_CONFIG_INJECT 'do-ip6:[[:blank:]]' ' do-ip6: yes' /etc/unbound/unbound.conf.d/dietpi.conf + else + G_CONFIG_INJECT 'do-ip6:[[:blank:]]' ' do-ip6: no' /etc/unbound/unbound.conf.d/dietpi.conf fi # Since IP binding might be used, start after network interfaces have been configured, not when they just start to be configured From 054ae4256256eba286e93b21f94124be51bbc374 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Mon, 11 Apr 2022 15:11:06 +0200 Subject: [PATCH 08/59] v8.4 - DietPi-Config | Network Options: Show IPv6 status based on dietpi.txt setting instead of whether there is an actual IPv6 address assigned. IPv6 can be temporarily disabled, e.g. when connecting to a VPN to avoid IPv6 leaks, or it could have been disabled by custom configs or other means, which are out of our control. This setting shall only toggle the DietPi controlled sysctl configuration file which disables IPv6 from boot on for all network interfaces. --- dietpi/dietpi-config | 91 +++++++++----------------------------------- 1 file changed, 19 insertions(+), 72 deletions(-) diff --git a/dietpi/dietpi-config b/dietpi/dietpi-config index bc6c88e7d6..e45f598753 100755 --- a/dietpi/dietpi-config +++ b/dietpi/dietpi-config @@ -2520,18 +2520,11 @@ NB: All Ethernet connections will be dropped!' && Network_ApplyChanges G_WHIP_MENU_ARRAY+=('' '●─ Additional Options ') # IPv6 - if [[ -d '/proc/sys/net/ipv6' ]]; then - - local ipv6_enabled=0 - local ipv6_status_text='Off' - if [[ $(ip -6 a) ]]; then - - ipv6_enabled=1 - ipv6_status_text='On' - - fi + if [[ -d '/proc/sys/net/ipv6' ]] + then + local ipv6_enabled=1 ipv6_status_text='On' + grep -q '^[[:blank:]]*CONFIG_ENABLE_IPV6=0' /boot/dietpi.txt && ipv6_enabled=0 ipv6_status_text='Off' G_WHIP_MENU_ARRAY+=('IPv6' ": [$ipv6_status_text]") - fi G_WHIP_MENU_ARRAY+=('Proxy' ": $proxy_state_text") @@ -2556,11 +2549,7 @@ NB: All Ethernet connections will be dropped!' && Network_ApplyChanges ;; - 'IPv6') - - /boot/dietpi/func/dietpi-set_hardware enableipv6 $(( ! $ipv6_enabled )) - - ;; + 'IPv6') /boot/dietpi/func/dietpi-set_hardware enableipv6 $(( ! $ipv6_enabled ));; 'Ethernet') @@ -2644,11 +2633,7 @@ NB: All Ethernet connections will be dropped!' && Network_ApplyChanges ;; - 'Proxy') - - TARGETMENUID=17 - - ;; + 'Proxy') TARGETMENUID=17;; *) :;; @@ -2660,12 +2645,10 @@ NB: All Ethernet connections will be dropped!' && Network_ApplyChanges TARGETMENUID=0 # Return to main menu # Exit DietPi-Config on back to previous menu? - if (( $EXITONBACK == 1 )); then - - TARGETMENUID=8 # Return to this menu - Menu_Exit + (( $EXITONBACK == 1 )) || return 0 - fi + TARGETMENUID=8 # Return to this menu + Menu_Exit fi @@ -2713,12 +2696,7 @@ NB: All Ethernet connections will be dropped!' && Network_ApplyChanges case "$G_WHIP_RETURNED_VALUE" in - 'Change Mode') - - ((ETH_MODE_TARGET++)) - (( $ETH_MODE_TARGET >= 2 )) && ETH_MODE_TARGET=0 - - ;; + 'Change Mode') ETH_MODE_TARGET=$(( ! $ETH_MODE_TARGET ));; 'Link Speed') @@ -2748,41 +2726,17 @@ NB: Auto-negotiation is highly recommended as long as you do not have issues wit ;; - 'Apply') - - Ethernet_Reconnect - - ;; - - 'Copy') - - Network_ETH_CopyCurrentToStatic + 'Apply') Ethernet_Reconnect;; - ;; + 'Copy') Network_ETH_CopyCurrentToStatic;; - 'Static IP') + 'Static IP') Change_StaticIp 0;; - Change_StaticIp 0 + 'Static Gateway') Change_StaticGateway 0;; - ;; - - 'Static Gateway') - - Change_StaticGateway 0 - - ;; + 'Static Mask') Change_StaticMask 0;; - 'Static Mask') - - Change_StaticMask 0 - - ;; - - 'Static DNS') - - Change_StaticDns 0 - - ;; + 'Static DNS') Change_StaticDns 0;; *) :;; @@ -2955,9 +2909,7 @@ NB: Auto-negotiation is highly recommended as long as you do not have issues wit 'Channel') # 2.4ghz only atm - local channel_mhz=2412 - local channel_min=1 - local channel_max=13 + local channel_mhz=2412 channel_min=1 channel_max=13 G_WHIP_MENU_ARRAY=() for ((i=$channel_min; i<=$channel_max; i++)) do @@ -2990,13 +2942,8 @@ NB: Auto-negotiation is highly recommended as long as you do not have issues wit 'Change Mode') - ((WIFI_MODE_TARGET++)) - if (( $WIFI_MODE_TARGET >= 2 )); then - - WIFI_MODE_TARGET=0 - G_WHIP_MSG 'Information for STATIC IP:\n\nWhen using STATIC IP, please ensure only 1 SSID entry exists in the "Scan" menu. Else, WiFi will most likely fail, and, the IP conflict committee will be displeased ;)' - - fi + WIFI_MODE_TARGET=$(( ! $WIFI_MODE_TARGET )) + [[ $WIFI_MODE_TARGET == 0 ]] && G_WHIP_MSG 'Information for STATIC IP:\n\nWhen using STATIC IP, please ensure only 1 SSID entry exists in the "Scan" menu. Else, WiFi will most likely fail, and, the IP conflict committee will be displeased ;)' ;; 'Apply') From 3d3618d8197856511cc2565962f7dc57d4f86a81 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Mon, 11 Apr 2022 23:26:24 +0200 Subject: [PATCH 09/59] v8.4 - DietPi-Build | Add support for NanoPi 2 series, using a dedicated ext4 boot partition - DietPi-PREP | Add support for NanoPi 2 series, using our Linux 4.4 firmware package - DietPi-PREP | Skip CRDA installation from Bookworm on, where it is not available anymore. From Debian POV it is obsolete, since modern Linux versions pull regulatory info/country code themselves, but the open question remains about how to override a possibly wrong kernel decision and how to comfortably apply a country code when using the WiFi adapter as access point. "iw reg set" can be used (via udev rules or /etc/network/interfaces "up"), wpasupplicant and probably hostapd allow to set the country code as well, so there are way, and we need to find the one that suites best the DietPi use cases. --- .build/images/dietpi-build | 7 +++++-- PREP_SYSTEM_FOR_DIETPI.sh | 15 +++++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.build/images/dietpi-build b/.build/images/dietpi-build index 5e2fd95a64..0202284ccd 100755 --- a/.build/images/dietpi-build +++ b/.build/images/dietpi-build @@ -65,6 +65,7 @@ partition_start=1 efi_size=64 boot_size=0 root_size=1023 +boot_fstype='fat32' # Used for MBR boot partition only => NanoPi M2 CLONING_TOOL='dd' case $HW_MODEL in 0) iname='RPi' partition_start=4 boot_size=128 root_size=892;; @@ -72,6 +73,7 @@ case $HW_MODEL in 16) iname='OdroidC4' HW_ARCH=3 partition_start=4 root_size=764;; 20) iname='VM' WIFI_REQUIRED=0 HW_ARCH=${HW_ARCH:-10} VMTYPE=${VMTYPE:-raw};; 21) iname='NativePC-BIOS' HW_ARCH=10 root_size=1215;; + 61) iname='NanoPiM2' HW_ARCH=2 boot_size=64 root_size=511 boot_fstype='ext4';; 75) iname='Container' root_size=399;; *) G_DIETPI-NOTIFY 1 "Invalid hardware model \"$HW_MODEL\" passed, aborting..."; exit 1;; esac @@ -206,7 +208,7 @@ else # MBR partition table G_EXEC parted -s "$OUTPUT_IMG_NAME.img" unit MiB mklabel msdos # boot partition - (( $boot_size )) && G_EXEC parted -s "$OUTPUT_IMG_NAME.img" unit MiB mkpart primary fat32 $((partition_start)) $((partition_start+boot_size)) + (( $boot_size )) && G_EXEC parted -s "$OUTPUT_IMG_NAME.img" unit MiB mkpart primary "$boot_fstype" "$partition_start" $((partition_start+boot_size)) # root partition G_EXEC parted -s "$OUTPUT_IMG_NAME.img" unit MiB mkpart primary "$FSTYPE" $((partition_start+boot_size)) 100% # x86_64: Set boot flag @@ -245,9 +247,10 @@ then G_EXEC mkdir rootfs/boot G_EXEC mount "${FP_LOOP}p1" rootfs/boot G_EXEC mkdir rootfs/etc + [[ $boot_fstype == 'fat32' ]] && boot_fstype='vfat' cat << _EOF_ > rootfs/etc/fstab PARTUUID=$(lsblk -no PARTUUID "${FP_LOOP}p2") / $FSTYPE noatime,lazytime 0 1 -PARTUUID=$(lsblk -no PARTUUID "${FP_LOOP}p1") /boot vfat noatime,lazytime 0 2 +PARTUUID=$(lsblk -no PARTUUID "${FP_LOOP}p1") /boot $boot_fstype noatime,lazytime 0 2 _EOF_ # - single partition else diff --git a/PREP_SYSTEM_FOR_DIETPI.sh b/PREP_SYSTEM_FOR_DIETPI.sh index 43b82f848a..6f6017b12c 100755 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -697,10 +697,10 @@ _EOF_ # WiFi related if (( $WIFI_REQUIRED )) then - aPACKAGES_REQUIRED_INSTALL+=('iw') # Tools to configure WiFi adapters - aPACKAGES_REQUIRED_INSTALL+=('wireless-tools') # Same as "iw", deprecated but still required for non-nl80211 adapters - aPACKAGES_REQUIRED_INSTALL+=('crda') # Set WiFi frequencies according to local regulations, based on WiFi country code - aPACKAGES_REQUIRED_INSTALL+=('wpasupplicant') # Support for WPA-protected WiFi network connection + aPACKAGES_REQUIRED_INSTALL+=('iw') # Tools to configure WiFi adapters + aPACKAGES_REQUIRED_INSTALL+=('wireless-tools') # Same as "iw", deprecated but still required for non-nl80211 adapters + (( $DISTRO_TARGET > 6 )) || aPACKAGES_REQUIRED_INSTALL+=('crda') # Set WiFi frequencies according to local regulations, based on WiFi country code (removed/obsolete since Bookworm) + aPACKAGES_REQUIRED_INSTALL+=('wpasupplicant') # Support for WPA-protected WiFi network connection fi # Kernel/bootloader/firmware @@ -998,6 +998,13 @@ _EOF_ # shellcheck disable=SC2046 G_AGI $(dpkg-query -Wf '${Package}\n' | grep -E '^linux-(image|dtb|u-boot)-|^u-boot') bc file + # - NanoPi M2/T2 + elif (( $G_HW_MODELK == 61 )) + then + G_EXEC curl -sSfLO 'https://dietpi.com/downloads/firmware-nanopi2.deb' + G_EXEC_OUTPUT=1 G_EXEC dpkg -i firmware-nanopi2.deb + G_EXEC rm firmware-nanopi2.deb + # - Generic kernel + device tree + U-Boot package auto detect elif (( $G_HW_MODEL != 75 )) then From 4656e8b8b07cca7a521eb79270469a24391550a5 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Mon, 11 Apr 2022 23:29:15 +0200 Subject: [PATCH 10/59] v8.4 - DietPi-PREP | Typo --- PREP_SYSTEM_FOR_DIETPI.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PREP_SYSTEM_FOR_DIETPI.sh b/PREP_SYSTEM_FOR_DIETPI.sh index 6f6017b12c..2495da093e 100755 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -999,7 +999,7 @@ _EOF_ G_AGI $(dpkg-query -Wf '${Package}\n' | grep -E '^linux-(image|dtb|u-boot)-|^u-boot') bc file # - NanoPi M2/T2 - elif (( $G_HW_MODELK == 61 )) + elif (( $G_HW_MODEL == 61 )) then G_EXEC curl -sSfLO 'https://dietpi.com/downloads/firmware-nanopi2.deb' G_EXEC_OUTPUT=1 G_EXEC dpkg -i firmware-nanopi2.deb From f039b5c63c69e207ce65981466816ee4dd14d8d1 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Mon, 11 Apr 2022 23:52:00 +0200 Subject: [PATCH 11/59] v8.4 - DietPi-Build | Raise NanoPi 2 series root partition size --- .build/images/dietpi-build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.build/images/dietpi-build b/.build/images/dietpi-build index 0202284ccd..1e4149c867 100755 --- a/.build/images/dietpi-build +++ b/.build/images/dietpi-build @@ -73,7 +73,7 @@ case $HW_MODEL in 16) iname='OdroidC4' HW_ARCH=3 partition_start=4 root_size=764;; 20) iname='VM' WIFI_REQUIRED=0 HW_ARCH=${HW_ARCH:-10} VMTYPE=${VMTYPE:-raw};; 21) iname='NativePC-BIOS' HW_ARCH=10 root_size=1215;; - 61) iname='NanoPiM2' HW_ARCH=2 boot_size=64 root_size=511 boot_fstype='ext4';; + 61) iname='NanoPiM2' HW_ARCH=2 boot_size=64 root_size=575 boot_fstype='ext4';; 75) iname='Container' root_size=399;; *) G_DIETPI-NOTIFY 1 "Invalid hardware model \"$HW_MODEL\" passed, aborting..."; exit 1;; esac From 279dff230051b3b625b97d03be4c92920a90ef33 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Tue, 12 Apr 2022 00:07:27 +0200 Subject: [PATCH 12/59] v8.4 - DietPi-PREP | Do not install initramfs-tools on NanoPi 2 series, since it ships with a fixed initramfs --- PREP_SYSTEM_FOR_DIETPI.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PREP_SYSTEM_FOR_DIETPI.sh b/PREP_SYSTEM_FOR_DIETPI.sh index 2495da093e..957739cf82 100755 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -667,7 +667,7 @@ _EOF_ then aPACKAGES_REQUIRED_INSTALL+=('tiny-initramfs') - elif (( $G_HW_MODEL > 9 )) + elif (( $G_HW_MODEL > 9 && $G_HW_MODEL != 61 )) then aPACKAGES_REQUIRED_INSTALL+=('initramfs-tools') fi From c6f32fe2d631137db87873d01ef68304ce6d5f71 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Tue, 12 Apr 2022 00:17:47 +0200 Subject: [PATCH 13/59] v8.4 - DietPi-Build | Fix non-FAT boot filesystem generation --- .build/images/dietpi-build | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.build/images/dietpi-build b/.build/images/dietpi-build index 1e4149c867..0f89ddc726 100755 --- a/.build/images/dietpi-build +++ b/.build/images/dietpi-build @@ -241,13 +241,18 @@ _EOF_ elif (( $boot_size )) then FP_ROOT_DEV=2 - G_EXEC mkfs.fat -F 32 "${FP_LOOP}p1" + if [[ $boot_fstype == 'fat32' ]] + then + boot_fstype='vfat' + G_EXEC mkfs.fat -F 32 "${FP_LOOP}p1" + else + G_EXEC "mkfs.$boot_fstype" "${FP_LOOP}p1" + fi G_EXEC "mkfs.$FSTYPE" "${FP_LOOP}p2" G_EXEC mount "${FP_LOOP}p2" rootfs G_EXEC mkdir rootfs/boot G_EXEC mount "${FP_LOOP}p1" rootfs/boot G_EXEC mkdir rootfs/etc - [[ $boot_fstype == 'fat32' ]] && boot_fstype='vfat' cat << _EOF_ > rootfs/etc/fstab PARTUUID=$(lsblk -no PARTUUID "${FP_LOOP}p2") / $FSTYPE noatime,lazytime 0 1 PARTUUID=$(lsblk -no PARTUUID "${FP_LOOP}p1") /boot $boot_fstype noatime,lazytime 0 2 From f33e7e2a2c2b893920676f525c059734ba0d27bf Mon Sep 17 00:00:00 2001 From: MichaIng Date: Tue, 12 Apr 2022 00:35:34 +0200 Subject: [PATCH 14/59] v8.4 - DietPi-PREP | Enable only ttyAMA0 serial console (default debug port) on NanoPi 2 series --- PREP_SYSTEM_FOR_DIETPI.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/PREP_SYSTEM_FOR_DIETPI.sh b/PREP_SYSTEM_FOR_DIETPI.sh index 957739cf82..f39e15bb0e 100755 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -1493,6 +1493,11 @@ _EOF_' [[ -f '/boot/dietpiEnv.txt' || -e '/dev/ttyAML0' ]] || tty='ttyS0' /boot/dietpi/func/dietpi-set_hardware serialconsole enable "$tty" + # NanoPi M2/T2: Enable ttyAMA0 only + elif (( $G_HW_MODEL == 61 )) + then + /boot/dietpi/func/dietpi-set_hardware serialconsole enable ttyAMA0 + # ROCK Pi S: Enable on ttyS0 only elif (( $G_HW_MODEL == 73 )) then From 29590b03761e0308b35d5547c56f2873333a6f32 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Tue, 12 Apr 2022 01:04:09 +0200 Subject: [PATCH 15/59] v8.4 - DietPi-Build | Create first partition at 4 MiB on NanoPi 2 series --- .build/images/dietpi-build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.build/images/dietpi-build b/.build/images/dietpi-build index 0f89ddc726..0a4f53cf14 100755 --- a/.build/images/dietpi-build +++ b/.build/images/dietpi-build @@ -73,7 +73,7 @@ case $HW_MODEL in 16) iname='OdroidC4' HW_ARCH=3 partition_start=4 root_size=764;; 20) iname='VM' WIFI_REQUIRED=0 HW_ARCH=${HW_ARCH:-10} VMTYPE=${VMTYPE:-raw};; 21) iname='NativePC-BIOS' HW_ARCH=10 root_size=1215;; - 61) iname='NanoPiM2' HW_ARCH=2 boot_size=64 root_size=575 boot_fstype='ext4';; + 61) iname='NanoPiM2' HW_ARCH=2 partition_start=4 boot_size=64 root_size=572 boot_fstype='ext4';; 75) iname='Container' root_size=399;; *) G_DIETPI-NOTIFY 1 "Invalid hardware model \"$HW_MODEL\" passed, aborting..."; exit 1;; esac From caa81a410695f8b93fbdf1da5d198ca5f48f6988 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Tue, 12 Apr 2022 01:34:00 +0200 Subject: [PATCH 16/59] v8.4 - DietPi-PREP | Add some checks for NanoPi 2 series to assure our firmware package is not installed on incompatible base images/partitioning --- 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 f39e15bb0e..67b7d5b50f 100755 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -998,8 +998,8 @@ _EOF_ # shellcheck disable=SC2046 G_AGI $(dpkg-query -Wf '${Package}\n' | grep -E '^linux-(image|dtb|u-boot)-|^u-boot') bc file - # - NanoPi M2/T2 - elif (( $G_HW_MODEL == 61 )) + # - NanoPi M2/T2 Linux 4.4: Requires dedicated boot partition, starting at 4 MiB for U-Boot, with ext4 filesystem + elif (( $G_HW_MODEL == 61 )) && [[ $(findmnt -Ufnro FSTYPE -M /boot) == 'ext4' ]] && (( $(sfdisk -qlo Start "$(lsblk -npo PKNAME "$(findmnt -Ufnro SOURCE -M /boot)")" | mawk 'NR==2') >= 8192 )) then G_EXEC curl -sSfLO 'https://dietpi.com/downloads/firmware-nanopi2.deb' G_EXEC_OUTPUT=1 G_EXEC dpkg -i firmware-nanopi2.deb From 4a2a0b23921f9c6cc1e89d70146954e680b1689e Mon Sep 17 00:00:00 2001 From: MichaIng Date: Tue, 12 Apr 2022 14:13:55 +0200 Subject: [PATCH 17/59] v8.4 - DietPi-Software | Fix syntax: Arrays cannot be passed that way as variables to functions or commands. This instead assignes a simple variable with "(value1 value2 ...)" as string. So the array needs to be assigned with as dedicated command in all cases. --- dietpi/dietpi-software | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index 43fe04ad55..b862076670 100755 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -2973,7 +2973,8 @@ unix_socket_directories = '/run/postgresql'" > "$i/00dietpi.conf" fi # Perform pip3 install (which includes setuptools and wheel modules) - aDEPS=('python3-dev') Download_Install 'https://bootstrap.pypa.io/get-pip.py' + aDEPS=('python3-dev') + Download_Install 'https://bootstrap.pypa.io/get-pip.py' G_EXEC_OUTPUT=1 G_EXEC python3 get-pip.py G_EXEC_NOHALT=1 G_EXEC rm get-pip.py @@ -5238,7 +5239,8 @@ _EOF_ G_THREAD_START curl -sSfL 'https://dietpi.com/downloads/binaries/all/cava.psf' -o /root/cava.psf # Font for nice bars - aDEPS=('libpulse0' 'libfftw3-3' 'libncursesw5') Download_Install "$url" + aDEPS=('libpulse0' 'libfftw3-3' 'libncursesw5') + Download_Install "$url" # CAVA conf, preserve existing [[ -f '/root/.config/cava/config' ]] || dps_index=$software_id Download_Install 'cava.conf' /root/.config/cava/config @@ -5907,7 +5909,8 @@ _EOF_ Banner_Installing - aDEPS=('python3') Download_Install 'https://yt-dl.org/downloads/latest/youtube-dl' /usr/local/bin/youtube-dl + aDEPS=('python3') + Download_Install 'https://yt-dl.org/downloads/latest/youtube-dl' /usr/local/bin/youtube-dl G_EXEC chmod +x /usr/local/bin/youtube-dl # youtube-dl supports Python 2 and Python 3, but its shebang calls Python 2, else fails: https://github.com/ytdl-org/youtube-dl/issues/27649 @@ -11445,7 +11448,8 @@ _EOF_ G_EXEC chown -R roon-extension-manager:root /mnt/dietpi_userdata/roon-extension-manager # Store installer to data dir, so we can reuse it on uninstall - aDEPS=('wget') Download_Install 'https://raw.githubusercontent.com/TheAppgineer/roon-extension-manager/v1.x/rem-setup.sh' /mnt/dietpi_userdata/roon-extension-manager/rem-setup.sh + aDEPS=('wget') + Download_Install 'https://raw.githubusercontent.com/TheAppgineer/roon-extension-manager/v1.x/rem-setup.sh' /mnt/dietpi_userdata/roon-extension-manager/rem-setup.sh G_EXEC cd /mnt/dietpi_userdata/roon-extension-manager G_EXEC chmod +x rem-setup.sh From e7524cb904589a2072fd47d8fcbad2ee003622e5 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Thu, 14 Apr 2022 00:04:40 +0200 Subject: [PATCH 18/59] v8.4 - DietPi-Software | ownCloud/Nextcloud: Omit Nginx version on error response --- .conf/dps_114/nginx.nextcloud.conf | 3 +++ .conf/dps_47/nginx.owncloud.conf | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.conf/dps_114/nginx.nextcloud.conf b/.conf/dps_114/nginx.nextcloud.conf index 3e034c7157..201204b02d 100644 --- a/.conf/dps_114/nginx.nextcloud.conf +++ b/.conf/dps_114/nginx.nextcloud.conf @@ -7,6 +7,9 @@ location ~ ^/\.well-known/(?:webfinger|nodeinfo) { location ^~ /nextcloud { + # Omit Nginx version on error response + server_tokens off; + # Set max upload size client_max_body_size 1048576M; fastcgi_buffers 64 4K; diff --git a/.conf/dps_47/nginx.owncloud.conf b/.conf/dps_47/nginx.owncloud.conf index 4e631f93d5..00bcc8bc77 100644 --- a/.conf/dps_47/nginx.owncloud.conf +++ b/.conf/dps_47/nginx.owncloud.conf @@ -2,6 +2,9 @@ location ^~ /owncloud { + # Omit Nginx version on error response + server_tokens off; + # Add headers to serve security related headers add_header X-Content-Type-Options nosniff always; add_header X-Frame-Options "SAMEORIGIN" always; From e5029bdb4b8eed8226094877bfe362ee12512cf1 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Thu, 14 Apr 2022 18:22:21 +0200 Subject: [PATCH 19/59] v8.4 - DietPi-Software | Python 3: Updated the workaround for ARMv6/7 Buster systems where installing numpy or any module which depends on numpy failed. It was accidentially applied only on Raspberry Pi 2 and earlier, while it should have been applied to all ARMv6/7 Buster systems. Additionally, all numpy >=0.21.5 versions are now blocked, since the recent v0.21.6 fails to compile for the same reason. --- .update/patches | 3 +++ CHANGELOG.txt | 1 + dietpi/dietpi-software | 6 +++--- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.update/patches b/.update/patches index a21023cef5..5896c9e0a5 100755 --- a/.update/patches +++ b/.update/patches @@ -721,6 +721,9 @@ Patch_8_4() G_DIETPI-NOTIFY 2 'Fixing syntax for legacy network interface nameing (eth0/wlan0). \e[33mNB: If you rely on "predictable" interface naming (enp0s0/wlp0s0), remove "net.ifnames=0" from /boot/armbianEnv.txt!' G_EXEC sed -i 's/extraargs="net.ifnames=0"/extraargs=net.ifnames=0/' /boot/armbianEnv.txt fi + + # Update workaround for numpy on ARMv6/7 Buster + (( $G_HW_ARCH < 3 && $G_DISTRO == 5 )) && [[ -f '/etc/pip-constraints.txt' ]] && G_EXEC sed -i '/^numpy!=1.21.5; python_version=='\''3.7'\''$/c\numpy<1.21.5; python_version=='\''3.7'\' /etc/pip-constraints.txt } # v6.35 => v7 migration diff --git a/CHANGELOG.txt b/CHANGELOG.txt index d6e563854b..88c13b820d 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -7,6 +7,7 @@ Fixes: - Network | Resolved an issue on some Armbian based systems where the network interface naming changed unintentionally after a kernel upgrade: https://dietpi.com/phpbb/viewtopic.php?t=10229 - DietPi-Software | Chromium: Resolved an issue on Raspberry Pi Buster systems where the installation failed because of a syntax error. Many thanks to @bbmak for reporting this issue: https://dietpi.com/phpbb/viewtopic.php?t=10258 - DietPi-Software | Tor/Unbound: Resolved an issue where IPv6 usage was assumed only based on the dietpi.txt setting instead of on whether IPv6 can really be used for Internet connections. E.g. when a VPN connection is established, usually IPv6 is disabled to prevent IPv6 leaks, without changing the general dietpi.txt setting. Tor and Unbound service starts however fail then, trying to bind to the IPv6 port. If the adapter has an IPv6 address assigned, but no IPv6 default route, binding to the IPv6 port succeeds, but Internet connections via IPv6 are not possible, which isn't better. On the other hand, using IPv4 only while IPv6 is enabled, has no real downsides. Many thanks to @Wgsem for reporting this issue: https://github.com/MichaIng/DietPi/issues/5412 +- DietPi-Software | Python 3: Updated the workaround for ARMv6/7 Buster systems where installing numpy or any module which depends on numpy failed. It was accidentially applied only on Raspberry Pi 2 and earlier, while it should have been applied to all ARMv6/7 Buster systems. Additionally, all numpy >=0.21.5 versions are now blocked, since the recent v0.21.6 fails to compile for the same reason. 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 diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index b862076670..27554955c0 100755 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -2964,10 +2964,10 @@ unix_socket_directories = '/run/postgresql'" > "$i/00dietpi.conf" # Create piwheels config file for ARMv6 and ARMv7 [[ $G_HW_ARCH != [12] || -f '/etc/pip.conf' ]] || G_EXEC eval "echo -e '[global]\nextra-index-url=https://www.piwheels.org/simple/' > /etc/pip.conf" - # Workaround for missing and failing numpy v1.21.5 build: https://github.com/piwheels/packages/issues/287#issuecomment-1036500818 - if (( $G_HW_MODEL < 3 && $G_DISTRO == 5 )) + # Workaround for missing and failing numpy >=v1.21.5 build: https://github.com/piwheels/packages/issues/287#issuecomment-1036500818 + if (( $G_HW_ARCH < 3 && $G_DISTRO == 5 )) then - G_EXEC eval 'echo "numpy!=1.21.5; python_version=='\''3.7'\''" > /etc/pip-constraints.txt' + G_EXEC eval 'echo "numpy<1.21.5; python_version=='\''3.7'\''" > /etc/pip-constraints.txt' G_CONFIG_INJECT '\[install\]' '[install]' /etc/pip.conf G_CONFIG_INJECT 'constraint=/etc/pip-constraints.txt' 'constraint=/etc/pip-constraints.txt' /etc/pip.conf '\[install\]' fi From e6e798e205b43f9e1b7c34fab68445611a8c555e Mon Sep 17 00:00:00 2001 From: MichaIng Date: Thu, 14 Apr 2022 18:48:38 +0200 Subject: [PATCH 20/59] v8.4 - CHANGELOG | NanoPi M2/T2/Fire2 | We updated our NanoPi 2 series image to be shipped with Linux 4.4, the latest Linux version for the S5P4418 SoC, provided by FriendlyELEC. It is compatible will all FriendlyELEC S5P4418 SBCs: NanoPi 2, NanoPi M2, NanoPC T2, NanoPi Fire2A, NanoPi 2 Fire and NanoPi S2. Sadly systems running the old image cannot be upgraded, since the new U-Boot requires more space and hence a different partitioning. The new image ships with two scripts to flash U-Boot and to change the U-Boot environment/config: One can now edit /boot/u-boot/env.txt and apply the changes by running /boot/u-boot/flash_env.sh. Run fw_printenv to see the current U-Boot environment, also to get an idea of available settings. Kernel, U-Boot, firmware and these scripts are installed as part of a self-hosted "firmware-nanopi2" package. The kernel sources can be found at https://github.com/friendlyarm/linux/tree/nanopi2-v4.4.y, so that headers can be compiled. We will probably provide a kernel headers package as well, if there is a demand, e.g. to enable the DKMS-based WireGuard VPN server software option. --- CHANGELOG.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 88c13b820d..ba017d676f 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,6 +1,9 @@ v8.4 (2022-04-30) +New images: +- NanoPi M2/T2/Fire2 | We updated our NanoPi 2 series image to be shipped with Linux 4.4, the latest Linux version for the S5P4418 SoC, provided by FriendlyELEC. It is compatible will all FriendlyELEC S5P4418 SBCs: NanoPi 2, NanoPi M2, NanoPC T2, NanoPi Fire2A, NanoPi 2 Fire and NanoPi S2. Sadly systems running the old image cannot be upgraded, since the new U-Boot requires more space and hence a different partitioning. The new image ships with two scripts to flash U-Boot and to change the U-Boot environment/config: One can now edit /boot/u-boot/env.txt and apply the changes by running /boot/u-boot/flash_env.sh. Run fw_printenv to see the current U-Boot environment, also to get an idea of available settings. Kernel, U-Boot, firmware and these scripts are installed as part of a self-hosted "firmware-nanopi2" package. The kernel sources can be found at https://github.com/friendlyarm/linux/tree/nanopi2-v4.4.y, so that headers can be compiled. We will probably provide a kernel headers package as well, if there is a demand, e.g. to enable the DKMS-based WireGuard VPN server software option. + Changes: Fixes: From 7aa79c1864aa1ddd12d792d1e25c0f7561593631 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sun, 17 Apr 2022 00:06:15 +0200 Subject: [PATCH 21/59] v8.4 - DietPi-Software | Box86: On ASUS Tinker Board, compiling is now done with an optimised build target flag. You can update Box86 by reinstalling it: dietpi-software reinstall 62 - DietPi-Software | Box64: On Odroid N2, compiling is now done with an optimised build target flag. You can update Box64 by reinstalling it: dietpi-software reinstall 197 - DietPi-Software | Box84/Box64: Update fallback URLs to latest version --- CHANGELOG.txt | 2 ++ dietpi/dietpi-software | 24 ++++++++++++++++-------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index ba017d676f..56d4edbedc 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -5,6 +5,8 @@ New images: - NanoPi M2/T2/Fire2 | We updated our NanoPi 2 series image to be shipped with Linux 4.4, the latest Linux version for the S5P4418 SoC, provided by FriendlyELEC. It is compatible will all FriendlyELEC S5P4418 SBCs: NanoPi 2, NanoPi M2, NanoPC T2, NanoPi Fire2A, NanoPi 2 Fire and NanoPi S2. Sadly systems running the old image cannot be upgraded, since the new U-Boot requires more space and hence a different partitioning. The new image ships with two scripts to flash U-Boot and to change the U-Boot environment/config: One can now edit /boot/u-boot/env.txt and apply the changes by running /boot/u-boot/flash_env.sh. Run fw_printenv to see the current U-Boot environment, also to get an idea of available settings. Kernel, U-Boot, firmware and these scripts are installed as part of a self-hosted "firmware-nanopi2" package. The kernel sources can be found at https://github.com/friendlyarm/linux/tree/nanopi2-v4.4.y, so that headers can be compiled. We will probably provide a kernel headers package as well, if there is a demand, e.g. to enable the DKMS-based WireGuard VPN server software option. Changes: +- DietPi-Software | Box86: On ASUS Tinker Board, compiling is now done with an optimised build target flag. You can update Box86 by reinstalling it: dietpi-software reinstall 62 +- DietPi-Software | Box64: On Odroid N2, compiling is now done with an optimised build target flag. You can update Box64 by reinstalling it: dietpi-software reinstall 197 Fixes: - Network | Resolved an issue on some Armbian based systems where the network interface naming changed unintentionally after a kernel upgrade: https://dietpi.com/phpbb/viewtopic.php?t=10229 diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index 27554955c0..d09f0b9872 100755 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -11519,28 +11519,32 @@ _EOF_ # Download local version=$(curl -sSfL 'https://api.github.com/repos/ptitSeb/box86/tags' | mawk -F\" '/"name": /{print $4;exit}') - [[ $version ]] || { version='v0.2.4'; G_DIETPI-NOTIFY 1 "Automatic latest ${aSOFTWARE_NAME[$software_id]} version detection failed. Version \"$version\" will be installed as fallback, but a newer version might be available. Please report this at: https://github.com/MichaIng/DietPi/issues"; } + [[ $version ]] || { version='v0.2.6'; G_DIETPI-NOTIFY 1 "Automatic latest ${aSOFTWARE_NAME[$software_id]} version detection failed. Version \"$version\" will be installed as fallback, but a newer version might be available. Please report this at: https://github.com/MichaIng/DietPi/issues"; } Download_Install "https://github.com/ptitSeb/box86/archive/$version.tar.gz" # Build G_EXEC mkdir "box86-${version#v}/build" G_EXEC cd "box86-${version#v}/build" # - RPi 2 - if [[ $G_HW_MODEL == 2 ]] + if (( $G_HW_MODEL == 2 )) then G_EXEC cmake .. -DRPI2=1 -DNOGIT=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo # - RPi 3 - elif [[ $G_HW_MODEL == 3 ]] + elif (( $G_HW_MODEL == 3 )) then G_EXEC cmake .. -DRPI3=1 -DNOGIT=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo # - RPi 4 - elif [[ $G_HW_MODEL == 4 ]] + elif (( $G_HW_MODEL == 4 )) then - G_EXEC cmake .. -DRPI4=1 -DNOGIT=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo + G_EXEC cmake .. -DRPI4=1 -DNOGIT=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo # - Odroids elif (( $G_HW_MODEL < 20 )) then G_EXEC cmake .. -DODROID=1 -DNOGIT=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo + # - ASUS Tinker Board + elif (( $G_HW_MODEL == 52 )) + then + G_EXEC cmake .. -DRK3288=1 -DNOGIT=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo # - Others else G_EXEC cmake .. -DARM_DYNAREC=ON -DNOGIT=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo @@ -11563,18 +11567,22 @@ _EOF_ # Download local version=$(curl -sSfL 'https://api.github.com/repos/ptitSeb/box64/tags' | mawk -F\" '/"name": /{print $4;exit}') - [[ $version ]] || { version='v0.1.6'; G_DIETPI-NOTIFY 1 "Automatic latest ${aSOFTWARE_NAME[$software_id]} version detection failed. Version \"$version\" will be installed as fallback, but a newer version might be available. Please report this at: https://github.com/MichaIng/DietPi/issues"; } + [[ $version ]] || { version='v0.1.8'; G_DIETPI-NOTIFY 1 "Automatic latest ${aSOFTWARE_NAME[$software_id]} version detection failed. Version \"$version\" will be installed as fallback, but a newer version might be available. Please report this at: https://github.com/MichaIng/DietPi/issues"; } Download_Install "https://github.com/ptitSeb/box64/archive/$version.tar.gz" # Build G_EXEC mkdir "box64-${version#v}/build" G_EXEC cd "box64-${version#v}/build" # - RPi 4 - if [[ $G_HW_MODEL == 4 ]] + if (( $G_HW_MODEL == 4 )) then G_EXEC cmake .. -DRPI4ARM64=1 -DNOGIT=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo + # - Odroid N2 + elif (( $G_HW_MODEL == 15 )) + then + G_EXEC cmake .. -DODROIDN2=1 -DNOGIT=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo # - RK3399 - elif [[ $G_HW_CPUID == 3 ]] + elif (( $G_HW_CPUID == 3 )) then G_EXEC cmake .. -DRK3399=1 -DNOGIT=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo # - Others From 8c592580e80d45fa29097d387f5ff9f673a2f1d8 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Mon, 18 Apr 2022 16:18:27 +0200 Subject: [PATCH 22/59] v8.4 - CHANGELOG | Typos --- CHANGELOG.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 56d4edbedc..c64b42d06d 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -42,7 +42,7 @@ Fixes: - NanoPi NEO3 | Resolved an issue where the board became unbootable after an "apt upgrade" because the latest version of the Armbian kernel does not ship a NEO3 device tree anymore. On DietPi upgrade, it is switched to the NanoPi R2 rev00 device tree, which works regarding Ethernet, USB and general GPIO interface: https://forum.armbian.com/topic/20133-nanopi-neo3-dtb-gone-since-linux-dtb-current-rockchip64-22021/ - Raspberry Pi | Resolved an issue where enabling and using onboard WiFi during first run installs was failing if a reboot was done after first run update due to a kernel upgrade. Many thanks to @matteocarnelos for reporting this issue: https://github.com/MichaIng/DietPi/issues/5391 - Network | Resolved an issue where the systemd network targets could have been reached before the network adapter was even detected. Many thanks to @Totila for reporting this issue: https://dietpi.com/phpbb/viewtopic.php?t=10167 -- DietPi-WiFi-Monitor | The first default gateway check is not done after the first tick rate interval instead of immediately after service start. This adds another grace period at boot to reduce the chance that the WiFi monitor reconfigures the interface which is just about to be configured for the first time. This should usually not be required, but may help with cases where the initial DHCP lease or WPA authentication time out of fail. +- DietPi-WiFi-Monitor | The first default gateway check is now done after the first tick rate interval instead of immediately after service start. This adds another grace period at boot to reduce the chance that the WiFi monitor reconfigures the interface which is just about to be configured for the first time. This should usually not be required, but may help with cases where the initial DHCP lease or WPA authentication time out or fail. - DietPi-TimeSync | Resolved an issue where the script threw a syntax error where it shouldn't, which however didn't affect functionality. Many thanks to @adminy for reporting this issue: https://github.com/MichaIng/DietPi/issues/5347 - DietPi-Login | Resolved an issue where a prompt about an unsupported SSH client terminal was incorrectly shown. Many thanks to @jahway603 and @Dagon for reporting this issue: https://github.com/MichaIng/DietPi/issues/5341, https://github.com/MichaIng/DietPi/issues/5366 - DietPi-Drive_Manager | Worked around an issue on Bullseye with legacy Linux versions, where exFAT filesystems failed to mount since the exFAT driver for FUSE is not invoked automatically if the native kernel driver is missing. A symlink for "mount.exfat => mount.exfat-fuse" is now created in these cases to force this invocation, and it is removed as fast as due to a kernel upgrade, the native exFAT driver becomes available. Many thanks to @RunningUtes for reporting this issue: https://github.com/MichaIng/DietPi/issues/5166 From 15a408caca738a572d87075ef59f41ed9e690a81 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Tue, 19 Apr 2022 16:01:18 +0200 Subject: [PATCH 23/59] v8.4 (#5432) - DietPi-Software | Single File PHP Gallery: Resolved the failing installation since a new version is available and the old download link has become invalid. Many thanks to @dodo1967 for reporting this issue: https://github.com/MichaIng/DietPi/issues/5415 --- CHANGELOG.txt | 1 + dietpi/dietpi-software | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index c64b42d06d..56eec84915 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -13,6 +13,7 @@ Fixes: - DietPi-Software | Chromium: Resolved an issue on Raspberry Pi Buster systems where the installation failed because of a syntax error. Many thanks to @bbmak for reporting this issue: https://dietpi.com/phpbb/viewtopic.php?t=10258 - DietPi-Software | Tor/Unbound: Resolved an issue where IPv6 usage was assumed only based on the dietpi.txt setting instead of on whether IPv6 can really be used for Internet connections. E.g. when a VPN connection is established, usually IPv6 is disabled to prevent IPv6 leaks, without changing the general dietpi.txt setting. Tor and Unbound service starts however fail then, trying to bind to the IPv6 port. If the adapter has an IPv6 address assigned, but no IPv6 default route, binding to the IPv6 port succeeds, but Internet connections via IPv6 are not possible, which isn't better. On the other hand, using IPv4 only while IPv6 is enabled, has no real downsides. Many thanks to @Wgsem for reporting this issue: https://github.com/MichaIng/DietPi/issues/5412 - DietPi-Software | Python 3: Updated the workaround for ARMv6/7 Buster systems where installing numpy or any module which depends on numpy failed. It was accidentially applied only on Raspberry Pi 2 and earlier, while it should have been applied to all ARMv6/7 Buster systems. Additionally, all numpy >=0.21.5 versions are now blocked, since the recent v0.21.6 fails to compile for the same reason. +- DietPi-Software | Single File PHP Gallery: Resolved the failing installation since a new version is available and the old download link has become invalid. Many thanks to @dodo1967 for reporting this issue: https://github.com/MichaIng/DietPi/issues/5415 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 diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index d09f0b9872..96f2bd19e4 100755 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -7831,9 +7831,13 @@ _EOF_ Banner_Installing + G_DIETPI-NOTIFY 2 'Obtaining latest download from: https://sye.dk/sfpg/?latest' + local file=$(curl -sSfL 'https://sye.dk/sfpg/?latest') + [[ $file ]] || { file='Single_File_PHP_Gallery_4.9.0.zip'; G_DIETPI-NOTIFY 1 "Automatic latest ${aSOFTWARE_NAME[$software_id]} download detection failed. Downloading the last known \"$file\" is attempted as fallback, but may fail if a newer version is available. Please report this at: https://github.com/MichaIng/DietPi/issues"; } + # Install required PHP modules: https://sye.dk/sfpg/ aDEPS=("php$PHP_VERSION-gd") - Download_Install 'https://sye.dk/sfpg/Single_File_PHP_Gallery_4.8.1.zip' /var/www/gallery + Download_Install "https://sye.dk/sfpg/$file" /var/www/gallery # Enable required PHP modules G_EXEC phpenmod gd @@ -14069,6 +14073,7 @@ If no WireGuard (auto)start is included, but you require it, please do the follo [[ -f '/var/www/gallery/index.php' ]] && G_EXEC rm /var/www/gallery/index.php [[ -f '/var/www/gallery/readme.txt' ]] && G_EXEC rm /var/www/gallery/readme.txt [[ -d '/var/www/gallery/_sfpg_data' ]] && G_EXEC rm -R /var/www/gallery/_sfpg_data + G_DIETPI-NOTIFY 2 'The plain gallery image files are not removed. You may do this manually via "rm -R /var/www/gallery".' fi From ddcc90e4e4355fac506c7848bb304936e245c90f Mon Sep 17 00:00:00 2001 From: MichaIng Date: Tue, 19 Apr 2022 16:24:46 +0200 Subject: [PATCH 24/59] v8.4 (#5436) - DietPi-Software | VirtualHere: Move binary and config from /etc/vhusbd to /opt/virtualhere to better align with other software options. Do never overwrite existing configs and use the hostname as default ServerName instead of "DietPi". Start the service after network has been configured and log to syslog instead of log file. --- CHANGELOG.txt | 1 + dietpi/dietpi-software | 43 ++++++++++++++++++++++++++++-------------- 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 56eec84915..868efff5de 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -7,6 +7,7 @@ New images: Changes: - DietPi-Software | Box86: On ASUS Tinker Board, compiling is now done with an optimised build target flag. You can update Box86 by reinstalling it: dietpi-software reinstall 62 - DietPi-Software | Box64: On Odroid N2, compiling is now done with an optimised build target flag. You can update Box64 by reinstalling it: dietpi-software reinstall 197 +- DietPi-Software | VirtualHere: On new installs and reinstalls, VirtualHere is now installed to /opt/virtualhere to align with most other software options. Logging is now done to system log, viewable via "journalctl -u virtualhere", instead of using the /var/log/virtualhere.log plain text file. By default, the system hostname is now used as VirtualHere server name, instead of the hardcoded "DietPi". An existing config file is never touched on reinstalls. Fixes: - Network | Resolved an issue on some Armbian based systems where the network interface naming changed unintentionally after a kernel upgrade: https://dietpi.com/phpbb/viewtopic.php?t=10229 diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index 96f2bd19e4..0695e318d0 100755 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -9579,39 +9579,52 @@ _EOF_ local url='https://virtualhere.com/sites/default/files/usbserver/vhusbd' # ARMv6/7 - if [[ $G_HW_ARCH == [12] ]]; then - + if [[ $G_HW_ARCH == [12] ]] + then url+='arm' # ARMv8 - elif (( $G_HW_ARCH == 3 )); then - + elif (( $G_HW_ARCH == 3 )) + then url+='arm64' # x86_64 - elif (( $G_HW_ARCH == 10 )); then - + elif (( $G_HW_ARCH == 10 )) + then url+='x86_64' - fi - [[ -d '/etc/vhusbd' ]] || G_EXEC mkdir /etc/vhusbd - G_EXEC curl -sSfL "$url" -o /etc/vhusbd/vhusbd - G_EXEC chmod +x /etc/vhusbd/vhusbd + Download_Install "$url" /opt/virtualhere/vhusbd + G_EXEC chmod +x /opt/virtualhere/vhusbd + + # Config + if [[ ! -f '/opt/virtualhere/config.ini' ]] + then + if [[ -f '/etc/vhusbd/config.ini' ]] + then + G_EXEC mv /etc/vhusbd/config.ini /opt/virtualhere/config.ini + else + # shellcheck disable=SC2016 + echo 'ServerName=$HOSTNAME$' > /opt/virtualhere/config.ini + fi + fi # Service cat << '_EOF_' > /etc/systemd/system/virtualhere.service [Unit] Description=VirtualHere (DietPi) +Wants=network-online.target +After=network-online.target [Service] -ExecStart=/etc/vhusbd/vhusbd -r /var/log/virtualhere.log +ExecStart=/opt/virtualhere/vhusbd [Install] WantedBy=multi-user.target _EOF_ - # Config - echo "ServerName='DietPi'" > /etc/vhusbd/config.ini + # Pre-v8.4 + [[ -d '/etc/vhusbd' ]] && G_EXEC rm -R /etc/vhusbd + [[ -f '/var/log/virtualhere.log' ]] && G_EXEC rm /var/log/virtualhere.log fi @@ -13214,7 +13227,9 @@ If no WireGuard (auto)start is included, but you require it, please do the follo G_EXEC rm /etc/systemd/system/virtualhere.service fi [[ -d '/etc/systemd/system/virtualhere.service.d' ]] && G_EXEC rm -R /etc/systemd/system/virtualhere.service.d - [[ -d '/etc/vhusbd' ]] && G_EXEC rm -R /etc/vhusbd + [[ -d '/opt/virtualhere' ]] && G_EXEC rm -R /opt/virtualhere + [[ -d '/etc/vhusbd' ]] && G_EXEC rm -R /etc/vhusbd # Pre-v8.4 + [[ -f '/var/log/virtualhere.log' ]] && G_EXEC rm /var/log/virtualhere.log # Pre-v8.4 fi From 1c15c42ff1a9e770b333ba47e90fb6f31df94c98 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Tue, 19 Apr 2022 17:25:56 +0200 Subject: [PATCH 25/59] v8.4 - DietPi-Software | Webmin: Remove obsolete workaround due to upstream fix --- dietpi/dietpi-software | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index 0695e318d0..bd3e7f62fe 100755 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -5881,8 +5881,7 @@ _EOF_ # APT package G_AGI webmin - # Workaround: https://github.com/MichaIng/DietPi/issues/5386 - systemctl -q is-active webmin && G_EXEC systemctl stop webmin + G_EXEC systemctl stop webmin # Service Remove_SysV webmin From 72db6d5e86372d895c23a66fae6a764be4186653 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Tue, 19 Apr 2022 18:18:09 +0200 Subject: [PATCH 26/59] v8.4 - DietPi-Config | Prevent the attempt to install CRDA and set WiFi country code on Debian Bookworm and above. The crda package is not available anymore, kernels are supposed to obtain it from wireless-regdb themselves. --- PREP_SYSTEM_FOR_DIETPI.sh | 9 ++++---- dietpi/dietpi-config | 22 +++++++++---------- dietpi/func/dietpi-set_hardware | 17 ++++++++------ .../lib/dietpi/services/dietpi-firstboot.bash | 2 +- 4 files changed, 27 insertions(+), 23 deletions(-) diff --git a/PREP_SYSTEM_FOR_DIETPI.sh b/PREP_SYSTEM_FOR_DIETPI.sh index 67b7d5b50f..944c194583 100755 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -697,10 +697,11 @@ _EOF_ # WiFi related if (( $WIFI_REQUIRED )) then - aPACKAGES_REQUIRED_INSTALL+=('iw') # Tools to configure WiFi adapters - aPACKAGES_REQUIRED_INSTALL+=('wireless-tools') # Same as "iw", deprecated but still required for non-nl80211 adapters - (( $DISTRO_TARGET > 6 )) || aPACKAGES_REQUIRED_INSTALL+=('crda') # Set WiFi frequencies according to local regulations, based on WiFi country code (removed/obsolete since Bookworm) - aPACKAGES_REQUIRED_INSTALL+=('wpasupplicant') # Support for WPA-protected WiFi network connection + aPACKAGES_REQUIRED_INSTALL+=('iw') # Tools to configure WiFi adapters + aPACKAGES_REQUIRED_INSTALL+=('wireless-tools') # Same as "iw", deprecated but still required for non-nl80211 adapters + # Set WiFi frequencies according to local regulations, based on WiFi country code. CRDA is not available since Bookworm, kernels are supposed to obtain it from wireless-regdb themselves. + (( $DISTRO_TARGET > 6 )) && aPACKAGES_REQUIRED_INSTALL+=('wireless-regdb') || aPACKAGES_REQUIRED_INSTALL+=('crda') + aPACKAGES_REQUIRED_INSTALL+=('wpasupplicant') # Support for WPA-protected WiFi network connection fi # Kernel/bootloader/firmware diff --git a/dietpi/dietpi-config b/dietpi/dietpi-config index e45f598753..1537f35d4f 100755 --- a/dietpi/dietpi-config +++ b/dietpi/dietpi-config @@ -2014,7 +2014,7 @@ Current setting: $user_frequency_min_text" && G_CONFIG_INJECT 'CONFIG_CPU_MIN_FR (( $WIFI_DISABLED )) && G_WHIP_BUTTON_CANCEL_TEXT='Skip' G_WHIP_YESNO 'Would you like to purge all WiFi related APT packages? \nThis will free up space, but an internet-capable Ethernet connection is required to re-enable WiFi functionality. - \nAffected packages: iw wireless-tools crda wpasupplicant' && G_AGP 'iw' 'wireless-tools' 'crda' 'wpasupplicant' + \nAffected packages: iw wireless-tools crda wireless-regdb wpasupplicant' && G_AGP 'iw' 'wireless-tools' 'crda' 'wireless-regdb' 'wpasupplicant' # Drop Connections G_DIETPI-NOTIFY 0 'Dropping connections, please wait...' @@ -2355,8 +2355,7 @@ NB: All Ethernet connections will be dropped!' && Network_ApplyChanges WIFI_BITRATE=0 WIFI_SIGNALSTRENGTH=0 command -v hostapd &> /dev/null && WIFI_HOTSPOT=1 || WIFI_HOTSPOT=0 - WIFI_COUNTRYCODE='GB' - # Prevent "nl80211 not found" message, when running this command with cfg80211 module disabled. + WIFI_COUNTRYCODE='Unknown' command -v iw &> /dev/null && WIFI_COUNTRYCODE=$(iw reg get | mawk '/country/{print $2;exit}' | tr -d ':') # Convert CIDR integer to net mask, e.g. "192.168.0.100/24" (take "24") to "255.255.255.0" @@ -2848,14 +2847,15 @@ NB: Auto-negotiation is highly recommended as long as you do not have issues wit fi G_WHIP_MENU_ARRAY+=('' '●─ Additional Options ') - # - Unset country code? - if [[ $WIFI_COUNTRYCODE == '00' ]]; then - - G_WHIP_MENU_ARRAY+=('Country' ": [$WIFI_COUNTRYCODE] (Not set, please configure)") - else - - G_WHIP_MENU_ARRAY+=('Country' ": [$WIFI_COUNTRYCODE]") - + # Country code: Not available from Debian Bookworm on: https://bugs.debian.org/1003903 + if (( $G_DISTRO < 7 )) + then + if [[ $WIFI_COUNTRYCODE == '00' ]] + then + G_WHIP_MENU_ARRAY+=('Country' ": [$WIFI_COUNTRYCODE] (Not set, please configure)") + else + G_WHIP_MENU_ARRAY+=('Country' ": [$WIFI_COUNTRYCODE]") + fi fi G_WHIP_MENU_ARRAY+=('' '●─ Toggle State ') diff --git a/dietpi/func/dietpi-set_hardware b/dietpi/func/dietpi-set_hardware index 08ad766d18..117b0ba358 100755 --- a/dietpi/func/dietpi-set_hardware +++ b/dietpi/func/dietpi-set_hardware @@ -96,13 +96,13 @@ $FP_SCRIPT rpi-eeprom Unsupported_Input_Name(){ - G_DIETPI-NOTIFY 2 "Input name ($INPUT_DEVICE_NAME) is not supported by $G_HW_MODEL_NAME. Nothing has been applied." + G_DIETPI-NOTIFY 2 "Input name ($INPUT_DEVICE_NAME) is not supported on your system. Nothing has been applied." } Unsupported_Input_Mode(){ - G_DIETPI-NOTIFY 2 "Input value ($INPUT_DEVICE_VALUE) is not supported by $G_HW_MODEL_NAME. Nothing has been applied." + G_DIETPI-NOTIFY 2 "Input value ($INPUT_DEVICE_VALUE) is not supported on your system. Nothing has been applied." } @@ -1412,7 +1412,9 @@ _EOF_ command -v rfkill > /dev/null && rfkill unblock wifi # Install required APT packages - G_EXEC_NOEXIT=1 G_AG_CHECK_INSTALL_PREREQ 'iw' 'wireless-tools' 'crda' 'wpasupplicant' || EXIT_CODE=1 + local crda='wireless-regdb' + (( $G_DISTRO > 6 )) || crda='crda' + G_EXEC_NOEXIT=1 G_AG_CHECK_INSTALL_PREREQ 'iw' 'wireless-tools' "$crda" 'wpasupplicant' || EXIT_CODE=1 elif [[ $INPUT_DEVICE_VALUE == 'onboard_enable' ]]; then @@ -1440,8 +1442,12 @@ _EOF_ # Use country code from command input: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 INPUT_DEVICE_VALUE=${INPUT_DEVICE_VALUE^^} # Needs to be uppercase while all input is made lowercase (ToDo) - if [[ $INPUT_DEVICE_VALUE == [[:upper:]][[:upper:]] ]]; then + if (( $G_DISTRO > 6 )) + then + Unsupported_Input_Name + elif [[ $INPUT_DEVICE_VALUE == [[:upper:]][[:upper:]] ]] + then # Update /etc/default/crda to apply country code via udev rules G_CONFIG_INJECT 'REGDOMAIN=' "REGDOMAIN=$INPUT_DEVICE_VALUE" /etc/default/crda || EXIT_CODE=1 @@ -1450,11 +1456,8 @@ _EOF_ # Update dietpi.txt with new value G_CONFIG_INJECT 'AUTO_SETUP_NET_WIFI_COUNTRY_CODE=' "AUTO_SETUP_NET_WIFI_COUNTRY_CODE=$INPUT_DEVICE_VALUE" /boot/dietpi.txt - else - Unknown_Input_Mode - fi } diff --git a/rootfs/var/lib/dietpi/services/dietpi-firstboot.bash b/rootfs/var/lib/dietpi/services/dietpi-firstboot.bash index 72a1c769c7..05bd50a3e7 100755 --- a/rootfs/var/lib/dietpi/services/dietpi-firstboot.bash +++ b/rootfs/var/lib/dietpi/services/dietpi-firstboot.bash @@ -249,7 +249,7 @@ _EOF_ /boot/dietpi/func/dietpi-wifidb 1 # Set WiFi country code - /boot/dietpi/func/dietpi-set_hardware wificountrycode "$(sed -n '/^[[:blank:]]*AUTO_SETUP_NET_WIFI_COUNTRY_CODE=/{s/^[^=]*=//p;q}' /boot/dietpi.txt)" + (( $G_DISTRO > 6 )) || /boot/dietpi/func/dietpi-set_hardware wificountrycode "$(sed -n '/^[[:blank:]]*AUTO_SETUP_NET_WIFI_COUNTRY_CODE=/{s/^[^=]*=//p;q}' /boot/dietpi.txt)" # - Ethernet elif (( $ethernet_enabled )); then From 276c27b84d36ac2ffe4aa333f5635032ab07a468 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Thu, 21 Apr 2022 11:36:51 +0200 Subject: [PATCH 27/59] v8.4 (#5447) - DietPi-Config | It is now possible toggle APT list compression. APT package lists are xz-compressed by default on DietPi, which reduces disk writes during APT updates and disk usage of APT lists by about 80%. But it slows down APT installs/upgrades, especially when a large number of packages is installed/upgraded, since parsing compressed lists for e.g. building the dependency tree is done quite inefficiently. The option can be found in "dietpi-config" > "Advanced Options" > "APT". - DietPi-Set_software | The "apt-cache" command has been renamed to "apt" to better reflect its options, which do not cover the APT cache only, but APT lists and the location of the downloaded package archive as well. For backwards compatibility, "apt-cache" however remains valid for now. - DietPi-Set_software | When using the "allo eth_static" command to apply static Ethernet interface settings, it is now possible to leave further positional arguments (address, gateway, netmask, dns-nameservers) empty (empty string '') or skipping the last ones. Only the defined non-empty arguments will be applied while other settings remain unchanged. --- CHANGELOG.txt | 4 ++ dietpi/dietpi-config | 21 +++++++---- dietpi/func/dietpi-set_software | 67 +++++++++++++++++++-------------- 3 files changed, 56 insertions(+), 36 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 868efff5de..9ced3bd95b 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -4,7 +4,11 @@ v8.4 New images: - NanoPi M2/T2/Fire2 | We updated our NanoPi 2 series image to be shipped with Linux 4.4, the latest Linux version for the S5P4418 SoC, provided by FriendlyELEC. It is compatible will all FriendlyELEC S5P4418 SBCs: NanoPi 2, NanoPi M2, NanoPC T2, NanoPi Fire2A, NanoPi 2 Fire and NanoPi S2. Sadly systems running the old image cannot be upgraded, since the new U-Boot requires more space and hence a different partitioning. The new image ships with two scripts to flash U-Boot and to change the U-Boot environment/config: One can now edit /boot/u-boot/env.txt and apply the changes by running /boot/u-boot/flash_env.sh. Run fw_printenv to see the current U-Boot environment, also to get an idea of available settings. Kernel, U-Boot, firmware and these scripts are installed as part of a self-hosted "firmware-nanopi2" package. The kernel sources can be found at https://github.com/friendlyarm/linux/tree/nanopi2-v4.4.y, so that headers can be compiled. We will probably provide a kernel headers package as well, if there is a demand, e.g. to enable the DKMS-based WireGuard VPN server software option. +CLI changes: +- DietPi-Set_software | The "apt-cache" command has been renamed to "apt" to better reflect its options, which do not cover the APT cache only, but APT lists and the location of the downloaded package archive as well. For backwards compatibility, "apt-cache" however remains valid for now. + Changes: +- DietPi-Config | It is now possible toggle APT list compression. APT package lists are xz-compressed by default on DietPi, which reduces disk writes during APT updates and disk usage of APT lists by about 80%. But it slows down APT installs/upgrades, especially when a large number of packages is installed/upgraded, since parsing compressed lists for e.g. building the dependency tree is done quite inefficiently. The option can be found in "dietpi-config" > "Advanced Options" > "APT". - DietPi-Software | Box86: On ASUS Tinker Board, compiling is now done with an optimised build target flag. You can update Box86 by reinstalling it: dietpi-software reinstall 62 - DietPi-Software | Box64: On Odroid N2, compiling is now done with an optimised build target flag. You can update Box64 by reinstalling it: dietpi-software reinstall 197 - DietPi-Software | VirtualHere: On new installs and reinstalls, VirtualHere is now installed to /opt/virtualhere to align with most other software options. Logging is now done to system log, viewable via "journalctl -u virtualhere", instead of using the /var/log/virtualhere.log plain text file. By default, the system hostname is now used as VirtualHere server name, instead of the hardcoded "DietPi". An existing config file is never touched on reinstalls. diff --git a/dietpi/dietpi-config b/dietpi/dietpi-config index 1537f35d4f..adcd5ac2cd 100755 --- a/dietpi/dietpi-config +++ b/dietpi/dietpi-config @@ -944,6 +944,8 @@ Re-enabling HDMI requires a reboot. If you need emergency HDMI output, edit the local cache_enabled=$(grep -cm1 '^Dir::Cache::pkgcache "[^"]' apt_conf) local cache_in_ram=$(grep -cm1 '^Dir::Cache "/tmp' apt_conf) local lists_in_ram=$(grep -cm1 '^Dir::State "/tmp' apt_conf) + local list_compression='On' + [[ -f '/etc/apt/apt.conf.d/98dietpi-nocompress' ]] && list_compression='Off' local archives_in_ram=0 (( $cache_in_ram )) && grep -q '^Dir::Cache::archives "[^/]' apt_conf || grep -q '^Dir::Cache::archives "/tmp' apt_conf && archives_in_ram=1 @@ -962,6 +964,7 @@ Re-enabling HDMI requires a reboot. If you need emergency HDMI output, edit the 'Reset' ': Reset to system defaults' 'APT cache' ": [$cache_text]" 'APT lists' ": [$lists_text]" + 'List compression' ": [$list_compression]" ) (( $cache_in_ram )) && G_WHIP_MENU_ARRAY+=('APT archives' ": [$archives_text]") @@ -971,19 +974,21 @@ Re-enabling HDMI requires a reboot. If you need emergency HDMI output, edit the - 50-100 MiB size, gets fully rewritten on every APT update \nAPT lists: Release files, one each distro and component - 50-100 MiB size, get individually rewritten if update available +\nList compression: Whether APT lists are stored xz-compressed + - Reduces disk writes (during APT updates) and usage by ~80% + - Slows down reading package lists on APT installs \nAPT archives: Where APT downloads packages to for install - Can temporarily consume much space on large APT installs - - Resets to disk if cache is moved to disk -\nPlease select an item to adjust:'; then + - Resets to disk if cache is moved to disk'; then - [[ $G_WHIP_RETURNED_VALUE == 'Reset' ]] && { /boot/dietpi/func/dietpi-set_software apt-cache reset; return; } + [[ $G_WHIP_RETURNED_VALUE == 'Reset' ]] && { /boot/dietpi/func/dietpi-set_software apt reset; return 0; } + [[ $G_WHIP_RETURNED_VALUE == 'List compression' ]] && { /boot/dietpi/func/dietpi-set_software apt compress $(( ! ${list_compression/On/1} )); return 0; } local item=$G_WHIP_RETURNED_VALUE G_WHIP_MENU_ARRAY=( 'To disk' ": Move $item to disk (default)" 'To RAM' ": Move $item to RAM" - ) [[ $item == 'APT cache' ]] && G_WHIP_MENU_ARRAY+=('Disable' ": Disable $item") @@ -999,7 +1004,7 @@ Re-enabling HDMI requires a reboot. If you need emergency HDMI output, edit the G_WHIP_MENU "Please select an option for $item$note" || return local option=${G_WHIP_RETURNED_VALUE#To } - /boot/dietpi/func/dietpi-set_software apt-cache "${item#APT }" "${option,,}" + /boot/dietpi/func/dietpi-set_software apt "${item#APT }" "${option,,}" else @@ -1090,8 +1095,8 @@ Re-enabling HDMI requires a reboot. If you need emergency HDMI output, edit the (( $swap_size )) || swap_size_text='Off' G_WHIP_MENU_ARRAY=('Swap file' ": [$swap_size_text | $swap_location]") - # APT cache - G_WHIP_MENU_ARRAY+=('APT cache' ': Manage APT cache/info storage') + # APT + G_WHIP_MENU_ARRAY+=('APT' ': Manage APT cache and list storage') # Time sync local ntpd_mode_current=$(sed -n '/^[[:blank:]]*CONFIG_NTP_MODE=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) @@ -1199,7 +1204,7 @@ Re-enabling HDMI requires a reboot. If you need emergency HDMI output, edit the G_WHIP_YESNO 'Swapfile control has been moved to DietPi-Drive_Manager, would you like to run the application now? \nOnce finished, exit to resume DietPi-Config' && /boot/dietpi/dietpi-drive_manager - elif [[ $G_WHIP_RETURNED_VALUE == 'APT cache' ]]; then + elif [[ $G_WHIP_RETURNED_VALUE == 'APT' ]]; then TARGETMENUID=19 diff --git a/dietpi/func/dietpi-set_software b/dietpi/func/dietpi-set_software index 7844edb7eb..c1c9d32605 100755 --- a/dietpi/func/dietpi-set_software +++ b/dietpi/func/dietpi-set_software @@ -18,7 +18,7 @@ $FP_SCRIPT allo eth_dhcp|eth_static [
] [] [] [|default -$FP_SCRIPT apt-cache clean|reset|cache|lists|archives [disable|ram|disk] +$FP_SCRIPT apt clean|reset|cache|lists|archives|compress [enable|disable|ram|disk] $FP_SCRIPT ntpd-mode [0-4] Time sync modes: 0=custom|1=boot|2=boot+daily|3=boot+hourly|4=daemon+drift $FP_SCRIPT verify_dietpi.txt Verifies dietpi.txt entries, adds missing entries if required $FP_SCRIPT passwords NULL=Prompt user to change DietPi related passwords | X=optional set X as global password for future dietpi-software installations and \"root\" + \"dietpi\" login passwords. @@ -140,26 +140,25 @@ deb $INPUT_MODE_VALUE $G_DISTRO_NAME-backports main contrib non-free' > /etc/apt #///////////////////////////////////////////////////////////////////////////////////// # Set APT Cache #///////////////////////////////////////////////////////////////////////////////////// - AptCache_Main(){ + Apt_Main(){ - local fp='/etc/apt/apt.conf.d/99-dietpi-cache' + local fp='/etc/apt/apt.conf.d/99-dietpi-cache' fp_compress='/etc/apt/apt.conf.d/98dietpi-nocompress' # Clean current cache before changing it, failsafe cleanup if custom dir was chosen before apt-get clean if [[ $INPUT_MODE_VALUE == 'reset' ]]; then - [[ -f $fp ]] && rm "$fp" - [[ -d '/tmp/apt' ]] && rm -R /tmp/apt + G_EXEC rm -Rf /tmp/apt "$fp" "$fp_compress" return 0 fi - [[ -f $fp ]] || echo '# Please use "dietpi-config" > "Advanded Options" > "APT Cache" to edit these settings.' > "$fp" + [[ -f $fp ]] || echo '# Please use "dietpi-config" > "Advanded Options" > "APT" to edit these settings.' > "$fp" if [[ $INPUT_MODE_VALUE == 'clean' ]]; then - rm -Rf /tmp/apt /var/cache/apt /var/lib/apt/{lists,mirrors,periodic,cdroms.list} + G_EXEC rm -Rf /tmp/apt /var/cache/apt /var/lib/apt/{lists,mirrors,periodic,cdroms.list} elif [[ $INPUT_MODE_VALUE == 'cache' ]]; then @@ -170,19 +169,19 @@ deb $INPUT_MODE_VALUE $G_DISTRO_NAME-backports main contrib non-free' > /etc/apt GCI_PRESERVE=1 G_CONFIG_INJECT 'Dir::Cache::archives[[:blank:]]' 'Dir::Cache::archives "/var/cache/apt/archives";' "$fp" G_CONFIG_INJECT 'Dir::Cache::pkgcache[[:blank:]]' 'Dir::Cache::pkgcache "";' "$fp" G_CONFIG_INJECT 'Dir::Cache::srcpkgcache[[:blank:]]' 'Dir::Cache::srcpkgcache "";' "$fp" - [[ -d '/var/cache/apt' ]] && rm -R /var/cache/apt + [[ -d '/var/cache/apt' ]] && G_EXEC rm -R /var/cache/apt elif [[ $INPUT_ADDITIONAL_1 == 'ram' ]]; then G_CONFIG_INJECT 'Dir::Cache[[:blank:]]' 'Dir::Cache "/tmp/apt";' "$fp" GCI_PRESERVE=1 G_CONFIG_INJECT 'Dir::Cache::archives[[:blank:]]' 'Dir::Cache::archives "/var/cache/apt/archives";' "$fp" sed -i '/pkgcache[[:blank:]]/d' "$fp" - [[ -d '/var/cache/apt' ]] && rm -R /var/cache/apt + [[ -d '/var/cache/apt' ]] && G_EXEC rm -R /var/cache/apt elif [[ $INPUT_ADDITIONAL_1 == 'disk' ]]; then sed -i '/^Dir::Cache/d' "$fp" - [[ -d '/tmp/apt' ]] && rm -R /tmp/apt + [[ -d '/tmp/apt' ]] && G_EXEC rm -R /tmp/apt fi @@ -193,12 +192,12 @@ deb $INPUT_MODE_VALUE $G_DISTRO_NAME-backports main contrib non-free' > /etc/apt G_CONFIG_INJECT 'Dir::State[[:blank:]]' 'Dir::State "/tmp/apt";' "$fp" G_CONFIG_INJECT 'Dir::State::extended_states[[:blank:]]' 'Dir::State::extended_states "/var/lib/apt/extended_states";' "$fp" G_CONFIG_INJECT 'Dir::State::status[[:blank:]]' 'Dir::State::status "/var/lib/dpkg/status";' "$fp" - rm -Rf /var/lib/apt/{lists,mirrors,periodic,cdroms.list} + G_EXEC rm -Rf /var/lib/apt/{lists,mirrors,periodic,cdroms.list} elif [[ $INPUT_ADDITIONAL_1 == 'disk' ]]; then sed -i '/^Dir::State/d' "$fp" - [[ -d '/tmp/apt' ]] && rm -R /tmp/apt + [[ -d '/tmp/apt' ]] && G_EXEC rm -R /tmp/apt fi @@ -209,33 +208,43 @@ deb $INPUT_MODE_VALUE $G_DISTRO_NAME-backports main contrib non-free' > /etc/apt # Cache needs to be in RAM as well for this to work reliable G_CONFIG_INJECT 'Dir::Cache[[:blank:]]' 'Dir::Cache "/tmp/apt";' "$fp" G_CONFIG_INJECT 'Dir::Cache::archives[[:blank:]]' 'Dir::Cache::archives "/tmp/apt/archives";' "$fp" - [[ -d '/var/cache/apt' ]] && rm -R /var/cache/apt + [[ -d '/var/cache/apt' ]] && G_EXEC rm -R /var/cache/apt elif [[ $INPUT_ADDITIONAL_1 == 'disk' ]]; then G_CONFIG_INJECT 'Dir::Cache::archives[[:blank:]]' 'Dir::Cache::archives "/var/cache/apt/archives";' "$fp" - [[ -d '/tmp/apt/archives' ]] && rm -R /tmp/apt/archives + [[ -d '/tmp/apt/archives' ]] && G_EXEC rm -R /tmp/apt/archives fi - fi - - if [[ -f $fp ]]; then + elif [[ $INPUT_MODE_VALUE == 'compress' ]]; then - # Remove drop-in config if it does not contain any setting - if ! grep -q '^Dir' "$fp"; then + if [[ $INPUT_ADDITIONAL_1 == 1 || $INPUT_ADDITIONAL_1 == 'enable' ]]; then - rm "$fp" + [[ -f '/etc/apt/apt.conf.d/98dietpi-nocompress' ]] && G_EXEC rm "$fp_compress" - # Re-create default cache dir if archives on disk while cache in RAM, since parent dirs are not auto-created - elif grep -q '/var/cache/apt/archives' "$fp"; then + elif [[ $INPUT_ADDITIONAL_1 == 0 || $INPUT_ADDITIONAL_1 == 'disable' ]]; then - mkdir -p /var/cache/apt/archives + echo -e '# Please use "dietpi-config" > "Advanded Options" > "APT" to edit this setting.\nAcquire::GzipIndexes "false";' > "$fp_compress" fi fi + [[ -f $fp ]] || return 0 + + # Remove drop-in config if it does not contain any setting + if ! grep -q '^Dir' "$fp"; then + + G_EXEC rm "$fp" + + # Re-create default cache dir if archives on disk while cache in RAM, since parent dirs are not auto-created + elif grep -q '/var/cache/apt/archives' "$fp"; then + + G_EXEC mkdir -p /var/cache/apt/archives + + fi + } #///////////////////////////////////////////////////////////////////////////////////// @@ -347,9 +356,10 @@ deb $INPUT_MODE_VALUE $G_DISTRO_NAME-backports main contrib non-free' > /etc/apt elif [[ $INPUT_MODE_VALUE == 'eth_static' ]]; then G_CONFIG_INJECT 'iface eth' 'iface eth0 inet static' /etc/network/interfaces - sed -i "0,\|^.*address[[:blank:]].*\$|s||address $INPUT_ADDITIONAL_1|" /etc/network/interfaces - sed -i "0,\|^.*gateway[[:blank:]].*\$|s||gateway $INPUT_ADDITIONAL_2|" /etc/network/interfaces - sed -i "0,\|^.*netmask[[:blank:]].*\$|s||netmask $INPUT_ADDITIONAL_3|" /etc/network/interfaces + [[ $INPUT_ADDITIONAL_1 ]] && sed -i "0,\|^.*address[[:blank:]].*\$|s||address $INPUT_ADDITIONAL_1|" /etc/network/interfaces + [[ $INPUT_ADDITIONAL_2 ]] && sed -i "0,\|^.*gateway[[:blank:]].*\$|s||gateway $INPUT_ADDITIONAL_2|" /etc/network/interfaces + [[ $INPUT_ADDITIONAL_3 ]] && sed -i "0,\|^.*netmask[[:blank:]].*\$|s||netmask $INPUT_ADDITIONAL_3|" /etc/network/interfaces + [[ $INPUT_ADDITIONAL_4 ]] || return 0 if command -v resolvconf > /dev/null then sed -i "0,\|^.*dns-nameservers[[:blank:]].*\$|s||dns-nameservers $INPUT_ADDITIONAL_4|" /etc/network/interfaces @@ -558,9 +568,10 @@ It is highly recommended to change this password, ideally, it should be differen AptMirror_Main - elif [[ $INPUT_MODE_NAME == 'apt-cache' ]]; then + # Pre-v8.4: Backwards compatibility for "apt-cache" => "apt" + elif [[ $INPUT_MODE_NAME == 'apt' || $INPUT_MODE_NAME == 'apt-cache' ]]; then - AptCache_Main + Apt_Main elif [[ $INPUT_MODE_NAME == 'useradd' ]]; then From 8d949fc18b61d9e057c33decc29ec7c2243787c1 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Thu, 21 Apr 2022 11:52:00 +0200 Subject: [PATCH 28/59] v8.4 - 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 bd3e7f62fe..70f324c4b5 100755 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -11113,7 +11113,7 @@ _EOF_ arch='amd64' fi - local fallback_url="https://github.com/go-gitea/gitea/releases/download/v1.16.5/gitea-1.16.5-linux-$arch" + local fallback_url="https://github.com/go-gitea/gitea/releases/download/v1.16.6/gitea-1.16.6-linux-$arch" Download_Install "$(curl -sSfL 'https://api.github.com/repos/go-gitea/gitea/releases/latest' | mawk -F\" "/\"browser_download_url\": \".*\/gitea-[^\"\/]*-linux-$arch\"/{print \$4}")" /mnt/dietpi_userdata/gitea/gitea # User From 97d1d689bc493523aae22421962fa18777c5ad59 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Thu, 21 Apr 2022 18:59:37 +0200 Subject: [PATCH 29/59] v8.4 - Security | Access permissions for /etc/sudoers.d/dietpi have been hardened to comply with best practice. Many thanks to @fmunteanu for reporting this issue: https://github.com/MichaIng/DietPi/issues/5441 --- .update/patches | 7 +++++++ CHANGELOG.txt | 1 + dietpi/func/dietpi-set_software | 11 +++++++---- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.update/patches b/.update/patches index 5896c9e0a5..caf6ec377d 100755 --- a/.update/patches +++ b/.update/patches @@ -724,6 +724,13 @@ Patch_8_4() # Update workaround for numpy on ARMv6/7 Buster (( $G_HW_ARCH < 3 && $G_DISTRO == 5 )) && [[ -f '/etc/pip-constraints.txt' ]] && G_EXEC sed -i '/^numpy!=1.21.5; python_version=='\''3.7'\''$/c\numpy<1.21.5; python_version=='\''3.7'\' /etc/pip-constraints.txt + + # https://github.com/MichaIng/DietPi/issues/5441 + if [[ -f '/etc/sudoers.d/dietpi' ]] + then + G_DIETPI-NOTIFY 2 'Hardening /etc/sudoers.d/dietpi permissions' + G_EXEC chmod 0440 /etc/sudoers.d/dietpi + fi } # v6.35 => v7 migration diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 9ced3bd95b..91fa3ec7be 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -8,6 +8,7 @@ CLI changes: - DietPi-Set_software | The "apt-cache" command has been renamed to "apt" to better reflect its options, which do not cover the APT cache only, but APT lists and the location of the downloaded package archive as well. For backwards compatibility, "apt-cache" however remains valid for now. Changes: +- Security | Access permissions for /etc/sudoers.d/dietpi have been hardened to comply with best practice. Many thanks to @fmunteanu for reporting this issue: https://github.com/MichaIng/DietPi/issues/5441 - DietPi-Config | It is now possible toggle APT list compression. APT package lists are xz-compressed by default on DietPi, which reduces disk writes during APT updates and disk usage of APT lists by about 80%. But it slows down APT installs/upgrades, especially when a large number of packages is installed/upgraded, since parsing compressed lists for e.g. building the dependency tree is done quite inefficiently. The option can be found in "dietpi-config" > "Advanced Options" > "APT". - DietPi-Software | Box86: On ASUS Tinker Board, compiling is now done with an optimised build target flag. You can update Box86 by reinstalling it: dietpi-software reinstall 62 - DietPi-Software | Box64: On Odroid N2, compiling is now done with an optimised build target flag. You can update Box64 by reinstalling it: dietpi-software reinstall 197 diff --git a/dietpi/func/dietpi-set_software b/dietpi/func/dietpi-set_software index c1c9d32605..c739390511 100755 --- a/dietpi/func/dietpi-set_software +++ b/dietpi/func/dietpi-set_software @@ -251,7 +251,7 @@ deb $INPUT_MODE_VALUE $G_DISTRO_NAME-backports main contrib non-free' > /etc/apt # Set time sync mode # NB: Also sets mirror as defined in dietpi.txt CONFIG_NTP_MIRROR #///////////////////////////////////////////////////////////////////////////////////// - NtpdMode_Main(){ + TimeSync_Main(){ if [[ ! $INPUT_MODE_VALUE || $INPUT_MODE_VALUE == [01234] ]]; then @@ -385,7 +385,7 @@ deb $INPUT_MODE_VALUE $G_DISTRO_NAME-backports main contrib non-free' > /etc/apt if [[ $INPUT_MODE_VALUE ]]; then - G_EXEC mkdir -p /home # Failsafe + [[ -d '/home' ]] || G_EXEC mkdir /home # Failsafe # Get global password # - Encrypted @@ -412,8 +412,11 @@ deb $INPUT_MODE_VALUE $G_DISTRO_NAME-backports main contrib non-free' > /etc/apt G_EXEC chown -R "$INPUT_MODE_VALUE:$INPUT_MODE_VALUE" "/home/$INPUT_MODE_VALUE" - # Allow sudo without pw + # Allow sudo without password + umask 0337 + [[ -f /etc/sudoers.d/$INPUT_MODE_VALUE ]] && G_EXEC chmod 0440 "/etc/sudoers.d/$INPUT_MODE_VALUE" echo "$INPUT_MODE_VALUE ALL=(ALL:ALL) NOPASSWD: ALL" > "/etc/sudoers.d/$INPUT_MODE_VALUE" + umask 0022 else @@ -583,7 +586,7 @@ It is highly recommended to change this password, ideally, it should be differen elif [[ $INPUT_MODE_NAME == 'ntpd-mode' ]]; then - NtpdMode_Main + TimeSync_Main elif [[ $INPUT_MODE_NAME == 'allo' ]]; then From 4b73d74c5e076cbbbfdb892e8909c6dd9f5474d6 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Fri, 22 Apr 2022 16:09:13 +0200 Subject: [PATCH 30/59] v8.4 - DietPi-Config | Resolved an issue on RPi where disabling and re-enabling Bluetooth failed, since the hciuart.service cannot be restarted until reboot after it was stopped once. In the same turn, this also resolved an issue in DietPi-PREP where the service is still running after package removal, while trying to disabling it fails as of the missing service file. Many thanks to @Mausy5043 for reporting this issue: https://github.com/MichaIng/DietPi/issues/5435 --- CHANGELOG.txt | 1 + dietpi/func/dietpi-set_hardware | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 91fa3ec7be..e1954963a3 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -16,6 +16,7 @@ Changes: Fixes: - Network | Resolved an issue on some Armbian based systems where the network interface naming changed unintentionally after a kernel upgrade: https://dietpi.com/phpbb/viewtopic.php?t=10229 +- DietPi-Config | Resolved an issue on RPi where disabling and re-enabling Bluetooth failed, since the hciuart.service cannot be restarted until reboot after it was stopped once. In the same turn, this also resolved an issue in DietPi-PREP where the service is still running after package removal, while trying to disabling it fails as of the missing service file. Many thanks to @Mausy5043 for reporting this issue: https://github.com/MichaIng/DietPi/issues/5435 - DietPi-Software | Chromium: Resolved an issue on Raspberry Pi Buster systems where the installation failed because of a syntax error. Many thanks to @bbmak for reporting this issue: https://dietpi.com/phpbb/viewtopic.php?t=10258 - DietPi-Software | Tor/Unbound: Resolved an issue where IPv6 usage was assumed only based on the dietpi.txt setting instead of on whether IPv6 can really be used for Internet connections. E.g. when a VPN connection is established, usually IPv6 is disabled to prevent IPv6 leaks, without changing the general dietpi.txt setting. Tor and Unbound service starts however fail then, trying to bind to the IPv6 port. If the adapter has an IPv6 address assigned, but no IPv6 default route, binding to the IPv6 port succeeds, but Internet connections via IPv6 are not possible, which isn't better. On the other hand, using IPv4 only while IPv6 is enabled, has no real downsides. Many thanks to @Wgsem for reporting this issue: https://github.com/MichaIng/DietPi/issues/5412 - DietPi-Software | Python 3: Updated the workaround for ARMv6/7 Buster systems where installing numpy or any module which depends on numpy failed. It was accidentially applied only on Raspberry Pi 2 and earlier, while it should have been applied to all ARMv6/7 Buster systems. Additionally, all numpy >=0.21.5 versions are now blocked, since the recent v0.21.6 fails to compile for the same reason. diff --git a/dietpi/func/dietpi-set_hardware b/dietpi/func/dietpi-set_hardware index 117b0ba358..0bbbca445d 100755 --- a/dietpi/func/dietpi-set_hardware +++ b/dietpi/func/dietpi-set_hardware @@ -1190,7 +1190,8 @@ _EOF_ # RPi if (( $G_HW_MODEL < 10 )) && (( $G_HW_ONBOARD_WIFI )); then - systemctl -q is-enabled hciuart 2> /dev/null || systemctl -q is-active hciuart && G_EXEC systemctl disable --now hciuart + # Do not stop the service, otherwise it cannot be started anymore until reboot. Also for this reason the service is not stopped on pi-bluetooth package removal, hence disabling it on "is-active" via "disable --now" fails due to missing service file: https://github.com/RPi-Distro/pi-bluetooth/issues/34, https://github.com/MichaIng/DietPi/issues/5435 + systemctl -q is-enabled hciuart 2> /dev/null && G_EXEC systemctl disable hciuart # Disable onboard Bluetooth via device tree overlay G_CONFIG_INJECT 'dtoverlay=disable-bt' 'dtoverlay=disable-bt' /boot/config.txt From c864974f5e6145ebefe92acf0e182408e40b0600 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Fri, 22 Apr 2022 20:18:20 +0200 Subject: [PATCH 31/59] v8.4 - DietPi-Software | WiFi Hotspot: Resolved an issue where the WiFi country code was not applied when the WiFi Hotspot was installed via automated first run setup. Many thanks to @matteocarnelos for reporting this issue: https://github.com/MichaIng/DietPi/issues/5407 --- CHANGELOG.txt | 1 + dietpi/dietpi-config | 4 +--- dietpi/dietpi-software | 3 +++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index e1954963a3..7db4390f06 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -21,6 +21,7 @@ Fixes: - DietPi-Software | Tor/Unbound: Resolved an issue where IPv6 usage was assumed only based on the dietpi.txt setting instead of on whether IPv6 can really be used for Internet connections. E.g. when a VPN connection is established, usually IPv6 is disabled to prevent IPv6 leaks, without changing the general dietpi.txt setting. Tor and Unbound service starts however fail then, trying to bind to the IPv6 port. If the adapter has an IPv6 address assigned, but no IPv6 default route, binding to the IPv6 port succeeds, but Internet connections via IPv6 are not possible, which isn't better. On the other hand, using IPv4 only while IPv6 is enabled, has no real downsides. Many thanks to @Wgsem for reporting this issue: https://github.com/MichaIng/DietPi/issues/5412 - DietPi-Software | Python 3: Updated the workaround for ARMv6/7 Buster systems where installing numpy or any module which depends on numpy failed. It was accidentially applied only on Raspberry Pi 2 and earlier, while it should have been applied to all ARMv6/7 Buster systems. Additionally, all numpy >=0.21.5 versions are now blocked, since the recent v0.21.6 fails to compile for the same reason. - DietPi-Software | Single File PHP Gallery: Resolved the failing installation since a new version is available and the old download link has become invalid. Many thanks to @dodo1967 for reporting this issue: https://github.com/MichaIng/DietPi/issues/5415 +- DietPi-Software | WiFi Hotspot: Resolved an issue where the WiFi country code was not applied when the WiFi Hotspot was installed via automated first run setup. Many thanks to @matteocarnelos for reporting this issue: https://github.com/MichaIng/DietPi/issues/5407 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 diff --git a/dietpi/dietpi-config b/dietpi/dietpi-config index adcd5ac2cd..8803253845 100755 --- a/dietpi/dietpi-config +++ b/dietpi/dietpi-config @@ -2262,8 +2262,6 @@ _EOF_ Change_WifiCountryCode(){ - local wifi_country_code_target=$WIFI_COUNTRYCODE - G_WHIP_MENU_ARRAY=( 'GB' ': Great Britain' @@ -2283,7 +2281,7 @@ _EOF_ G_WHIP_INPUTBOX 'Please enter a 2 character country code: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2' || return 0 [[ $G_WHIP_RETURNED_VALUE == [[:upper:]][[:upper:]] ]] || { G_WHIP_MSG "[FAILED] Invalid country code ($G_WHIP_RETURNED_VALUE). Aborting..."; return 1; } fi - wifi_country_code_target=$G_WHIP_RETURNED_VALUE + local wifi_country_code_target=$G_WHIP_RETURNED_VALUE /boot/dietpi/func/dietpi-set_hardware wificountrycode "$wifi_country_code_target" diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index 70f324c4b5..29c11c78f1 100755 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -8149,6 +8149,9 @@ _EOF_ # Enable WiFi modules /boot/dietpi/func/dietpi-set_hardware wifimodules enable + # Set WiFi Country Code + (( $G_DISTRO > 6 )) || /boot/dietpi/func/dietpi-set_hardware wificountrycode "$(sed -n '/^[[:blank:]]*AUTO_SETUP_NET_WIFI_COUNTRY_CODE=/{s/^[^=]*=//p;q}' /boot/dietpi.txt)" + local eth_iface=$(G_GET_NET -t eth iface) local wifi_iface=$(G_GET_NET -t wlan iface) From 75a78ee483248e69edf161aaf3300a50876de54c Mon Sep 17 00:00:00 2001 From: MichaIng Date: Fri, 22 Apr 2022 21:54:36 +0200 Subject: [PATCH 32/59] v8.4 (#5450) - DietPi-Software | rTorrent: The ruTorrent web interface is now reinstalled cleanly, i.e. configs and 3rd party plugins are preserved but all other files are removed before new ruTorrent files are installed. Many thanks to @shanew1694 for reporting a related issue with remaining obsolete files: https://github.com/MichaIng/DietPi/issues/5161#issuecomment-1013286248 --- CHANGELOG.txt | 1 + dietpi/dietpi-software | 39 +++++++++++++++++++++++++-------------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 7db4390f06..c4db1a4e0f 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -13,6 +13,7 @@ Changes: - DietPi-Software | Box86: On ASUS Tinker Board, compiling is now done with an optimised build target flag. You can update Box86 by reinstalling it: dietpi-software reinstall 62 - DietPi-Software | Box64: On Odroid N2, compiling is now done with an optimised build target flag. You can update Box64 by reinstalling it: dietpi-software reinstall 197 - DietPi-Software | VirtualHere: On new installs and reinstalls, VirtualHere is now installed to /opt/virtualhere to align with most other software options. Logging is now done to system log, viewable via "journalctl -u virtualhere", instead of using the /var/log/virtualhere.log plain text file. By default, the system hostname is now used as VirtualHere server name, instead of the hardcoded "DietPi". An existing config file is never touched on reinstalls. +- DietPi-Software | rTorrent: The ruTorrent web interface is now reinstalled cleanly, i.e. configs, 3rd party plugins and themes are preserved but all other files are removed before new ruTorrent files are installed. Many thanks to @shanew1694 for reporting a related issue with remaining obsolete files: https://github.com/MichaIng/DietPi/issues/5161#issuecomment-1013286248 Fixes: - Network | Resolved an issue on some Armbian based systems where the network interface naming changed unintentionally after a kernel upgrade: https://dietpi.com/phpbb/viewtopic.php?t=10229 diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index 29c11c78f1..11118df6d2 100755 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -8953,25 +8953,36 @@ _EOF_ [[ $version ]] || { version='v3.10'; G_DIETPI-NOTIFY 1 "Automatic latest ruTorrent version detection failed. Version \"$version\" will be installed as fallback, but a newer version might be available. Please report this at: https://github.com/MichaIng/DietPi/issues"; } Download_Install "https://github.com/Novik/ruTorrent/archive/$version.tar.gz" - # - Reinstall - if [[ -d '/var/www/rutorrent' ]]; then - - # Make new config files examples, if they exist in the old install already - [[ -f '/var/www/rutorrent/conf/config.php' ]] && G_EXEC mv "ruTorrent-${version#v}/conf/config.php"{,.example} - [[ -f '/var/www/rutorrent/conf/access.ini' ]] && G_EXEC mv "ruTorrent-${version#v}/conf/access.ini"{,.example} - [[ -f '/var/www/rutorrent/conf/plugins.ini' ]] && G_EXEC mv "ruTorrent-${version#v}/conf/plugins.ini"{,.example} - - # Merge new install into old to preserve e.g. 3rd party plugins - G_EXEC cp -a "ruTorrent-${version#v}/". /var/www/rutorrent/ - G_EXEC rm -R "ruTorrent-${version#v}" + # - Reinstall freshly with preserved configs and 3rd party plugins + if [[ -d '/var/www/rutorrent' ]] + then + # If old configs exist, preserve them and make new config files examples + [[ -f '/var/www/rutorrent/conf/config.php' ]] && { G_EXEC mv "ruTorrent-${version#v}/conf/config.php"{,.example}; G_EXEC cp -a {/var/www/rutorrent,"ruTorrent-${version#v}"}/conf/config.php; } + [[ -f '/var/www/rutorrent/conf/access.ini' ]] && { G_EXEC mv "ruTorrent-${version#v}/conf/access.ini"{,.example}; G_EXEC cp -a {/var/www/rutorrent,"ruTorrent-${version#v}"}/conf/access.ini; } + [[ -f '/var/www/rutorrent/conf/plugins.ini' ]] && { G_EXEC mv "ruTorrent-${version#v}/conf/plugins.ini"{,.example}; G_EXEC cp -a {/var/www/rutorrent,"ruTorrent-${version#v}"}/conf/plugins.ini; } - # - Fresh install - else + # Preserve 3rd party plugins + for i in /var/www/rutorrent/plugins/{,.??,.[^.]}* + do + [[ -e $i ]] || continue + [[ -e ruTorrent-${version#v}/plugins/${i#/var/www/rutorrent/plugins/} ]] && continue + G_EXEC cp -a "$i" "ruTorrent-${version#v}/plugins/" + done - G_EXEC mv "ruTorrent-${version#v}" /var/www/rutorrent + # Preserve 3rd party themes + for i in /var/www/rutorrent/plugins/theme/themes/{,.??,.[^.]}* + do + [[ -e $i ]] || continue + [[ -e ruTorrent-${version#v}/plugins/theme/themes/${i#/var/www/rutorrent/plugins/theme/themes/} ]] && continue + G_EXEC cp -a "$i" "ruTorrent-${version#v}/plugins/theme/themes/" + done + # Reinstall freshly with preserved configs, 3rd party plugins and themes + G_EXEC rm -R /var/www/rutorrent fi + G_EXEC mv "ruTorrent-${version#v}" /var/www/rutorrent + # Install DarkBetter theme manually: https://github.com/MichaIng/DietPi/issues/3271 if [[ -d '/var/www/rutorrent/plugins/theme/themes/DarkBetter' ]]; then From 49d723d3c886ca8ed3f4fa6cb8b4cbec8e2f006e Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sat, 23 Apr 2022 23:44:49 +0200 Subject: [PATCH 33/59] v8.4 (#5451) - DietPi-Software | The webserver, desktop and browser "preference" menus have been removed, in favour of an interactive dialogue once respective dependant software is to be installed. Those menus have always caused confusion, since selecting e.g. a specific desktop didn't cause this desktop to be installed, unless another software was selected which requires a desktop to work. For automated first run installs, the respective dietpi.txt settings are still respected. --- .update/patches | 3 + CHANGELOG.txt | 1 + dietpi.txt | 20 +- dietpi/dietpi-software | 616 ++++++++++++++--------------------------- 4 files changed, 215 insertions(+), 425 deletions(-) diff --git a/.update/patches b/.update/patches index caf6ec377d..540a938683 100755 --- a/.update/patches +++ b/.update/patches @@ -731,6 +731,9 @@ Patch_8_4() G_DIETPI-NOTIFY 2 'Hardening /etc/sudoers.d/dietpi permissions' G_EXEC chmod 0440 /etc/sudoers.d/dietpi fi + + # Remove obsolete software preference indices + [[ -f '/boot/dietpi/.installed' ]] && G_EXEC sed -Ei '/^[[:blank:]]*INDEX_(WEBSERVER|DESKTOP|BROWSER)=/d' /boot/dietpi/.installed } # v6.35 => v7 migration diff --git a/CHANGELOG.txt b/CHANGELOG.txt index c4db1a4e0f..11a58e3363 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -10,6 +10,7 @@ CLI changes: Changes: - Security | Access permissions for /etc/sudoers.d/dietpi have been hardened to comply with best practice. Many thanks to @fmunteanu for reporting this issue: https://github.com/MichaIng/DietPi/issues/5441 - DietPi-Config | It is now possible toggle APT list compression. APT package lists are xz-compressed by default on DietPi, which reduces disk writes during APT updates and disk usage of APT lists by about 80%. But it slows down APT installs/upgrades, especially when a large number of packages is installed/upgraded, since parsing compressed lists for e.g. building the dependency tree is done quite inefficiently. The option can be found in "dietpi-config" > "Advanced Options" > "APT". +- DietPi-Software | The webserver, desktop and browser "preference" menus have been removed, in favour of an interactive dialogue once respective dependant software is to be installed. Those menus have always caused confusion, since selecting e.g. a specific desktop didn't cause this desktop to be installed, unless another software was selected which requires a desktop to work. For automated first run installs, the respective dietpi.txt settings are still respected. - DietPi-Software | Box86: On ASUS Tinker Board, compiling is now done with an optimised build target flag. You can update Box86 by reinstalling it: dietpi-software reinstall 62 - DietPi-Software | Box64: On Odroid N2, compiling is now done with an optimised build target flag. You can update Box64 by reinstalling it: dietpi-software reinstall 197 - DietPi-Software | VirtualHere: On new installs and reinstalls, VirtualHere is now installed to /opt/virtualhere to align with most other software options. Logging is now done to system log, viewable via "journalctl -u virtualhere", instead of using the /var/log/virtualhere.log plain text file. By default, the system hostname is now used as VirtualHere server name, instead of the hardcoded "DietPi". An existing config file is never touched on reinstalls. diff --git a/dietpi.txt b/dietpi.txt index 3e17ade13c..b8569ae5b5 100644 --- a/dietpi.txt +++ b/dietpi.txt @@ -87,19 +87,15 @@ AUTO_SETUP_LOGGING_INDEX=-1 # RAMlog max tmpfs size (MB). 50MB should be fine for single use. 200MB+ for heavy webserver and access log etc. AUTO_SETUP_RAMLOG_MAXSIZE=50 -# Webserver preference: 0=Apache | -1=Nginx | -2=Lighttpd -# - This defines the webserver to install (only) when another selected software requires one. -# - It won't be installed if no other software requires a webserver and a manual webserver stack selection will override it. -AUTO_SETUP_WEB_SERVER_INDEX=-2 - -# Desktop preference: 0=LXDE | -1=Xfce | -2=MATE | -3=LXQt | -4=GNUstep -# - This defines the desktop to install (only) when another selected software requires one. -# - It won't be installed if no other software requires a desktop and a manual desktop selection will override it. +# Dependency preferences +# - DietPi-Software installs all dependencies for selected software options automatically, which can include a webserver for web applications, a desktop for GUI applications and one usually wants a web browser on desktops. +# - Especially for non-interactive first run installs (see AUTO_SETUP_AUTOMATED below), you may want to define which webserver, desktop and/or browser you want to have installed in such case. For interactive installs you will be always asked to pick one. +# - With below settings you can define your preference for non-interactive installs. However, it will only installed if any other selected software requires it, and an explicit webserver/desktop/browser selection overrides those settings: +# - Webserver preference: 0=Apache | -1=Nginx | -2=Lighttpd +AUTO_SETUP_WEB_SERVER_INDEX=0 +# - Desktop preference: 0=LXDE | -1=Xfce | -2=MATE | -3=LXQt | -4=GNUstep AUTO_SETUP_DESKTOP_INDEX=0 - -# Browser preference: 0=None | -1=Firefox | -2=Chromium -# - This defines the browser to install (only) when a desktop is installed. -# - It won't be installed if no desktop is installed and a manual browser selection will override it. +# - Browser preference: 0=None | -1=Firefox | -2=Chromium AUTO_SETUP_BROWSER_INDEX=-1 # DietPi-Autostart: 0=Console | 7=Console autologin | 1=Kodi | 2=Desktop autologin | 16=Desktop | 4=OpenTyrian | 5=DietPi-CloudShell | 6=Amiberry fast boot | 8=Amiberry standard boot | 9=DDX-Rebirth | 10=CAVA Spectrum | 11=Chromium kiosk | 14=Custom script (background) | 17=Custom script (foreground) diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index 11118df6d2..a96c104a25 100755 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -88,10 +88,7 @@ Available commands: done # Choice and preference indices - install_states+="INDEX_LOGGING=$INDEX_LOGGING -INDEX_WEBSERVER=$INDEX_WEBSERVER -INDEX_DESKTOP=$INDEX_DESKTOP -INDEX_BROWSER=$INDEX_BROWSER" + install_states+="INDEX_LOGGING=$INDEX_LOGGING" echo "$install_states" > /boot/dietpi/.installed @@ -107,9 +104,6 @@ INDEX_BROWSER=$INDEX_BROWSER" >> /boot/dietpi/.installed fi - # Disable browser preference on ARMv6 Bullseye+ systems: https://github.com/RPi-Distro/chromium-browser/issues/21 - (( $G_HW_ARCH == 1 && $G_DISTRO > 5 )) && INDEX_BROWSER=0 - } Check_Net_and_Time_sync(){ @@ -136,11 +130,8 @@ INDEX_BROWSER=$INDEX_BROWSER" # Flag to skip APT update in Run_Installations(), set by DietPi-Automation_Pre() SKIP_APT_UPDATE=0 - # DietPi choice and preference systems + # Logging choice index INDEX_LOGGING=-1 - INDEX_WEBSERVER=-2 - INDEX_DESKTOP=0 - INDEX_BROWSER=-1 # Since no automated reboot is done anymore after installs, collect services to start manually, when not controlled by DietPi-Services aSTART_SERVICES=() @@ -1888,6 +1879,200 @@ INDEX_BROWSER=$INDEX_BROWSER" G_WHIP_MSG "[WARNING] Conflicting installs have been detected!$unmarked_text$dependants_text" } + Select_Webserver_Dependency() + { + # Check for existing webserver (Apache, Nginx, Lighttpd) installation + # - Do no reinstalls, as those are currently too intrusive, overriding custom configs + (( ${aSOFTWARE_INSTALL_STATE[83]} < 1 && ${aSOFTWARE_INSTALL_STATE[84]} < 1 && ${aSOFTWARE_INSTALL_STATE[85]} < 1 )) || return 1 + + # Auto-select webserver if manually installed + if dpkg-query -s 'apache2' &> /dev/null + then + SELECTED_WEBSERVER=83; return 0 + + elif dpkg-query -s 'nginx-common' &> /dev/null + then + SELECTED_WEBSERVER=85; return 0 + + elif dpkg-query -s 'lighttpd' &> /dev/null + then + SELECTED_WEBSERVER=84; return 0 + fi + + local dependant=$1 preference_index=$(sed -n '/^[[:blank:]]*AUTO_SETUP_WEB_SERVER_INDEX=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) software_id + # Preference index to software ID + case $preference_index in + -2) software_id=84;; # Lighttpd + -1) software_id=85;; # Nginx + *) software_id=83;; # Apache (default) + esac + + G_WHIP_MENU_ARRAY=( + + "${aSOFTWARE_NAME[83]}" ": ${aSOFTWARE_DESC[83]}" + "${aSOFTWARE_NAME[85]}" ": ${aSOFTWARE_DESC[85]}" + "${aSOFTWARE_NAME[84]}" ": ${aSOFTWARE_DESC[84]}" + ) + + G_WHIP_DEFAULT_ITEM=${aSOFTWARE_NAME[$software_id]} + G_WHIP_BUTTON_OK_TEXT='Confirm' G_WHIP_BUTTON_CANCEL_TEXT="Select ${aSOFTWARE_NAME[$software_id]}" + G_WHIP_MENU "${aSOFTWARE_NAME[$dependant]} requires a webserver. Which one shall be installed? +\n- Apache: Feature-rich and popular. Recommended for beginners and users who are looking to follow Apache based guides. +\n- Nginx: Lightweight alternative to Apache. Nginx claims faster webserver performance compared to Apache. +\n- Lighttpd: Extremely lightweight and is generally considered to offer the \"best\" webserver performance for SBCs. Recommended for users who expect low webserver traffic. +\n- More info: https://dietpi.com/docs/software/webserver_stack/" || G_WHIP_RETURNED_VALUE=${aSOFTWARE_NAME[$software_id]} + + # Software name to ID and preference index + if [[ $G_WHIP_RETURNED_VALUE == "${aSOFTWARE_NAME[83]}" ]] + then + SELECTED_WEBSERVER=83 preference_index=0 + + elif [[ $G_WHIP_RETURNED_VALUE == "${aSOFTWARE_NAME[85]}" ]] + then + SELECTED_WEBSERVER=85 preference_index=-1 + + elif [[ $G_WHIP_RETURNED_VALUE == "${aSOFTWARE_NAME[84]}" ]] + then + SELECTED_WEBSERVER=84 preference_index=-2 + fi + + G_CONFIG_INJECT 'AUTO_SETUP_WEB_SERVER_INDEX=' "AUTO_SETUP_WEB_SERVER_INDEX=$preference_index" /boot/dietpi.txt + return 0 + } + + Select_Desktop_Dependency() + { + # Check for existing desktop (LXDE, MATE, Xfce, GNUstep, LXQt) installation + # - Do no reinstalls, as those are loose dependencies + (( ${aSOFTWARE_INSTALL_STATE[23]} < 1 && ${aSOFTWARE_INSTALL_STATE[24]} < 1 && ${aSOFTWARE_INSTALL_STATE[25]} < 1 && ${aSOFTWARE_INSTALL_STATE[26]} < 1 && ${aSOFTWARE_INSTALL_STATE[173]} < 1 )) || return 1 + + # Auto-select desktop if manually installed + if dpkg-query -s 'lxde' &> /dev/null + then + SELECTED_DESKTOP=23; return 0 + + elif dpkg-query -s 'xfce4' &> /dev/null + then + SELECTED_DESKTOP=25; return 0 + + elif dpkg-query -s 'mate-desktop-environment-core' &> /dev/null + then + SELECTED_DESKTOP=24; return 0 + + elif dpkg-query -s 'lxqt' &> /dev/null + then + SELECTED_DESKTOP=173; return 0 + + elif dpkg-query -s 'gnustep' &> /dev/null + then + SELECTED_DESKTOP=26; return 0 + fi + + local dependant=$1 preference_index=$(sed -n '/^[[:blank:]]*AUTO_SETUP_DESKTOP_INDEX=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) software_id + # Preference index to software ID + case $preference_index in + -1) software_id=25;; # Xfce + -2) software_id=24;; # MATE + -3) software_id=173;; # LXQt + -4) software_id=26;; # GNUstep + *) software_id=23;; # LXDE (default) + esac + + G_WHIP_MENU_ARRAY=( + + "${aSOFTWARE_NAME[23]}" ": ${aSOFTWARE_DESC[23]}" + "${aSOFTWARE_NAME[25]}" ": ${aSOFTWARE_DESC[25]}" + "${aSOFTWARE_NAME[24]}" ": ${aSOFTWARE_DESC[24]}" + "${aSOFTWARE_NAME[173]}" ": ${aSOFTWARE_DESC[173]}" + "${aSOFTWARE_NAME[26]}" ": ${aSOFTWARE_DESC[26]}" + ) + + G_WHIP_DEFAULT_ITEM=${aSOFTWARE_NAME[$software_id]} + G_WHIP_BUTTON_OK_TEXT='Confirm' G_WHIP_BUTTON_CANCEL_TEXT="Select ${aSOFTWARE_NAME[$software_id]}" + G_WHIP_MENU "${aSOFTWARE_NAME[$dependant]} requires a desktop. Which one shall be installed?" || G_WHIP_RETURNED_VALUE=${aSOFTWARE_NAME[$software_id]} + + # Software name to ID and preference index + if [[ $G_WHIP_RETURNED_VALUE == "${aSOFTWARE_NAME[23]}" ]] + then + SELECTED_DESKTOP=23 preference_index=0 + + elif [[ $G_WHIP_RETURNED_VALUE == "${aSOFTWARE_NAME[25]}" ]] + then + SELECTED_DESKTOP=25 preference_index=-1 + + elif [[ $G_WHIP_RETURNED_VALUE == "${aSOFTWARE_NAME[24]}" ]] + then + SELECTED_DESKTOP=24 preference_index=-2 + + elif [[ $G_WHIP_RETURNED_VALUE == "${aSOFTWARE_NAME[173]}" ]] + then + SELECTED_DESKTOP=173 preference_index=-3 + + elif [[ $G_WHIP_RETURNED_VALUE == "${aSOFTWARE_NAME[26]}" ]] + then + SELECTED_DESKTOP=26 preference_index=-4 + fi + + G_CONFIG_INJECT 'AUTO_SETUP_DESKTOP_INDEX=' "AUTO_SETUP_DESKTOP_INDEX=$preference_index" /boot/dietpi.txt + return 0 + } + + Select_Browser_Dependency() + { + # Check for existing browser (Firefox, Chromium) installation + # - Do no reinstalls, as those are loose dependencies + (( ${aSOFTWARE_INSTALL_STATE[67]} < 1 && ${aSOFTWARE_INSTALL_STATE[113]} < 1 )) || return 1 + + # Disable browser preference on ARMv6 Bullseye+ systems: https://github.com/RPi-Distro/chromium-browser/issues/21 + (( $G_HW_ARCH == 1 && $G_DISTRO > 5 )) && return 1 + + # Auto-select browser if manually installed + if dpkg-query -s 'firefox-esr' &> /dev/null + then + SELECTED_BROWSER=67; return 0 + + elif dpkg-query -s 'chromium' &> /dev/null || dpkg-query -s 'chromium-browser' &> /dev/null + then + SELECTED_BROWSER=113; return 0 + fi + + local dependant=$1 preference_index=$(sed -n '/^[[:blank:]]*AUTO_SETUP_BROWSER_INDEX=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) software_id + # Preference index to software ID + case $preference_index in + 0) return 1;; # None: Skip menu if "None" was explicitly selected or set via dietpi.txt before + -1) software_id=113;; # Chromium + *) software_id=67;; # Firefox (default) + esac + + G_WHIP_MENU_ARRAY=( + + 'None' ': If you do not require a web browser' + "${aSOFTWARE_NAME[67]}" ": ${aSOFTWARE_DESC[67]}" + "${aSOFTWARE_NAME[113]}" ": ${aSOFTWARE_DESC[113]}" + ) + + G_WHIP_DEFAULT_ITEM=${aSOFTWARE_NAME[$software_id]} + G_WHIP_BUTTON_OK_TEXT='Confirm' G_WHIP_BUTTON_CANCEL_TEXT="Select ${aSOFTWARE_NAME[$software_id]}" + G_WHIP_MENU "Which web browser shall be installed with the ${aSOFTWARE_NAME[$dependant]} desktop environment?" || G_WHIP_RETURNED_VALUE=${aSOFTWARE_NAME[$software_id]} + + # Software name to ID and preference index + if [[ $G_WHIP_RETURNED_VALUE == 'None' ]] + then + preference_index=0 + + elif [[ $G_WHIP_RETURNED_VALUE == "${aSOFTWARE_NAME[67]}" ]] + then + SELECTED_BROWSER=67 preference_index=-1 + + elif [[ $G_WHIP_RETURNED_VALUE == "${aSOFTWARE_NAME[113]}" ]] + then + SELECTED_BROWSER=113 preference_index=-2 + fi + + G_CONFIG_INJECT 'AUTO_SETUP_BROWSER_INDEX=' "AUTO_SETUP_BROWSER_INDEX=$preference_index" /boot/dietpi.txt + [[ $G_WHIP_RETURNED_VALUE == 'None' ]] && return 1 || return 0 + } + # $1: software ID Resolve_Dependencies(){ @@ -1898,81 +2083,20 @@ INDEX_BROWSER=$INDEX_BROWSER" # Resolve webserver dependency based on install state and user preference if [[ $i == 'webserver' ]] then - # Check for existing webserver (Apache, Nginx, Lighttpd) installation - # - Do no reinstalls, as those are currently too intrusive, overriding custom configs - (( ${aSOFTWARE_INSTALL_STATE[83]} < 1 && ${aSOFTWARE_INSTALL_STATE[84]} < 1 && ${aSOFTWARE_INSTALL_STATE[85]} < 1 )) || continue - - # No webserver installed, select one based on user preference - # - Apache - if (( $INDEX_WEBSERVER == 0 )) - then - i=83 - - # - Nginx - elif (( $INDEX_WEBSERVER == -1 )) - then - i=85 - - # - Lighttpd - else - i=84 - fi + Select_Webserver_Dependency "$1" || continue + i=$SELECTED_WEBSERVER # Resolve desktop dependency based on install state elif [[ $i == 'desktop' ]] then - # Check for existing desktop (LXDE, MATE, Xfce, GNUstep, LXQt) installation - # - Do no reinstalls, as those are loose dependencies - (( ${aSOFTWARE_INSTALL_STATE[23]} < 1 && ${aSOFTWARE_INSTALL_STATE[24]} < 1 && ${aSOFTWARE_INSTALL_STATE[25]} < 1 && ${aSOFTWARE_INSTALL_STATE[26]} < 1 && ${aSOFTWARE_INSTALL_STATE[173]} < 1 )) || continue - - # No desktop installed, select one based on user preference - # - GNUstep - if (( $INDEX_DESKTOP == -4 )) - then - i=26 - - # - Xfce - elif (( $INDEX_DESKTOP == -1 )) - then - i=25 - - # - MATE - elif (( $INDEX_DESKTOP == -2 )) - then - i=24 - - # - LXQt - elif (( $INDEX_DESKTOP == -3 )) - then - i=173 - - # - LXDE - else - i=23 - fi + Select_Desktop_Dependency "$1" || continue + i=$SELECTED_DESKTOP # Resolve browser dependency based on install state elif [[ $i == 'browser' ]] then - # Check for existing browser (Firefox, Chromium) installation - # - Do no reinstalls, as those are loose dependencies - (( ${aSOFTWARE_INSTALL_STATE[67]} < 1 && ${aSOFTWARE_INSTALL_STATE[113]} < 1 )) || continue - - # No browser installed, select one based on user preference - # - None - if (( $INDEX_BROWSER == 0 )) - then - continue - - # - Chromium - elif (( $INDEX_BROWSER == -2 )) - then - i=113 - - # - Firefox - else - i=67 - fi + Select_Browser_Dependency "$1" || continue + i=$SELECTED_BROWSER fi # Skip if dependency is marked for install already @@ -3067,9 +3191,6 @@ _EOF_ Banner_Installing - # Apply preference index - INDEX_DESKTOP=0 - # RPi: Block packages from RPi desktop which conflict with a native LXDE desktop: # - https://github.com/MichaIng/DietPi/issues/1558#issuecomment-691206284 # - https://github.com/MichaIng/DietPi/issues/4687 @@ -3140,9 +3261,6 @@ _EOF_ Banner_Installing - # Apply preference index - INDEX_DESKTOP=-3 - G_AGI lxqt qterminal xarchiver lxde-icon-theme upower xscreensaver featherpad speedcrunch # Configs @@ -3160,9 +3278,6 @@ _EOF_ Banner_Installing - # Apply preference index - INDEX_DESKTOP=-2 - # Add xterm, as the mate-terminal is not compatible with desktop console shortcuts: https://github.com/MichaIng/DietPi/issues/3160#issuecomment-828305136 G_AGI mate-desktop-environment-core mate-media upower xterm @@ -3175,9 +3290,6 @@ _EOF_ Banner_Installing - # Apply preference index - INDEX_DESKTOP=-4 - G_AGI wmaker gnustep gnustep-devel gnustep-games upower policykit-1 xterm Create_Desktop_Shared_Items @@ -3189,9 +3301,6 @@ _EOF_ Banner_Installing - # Apply preference index - INDEX_DESKTOP=-1 - G_AGI xfce4 xfce4-terminal gnome-icon-theme tango-icon-theme upower policykit-1 Create_Desktop_Shared_Items @@ -3222,9 +3331,6 @@ _EOF_ Banner_Installing - # Apply preference index - INDEX_BROWSER=-1 - # libpci3: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=993308 G_AGI firefox-esr libpci3 @@ -3465,9 +3571,6 @@ _EOF_ Banner_Installing - # Apply preference index - INDEX_WEBSERVER=0 - # Pre-create a dummy port 80 vhost if it does not exist yet, so we can avoid overwriting it on reinstalls. if [[ ! -f '/etc/apache2/sites-available/000-default.conf' ]] then @@ -3552,9 +3655,6 @@ _EOF_ Banner_Installing - # Apply preference index - INDEX_WEBSERVER=-1 - local apackages=('nginx-light') # Install Certbot module, if Certbot was already installed (( ${aSOFTWARE_INSTALL_STATE[92]} == 2 )) && apackages+=('python3-certbot-nginx') @@ -3616,9 +3716,6 @@ _EOF_ fi fi - # Apply preference index - INDEX_WEBSERVER=-2 - # perl is required for lighty-enable-mod, it has been degraded to recommends only with Buster. G_AGI lighttpd perl "${deflate[@]}" "${openssl[@]}" G_EXEC systemctl stop lighttpd @@ -9424,9 +9521,6 @@ _EOF_ Banner_Installing - # Apply preference index - INDEX_BROWSER=-2 - # libpam-systemd: Required for non-root users to start Chromium from console via "startx" if (( $G_HW_MODEL > 9 )) then @@ -12561,9 +12655,6 @@ If no WireGuard (auto)start is included, but you require it, please do the follo G_EXEC rm -Rf /{root,home/*}/.{config,cache}/{lxpanel,lxsession,lxterminal,openbox,pcmanfm,dconf} [[ -f '/etc/apt/preferences.d/dietpi-lxde' ]] && G_EXEC rm /etc/apt/preferences.d/dietpi-lxde - # Update desktop preference index - (( $INDEX_DESKTOP == 0 )) && INDEX_DESKTOP=-1 - fi software_id=173 # LXQt @@ -12574,9 +12665,6 @@ If no WireGuard (auto)start is included, but you require it, please do the follo G_AGP lxqt rm -Rf /{root,home/*}/.config/lxqt - # Update desktop preference index - (( $INDEX_DESKTOP == -3 )) && INDEX_DESKTOP=0 - fi software_id=174 # GIMP @@ -12602,9 +12690,6 @@ If no WireGuard (auto)start is included, but you require it, please do the follo apt-mark auto upower policykit-1 2> /dev/null G_AGP mate-desktop-environment-core mate-media - # Update desktop preference index - (( $INDEX_DESKTOP == -2 )) && INDEX_DESKTOP=0 - fi software_id=26 # GNUstep @@ -12614,9 +12699,6 @@ If no WireGuard (auto)start is included, but you require it, please do the follo apt-mark auto upower policykit-1 2> /dev/null G_AGP x-window-system-core wmaker gnustep gnustep-devel gnustep-games - # Update desktop preference index - (( $INDEX_DESKTOP == -4 )) && INDEX_DESKTOP=0 - fi software_id=25 # Xfce @@ -12626,9 +12708,6 @@ If no WireGuard (auto)start is included, but you require it, please do the follo apt-mark auto gnome-icon-theme tango-icon-theme upower policykit-1 2> /dev/null G_AGP xfce4 xfce4-terminal - # Update desktop preference index - (( $INDEX_DESKTOP == -1 )) && INDEX_DESKTOP=0 - fi software_id=22 # QuiteRSS @@ -12810,9 +12889,6 @@ If no WireGuard (auto)start is included, but you require it, please do the follo G_AGP apache2 libapache2-mod-php* G_EXEC rm -Rf /{etc,var/{lib,log}}/apache2 /{etc/php,var/lib/php/modules}/*/apache2 - # Adjust webserver preference index - (( $INDEX_WEBSERVER == 0 )) && INDEX_WEBSERVER=-2 - fi software_id=85 # Nginx @@ -12821,9 +12897,6 @@ If no WireGuard (auto)start is included, but you require it, please do the follo Banner_Uninstalling G_AGP nginx 'nginx-*' - # Adjust webserver preference index - (( $INDEX_WEBSERVER == -1 )) && INDEX_WEBSERVER=-2 - fi software_id=84 # Lighttpd @@ -12849,9 +12922,6 @@ If no WireGuard (auto)start is included, but you require it, please do the follo [[ -f 'etc/systemd/system/certbot.service.d/dietpi-lighttpd.conf' ]] && G_EXEC rm /etc/systemd/system/certbot.service.d/dietpi-lighttpd.conf [[ -d '/etc/systemd/system/certbot.service.d' ]] && G_EXEC rmdir --ignore-fail-on-non-empty /etc/systemd/system/certbot.service.d - # Adjust webserver preference index - (( $INDEX_WEBSERVER == -2 )) && INDEX_WEBSERVER=0 - fi software_id=87 # SQLite @@ -14620,8 +14690,6 @@ _EOF_ [[ -f '/var/lib/dietpi/dietpi-software/installed/chromium-autostart.sh' ]] && G_EXEC rm /var/lib/dietpi/dietpi-software/installed/chromium-autostart.sh # Autostart index: If currently Chromium, revert to console login [[ -f '/boot/dietpi/.dietpi-autostart_index' && $( 5 )) || INDEX_BROWSER=$AUTOINSTALL_BROWSERINDEX # - Pre-v7.9 case "$AUTOINSTALL_FILESERVERINDEX" in @@ -16550,50 +16605,6 @@ We allow it to take up to 30 minutes, it's process can be followed, please be pa fi - # Selected webserver preference - local index_webserver_text=${aSOFTWARE_NAME[83]} # Apache - if (( $INDEX_WEBSERVER == -1 )); then - - index_webserver_text=${aSOFTWARE_NAME[85]} # Nginx - - elif (( $INDEX_WEBSERVER == -2 )); then - - index_webserver_text=${aSOFTWARE_NAME[84]} # Lighttpd - - fi - - # Selected desktop preference - local index_desktop_text=${aSOFTWARE_NAME[23]} # LXDE - if (( $INDEX_DESKTOP == -1 )); then - - index_desktop_text=${aSOFTWARE_NAME[25]} # Xfce - - elif (( $INDEX_DESKTOP == -2 )); then - - index_desktop_text=${aSOFTWARE_NAME[24]} # MATE - - elif (( $INDEX_DESKTOP == -3 )); then - - index_desktop_text=${aSOFTWARE_NAME[173]} # LXQt - - elif (( $INDEX_DESKTOP == -4 )); then - - index_desktop_text=${aSOFTWARE_NAME[26]} # GNUstep - - fi - - # Selected browser preference - local index_browser_text='None' - if (( $INDEX_BROWSER == -1 )); then - - index_browser_text=${aSOFTWARE_NAME[67]} # Firefox - - elif (( $INDEX_BROWSER == -2 )); then - - index_browser_text=${aSOFTWARE_NAME[113]} # Chromium - - fi - # Get real userdata location local user_data_location_current=$(readlink -f /mnt/dietpi_userdata) @@ -16620,9 +16631,6 @@ We allow it to take up to 30 minutes, it's process can be followed, please be pa 'Browse Software' ': Select software from the full list' 'SSH Server' ": [$sshserver_text]" 'Log System' ": [$index_logging_text]" - 'Webserver Preference' ": [$index_webserver_text]" - 'Desktop Preference' ": [$index_desktop_text]" - 'Browser Preference' ": [$index_browser_text]" 'User Data Location' ": [$user_data_location_description]" '' '●─ Install or Remove Software ' 'Uninstall' ': Select installed software for removal' @@ -16652,7 +16660,6 @@ We allow it to take up to 30 minutes, it's process can be followed, please be pa 'None' ': Not required / manual setup' "${aSOFTWARE_NAME[104]}" ": ${aSOFTWARE_DESC[104]} (recommended)" "${aSOFTWARE_NAME[105]}" ": ${aSOFTWARE_DESC[105]}" - ) G_WHIP_DEFAULT_ITEM=$sshserver_text @@ -16681,7 +16688,6 @@ We allow it to take up to 30 minutes, it's process can be followed, please be pa [[ $toberemoved_text ]] && toberemoved_text="\n\nThe following software will be uninstalled:$toberemoved_text" G_WHIP_MSG "$G_WHIP_RETURNED_VALUE has been selected:\n- Your choice will be applied when 'Install Go >> Start installation' is selected.$tobeinstalled_text$toberemoved_text" - ;; 'Log System') @@ -16692,7 +16698,6 @@ We allow it to take up to 30 minutes, it's process can be followed, please be pa 'DietPi-RAMlog #1' ': Hourly clear (recommended)' 'DietPi-RAMlog #2' ': Hourly save, then clear' 'Full' ': Logrotate and Rsyslog' - ) G_WHIP_DEFAULT_ITEM=$index_logging_text @@ -16710,7 +16715,6 @@ We allow it to take up to 30 minutes, it's process can be followed, please be pa 'DietPi-RAMlog #2') Apply_Logging_Choices -2;; 'Full') Apply_Logging_Choices -3;; *) Apply_Logging_Choices -1;; - esac # Check for changes @@ -16723,8 +16727,7 @@ We allow it to take up to 30 minutes, it's process can be followed, please be pa [[ $tobeinstalled_text ]] && tobeinstalled_text="\n\nThe following software will be installed:$tobeinstalled_text" [[ $toberemoved_text ]] && toberemoved_text="\n\nThe following software will be uninstalled:$toberemoved_text" - G_WHIP_MSG "$G_WHIP_RETURNED_VALUE has been selected:\n- Your choice will be applied when 'Install Go >> Start installation' is selected.$tobeinstalled_text$toberemoved_text" - + G_WHIP_MSG "$G_WHIP_RETURNED_VALUE has been selected:\n- Your choice will be applied when 'Install : Go >> Start installation' is selected.$tobeinstalled_text$toberemoved_text" ;; 'User Data Location') @@ -16737,7 +16740,6 @@ We allow it to take up to 30 minutes, it's process can be followed, please be pa 'List' ': Select from a list of available drives to move user data.' 'Custom' ': Manually enter a location to move user data.' 'Drive' ': Launch DietPi-Drive_Manager.' - ) G_WHIP_BUTTON_CANCEL_TEXT='Back' @@ -16788,215 +16790,6 @@ We allow it to take up to 30 minutes, it's process can be followed, please be pa G_WHIP_MSG "User data transfer: Failed\n\n$( /dev/null; then - - webserver_installed=1 preference_index=0 webserver_name=${aSOFTWARE_NAME[83]} - - elif (( ${aSOFTWARE_INSTALL_STATE[85]} == 2 )) || dpkg-query -s 'nginx-common' &> /dev/null; then - - webserver_installed=1 preference_index=-1 webserver_name=${aSOFTWARE_NAME[85]} - - elif (( ${aSOFTWARE_INSTALL_STATE[84]} == 2 )) || dpkg-query -s 'lighttpd' &> /dev/null; then - - webserver_installed=1 preference_index=-2 webserver_name=${aSOFTWARE_NAME[84]} - - fi - - if (( $webserver_installed == 1 )) - then - G_WHIP_MSG "[ INFO ] $webserver_name is installed already. -\nThe webserver preference has no effect and cannot be changed as long as a webserver is installed already. -\nIf you want to install a different webserver, uninstall $webserver_name first." - (( $INDEX_WEBSERVER == $preference_index )) || G_CONFIG_INJECT 'INDEX_WEBSERVER=' "INDEX_WEBSERVER=$preference_index" /boot/dietpi/.installed - INDEX_WEBSERVER=$preference_index - return 0 - fi - - G_WHIP_MENU_ARRAY=( - - "${aSOFTWARE_NAME[83]}" ": ${aSOFTWARE_DESC[83]}" - "${aSOFTWARE_NAME[85]}" ": ${aSOFTWARE_DESC[85]}" - "${aSOFTWARE_NAME[84]}" ": ${aSOFTWARE_DESC[84]} (default)" - - ) - - G_WHIP_DEFAULT_ITEM=$index_webserver_text - G_WHIP_BUTTON_CANCEL_TEXT='Back' - G_WHIP_MENU 'Which webserver shall be installed when you select software that requires a webserver? -\n- Apache: Feature-rich and popular. Recommended for beginners and users who are looking to follow Apache based guides. -\n- Nginx: Lightweight alternative to Apache. Nginx claims faster webserver performance compared to Apache. -\n- Lighttpd: Extremely lightweight and is generally considered to offer the \"best\" webserver performance for SBCs. Recommended for users who expect low webserver traffic. -\n- More info: https://dietpi.com/docs/software/webserver_stack/' || return 0 - - # Apply preference index - if [[ $G_WHIP_RETURNED_VALUE == "${aSOFTWARE_NAME[83]}" ]]; then - - preference_index=0 - - elif [[ $G_WHIP_RETURNED_VALUE == "${aSOFTWARE_NAME[85]}" ]]; then - - preference_index=-1 - - elif [[ $G_WHIP_RETURNED_VALUE == "${aSOFTWARE_NAME[84]}" ]]; then - - preference_index=-2 - - fi - (( $INDEX_WEBSERVER == $preference_index )) || G_CONFIG_INJECT 'INDEX_WEBSERVER=' "INDEX_WEBSERVER=$preference_index" /boot/dietpi/.installed - INDEX_WEBSERVER=$preference_index - - ;; - - 'Desktop Preference') - - # Do not allow to change preference if a desktop is installed already - local desktop_installed=0 preference_index desktop_name - - if (( ${aSOFTWARE_INSTALL_STATE[23]} == 2 )) || dpkg-query -s 'lxde' &> /dev/null; then - - desktop_installed=1 preference_index=0 desktop_name=${aSOFTWARE_NAME[23]} - - elif (( ${aSOFTWARE_INSTALL_STATE[25]} == 2 )) || dpkg-query -s 'xfce4' &> /dev/null; then - - desktop_installed=1 preference_index=-1 desktop_name=${aSOFTWARE_NAME[25]} - - elif (( ${aSOFTWARE_INSTALL_STATE[24]} == 2 )) || dpkg-query -s 'mate-desktop-environment-core' &> /dev/null; then - - desktop_installed=1 preference_index=-2 desktop_name=${aSOFTWARE_NAME[24]} - - elif (( ${aSOFTWARE_INSTALL_STATE[173]} == 2 )) || dpkg-query -s 'lxqt' &> /dev/null; then - - desktop_installed=1 preference_index=-3 desktop_name=${aSOFTWARE_NAME[173]} - - elif (( ${aSOFTWARE_INSTALL_STATE[26]} == 2 )) || dpkg-query -s 'gnustep' &> /dev/null; then - - desktop_installed=1 preference_index=-4 desktop_name=${aSOFTWARE_NAME[26]} - - fi - - if (( $desktop_installed == 1 )) - then - G_WHIP_MSG "[ INFO ] $desktop_name is installed already. -\nThe desktop preference has no effect and cannot be changed as long as a desktop is installed already. -\nYou can however select any additional desktop from 'Browse software' or 'Search software' menus." - (( $INDEX_DESKTOP == $preference_index )) || G_CONFIG_INJECT 'INDEX_DESKTOP=' "INDEX_DESKTOP=$preference_index" /boot/dietpi/.installed - INDEX_DESKTOP=$preference_index - return 0 - fi - - G_WHIP_MENU_ARRAY=( - - "${aSOFTWARE_NAME[23]}" ": ${aSOFTWARE_DESC[23]} (default)" - "${aSOFTWARE_NAME[25]}" ": ${aSOFTWARE_DESC[25]}" - "${aSOFTWARE_NAME[24]}" ": ${aSOFTWARE_DESC[24]}" - "${aSOFTWARE_NAME[173]}" ": ${aSOFTWARE_DESC[173]}" - "${aSOFTWARE_NAME[26]}" ": ${aSOFTWARE_DESC[26]}" - - ) - - G_WHIP_DEFAULT_ITEM=$index_desktop_text - G_WHIP_BUTTON_CANCEL_TEXT='Back' - G_WHIP_MENU 'Which desktop shall be installed when you select software that requires a desktop?' || return 0 - - # Apply preference index - if [[ $G_WHIP_RETURNED_VALUE == "${aSOFTWARE_NAME[23]}" ]]; then - - preference_index=0 - - elif [[ $G_WHIP_RETURNED_VALUE == "${aSOFTWARE_NAME[25]}" ]]; then - - preference_index=-1 - - elif [[ $G_WHIP_RETURNED_VALUE == "${aSOFTWARE_NAME[24]}" ]]; then - - preference_index=-2 - - elif [[ $G_WHIP_RETURNED_VALUE == "${aSOFTWARE_NAME[173]}" ]]; then - - preference_index=-3 - - elif [[ $G_WHIP_RETURNED_VALUE == "${aSOFTWARE_NAME[26]}" ]]; then - - preference_index=-4 - - fi - (( $INDEX_DESKTOP == $preference_index )) || G_CONFIG_INJECT 'INDEX_DESKTOP=' "INDEX_DESKTOP=$preference_index" /boot/dietpi/.installed - INDEX_DESKTOP=$preference_index - - ;; - - 'Browser Preference') - - # Disable browser preference on ARMv6 Bullseye+ systems: https://github.com/RPi-Distro/chromium-browser/issues/21 - if (( $G_HW_ARCH == 1 && $G_DISTRO > 5 )) - then - G_WHIP_MSG '[ INFO ] No browsers are available for your system -\nSince Bullseye, on ARMv6 RPi models (RPi 1 and Zero (1) variants) the two browsers Chromium and Firefox fail to start and are hence disabled. -\nWe are looking for an alternative compatible browser for those systems to implement into dietpi-software, but until then the browser preference menu is disabled. -\nFurther info: https://github.com/RPi-Distro/chromium-browser/issues/21' - return 0 - fi - - # Do not allow to change preference if a browser is installed already - local browser_installed=0 preference_index browser_name - - if (( ${aSOFTWARE_INSTALL_STATE[67]} == 2 )) || dpkg-query -s 'firefox-esr' &> /dev/null; then - - browser_installed=1 preference_index=-1 browser_name=${aSOFTWARE_NAME[67]} - - elif (( ${aSOFTWARE_INSTALL_STATE[113]} == 2 )) || dpkg-query -s 'chromium' &> /dev/null || dpkg-query -s 'chromium-browser' &> /dev/null; then - - browser_installed=1 preference_index=-2 browser_name=${aSOFTWARE_NAME[25]} - - fi - - if (( $browser_installed == 1 )) - then - G_WHIP_MSG "[ INFO ] $browser_name is installed already. -\nThe browser preference has no effect and cannot be changed as long as a browser is installed already. -\nYou can however select any additional browser from 'Browse software' or 'Search software' menus." - (( $INDEX_BROWSER == $preference_index )) || G_CONFIG_INJECT 'INDEX_BROWSER=' "INDEX_BROWSER=$preference_index" /boot/dietpi/.installed - INDEX_BROWSER=$preference_index - return 0 - fi - - G_WHIP_MENU_ARRAY=( - - 'None' ': No browser will be installed with desktops' - "${aSOFTWARE_NAME[67]}" ": ${aSOFTWARE_DESC[67]} (default)" - "${aSOFTWARE_NAME[113]}" ": ${aSOFTWARE_DESC[113]}" - - ) - - G_WHIP_DEFAULT_ITEM=$index_browser_text - G_WHIP_BUTTON_CANCEL_TEXT='Back' - G_WHIP_MENU 'When a desktop is installed, which browser shall it contain?' || return 0 - - # Apply preference index - if [[ $G_WHIP_RETURNED_VALUE == 'None' ]]; then - - preference_index=0 - - elif [[ $G_WHIP_RETURNED_VALUE == "${aSOFTWARE_NAME[67]}" ]]; then - - preference_index=-1 - - elif [[ $G_WHIP_RETURNED_VALUE == "${aSOFTWARE_NAME[113]}" ]]; then - - preference_index=-2 - - fi - (( $INDEX_BROWSER == $preference_index )) || G_CONFIG_INJECT 'INDEX_BROWSER=' "INDEX_BROWSER=$preference_index" /boot/dietpi/.installed - INDEX_BROWSER=$preference_index - ;; 'DietPi-Config') /boot/dietpi/dietpi-config;; @@ -17025,7 +16818,6 @@ List of installed software and their online documentation URLs: G_WHIP_SIZE_X_MAX=70 G_WHIP_MSG "$string" - ;; 'Install') Menu_StartInstall;; @@ -17036,9 +16828,7 @@ List of installed software and their online documentation URLs: # Exit/Abort Setup else - Menu_Exit - fi } From ada05354ead984b69a104652bf2e1cb7aa299fa7 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sat, 23 Apr 2022 23:47:31 +0200 Subject: [PATCH 34/59] v8.4 - RC up --- .update/version | 2 +- dietpi/func/dietpi-globals | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.update/version b/.update/version index 3f53e1f3e4..b29a3e704e 100644 --- a/.update/version +++ b/.update/version @@ -3,7 +3,7 @@ # Available DietPi version G_REMOTE_VERSION_CORE=8 G_REMOTE_VERSION_SUB=4 -G_REMOTE_VERSION_RC=-1 +G_REMOTE_VERSION_RC=0 # Minimum DietPi version to allow update G_MIN_VERSION_CORE=6 G_MIN_VERSION_SUB=14 diff --git a/dietpi/func/dietpi-globals b/dietpi/func/dietpi-globals index 526d6ad708..f2b8c16e3c 100644 --- a/dietpi/func/dietpi-globals +++ b/dietpi/func/dietpi-globals @@ -59,7 +59,7 @@ # - Assign defaults/code version as fallback [[ $G_DIETPI_VERSION_CORE ]] || G_DIETPI_VERSION_CORE=8 [[ $G_DIETPI_VERSION_SUB ]] || G_DIETPI_VERSION_SUB=4 - [[ $G_DIETPI_VERSION_RC ]] || G_DIETPI_VERSION_RC=-1 + [[ $G_DIETPI_VERSION_RC ]] || G_DIETPI_VERSION_RC=0 [[ $G_GITBRANCH ]] || G_GITBRANCH='master' [[ $G_GITOWNER ]] || G_GITOWNER='MichaIng' # - Save current version and Git branch From 267a5821e1f5eb5443f03481d0386a83f17320d2 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Mon, 25 Apr 2022 01:07:09 +0200 Subject: [PATCH 35/59] v8.4 - DietPi-Login | Skip GPLv2 license prompt. The full license is shipped as /boot/dietpi-LICENSE.txt and the short form contained in /boot/dietpi-README.md and as well within the image archives, both as well contained and presented in the GitHub repository. --- .update/patches | 4 ++ PREP_SYSTEM_FOR_DIETPI.sh | 15 ------- dietpi.txt | 44 +++++++++---------- dietpi/dietpi-login | 10 ----- .../lib/dietpi/services/dietpi-firstboot.bash | 21 +++------ 5 files changed, 30 insertions(+), 64 deletions(-) diff --git a/.update/patches b/.update/patches index 540a938683..655822b709 100755 --- a/.update/patches +++ b/.update/patches @@ -734,6 +734,10 @@ Patch_8_4() # Remove obsolete software preference indices [[ -f '/boot/dietpi/.installed' ]] && G_EXEC sed -Ei '/^[[:blank:]]*INDEX_(WEBSERVER|DESKTOP|BROWSER)=/d' /boot/dietpi/.installed + + # Remove obsolete license file and setting + [[ -f '/var/lib/dietpi/license.txt' ]] && G_EXEC rm /var/lib/dietpi/license.txt + G_EXEC sed -i '/^[[:blank:]]*AUTO_SETUP_ACCEPT_LICENSE=/d' /boot/dietpi.txt } # v6.35 => v7 migration diff --git a/PREP_SYSTEM_FOR_DIETPI.sh b/PREP_SYSTEM_FOR_DIETPI.sh index 944c194583..67afb4192d 100755 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -1888,21 +1888,6 @@ _EOF_ G_DIETPI-NOTIFY 2 'Writing PREP information to file' echo -e "$IMAGE_CREATOR\n$PREIMAGE_INFO" > /boot/dietpi/.prep_info - G_DIETPI-NOTIFY 2 'Generating GPLv2 license readme' - cat << '_EOF_' > /var/lib/dietpi/license.txt ------------------------ -DietPi - GPLv2 License: ------------------------ - - Use arrow keys to scroll - - Press 'TAB' then 'ENTER' to continue - -This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with this program. If not, please see https://www.gnu.org/licenses/ -_EOF_ - G_DIETPI-NOTIFY 2 'Disabling and clearing APT cache' G_EXEC rm /etc/apt/apt.conf.d/98dietpi-prep /boot/dietpi/func/dietpi-set_software apt-cache cache disable diff --git a/dietpi.txt b/dietpi.txt index b8569ae5b5..46373a5208 100644 --- a/dietpi.txt +++ b/dietpi.txt @@ -5,30 +5,26 @@ #------------------------------------------------------------------------------------------------------ ##### DietPi-Automation settings, applied on first boot of DietPi only, ONCE! ##### #------------------------------------------------------------------------------------------------------ -# By setting this to "1" you accept the DietPi GPLv2 license and skip the related interactive dialog. -# - Full license text: /boot/dietpi-LICENSE.txt -# - This setting is ignored (and assumed to be affirmative) if AUTO_SETUP_AUTOMATED=1 -AUTO_SETUP_ACCEPT_LICENSE=0 -##### Language/Regional Options ##### -# Locale: eg: "en_GB.UTF-8" / "de_DE.UTF-8" | One entry and UTF-8 ONLY! +##### Language/Regional options ##### +# Locale: e.g.: "en_GB.UTF-8" / "de_DE.UTF-8" | One entry and UTF-8 ONLY! AUTO_SETUP_LOCALE=C.UTF-8 -# Keyboard Layout eg: "gb" / "us" / "de" / "fr" +# Keyboard layout e.g.: "gb" / "us" / "de" / "fr" AUTO_SETUP_KEYBOARD_LAYOUT=gb -# Timezone eg: "Europe/London" / "America/New_York" | Full list (TZ*): https://en.wikipedia.org/wiki/List_of_tz_database_time_zones +# Time zone e.g.: "Europe/London" / "America/New_York" | Full list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones AUTO_SETUP_TIMEZONE=Europe/London -##### Network Options ##### +##### Network options ##### # Enable Ethernet or WiFi adapter: 1=enable | 0=disable # - If both Ethernet and WiFi are enabled, WiFi will take priority and Ethernet will be disabled. # - If using WiFi, please edit dietpi-wifi.txt to pre-enter credentials. AUTO_SETUP_NET_ETHERNET_ENABLED=1 AUTO_SETUP_NET_WIFI_ENABLED=0 -# Force Ethernet speeds: 0=automatic speed | 10 = 10Mbit | 100 = 100Mbit etc -# - This is mainly aimed at PINE A64 which may have an HW issue that causes unstable 1Gbit link. +# Force Ethernet speeds: 0=automatic speed | 10 = 10 Mbit/s | 100 = 100 Mbit/s etc. +# - Use this when your Ethernet adapter has an unstable 1 Gbit/s link. AUTO_SETUP_NET_ETH_FORCE_SPEED=0 # WiFi country code: 2 uppercase character value (e.g. GB US DE JP): https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 @@ -50,7 +46,7 @@ AUTO_SETUP_NET_HOSTNAME=DietPi # Delay service starts at boot until network is established: 0=disabled | 1=enabled AUTO_SETUP_BOOT_WAIT_FOR_NETWORK=1 -##### Misc Options ##### +##### Misc options ##### # Swap space size to generate: 0 => disable | 1 => auto | 2 and up => size in MiB AUTO_SETUP_SWAPFILE_SIZE=1 # Swap space location: "zram" => swap space on /dev/zram0 (auto-size = 50% of RAM size) | /path/to/file => swap file at location (auto-size = 2 GiB minus RAM size) @@ -78,13 +74,13 @@ AUTO_SETUP_CUSTOM_SCRIPT_EXEC=0 # - Simply attach the drive/disk/stick with contains the backup. All attached drives will be mounted temporarily and searched automatically. AUTO_SETUP_BACKUP_RESTORE=0 -##### Software Options ##### +##### Software options ##### # SSH server choice: 0=none/custom | -1=Dropbear | -2=OpenSSH AUTO_SETUP_SSH_SERVER_INDEX=-1 -# Logging mode choice: 0=none/custom | -1=RAMlog 1h clear | -2=RAMlog 1h save clear | -3=rsyslog + logrotate +# Logging mode choice: 0=none/custom | -1=RAMlog hourly clear | -2=RAMlog hourly save to disk + clear | -3=Rsyslog + Logrotate AUTO_SETUP_LOGGING_INDEX=-1 -# RAMlog max tmpfs size (MB). 50MB should be fine for single use. 200MB+ for heavy webserver and access log etc. +# RAMlog max tmpfs size (MiB). 50 MiB should be fine for single use. 200+ MiB for heavy webserver access log etc. AUTO_SETUP_RAMLOG_MAXSIZE=50 # Dependency preferences @@ -99,15 +95,15 @@ AUTO_SETUP_DESKTOP_INDEX=0 AUTO_SETUP_BROWSER_INDEX=-1 # DietPi-Autostart: 0=Console | 7=Console autologin | 1=Kodi | 2=Desktop autologin | 16=Desktop | 4=OpenTyrian | 5=DietPi-CloudShell | 6=Amiberry fast boot | 8=Amiberry standard boot | 9=DDX-Rebirth | 10=CAVA Spectrum | 11=Chromium kiosk | 14=Custom script (background) | 17=Custom script (foreground) -# - This will be effective on 2nd boot, after firstrun update and installs have been done. -# - Related software titles must be installed either on firstrun installs or via AUTO_SETUP_AUTOMATED=1 + AUTO_SETUP_INSTALL_SOFTWARE_ID (see below). +# - This will be effective on 2nd boot, after first run update and installs have been done. +# - Related software titles must be installed either on first run installs or via AUTO_SETUP_AUTOMATED=1 + AUTO_SETUP_INSTALL_SOFTWARE_ID (see below). AUTO_SETUP_AUTOSTART_TARGET_INDEX=0 # Autologin user name -# - This user must exist before firstrun installs, otherwise it will be reverted to root. +# - This user must exist before first run installs, otherwise it will be reverted to root. # - Applies to all autostart options but: 0, 6, 14 and 16 AUTO_SETUP_AUTOSTART_LOGIN_USER=root -##### Non-interactive Firstrun Setup ##### +##### Non-interactive first run setup ##### # On first login, run update, initial setup and software installs without any user input # - Setting this to "1" is required for AUTO_SETUP_GLOBAL_PASSWORD and AUTO_SETUP_INSTALL_SOFTWARE_ID. # - Setting this to "1" indicates that you accept the DietPi GPLv2 license, available at /boot/dietpi-LICENSE.txt, superseding AUTO_SETUP_ACCEPT_LICENSE. @@ -116,7 +112,7 @@ AUTO_SETUP_AUTOMATED=0 # Global Password to be applied for the system # - Requires AUTO_SETUP_AUTOMATED=1 # - Affects "root" and "dietpi" users login passwords and is used by dietpi-software as default for software installs which require a password. -# - On first dietpi-software execution, the password is removed from this file and instead encrypted and saved to rootfs. +# - On first dietpi-software execution, the password is removed from this file and instead encrypted and saved to root filesystem. # - WARN: We cannot guarantee that all software options can handle special characters like \"$. AUTO_SETUP_GLOBAL_PASSWORD=dietpi @@ -140,16 +136,16 @@ SURVEY_OPTED_IN=-1 #------------------------------------------------------------------------------------------------------ # CPU Governor: schedutil | ondemand | interactive | conservative | powersave | performance CONFIG_CPU_GOVERNOR=schedutil -# Ondemand Sampling Rate | Min value: 10000 microseconds (10ms) +# Ondemand Sampling Rate | Min value: 10000 microseconds (10 ms) CONFIG_CPU_ONDEMAND_SAMPLE_RATE=25000 -# Ondemand Sampling Down Factor: Sampling Rate * Down Factor / 1000 = ms (40 = 1000ms when sampling rate is 25000) +# Ondemand Sampling Down Factor: Sampling Rate * Down Factor / 1000 = ms (40 = 1000 ms when sampling rate is 25000) CONFIG_CPU_ONDEMAND_SAMPLE_DOWNFACTOR=40 # Throttle Up Percentage: Percentage of average CPU usage during sampling rate at which CPU will be throttled up/down CONFIG_CPU_USAGE_THROTTLE_UP=50 # CPU Frequency Limits: Disabled=disabled -# - Intel CPUs use a percentage value (%) from 0-100, eg: 55 -# - All other devices must use a specific MHz value, eg: 1600 +# - Intel CPUs use a percentage value (%) from 0-100, e.g.: 55 +# - All other devices must use a specific MHz value, e.g.: 1600 # - Has no effect on RPi, please set "arm_freq" and "arm_freq_min" in config.txt instead. CONFIG_CPU_MAX_FREQ=Disabled CONFIG_CPU_MIN_FREQ=Disabled diff --git a/dietpi/dietpi-login b/dietpi/dietpi-login index a535e9d029..69b0dc3dac 100755 --- a/dietpi/dietpi-login +++ b/dietpi/dietpi-login @@ -20,14 +20,6 @@ readonly FP_DIETPI_FIRSTRUNSETUP_PID='/tmp/.dietpi-login_firstrun_setup.pid' # PID and flag to detect and avoid concurrent first run setup readonly FP_DIETPI_FIRSTRUNSETUP_ERR='/tmp/.dietpi-login_firstrun_setup_err' # Error flag to allow a second instance kill and repeat first run setup - Show_License(){ - - [[ -f '/var/lib/dietpi/license.txt' ]] || return - G_WHIP_VIEWFILE /var/lib/dietpi/license.txt - rm /var/lib/dietpi/license.txt - - } - # AutoStart after autologin # - $1: AutoStart index Run_AutoStart(){ @@ -189,8 +181,6 @@ Please login again as user "root" with password "dietpi", respectively the one y # - Always remove PID file when script is exited/terminated/killed trap '[[ -f $FP_DIETPI_FIRSTRUNSETUP_PID ]] && rm $FP_DIETPI_FIRSTRUNSETUP_PID' EXIT - Show_License - # 1st run dietpi-update if (( $G_DIETPI_INSTALL_STAGE == 0 )); then diff --git a/rootfs/var/lib/dietpi/services/dietpi-firstboot.bash b/rootfs/var/lib/dietpi/services/dietpi-firstboot.bash index 05bd50a3e7..3a3aa20f6a 100755 --- a/rootfs/var/lib/dietpi/services/dietpi-firstboot.bash +++ b/rootfs/var/lib/dietpi/services/dietpi-firstboot.bash @@ -120,8 +120,8 @@ # Set hostname /boot/dietpi/func/change_hostname "$(sed -n '/^[[:blank:]]*AUTO_SETUP_NET_HOSTNAME=/{s/^[^=]*=//p;q}' /boot/dietpi.txt)" - if grep -q '^[[:blank:]]*AUTO_SETUP_AUTOMATED=1' /boot/dietpi.txt; then - + if grep -q '^[[:blank:]]*AUTO_SETUP_AUTOMATED=1' /boot/dietpi.txt + then # Enable root autologin on local console (/dev/tty1) and container console (/dev/console), overwritten during 1st run setup mkdir -p /etc/systemd/system/{getty@tty1,console-getty}.service.d cat << '_EOF_' > /etc/systemd/system/getty@tty1.service.d/dietpi-autologin.conf @@ -134,27 +134,18 @@ _EOF_ ExecStart= ExecStart=-/sbin/agetty -a root -J -s console 115200,38400,9600 $TERM _EOF_ - # Assume accepted license in automated installs: https://github.com/MichaIng/DietPi/pull/4477 - rm /var/lib/dietpi/license.txt - - elif grep -q '^[[:blank:]]*AUTO_SETUP_ACCEPT_LICENSE=1' /boot/dietpi.txt; then - - rm /var/lib/dietpi/license.txt - fi # Apply login password if it has not been encrypted before to avoid applying the informational text - if [[ ! -f '/var/lib/dietpi/dietpi-software/.GLOBAL_PW.bin' ]]; then - + if [[ ! -f '/var/lib/dietpi/dietpi-software/.GLOBAL_PW.bin' ]] + then local password=$(sed -n '/^[[:blank:]]*AUTO_SETUP_GLOBAL_PASSWORD=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) - if [[ $password ]]; then - + if [[ $password ]] + then chpasswd <<< "root:$password" chpasswd <<< "dietpi:$password" - fi unset -v password - fi # Set APT mirror From 9e01b919159a0ac40528b4ec9c78b9d4c66a768b Mon Sep 17 00:00:00 2001 From: MichaIng Date: Tue, 26 Apr 2022 16:50:55 +0200 Subject: [PATCH 36/59] v8.4 (#5458) - Odroid XU4 | We updated our Odroid XU4 image to be shipped with Linux 5.4. Sadly systems running the old image cannot be upgraded, since the new U-Boot config requires a single ext4 partition without a dedicated boot partition. - DietPi-Build | Added support for Odroid C2 image from scratch --- .build/images/OdroidXU4/boot.ini | 220 ++++++++++++++++++ .build/images/U-Boot/dietpi-initramfs_cleanup | 18 +- .build/images/dietpi-build | 2 + .update/patches | 11 +- CHANGELOG.txt | 1 + PREP_SYSTEM_FOR_DIETPI.sh | 47 ++-- boot_xu4.ini | 20 +- 7 files changed, 285 insertions(+), 34 deletions(-) create mode 100644 .build/images/OdroidXU4/boot.ini diff --git a/.build/images/OdroidXU4/boot.ini b/.build/images/OdroidXU4/boot.ini new file mode 100644 index 0000000000..463e541a84 --- /dev/null +++ b/.build/images/OdroidXU4/boot.ini @@ -0,0 +1,220 @@ +ODROIDXU-UBOOT-CONFIG + +# U-Boot parameters +setenv initrd_high "0xffffffff" +setenv fdt_high "0xffffffff" + +# MAC address configuration +setenv macaddr "00:1e:06:61:7a:72" + +# Kernel command-line parameters +setenv bootrootfs "root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait ro console=ttySAC2,115200n8 console=tty1 consoleblank=0 fsck.repair=yes net.ifnames=0" + +# HDMI/DVI selection: "hdmi" or "dvi" +# - DVI mode disables HDMI sound +setenv vout "hdmi" + +# HDMI Hot Plug detection: "false" or "true" +# - "true" enables HDMI detection based on cable connection. +# - "false" disables auto-detection and forces HDMI output. +setenv HPD "true" + +# HDMI CEC: "false" or "true", defaults to "true" +#setenv cecenable "false" + +# HDMI resolution +# - Uncomment only ONE line! Leave all commented for automatic selection. +# - Uncomment only the setenv line! +# ----------------------------------------------- +# ODROID-VU forced resolution +#setenv videoconfig "video=HDMI-A-1:1280x800@60" +# ----------------------------------------------- +# ODROID-VU forced EDID +#setenv videoconfig "drm_kms_helper.edid_firmware=edid/1280x800.bin" +# ----------------------------------------------- +# 1920x1200 60hz without monitor data using generic information +#setenv videoconfig "drm_kms_helper.edid_firmware=edid/1920x1200_60hz.bin" +# ----------------------------------------------- +# 1920x1200 30hz without monitor data using generic information +#setenv videoconfig "drm_kms_helper.edid_firmware=edid/1920x1200_30hz.bin" +# ----------------------------------------------- +# 1920x1080 (1080P) with monitor provided EDID information. (1080p-edid) +#setenv videoconfig "video=HDMI-A-1:1920x1080@60" +# ----------------------------------------------- +# 1920x1080 (1080P) without monitor data using generic information (1080p-noedid) +#setenv videoconfig "drm_kms_helper.edid_firmware=edid/1920x1080.bin" +# ----------------------------------------------- +# 1920x1080 50hz (1080P) with monitor provided EDID information. (1080p 50hz-edid) +#setenv videoconfig "video=HDMI-A-1:1920x1080@50" +# ----------------------------------------------- +# 1920x1080 50hz (1080P) without monitor data using generic information (1080p 50hz-noedid) +#setenv videoconfig "drm_kms_helper.edid_firmware=edid/1920x1080_50hz.bin" +# ----------------------------------------------- +# 1920x800 60hz without monitor data using generic information +#setenv videoconfig "drm_kms_helper.edid_firmware=edid/1920x800.bin" +# ----------------------------------------------- +# 1792x1344 60hz without monitor data using generic information +#setenv videoconfig "drm_kms_helper.edid_firmware=edid/1792x1344.bin" +# ----------------------------------------------- +# 1680x1050 without monitor data using generic information +#setenv videoconfig "drm_kms_helper.edid_firmware=edid/1680x1050.bin" +# ----------------------------------------------- +# 1600x1200 without monitor data using generic information +#setenv videoconfig "drm_kms_helper.edid_firmware=edid/1600x1200.bin" +# ----------------------------------------------- +# 1600x900 without monitor data using generic information +#setenv videoconfig "drm_kms_helper.edid_firmware=edid/1600x900.bin" +# ----------------------------------------------- +# 1400x1050 60hz without monitor data using generic information +#setenv videoconfig "drm_kms_helper.edid_firmware=edid/1400x1050.bin" +# ----------------------------------------------- +# 1440x900 with monitor provided EDID information. +#setenv videoconfig "video=HDMI-A-1:1440x900@60" +# ----------------------------------------------- +# 1440x900 without monitor data using generic information +#setenv videoconfig "drm_kms_helper.edid_firmware=edid/1440x900.bin" +# ----------------------------------------------- +# 1366x768 without monitor data using generic information +#setenv videoconfig "drm_kms_helper.edid_firmware=edid/1366x768.bin" +# ----------------------------------------------- +# 1360x768 without monitor data using generic information +#setenv videoconfig "drm_kms_helper.edid_firmware=edid/1360x768.bin" +# ----------------------------------------------- +# 1280x1024 without monitor data using generic information +#setenv videoconfig "drm_kms_helper.edid_firmware=edid/1280x1024.bin" +# ----------------------------------------------- +# 1280x768 60hz without monitor data using generic information +#setenv videoconfig "drm_kms_helper.edid_firmware=edid/1280x768.bin" +# ----------------------------------------------- +# 1280x720 (720P) with monitor provided EDID information. (720p-edid) +#setenv videoconfig "video=HDMI-A-1:1280x720@60" +# ----------------------------------------------- +# 1280x720 (720P) without monitor data using generic information (720p-noedid) +#setenv videoconfig "drm_kms_helper.edid_firmware=edid/1280x720.bin" +# ----------------------------------------------- +# 1152x864 75hz without monitor data using generic information +#setenv videoconfig "drm_kms_helper.edid_firmware=edid/1152x864_75hz.bin" +# ----------------------------------------------- +# 1024x768 without monitor data using generic information +#setenv videoconfig "drm_kms_helper.edid_firmware=edid/1024x768.bin" +# ----------------------------------------------- +# 1024x600 without monitor data using generic information (ODROID VU7+) +#setenv videoconfig "drm_kms_helper.edid_firmware=edid/1024x600.bin" +# ----------------------------------------------- +# 800x600 without monitor data using generic information +#setenv videoconfig "drm_kms_helper.edid_firmware=edid/800x600.bin" +# ----------------------------------------------- +# 848x480 60hz without monitor data using generic information +#setenv videoconfig "drm_kms_helper.edid_firmware=edid/848x480.bin" +# ----------------------------------------------- +# 800x480 without monitor data using generic information (ODROID 7") +#setenv videoconfig "drm_kms_helper.edid_firmware=edid/800x480.bin" +# ----------------------------------------------- +# 720x576 without monitor data using generic information +#setenv videoconfig "drm_kms_helper.edid_firmware=edid/720x576.bin" +# ----------------------------------------------- +# 720x480 without monitor data using generic information +#setenv videoconfig "drm_kms_helper.edid_firmware=edid/720x480.bin" +# ----------------------------------------------- +# 640x480 without monitor data using generic information +#setenv videoconfig "drm_kms_helper.edid_firmware=edid/640x480.bin" +# ----------------------------------------------- +# 480x800 without monitor data using generic information +#setenv videoconfig "drm_kms_helper.edid_firmware=edid/480x800.bin" +# ----------------------------------------------- + +# ODROID-VU7 touchscreen: "false" or "true", defaults to "true" +#setenv disable_vu7 "false" + +# ODROID CloudShell2 TFT LCD and FAN control via I2C bus: "false" or "true", defaults to "false" +#setenv cs2enable "true" + +# Device tree overlays +# - See /boot/dtb/overlays for available overlays: defaults to empty string "" +#setenv overlays "i2c0" + +# CPU governor +# - DietPi will override this setting to user configured in dietpi-config > Performance Options > CPU governor +setenv governor "performance" + +# DDR frequency [MHz]: "933", "825", "728" or "633", defaults to "825" +#setenv ddr_freq "933" + +# TMDS data amplitude control. +# - 1LSB corresponds to 20 mVdiff amplitude level +# - tx_amp_lvl : 0 = 760 mVdiff(Min), 31 = 1380 mVdiff(Max) +# - Hardkernel default: hdmi_tx_amp_lvl = 31(1380 mVdiff) +setenv hdmi_tx_amp_lvl "31" + +# TMDS data amplitude fine control for each channel +# - 1LSB corresponds to 20 mVdiff amplitude level +# - tx_lvl : 0 = 0 mVdiff(Min), 3 = 60 mVdiff(Max) +# - Hardkernel default: hdmi_tx_lvl_ch0=hdmi_tx_lvl_ch1=hdmi_tx_lvl_ch2 = 3 +setenv hdmi_tx_lvl_ch0 "3" +setenv hdmi_tx_lvl_ch1 "3" +setenv hdmi_tx_lvl_ch2 "3" + +# TMDS data pre-emphasis level control +# - 1LSB corresponds to -0.45dB emphasis level except for 1 +# - tx_emp_lvl : 0 = 0 db(Min), 1 = -0.25 db, 2 = 0.7 db, 15 = -7.45 db(Max) +# - Hardkernel default: hdmi_tx_emp_lvl = 6 (-2.50 db) +setenv hdmi_tx_emp_lvl "6" + +# TMDS clock amplitude control +# - 1LSB corresponds to 20 mVdiff amplitude level. +# - clk_amp_lvl : 0 = 790 mVdiff(Min), 31 = 1410 mVdiff(Max) +# - Hardkernel default hdmi_clk_amp_lvl = 31 (1410 mVdiff) +setenv hdmi_clk_amp_lvl "31" + +# TMDS data source termination resistor control +# - tx_res : 0 = Source Termination OFF(Min), 1 = 200 ohm, 2 = 300 ohm, 3 = 120 ohm(Max) +# - Hardkernel default hdmi_tx_res = 0 (Source Termination OFF) +setenv hdmi_tx_res "0" + +### DO NOT EDIT ANYTHING BELOW THIS LINE ### + +setenv hdmi_phy_control "hdmi_tx_amp_lvl=${hdmi_tx_amp_lvl} hdmi_tx_lvl_ch0=${hdmi_tx_lvl_ch0} hdmi_tx_lvl_ch1=${hdmi_tx_lvl_ch1} hdmi_tx_lvl_ch2=${hdmi_tx_lvl_ch2} hdmi_tx_emp_lvl=${hdmi_tx_emp_lvl} hdmi_clk_amp_lvl=${hdmi_clk_amp_lvl} hdmi_tx_res=${hdmi_tx_res} HPD=${HPD} vout=${vout}" + +# Load kernel, initrd and dtb in that sequence +ext4load mmc 0:1 0x40008000 /boot/zImage +ext4load mmc 0:1 0x42000000 /boot/uInitrd +if test "${board_name}" = "xu4"; then setenv fdtfile "exynos5422-odroidxu4.dtb"; fi +if test "${board_name}" = "xu3"; then setenv fdtfile "exynos5422-odroidxu3.dtb"; fi +if test "${board_name}" = "xu3l"; then setenv fdtfile "exynos5422-odroidxu3-lite.dtb"; fi +if test "${board_name}" = "hc1"; then setenv fdtfile "exynos5422-odroidhc1.dtb"; fi +ext4load mmc 0:1 0x44000000 /boot/dtb/${fdtfile} + +# Set FDT address +fdt addr 0x44000000 + +if test "${cecenable}" = "false"; then fdt rm /cec@101B0000; fi +if test "${disable_vu7}" = "false"; then setenv hid_quirks "usbhid.quirks=0x0eef:0x0005:0x0004"; fi + +# Add overlays for CloudShell +if test "${cs2enable}" = "true"; then + for csoverlay in i2c0 i2c1 hktft-cs-ogst; do + setenv match "false" + for overlay in ${overlays}; do + if test "${overlay}" = "${csoverlay}"; then setenv match "true"; fi + done + if test "${match}" = "false"; then setenv overlays "${overlays} ${csoverlay}"; fi + done +fi + +# Load device tree overlays +if test "x${overlays}" != "x"; then + fdt resize 8192 + for overlay in ${overlays}; do + ext4load mmc 0:1 0x60000000 /boot/dtb/overlays/${overlay}.dtbo + fdt apply 0x60000000 + done +fi + +# Set DDR frequency +if test "x${ddr_freq}" != "x"; then dmc "${ddr_freq}"; fi + +# Final boot args (DRM debugging: drm.debug=0xff) +setenv bootargs "${bootrootfs} ${videoconfig} smsc95xx.macaddr=${macaddr} governor=${governor} ${hdmi_phy_control} ${hid_quirks}" + +# Boot the board +bootz 0x40008000 0x42000000 0x44000000 diff --git a/.build/images/U-Boot/dietpi-initramfs_cleanup b/.build/images/U-Boot/dietpi-initramfs_cleanup index a4b37c5307..b71e024d74 100755 --- a/.build/images/U-Boot/dietpi-initramfs_cleanup +++ b/.build/images/U-Boot/dietpi-initramfs_cleanup @@ -7,18 +7,24 @@ version="$1" if [ -z "$version" ] then - echo "W: initramfs-tools: ${DPKG_MAINTSCRIPT_PACKAGE:-kernel package} did not pass a version number" >&2 - exit 0 + echo "W: initramfs-tools: ${DPKG_MAINTSCRIPT_PACKAGE:-kernel package} did not pass a version number" >&2 + exit 0 fi # Avoid running multiple times if [ "$DEB_MAINT_PARAMS" ] then - eval set -- "$DEB_MAINT_PARAMS" - [ "$1" = 'upgrade' ] || exit 0 + eval set -- "$DEB_MAINT_PARAMS" + [ "$1" = 'upgrade' ] || exit 0 fi -# Delete unused initrd images -find /boot -name 'initrd.img-*' -o -name 'uInitrd-*' ! -name "*-$version" -printf 'Removing obsolete file %f\n' -delete +# Delete unused initramfs images +files="$(find /boot -maxdepth 1 -name 'initrd.img-*' -o -name 'uInitrd-*')" +for f in $files +do + [ -d "/lib/modules/${f#*-}" ] || continue + echo "Removing obsolete initramfs image: $f" + rm "$f" +done exit 0 diff --git a/.build/images/dietpi-build b/.build/images/dietpi-build index 0a4f53cf14..4f9433cdc0 100755 --- a/.build/images/dietpi-build +++ b/.build/images/dietpi-build @@ -69,6 +69,8 @@ boot_fstype='fat32' # Used for MBR boot partition only => NanoPi M2 CLONING_TOOL='dd' case $HW_MODEL in 0) iname='RPi' partition_start=4 boot_size=128 root_size=892;; + 11) iname='OdroidXU4' HW_ARCH=2 partition_start=4 root_size=764;; + 12) iname='OdroidC2' HW_ARCH=3 partition_start=4 root_size=764;; 15) iname='OdroidN2' HW_ARCH=3 partition_start=4 root_size=764;; 16) iname='OdroidC4' HW_ARCH=3 partition_start=4 root_size=764;; 20) iname='VM' WIFI_REQUIRED=0 HW_ARCH=${HW_ARCH:-10} VMTYPE=${VMTYPE:-raw};; diff --git a/.update/patches b/.update/patches index 655822b709..3278086ed0 100755 --- a/.update/patches +++ b/.update/patches @@ -266,9 +266,6 @@ Patch_7_5() grep -q '[[:blank:]]console=tty3' /boot/cmdline.txt && G_EXEC sed -i 's/[[:blank:]]*console=tty3/ console=tty1/' /boot/cmdline.txt fi - # Fix syntax in initramfs cleanup script - [[ -f '/etc/kernel/preinst.d/dietpi-initramfs_cleanup' ]] && grep -q 'reverse) do' /etc/kernel/preinst.d/dietpi-initramfs_cleanup && G_EXEC sed -i 's/reverse) do/reverse); do/' /etc/kernel/preinst.d/dietpi-initramfs_cleanup - # RPi: Offer to prevent constant SD card polling (( $G_HW_MODEL < 10 )) && ! grep -q '^dtparam=sd_poll_once' /boot/config.txt && G_WHIP_BUTTON_CANCEL_TEXT='Skip' G_WHIP_YESNO '[ INFO ] Disable SD card hot plug detection \nAn issue was detected on RPi, where the default regular SD card polling leads to significant CPU load, when no SD card is actually attached: @@ -738,6 +735,14 @@ Patch_8_4() # Remove obsolete license file and setting [[ -f '/var/lib/dietpi/license.txt' ]] && G_EXEC rm /var/lib/dietpi/license.txt G_EXEC sed -i '/^[[:blank:]]*AUTO_SETUP_ACCEPT_LICENSE=/d' /boot/dietpi.txt + + # Update DietPi initramfs cleanup script, following reasonable changes done by Armbian + if [[ -f '/etc/kernel/preinst.d/dietpi-initramfs_cleanup' ]] + then + G_EXEC curl -sSfL "https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH/.build/images/U-Boot/dietpi-initramfs_cleanup" -o /etc/kernel/postinst.d/dietpi-initramfs_cleanup + G_EXEC rm /etc/kernel/preinst.d/dietpi-initramfs_cleanup + G_EXEC rmdir --ignore-fail-on-non-empty /etc/kernel/preinst.d + fi } # v6.35 => v7 migration diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 11a58e3363..17f111f4ba 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -3,6 +3,7 @@ v8.4 New images: - NanoPi M2/T2/Fire2 | We updated our NanoPi 2 series image to be shipped with Linux 4.4, the latest Linux version for the S5P4418 SoC, provided by FriendlyELEC. It is compatible will all FriendlyELEC S5P4418 SBCs: NanoPi 2, NanoPi M2, NanoPC T2, NanoPi Fire2A, NanoPi 2 Fire and NanoPi S2. Sadly systems running the old image cannot be upgraded, since the new U-Boot requires more space and hence a different partitioning. The new image ships with two scripts to flash U-Boot and to change the U-Boot environment/config: One can now edit /boot/u-boot/env.txt and apply the changes by running /boot/u-boot/flash_env.sh. Run fw_printenv to see the current U-Boot environment, also to get an idea of available settings. Kernel, U-Boot, firmware and these scripts are installed as part of a self-hosted "firmware-nanopi2" package. The kernel sources can be found at https://github.com/friendlyarm/linux/tree/nanopi2-v4.4.y, so that headers can be compiled. We will probably provide a kernel headers package as well, if there is a demand, e.g. to enable the DKMS-based WireGuard VPN server software option. +- Odroid XU4 | We updated our Odroid XU4 image to be shipped with Linux 5.4. Sadly systems running the old image cannot be upgraded, since the new U-Boot config requires a single ext4 partition without a dedicated boot partition. CLI changes: - DietPi-Set_software | The "apt-cache" command has been renamed to "apt" to better reflect its options, which do not cover the APT cache only, but APT lists and the location of the downloaded package archive as well. For backwards compatibility, "apt-cache" however remains valid for now. diff --git a/PREP_SYSTEM_FOR_DIETPI.sh b/PREP_SYSTEM_FOR_DIETPI.sh index 67afb4192d..4bc6d39c0e 100755 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -491,6 +491,16 @@ _EOF_ # Boot in 64-bit mode if this is a 64-bit image [[ $G_HW_ARCH == 3 ]] && G_CONFIG_INJECT 'arm_64bit=' 'arm_64bit=1' /boot/config.txt + elif [[ $G_HW_MODEL == 11 && -f '/boot/boot.ini' && $(findmnt -Ufnro TARGET -t ext4 -T /boot) == '/' ]]; then + + # Temporary until boot U-Boot config got merged into master + G_EXEC curl -sSfL 'https://raw.githubusercontent.com/MichaIng/DietPi/dev/.build/images/OdroidXU4/boot.ini' -o /boot/boot.ini + #G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/OdroidXU4/boot.ini" /boot/boot.ini + G_EXEC sed -i "s/root=UUID=[^[:blank:]]*/root=UUID=$(findmnt -Ufnro UUID -M /)/" /boot/boot.ini + G_EXEC mkdir -p /etc/kernel/postinst.d /etc/initramfs/post-update.d + G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/dietpi-initramfs_cleanup" /etc/kernel/postinst.d/dietpi-initramfs_cleanup + G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/99-dietpi-uboot" /etc/initramfs/post-update.d/99-dietpi-uboot + elif [[ $G_HW_MODEL == 11 && -f '/boot/boot.ini' && $(findmnt -t vfat -M /boot) ]]; then G_EXEC mv "DietPi-$G_GITBRANCH/boot_xu4.ini" /boot/boot.ini @@ -500,12 +510,12 @@ _EOF_ G_EXEC mv "DietPi-$G_GITBRANCH/boot_c2.ini" /boot/boot.ini - elif [[ $G_HW_MODEL == 1[56] && $(findmnt -Ufnro TARGET -T /boot) == '/' ]]; then + elif [[ $G_HW_MODEL == 1[256] && $(findmnt -Ufnro TARGET -T /boot) == '/' ]]; then G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/boot.cmd" /boot/boot.cmd G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/dietpiEnv.txt" /boot/dietpiEnv.txt - G_EXEC mkdir -p /etc/kernel/preinst.d /etc/initramfs/post-update.d - G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/dietpi-initramfs_cleanup" /etc/kernel/preinst.d/dietpi-initramfs_cleanup + G_EXEC mkdir -p /etc/kernel/postinst.d /etc/initramfs/post-update.d + G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/dietpi-initramfs_cleanup" /etc/kernel/postinst.d/dietpi-initramfs_cleanup G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/99-dietpi-uboot" /etc/initramfs/post-update.d/99-dietpi-uboot elif [[ $G_HW_MODEL == 15 && -f '/boot/boot.ini' && $(findmnt -t vfat -M /boot) ]]; then @@ -767,8 +777,8 @@ _EOF_ fi fi - # - Odroid N2/C4: Modern single partition image - if [[ $G_HW_MODEL == 1[56] && -f '/boot/dietpiEnv.txt' ]] + # - Odroid XU4/C2/N2/C4: Modern single partition image + if [[ ( $G_HW_MODEL == 1[256] && -f '/boot/dietpiEnv.txt' ) || ( $G_HW_MODEL == 11 && $(findmnt -Ufnro TARGET -t ext4 -T /boot) == '/' ) ]] then # Bootstrap Armbian repository G_EXEC eval "curl -sSfL 'https://apt.armbian.com/armbian.key' | gpg --dearmor -o /etc/apt/trusted.gpg.d/dietpi-armbian.gpg --yes" @@ -785,14 +795,16 @@ _EOF_ G_AGUP # Install kernel, device tree, U-Boot, firmware and initramfs packages, initramfs-tools first to have an initramfs generated on kernel install G_AGI initramfs-tools - local model='odroidn2' - [[ $G_HW_MODEL == 16 ]] && model='odroidc4' - G_AGI linux-{image,dtb}-current-meson64 "linux-u-boot-$model-current" u-boot-tools armbian-firmware + local model='odroidn2' kernel='meson64' arch='arm64' + (( $G_HW_MODEL == 16 )) && model='odroidc4' + (( $G_HW_MODEL == 12 )) && model='odroidc2' + (( $G_HW_MODEL == 11 )) && model='odroidxu4' kernel='odroidxu4' arch='arm' + G_AGI linux-{image,dtb}-current-"$kernel" "linux-u-boot-$model-current" u-boot-tools armbian-firmware # Cleanup [[ -f '/boot/uImage' ]] && G_EXEC rm /boot/uImage [[ -f '/boot/.next' ]] && G_EXEC rm /boot/.next # Compile U-Boot config - G_EXEC mkimage -C none -A arm64 -T script -d /boot/boot.cmd /boot/boot.scr + [[ -f '/boot/boot.cmd' ]] && G_EXEC mkimage -C none -A "$arch" -T script -d /boot/boot.cmd /boot/boot.scr # Flash U-Boot # shellcheck disable=SC1091 . /usr/lib/u-boot/platform_install.sh @@ -1487,19 +1499,24 @@ _EOF_' /boot/dietpi/func/dietpi-set_hardware serialconsole disable ttyS0 G_EXEC systemctl mask serial-getty@ttyS0 - # Odroid N2/C4: Enable on serial debug console only - elif [[ $G_HW_MODEL == 1[56] ]] + # Odroid XU4 + elif (( $G_HW_MODEL == 11 )) + then + /boot/dietpi/func/dietpi-set_hardware serialconsole enable ttySAC2 + + # Odroid C2/N2/C4: Modern vs legacy kernel + elif [[ $G_HW_MODEL == 1[256] ]] then local tty='ttyAML0' [[ -f '/boot/dietpiEnv.txt' || -e '/dev/ttyAML0' ]] || tty='ttyS0' /boot/dietpi/func/dietpi-set_hardware serialconsole enable "$tty" - # NanoPi M2/T2: Enable ttyAMA0 only + # NanoPi M2/T2 elif (( $G_HW_MODEL == 61 )) then /boot/dietpi/func/dietpi-set_hardware serialconsole enable ttyAMA0 - # ROCK Pi S: Enable on ttyS0 only + # ROCK Pi S elif (( $G_HW_MODEL == 73 )) then /boot/dietpi/func/dietpi-set_hardware serialconsole enable ttyS0 @@ -1571,8 +1588,8 @@ _EOF_' G_EXEC eval 'echo -e '\''apm = 127\nforce_spindown_time = 120'\'' > /etc/hdparm.conf' fi - # Odroid N2/C4: Modern single partition image - if [[ $G_HW_MODEL == 1[56] && -f '/boot/dietpiEnv.txt' ]] + # Odroid C2/N2/C4: Modern single partition image + if [[ $G_HW_MODEL == 1[256] && -f '/boot/dietpiEnv.txt' ]] then G_CONFIG_INJECT 'rootdev=' "rootdev=UUID=$(findmnt -Ufnro UUID -M /)" /boot/dietpiEnv.txt G_CONFIG_INJECT 'rootfstype=' "rootfstype=$(findmnt -Ufnro FSTYPE -M /)" /boot/dietpiEnv.txt diff --git a/boot_xu4.ini b/boot_xu4.ini index 6de4568a82..945327cad3 100644 --- a/boot_xu4.ini +++ b/boot_xu4.ini @@ -4,11 +4,11 @@ ODROIDXU-UBOOT-CONFIG setenv initrd_high "0xffffffff" setenv fdt_high "0xffffffff" -# Mac address configuration +# MAC address configuration setenv macaddr "00:1e:06:61:7a:72" # Kernel command-line parameters -setenv bootrootfs "console=tty1 console=ttySAC2,115200n8 root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait ro fsck.repair=yes net.ifnames=0" +setenv bootrootfs "root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait ro console=ttySAC2,115200n8 console=tty1 consoleblank=0 fsck.repair=yes net.ifnames=0" # HDMI config setenv videoconfig "drm_kms_helper.edid_firmware=edid/1920x1080.bin" @@ -17,24 +17,24 @@ setenv videoconfig "drm_kms_helper.edid_firmware=edid/1920x1080.bin" # - DVI mode disables HDMI sound setenv vout "hdmi" +# HDMI Hot Plug detection: "false" or "true" +# - "true" enables HDMI detection based on cable connection. +# - "false" disables auto-detection and forces HDMI output. +setenv HPD "true" + # HDMI CEC: "false" or "true", defaults to "true" #setenv cecenable "false" +# ODROID-VU7 touchscreen: "false" or "true", defaults to "true" +#setenv disable_vu7 "false" + # CPU governor # - DietPi will override this setting to user configured in dietpi-config > Performance Options > CPU governor setenv governor "performance" -# ODROID-VU7 touchscreen: "false" or "true", defaults to "true" -#setenv disable_vu7 "false" - # DDR frequency [MHz]: "933", "825", "728" or "633", defaults to "825" #setenv ddr_freq "933" -# HDMI Hot Plug detection: "false" or "true" -# - "true" enables HDMI detection based on cable connection. -# - "false" disables auto-detection and forces HDMI output. -setenv HPD "true" - # TMDS data amplitude control. # - 1LSB corresponds to 20 mVdiff amplitude level # - tx_amp_lvl : 0 = 760 mVdiff(Min), 31 = 1380 mVdiff(Max) From 6f2b89ecb6ea20a49caf5a6ebbaa3cef1f89a6c3 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Tue, 26 Apr 2022 17:00:42 +0200 Subject: [PATCH 37/59] v8.4 - DietPi-Build | Fix QEMU download URL --- .build/images/dietpi-build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.build/images/dietpi-build b/.build/images/dietpi-build index 4f9433cdc0..373d15b3fa 100755 --- a/.build/images/dietpi-build +++ b/.build/images/dietpi-build @@ -41,6 +41,7 @@ ITYPE= VMTYPE= GITBRANCH='master' GITOWNER='MichaIng' +EDITION= while (( $# )) do case $1 in @@ -147,7 +148,7 @@ then # Use package from Debian repo, since Ubuntu does not shot ARM packages and has no global HTTPS mirror director if (( ${G_DISTRO:=5} < 6 )) then - G_EXEC curl -fL "https://deb.debian.org/debian/pool/main/q/qemu/qemu-user-static_6.2+dfsg-2_$DEB_ARCH.deb" -o qemu.deb + G_EXEC curl -fL "https://deb.debian.org/debian/pool/main/q/qemu/qemu-user-static_6.2+dfsg-2~bpo11+1_$DEB_ARCH.deb" -o qemu.deb G_EXEC dpkg -i qemu.deb G_EXEC rm qemu.deb fi From e31674401802bc104553f40344e3062cde0651d4 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Tue, 26 Apr 2022 19:32:04 +0200 Subject: [PATCH 38/59] v8.4 - DietPi-PREP | Apply haveged bug workaround for ARMv7 - DietPi-Patches | Bring forward haveged workaround for ARMv7 and merge another workaround for ARM on Buster. --- .update/patches | 26 ++++++++++++-------------- PREP_SYSTEM_FOR_DIETPI.sh | 7 +++++++ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/.update/patches b/.update/patches index 3278086ed0..d14cb356af 100755 --- a/.update/patches +++ b/.update/patches @@ -186,9 +186,6 @@ Patch_7_3() # This is required to call our software CLI wrapper scripts, which contain "sudo -u " to assure correct config and data is loaded. [[ -f '/etc/sudoers.d/dietpi' ]] && echo 'dietpi ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/dietpi - # When haveged from Bullseye was installed on Buster (on ARM to workaround a bug), mark the related library as auto-installed so that it can be autoremoved when haveged itself is removed. - dpkg-query -s haveged &> /dev/null && dpkg-query -s libhavege2 &> /dev/null && G_EXEC apt-mark auto libhavege2 - # Update DietPi-Backup filter file if [[ -f '/boot/dietpi/.dietpi-backup_inc_exc' && $(head -1 /boot/dietpi/.dietpi-backup_inc_exc) != '# DietPi-Backup include/exclude filter' ]] then @@ -306,17 +303,8 @@ Patch_7_6() G_EXEC curl -sSfLO "https://dietpi.com/downloads/binaries/buster/haveged_$G_HW_ARCH_NAME.deb" G_AGI "./libhavege2_$G_HW_ARCH_NAME.deb" "./haveged_$G_HW_ARCH_NAME.deb" G_EXEC rm "./libhavege2_$G_HW_ARCH_NAME.deb" "./haveged_$G_HW_ARCH_NAME.deb" - fi - - # https://github.com/MichaIng/DietPi/issues/4710 - if [[ $G_DISTRO -ge 5 && $G_HW_ARCH == 2 ]] && dpkg-query -s haveged &> /dev/null - then - G_DIETPI-NOTIFY 2 'Applying workaround for haveged entropy daemon bug:' - G_DIETPI-NOTIFY 2 ' - https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=985196' - G_EXEC mkdir -p /etc/systemd/system/haveged.service.d - G_EXEC eval "echo -e '[Service]\nSystemCallFilter=uname' > /etc/systemd/system/haveged.service.d/dietpi.conf" - G_EXEC systemctl daemon-reload - G_EXEC systemctl restart haveged + # Mark the library as auto-installed so that it can be autoremoved when haveged itself is removed. + G_EXEC apt-mark auto libhavege2 fi } @@ -743,6 +731,16 @@ Patch_8_4() G_EXEC rm /etc/kernel/preinst.d/dietpi-initramfs_cleanup G_EXEC rmdir --ignore-fail-on-non-empty /etc/kernel/preinst.d fi + + # https://github.com/MichaIng/DietPi/issues/4710 + if (( $G_HW_ARCH == 2 )) && dpkg-query -s haveged &> /dev/null + then + G_DIETPI-NOTIFY 2 'Applying workaround for haveged entropy daemon bug: https://bugs.debian.org/985196' + [[ -d '/etc/systemd/system/haveged.service.d' ]] || G_EXEC mkdir /etc/systemd/system/haveged.service.d + G_EXEC eval 'echo -e '\''[Service]\nSystemCallFilter=uname'\'' > /etc/systemd/system/haveged.service.d/dietpi.conf' + G_EXEC systemctl daemon-reload + G_EXEC systemctl restart haveged + fi } # v6.35 => v7 migration diff --git a/PREP_SYSTEM_FOR_DIETPI.sh b/PREP_SYSTEM_FOR_DIETPI.sh index 4bc6d39c0e..86d9aecdfc 100755 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -688,6 +688,13 @@ _EOF_ aPACKAGES_REQUIRED_INSTALL+=('rng-tools5') else aPACKAGES_REQUIRED_INSTALL+=('haveged') + # https://github.com/MichaIng/DietPi/issues/4710 + if (( $G_HW_ARCH == 2 )) + then + G_DIETPI-NOTIFY 2 'Applying workaround for haveged entropy daemon bug: https://bugs.debian.org/985196' + [[ -d '/etc/systemd/system/haveged.service.d' ]] || G_EXEC mkdir /etc/systemd/system/haveged.service.d + G_EXEC eval 'echo -e '\''[Service]\nSystemCallFilter=uname'\'' > /etc/systemd/system/haveged.service.d/dietpi.conf' + fi fi # G_DISTRO specific From e9201a13af29d8d0f0ec55c641ab7852f129551a Mon Sep 17 00:00:00 2001 From: MichaIng Date: Wed, 27 Apr 2022 19:26:08 +0200 Subject: [PATCH 39/59] v8.4 - DietPi-Build | Add support for Odroid C1 - DietPi-Backup | Add support for restoring dietpiEnv.txt backups on first boot - DietPi-PREP | Odroid XU4: Fix architecture for converting initramfs to U-Boot format - DietPi-Config | Odroid C1: Add support for toggling serial console in boot.ini --- .build/images/OdroidC1/boot.ini | 95 +++++++++++++++++++++++++++++++++ .build/images/dietpi-build | 1 + PREP_SYSTEM_FOR_DIETPI.sh | 45 +++++++++++----- dietpi/dietpi-backup | 19 +++++-- dietpi/dietpi-drive_manager | 4 +- dietpi/func/dietpi-set_hardware | 9 ++-- 6 files changed, 149 insertions(+), 24 deletions(-) create mode 100644 .build/images/OdroidC1/boot.ini diff --git a/.build/images/OdroidC1/boot.ini b/.build/images/OdroidC1/boot.ini new file mode 100644 index 0000000000..44dda5b7c6 --- /dev/null +++ b/.build/images/OdroidC1/boot.ini @@ -0,0 +1,95 @@ +ODROIDC-UBOOT-CONFIG + +# HDMI resolution +# - Exactly one line needs to be uncommented! +#setenv m "vga" # 640x480 +#setenv m "480p" # 720x480 +#setenv m "576p" # 720x576 +#setenv m "800x480p60hz" # 800x480 +#setenv m "800x600p60hz" # 800x600 +#setenv m "1024x600p60hz" # 1024x600 +#setenv m "1024x768p60hz" # 1024x768 +#setenv m "1360x768p60hz" # 1360x768 +#setenv m "1440x900p60hz" # 1440x900 +#setenv m "1600x900p60hz" # 1600x900 +#setenv m "1680x1050p60hz" # 1680x1050 +#setenv m "720p" # 720p 1280x720 +#setenv m "800p" # 1280x800 +#setenv m "sxga" # 1280x1024 +#setenv m "1080i50hz" # 1080I@50Hz +#setenv m "1080p24hz" # 1080P@24Hz +#setenv m "1080p50hz" # 1080P@50Hz +setenv m "1080p" # 1080P@60Hz +#setenv m "1920x1200" # 1920x1200 + +# HDMI/DVI selection: "hdmi" or "dvi" +# - DVI mode disables HDMI sound +setenv vout "hdmi" + +# HDMI BPP Mode: "32", "24" or "12" +setenv m_bpp "32" + +# Monitor output: "true" or "false" +# - Controls if HDMI PHY should output anything to the monitor +setenv monitor_onoff "true" + +# HDMI Hot Plug detection +# - "0" disables auto-detection and forces HDMI output. +# - "1" enables HDMI detection based on cable connection (default). +#setenv hpd "0" + +# CEC (requires hardware modification) +# - "0" disables HDMI CEC (default). +# - "1" enables HDMI CEC. +#setenv cec "0" + +# PCM5102 I2S Audio DAC +# - PCM5102 is an I2S Audio DAC addon board for ODROID-C1+ +# - Uncomment the line below to __ENABLE__ support for this addon board. +#setenv enabledac "enabledac" + +# UHS Card Configuration +# - Uncomment the line below to __DISABLE__ UHS-1 Micro SD support +# - This might break boot for some brand models of cards. +#setenv disableuhs "disableuhs" + + +# Disable VPU (Video decoding engine, saves RAM!!!) +# - 0 = disabled +# - 1 = enabled (default) +#setenv vpu "1" + +# Disable HDMI Output (Again, saves RAM!) +# - 0 = disabled +# - 1 = enabled (default) +#setenv hdmioutput "1" + +# Default Console Device Setting +setenv condev "console=ttyAML0,115200n8 console=tty1" + +# ODROID-VU7 touchscreen: "false" or "true", defaults to "true" +#setenv disable_vu7 "false" + +# CPU Max Frequency: 96 192 312 408 504 600 720 816 1008 1200 1320 1488 1536 1632 1728 or 1824 +setenv max_freq "1536" + +### DO NOT EDIT ANYTHING BELOW THIS LINE ### + +if test "${hpd}" = "0"; then setenv hdmi_hpd "disablehpd=true"; fi +if test "${cec}" = "1"; then setenv hdmi_cec "hdmitx=cecf"; fi +if test "${disable_vu7}" = "false"; then setenv hid_quirks "usbhid.quirks=0x0eef:0x0005:0x0004"; fi + +# Boot arguments +setenv bootargs "root=UUID=0ae78c3b-9579-4a13-8b2d-58ad222f2ca6 rootfstype=ext4 rootwait rw ${condev} loglevel=4 no_console_suspend consoleblank=0 vdaccfg=0xa000 logo=osd1,loaded,0x7900000,720p,full dmfc=3 cvbsmode=576cvbs hdmimode=${m} m_bpp=${m_bpp} vout=${vout} ${disableuhs} ${hdmi_hpd} ${hdmi_cec} ${enabledac} monitor_onoff=${monitor_onoff} max_freq=${max_freq} ${hid_quirks} ${extraargs}" + +# Booting +fatload mmc 0:1 0x20800000 uImage +fatload mmc 0:1 0x22000000 uInitrd +fatload mmc 0:1 0x21800000 dtb/meson8b-odroidc1.dtb + +fdt addr 21800000 + +if test "${vpu}" = "0"; then fdt rm /mesonstream; fdt rm /vdec; fdt rm /ppmgr; fi +if test "${hdmioutput}" = "0"; then fdt rm /mesonfb; fi + +bootm 0x20800000 0x22000000 0x21800000 diff --git a/.build/images/dietpi-build b/.build/images/dietpi-build index 373d15b3fa..a69f3f9bfd 100755 --- a/.build/images/dietpi-build +++ b/.build/images/dietpi-build @@ -70,6 +70,7 @@ boot_fstype='fat32' # Used for MBR boot partition only => NanoPi M2 CLONING_TOOL='dd' case $HW_MODEL in 0) iname='RPi' partition_start=4 boot_size=128 root_size=892;; + 10) iname='OdroidC1' HW_ARCH=2 partition_start=4 boot_size=128 root_size=764;; 11) iname='OdroidXU4' HW_ARCH=2 partition_start=4 root_size=764;; 12) iname='OdroidC2' HW_ARCH=3 partition_start=4 root_size=764;; 15) iname='OdroidN2' HW_ARCH=3 partition_start=4 root_size=764;; diff --git a/PREP_SYSTEM_FOR_DIETPI.sh b/PREP_SYSTEM_FOR_DIETPI.sh index 86d9aecdfc..50ae344c99 100755 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -333,10 +333,10 @@ _EOF_ #'2' ': Raspberry Pi 2' #'3' ': Raspberry Pi 3/3+' #'4' ': Raspberry Pi 4' - '13' ': Odroid U3' '10' ': Odroid C1' '11' ': Odroid XU3/XU4/MC1/HC1/HC2' '12' ': Odroid C2' + '13' ': Odroid U3' '15' ': Odroid N2' '16' ': Odroid C4/HC4' '70' ': Sparky SBC' @@ -491,6 +491,18 @@ _EOF_ # Boot in 64-bit mode if this is a 64-bit image [[ $G_HW_ARCH == 3 ]] && G_CONFIG_INJECT 'arm_64bit=' 'arm_64bit=1' /boot/config.txt + elif [[ $G_HW_MODEL == 10 && -f '/boot/boot.ini' && $(findmnt -t vfat -M /boot) ]]; then + + # Temporary until boot U-Boot config got merged into master + G_EXEC curl -sSfL 'https://raw.githubusercontent.com/MichaIng/DietPi/dev/.build/images/OdroidC1/boot.ini' -o /boot/boot.ini + #G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/OdroidC1/boot.ini" /boot/boot.ini + G_EXEC sed -i "s/root=UUID=[^[:blank:]]*/root=UUID=$(findmnt -Ufnro UUID -M /)/" /boot/boot.ini + G_EXEC mkdir -p /etc/kernel/postinst.d /etc/initramfs/post-update.d + G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/dietpi-initramfs_cleanup" /etc/kernel/postinst.d/dietpi-initramfs_cleanup + G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/99-dietpi-uboot" /etc/initramfs/post-update.d/99-dietpi-uboot + G_EXEC sed -i 's/arm64/arm/' /etc/initramfs/post-update.d/99-dietpi-uboot + G_EXEC sed -i '/^ln -sf/c\mv "/boot/uInitrd-$1" /boot/uInitrd' /etc/initramfs/post-update.d/99-dietpi-uboot # FAT filesystem does not support symlinks + elif [[ $G_HW_MODEL == 11 && -f '/boot/boot.ini' && $(findmnt -Ufnro TARGET -t ext4 -T /boot) == '/' ]]; then # Temporary until boot U-Boot config got merged into master @@ -500,6 +512,15 @@ _EOF_ G_EXEC mkdir -p /etc/kernel/postinst.d /etc/initramfs/post-update.d G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/dietpi-initramfs_cleanup" /etc/kernel/postinst.d/dietpi-initramfs_cleanup G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/99-dietpi-uboot" /etc/initramfs/post-update.d/99-dietpi-uboot + G_EXEC sed -i 's/arm64/arm/' /etc/initramfs/post-update.d/99-dietpi-uboot + + elif [[ $G_HW_MODEL == 1[256] && $(findmnt -Ufnro TARGET -T /boot) == '/' ]]; then + + G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/boot.cmd" /boot/boot.cmd + G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/dietpiEnv.txt" /boot/dietpiEnv.txt + G_EXEC mkdir -p /etc/kernel/postinst.d /etc/initramfs/post-update.d + G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/dietpi-initramfs_cleanup" /etc/kernel/postinst.d/dietpi-initramfs_cleanup + G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/99-dietpi-uboot" /etc/initramfs/post-update.d/99-dietpi-uboot elif [[ $G_HW_MODEL == 11 && -f '/boot/boot.ini' && $(findmnt -t vfat -M /boot) ]]; then @@ -510,14 +531,6 @@ _EOF_ G_EXEC mv "DietPi-$G_GITBRANCH/boot_c2.ini" /boot/boot.ini - elif [[ $G_HW_MODEL == 1[256] && $(findmnt -Ufnro TARGET -T /boot) == '/' ]]; then - - G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/boot.cmd" /boot/boot.cmd - G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/dietpiEnv.txt" /boot/dietpiEnv.txt - G_EXEC mkdir -p /etc/kernel/postinst.d /etc/initramfs/post-update.d - G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/dietpi-initramfs_cleanup" /etc/kernel/postinst.d/dietpi-initramfs_cleanup - G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/99-dietpi-uboot" /etc/initramfs/post-update.d/99-dietpi-uboot - elif [[ $G_HW_MODEL == 15 && -f '/boot/boot.ini' && $(findmnt -t vfat -M /boot) ]]; then G_EXEC mv "DietPi-$G_GITBRANCH/boot_n2.ini" /boot/boot.ini @@ -784,8 +797,8 @@ _EOF_ fi fi - # - Odroid XU4/C2/N2/C4: Modern single partition image - if [[ ( $G_HW_MODEL == 1[256] && -f '/boot/dietpiEnv.txt' ) || ( $G_HW_MODEL == 11 && $(findmnt -Ufnro TARGET -t ext4 -T /boot) == '/' ) ]] + # - Odroid C1/XU4/C2/N2/C4 + if [[ ( $G_HW_MODEL == 1[256] && -f '/boot/dietpiEnv.txt' ) || ( $G_HW_MODEL == 11 && $(findmnt -Ufnro TARGET -t ext4 -T /boot) == '/' ) || ( $G_HW_MODEL == 10 && $(findmnt -t vfat -M /boot) ) ]] then # Bootstrap Armbian repository G_EXEC eval "curl -sSfL 'https://apt.armbian.com/armbian.key' | gpg --dearmor -o /etc/apt/trusted.gpg.d/dietpi-armbian.gpg --yes" @@ -806,9 +819,10 @@ _EOF_ (( $G_HW_MODEL == 16 )) && model='odroidc4' (( $G_HW_MODEL == 12 )) && model='odroidc2' (( $G_HW_MODEL == 11 )) && model='odroidxu4' kernel='odroidxu4' arch='arm' + (( $G_HW_MODEL == 10 )) && model='odroidc1' kernel='meson' arch='arm' G_AGI linux-{image,dtb}-current-"$kernel" "linux-u-boot-$model-current" u-boot-tools armbian-firmware # Cleanup - [[ -f '/boot/uImage' ]] && G_EXEC rm /boot/uImage + [[ $G_HW_MODEL != 10 && -f '/boot/uImage' ]] && G_EXEC rm /boot/uImage [[ -f '/boot/.next' ]] && G_EXEC rm /boot/.next # Compile U-Boot config [[ -f '/boot/boot.cmd' ]] && G_EXEC mkimage -C none -A "$arch" -T script -d /boot/boot.cmd /boot/boot.scr @@ -816,7 +830,7 @@ _EOF_ # shellcheck disable=SC1091 . /usr/lib/u-boot/platform_install.sh # shellcheck disable=SC2154 - write_uboot_platform "$DIR" "$(lsblk -npo PKNAME "$(findmnt -Ufnro SOURCE -M /)")" + write_uboot_platform "$DIR" "$(lsblk -npo PKNAME "$(findmnt -Ufnro SOURCE -T /boot)")" # - Armbian grab currently installed packages elif [[ $G_HW_MODEL != 75 && $(dpkg-query -Wf '${Package} ') == *'armbian'* ]]; then @@ -1506,6 +1520,11 @@ _EOF_' /boot/dietpi/func/dietpi-set_hardware serialconsole disable ttyS0 G_EXEC systemctl mask serial-getty@ttyS0 + # Odroid C2 + elif (( $G_HW_MODEL == 10 )) + then + /boot/dietpi/func/dietpi-set_hardware serialconsole enable ttyAML0 + # Odroid XU4 elif (( $G_HW_MODEL == 11 )) then diff --git a/dietpi/dietpi-backup b/dietpi/dietpi-backup index 932cb77943..c4ed540c66 100755 --- a/dietpi/dietpi-backup +++ b/dietpi/dietpi-backup @@ -236,7 +236,7 @@ However, this check is a rough estimation in reasonable time, thus it could be m # When restoring a backup, assure that either the UUIDs stored in the backup fstab/boot config matches the current system drive, or that we know all relevant files to adjust afterwards. Check_UUIDs() { - UPDATE_UUIDs=0 UPDATE_GRUB=0 UPDATE_RPI=0 UPDATE_ARMBIAN=0 UPDATE_ODROID=0 UPDATE_UBOOT=0 + UPDATE_UUIDs=0 UPDATE_GRUB=0 UPDATE_RPI=0 UPDATE_DIETPI=0 UPDATE_ARMBIAN=0 UPDATE_ODROID=0 UPDATE_UBOOT=0 UUID_ROOT=$(findmnt -Ufnro UUID -M /) PARTUUID_ROOT=$(findmnt -Ufnro PARTUUID -M /) @@ -256,6 +256,11 @@ However, this check is a rough estimation in reasonable time, thus it could be m then UPDATE_RPI=1 + # - DietPi modern U-Boot + elif [[ -f $FP_TARGET/$DATA/boot/dietpiEnv.txt ]] + then + UPDATE_DIETPI=1 + # - Armbian elif [[ -f $FP_TARGET/$DATA/boot/armbianEnv.txt ]] then @@ -317,6 +322,12 @@ However, this check is a rough estimation in reasonable time, thus it could be m then G_EXEC sed -Ei "s/(^|[[:blank:]])root=[^[:blank:]]*/\1root=PARTUUID=$PARTUUID_ROOT/" /boot/cmdline.txt + # - DietPi modern U-Boot + elif (( $UPDATE_DIETPI == 1 )) + then + grep -q '^[[:blank:]]*rootdev=UUID=' /boot/dietpiEnv.txt && G_CONFIG_INJECT 'rootdev=UUID=' "rootdev=UUID=$UUID_ROOT" /boot/dietpiEnv.txt && return + grep -q '^[[:blank:]]*rootdev=PARTUUID=' /boot/dietpiEnv.txt && G_CONFIG_INJECT 'rootdev=PARTUUID=' "rootdev=PARTUUID=$PARTUUID_ROOT" /boot/dietpiEnv.txt + # - Armbian elif (( $UPDATE_ARMBIAN == 1 )) then @@ -326,14 +337,12 @@ However, this check is a rough estimation in reasonable time, thus it could be m # - Odroids / classic U-Boot elif (( $UPDATE_ODROID == 1 )) then - G_EXEC sed -Ei "s/(\"|root=)UUID=[^[:blank:]\"]*/\1UUID=$UUID_ROOT/" /boot/boot.ini - G_EXEC sed -Ei "s/(\"|root=)PARTUUID=[^[:blank:]\"]*/\1PARTUUID=$PARTUUID_ROOT/" /boot/boot.ini + G_EXEC sed -Ei -e "s/(\"|root=)UUID=[^[:blank:]\"]*/\1UUID=$UUID_ROOT/" -e "s/(\"|root=)PARTUUID=[^[:blank:]\"]*/\1PARTUUID=$PARTUUID_ROOT/" /boot/boot.ini # - Modern U-Boot elif (( $UPDATE_UBOOT == 1 )) then - G_EXEC sed -Ei "s/(\"|root=)UUID=[^[:blank:]\"]*/\1UUID=$UUID_ROOT/" /boot/boot.cmd - G_EXEC sed -Ei "s/(\"|root=)PARTUUID=[^[:blank:]\"]*/\1PARTUUID=$PARTUUID_ROOT/" /boot/boot.cmd + G_EXEC sed -Ei -e "s/(\"|root=)UUID=[^[:blank:]\"]*/\1UUID=$UUID_ROOT/" -e "s/(\"|root=)PARTUUID=[^[:blank:]\"]*/\1PARTUUID=$PARTUUID_ROOT/" /boot/boot.cmd G_EXEC mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr fi } diff --git a/dietpi/dietpi-drive_manager b/dietpi/dietpi-drive_manager index d8b7cdc9b6..b0c2659db6 100755 --- a/dietpi/dietpi-drive_manager +++ b/dietpi/dietpi-drive_manager @@ -704,7 +704,7 @@ Do you wish to ignore this warning, and, mount the drive regardless?" || return # Mount rootfs to tmp mount point to allow rsync # - rsync "-x" option prevents copying mounts content, but it copies permissions of mount point 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 filesystem dir, we copy from a temporary mount point to assure that underlying rootfs content matches 100%. - G_EXEC mkdir -p /tmp/tmp_rootfs + [[ -d '/tmp/tmp_rootfs' ]] || G_EXEC mkdir /tmp/tmp_rootfs G_EXEC mount "$G_ROOTFS_DEV" /tmp/tmp_rootfs # Start rsync @@ -712,7 +712,7 @@ Do you wish to ignore this warning, and, mount the drive regardless?" || return G_DIETPI-NOTIFY 1 'Rsync has failed, RootFS transfer has been aborted.' umount /tmp/tmp_rootfs - rmdir /tmp/tmp_rootfs + rmdir --ignore-fail-on-non-empty /tmp/tmp_rootfs return 1 fi diff --git a/dietpi/func/dietpi-set_hardware b/dietpi/func/dietpi-set_hardware index 0bbbca445d..d43f93a80e 100755 --- a/dietpi/func/dietpi-set_hardware +++ b/dietpi/func/dietpi-set_hardware @@ -1499,14 +1499,15 @@ Do you want to continue and DISABLE Bluetooth now?' || return 1 grep -q "console=$INPUT_ADDITIONAL" /boot/cmdline.txt || sed -i "/root=/s/[[:blank:]]*$/ console=$INPUT_ADDITIONAL,115200/" /boot/cmdline.txt - # - Odroid C2 legacy - elif [[ $G_HW_MODEL == 12 && -f '/boot/boot.ini' ]]; then + # - Odroid C1/C2 legacy + elif [[ $G_HW_MODEL == 1[02] && -f '/boot/boot.ini' ]]; then - local old= + local old firstline='ODROIDC2-UBOOT-CONFIG' + (( $G_HW_MODEL == 10 )) && firstline='ODROIDC-UBOOT-CONFIG' old=$(grep -Em1 '^[[:blank:]]*setenv[[:blank:]]+condev[[:blank:]]' /boot/boot.ini) || return 0 [[ $old == *"console=$INPUT_ADDITIONAL"* ]] && return 0 old=$(cut -d \" -f 2 <<< "$old") - G_CONFIG_INJECT 'setenv[[:blank:]]+condev[[:blank:]]' "setenv condev \"$old console=$INPUT_ADDITIONAL,115200n8\"" /boot/boot.ini 'ODROIDC2-UBOOT-CONFIG' + G_CONFIG_INJECT 'setenv[[:blank:]]+condev[[:blank:]]' "setenv condev \"$old console=$INPUT_ADDITIONAL,115200n8\"" /boot/boot.ini "$firstline" # - Odroid XU4 legacy elif [[ $G_HW_MODEL == 11 && -f '/boot/boot.ini' ]]; then From 8ac5ed7c6e6781f4a1f54441201268032ff28f5b Mon Sep 17 00:00:00 2001 From: MichaIng Date: Wed, 27 Apr 2022 19:28:42 +0200 Subject: [PATCH 40/59] v8.4 - DietPi-PREP | Satisfy shellcheck --- PREP_SYSTEM_FOR_DIETPI.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/PREP_SYSTEM_FOR_DIETPI.sh b/PREP_SYSTEM_FOR_DIETPI.sh index 50ae344c99..dfe7521e29 100755 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -501,6 +501,7 @@ _EOF_ G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/dietpi-initramfs_cleanup" /etc/kernel/postinst.d/dietpi-initramfs_cleanup G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/99-dietpi-uboot" /etc/initramfs/post-update.d/99-dietpi-uboot G_EXEC sed -i 's/arm64/arm/' /etc/initramfs/post-update.d/99-dietpi-uboot + # shellcheck disable=SC2016 G_EXEC sed -i '/^ln -sf/c\mv "/boot/uInitrd-$1" /boot/uInitrd' /etc/initramfs/post-update.d/99-dietpi-uboot # FAT filesystem does not support symlinks elif [[ $G_HW_MODEL == 11 && -f '/boot/boot.ini' && $(findmnt -Ufnro TARGET -t ext4 -T /boot) == '/' ]]; then From 3481c6bdc4e09d636e71802f6a2654f4644b1afe Mon Sep 17 00:00:00 2001 From: MichaIng Date: Wed, 27 Apr 2022 19:58:39 +0200 Subject: [PATCH 41/59] v8.4 + DietPi-PREP | Odroid C1/XU4: Fix image detection when it got built from scratch --- 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 dfe7521e29..a8ca53f57f 100755 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -491,7 +491,7 @@ _EOF_ # Boot in 64-bit mode if this is a 64-bit image [[ $G_HW_ARCH == 3 ]] && G_CONFIG_INJECT 'arm_64bit=' 'arm_64bit=1' /boot/config.txt - elif [[ $G_HW_MODEL == 10 && -f '/boot/boot.ini' && $(findmnt -t vfat -M /boot) ]]; then + elif [[ $G_HW_MODEL == 10 && $(findmnt -t vfat -M /boot) ]]; then # Temporary until boot U-Boot config got merged into master G_EXEC curl -sSfL 'https://raw.githubusercontent.com/MichaIng/DietPi/dev/.build/images/OdroidC1/boot.ini' -o /boot/boot.ini @@ -504,7 +504,7 @@ _EOF_ # shellcheck disable=SC2016 G_EXEC sed -i '/^ln -sf/c\mv "/boot/uInitrd-$1" /boot/uInitrd' /etc/initramfs/post-update.d/99-dietpi-uboot # FAT filesystem does not support symlinks - elif [[ $G_HW_MODEL == 11 && -f '/boot/boot.ini' && $(findmnt -Ufnro TARGET -t ext4 -T /boot) == '/' ]]; then + elif [[ $G_HW_MODEL == 11 && $(findmnt -Ufnro TARGET -t ext4 -T /boot) == '/' ]]; then # Temporary until boot U-Boot config got merged into master G_EXEC curl -sSfL 'https://raw.githubusercontent.com/MichaIng/DietPi/dev/.build/images/OdroidXU4/boot.ini' -o /boot/boot.ini From 3fd4846d73bc4be6134bb5f5452b47b6fd7ba710 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Wed, 27 Apr 2022 20:04:49 +0200 Subject: [PATCH 42/59] v8.4 - Odroid C1 | Remove logo from boot config --- .build/images/OdroidC1/boot.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.build/images/OdroidC1/boot.ini b/.build/images/OdroidC1/boot.ini index 44dda5b7c6..be0c62b3ae 100644 --- a/.build/images/OdroidC1/boot.ini +++ b/.build/images/OdroidC1/boot.ini @@ -80,7 +80,7 @@ if test "${cec}" = "1"; then setenv hdmi_cec "hdmitx=cecf"; fi if test "${disable_vu7}" = "false"; then setenv hid_quirks "usbhid.quirks=0x0eef:0x0005:0x0004"; fi # Boot arguments -setenv bootargs "root=UUID=0ae78c3b-9579-4a13-8b2d-58ad222f2ca6 rootfstype=ext4 rootwait rw ${condev} loglevel=4 no_console_suspend consoleblank=0 vdaccfg=0xa000 logo=osd1,loaded,0x7900000,720p,full dmfc=3 cvbsmode=576cvbs hdmimode=${m} m_bpp=${m_bpp} vout=${vout} ${disableuhs} ${hdmi_hpd} ${hdmi_cec} ${enabledac} monitor_onoff=${monitor_onoff} max_freq=${max_freq} ${hid_quirks} ${extraargs}" +setenv bootargs "root=UUID=0ae78c3b-9579-4a13-8b2d-58ad222f2ca6 rootfstype=ext4 rootwait rw ${condev} loglevel=4 no_console_suspend consoleblank=0 vdaccfg=0xa000 dmfc=3 cvbsmode=576cvbs hdmimode=${m} m_bpp=${m_bpp} vout=${vout} ${disableuhs} ${hdmi_hpd} ${hdmi_cec} ${enabledac} monitor_onoff=${monitor_onoff} max_freq=${max_freq} ${hid_quirks} ${extraargs}" # Booting fatload mmc 0:1 0x20800000 uImage From ce69a459ccf81f3896d1e0deeff7b7ba1faad2b0 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Thu, 28 Apr 2022 00:53:07 +0200 Subject: [PATCH 43/59] v8.4 - DietPi-PREP | Reorder device list --- PREP_SYSTEM_FOR_DIETPI.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/PREP_SYSTEM_FOR_DIETPI.sh b/PREP_SYSTEM_FOR_DIETPI.sh index a8ca53f57f..a71381cc4b 100755 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -326,12 +326,15 @@ _EOF_ G_WHIP_DEFAULT_ITEM=0 G_WHIP_MENU_ARRAY=( + '' '●─ x86_64 ' + '20' ': Virtual machine' + '21' ': Native PC' '' '●─ ARM ' '0' ': Raspberry Pi (all models)' #'0' ': Raspberry Pi 1 (256 MiB) #'1' ': Raspberry Pi 1/Zero (512 MiB)' #'2' ': Raspberry Pi 2' - #'3' ': Raspberry Pi 3/3+' + #'3' ': Raspberry Pi 3/3+/Zero 2 W' #'4' ': Raspberry Pi 4' '10' ': Odroid C1' '11' ': Odroid XU3/XU4/MC1/HC1/HC2' @@ -355,7 +358,7 @@ _EOF_ '64' ': NanoPi NEO Air' '63' ': NanoPi M1/T1' '66' ': NanoPi M1 Plus' - '61' ': NanoPi M2/T2' + '61' ': NanoPi M2/T2/Fire2' '62' ': NanoPi M3/T3/Fire3' '68' ': NanoPi M4/T4/NEO4' '58' ': NanoPi M4V2' @@ -367,19 +370,16 @@ _EOF_ '72' ': ROCK Pi 4' '73' ': ROCK Pi S' '74' ': Radxa Zero' - '' '●─ x86_64 ' - '21' ': x86_64 Native PC' - '20' ': x86_64 Virtual Machine' + '23' ': Generic Rockchip RK3328' + '24' ': Generic Rockchip RK3399' + '25' ': Generic Allwinner H3' + '26' ': Generic Allwinner H5' + '27' ': Generic Allwinner H6' + '28' ': Generic Amlogic S905' + '29' ': Generic Amlogic S922X' '' '●─ Other ' '75' ': Container image' - '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' + '22' ': Generic device' ) while : From 4745244d19a5cd50b84a2ef7ef516e1e065f3f0d Mon Sep 17 00:00:00 2001 From: MichaIng Date: Thu, 28 Apr 2022 00:58:47 +0200 Subject: [PATCH 44/59] v8.4 - RC up --- .update/version | 2 +- dietpi/func/dietpi-globals | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.update/version b/.update/version index b29a3e704e..23ffa6388a 100644 --- a/.update/version +++ b/.update/version @@ -3,7 +3,7 @@ # Available DietPi version G_REMOTE_VERSION_CORE=8 G_REMOTE_VERSION_SUB=4 -G_REMOTE_VERSION_RC=0 +G_REMOTE_VERSION_RC=1 # Minimum DietPi version to allow update G_MIN_VERSION_CORE=6 G_MIN_VERSION_SUB=14 diff --git a/dietpi/func/dietpi-globals b/dietpi/func/dietpi-globals index f2b8c16e3c..03f578670a 100644 --- a/dietpi/func/dietpi-globals +++ b/dietpi/func/dietpi-globals @@ -59,7 +59,7 @@ # - Assign defaults/code version as fallback [[ $G_DIETPI_VERSION_CORE ]] || G_DIETPI_VERSION_CORE=8 [[ $G_DIETPI_VERSION_SUB ]] || G_DIETPI_VERSION_SUB=4 - [[ $G_DIETPI_VERSION_RC ]] || G_DIETPI_VERSION_RC=0 + [[ $G_DIETPI_VERSION_RC ]] || G_DIETPI_VERSION_RC=1 [[ $G_GITBRANCH ]] || G_GITBRANCH='master' [[ $G_GITOWNER ]] || G_GITOWNER='MichaIng' # - Save current version and Git branch From 3d16ef8c108781e3ef2f90b641ec14be9fde9adf Mon Sep 17 00:00:00 2001 From: MichaIng Date: Thu, 28 Apr 2022 01:15:39 +0200 Subject: [PATCH 45/59] v8.4 - CHANGELOG | Set v8.4 release PR and fix one typo --- CHANGELOG.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 17f111f4ba..2ae588b032 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -22,11 +22,11 @@ Fixes: - DietPi-Config | Resolved an issue on RPi where disabling and re-enabling Bluetooth failed, since the hciuart.service cannot be restarted until reboot after it was stopped once. In the same turn, this also resolved an issue in DietPi-PREP where the service is still running after package removal, while trying to disabling it fails as of the missing service file. Many thanks to @Mausy5043 for reporting this issue: https://github.com/MichaIng/DietPi/issues/5435 - DietPi-Software | Chromium: Resolved an issue on Raspberry Pi Buster systems where the installation failed because of a syntax error. Many thanks to @bbmak for reporting this issue: https://dietpi.com/phpbb/viewtopic.php?t=10258 - DietPi-Software | Tor/Unbound: Resolved an issue where IPv6 usage was assumed only based on the dietpi.txt setting instead of on whether IPv6 can really be used for Internet connections. E.g. when a VPN connection is established, usually IPv6 is disabled to prevent IPv6 leaks, without changing the general dietpi.txt setting. Tor and Unbound service starts however fail then, trying to bind to the IPv6 port. If the adapter has an IPv6 address assigned, but no IPv6 default route, binding to the IPv6 port succeeds, but Internet connections via IPv6 are not possible, which isn't better. On the other hand, using IPv4 only while IPv6 is enabled, has no real downsides. Many thanks to @Wgsem for reporting this issue: https://github.com/MichaIng/DietPi/issues/5412 -- DietPi-Software | Python 3: Updated the workaround for ARMv6/7 Buster systems where installing numpy or any module which depends on numpy failed. It was accidentially applied only on Raspberry Pi 2 and earlier, while it should have been applied to all ARMv6/7 Buster systems. Additionally, all numpy >=0.21.5 versions are now blocked, since the recent v0.21.6 fails to compile for the same reason. +- DietPi-Software | Python 3: Updated the workaround for ARMv6/7 Buster systems where installing numpy or any module which depends on numpy failed. It was accidentally applied only on Raspberry Pi 2 and earlier, while it should have been applied to all ARMv6/7 Buster systems. Additionally, all numpy >=0.21.5 versions are now blocked, since the recent v0.21.6 fails to compile for the same reason. - DietPi-Software | Single File PHP Gallery: Resolved the failing installation since a new version is available and the old download link has become invalid. Many thanks to @dodo1967 for reporting this issue: https://github.com/MichaIng/DietPi/issues/5415 - DietPi-Software | WiFi Hotspot: Resolved an issue where the WiFi country code was not applied when the WiFi Hotspot was installed via automated first run setup. Many thanks to @matteocarnelos for reporting this issue: https://github.com/MichaIng/DietPi/issues/5407 -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 +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/5460 For all additional issues that may appear after release, please see the following link for active tickets: https://github.com/MichaIng/DietPi/issues From 37acc309438d51f7a6fc12c6ee3f4b106801fa6d Mon Sep 17 00:00:00 2001 From: MichaIng Date: Fri, 29 Apr 2022 13:39:07 +0200 Subject: [PATCH 46/59] v8.4 - DietPi-Globals | Minor --- dietpi/func/dietpi-globals | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/dietpi/func/dietpi-globals b/dietpi/func/dietpi-globals index 03f578670a..541f70057d 100644 --- a/dietpi/func/dietpi-globals +++ b/dietpi/func/dietpi-globals @@ -460,8 +460,8 @@ $grey───────────────────────── # G_WHIP_INIT # - Update target whiptail size, based on current screen dimensions # - $1 = input mode | 2: Z=G_WHIP_MENU_ARRAY 3: Z=G_WHIP_CHECKLIST_ARRAY - G_WHIP_INIT(){ - + G_WHIP_INIT() + { # Automagically set size of whiptail box and contents according to screen size and whiptail type local input_mode=$1 @@ -627,13 +627,12 @@ $grey───────────────────────── WHIP_SIZE_Y=$whip_lines_text fi - } # G_WHIP_MSG "message" # - Display a message from input string - G_WHIP_MSG(){ - + G_WHIP_MSG() + { local WHIP_MESSAGE=$* if [[ $G_INTERACTIVE == 1 ]]; then @@ -650,14 +649,13 @@ $grey───────────────────────── fi G_WHIP_DESTROY - } # G_WHIP_VIEWFILE "/path/to/file" # - Display content from input file # - Exit code: 1=file not found, else=file shown or noninteractive - G_WHIP_VIEWFILE(){ - + G_WHIP_VIEWFILE() + { local result=0 if [[ $G_INTERACTIVE == 1 ]]; then @@ -684,14 +682,13 @@ $grey───────────────────────── G_WHIP_DESTROY return "$result" - } # G_WHIP_YESNO "message" # - Prompt user for Yes/No | Ok/Cancel choice and return result # - Exit code: 0=Yes/Ok, else=No/Cancel or noninteractive - G_WHIP_YESNO(){ - + G_WHIP_YESNO() + { local result=1 default_no='--defaultno' [[ ${G_WHIP_DEFAULT_ITEM,,} == 'yes' || ${G_WHIP_DEFAULT_ITEM,,} == 'ok' ]] && result=0 default_no= @@ -707,14 +704,13 @@ $grey───────────────────────── G_WHIP_DESTROY return "$result" - } # G_WHIP_INPUTBOX "message" # - Prompt user to input text and save it to G_WHIP_RETURNED_VALUE # - Exit code: 0=input done, else=user cancelled or noninteractive - G_WHIP_INPUTBOX(){ - + G_WHIP_INPUTBOX() + { local result=1 unset -v G_WHIP_RETURNED_VALUE # in case left from last G_WHIP @@ -735,15 +731,14 @@ $grey───────────────────────── G_WHIP_DESTROY return "$result" - } # G_WHIP_PASSWORD "message" # - Prompt user to input password and save it in variable "result" # - Originating script must "unset result" after value has been handled for security reasons! # - Exit code: 0=input done + passwords match, else=noninteractive (Cancelling is disabled since no password in originating script can cause havoc!) - G_WHIP_PASSWORD(){ - + G_WHIP_PASSWORD() + { local return_value=1 unset -v result # in case left from last call @@ -767,7 +762,6 @@ $grey───────────────────────── G_WHIP_DESTROY return "$return_value" - } # G_WHIP_MENU "message" From 0090c71d47a25e08446668d2fb6bd15082092eab Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sat, 30 Apr 2022 20:49:21 +0200 Subject: [PATCH 47/59] v8.4 (#5464) - DietPi-Build | Move all image build related scripts and config into respective .build sub directory of the repository to clean up the parent dir - DietPi-PREP | Rename script to "DietPi-Installer", which better reflects what it is doing: installing DietPi on the Debian base image - DietPi-Installer | Remove support and configs for Meveric's legacy U-Boot images. All Ordoids have been moved to Armbian kernel for now --- config.txt => .build/images/RPi/config.txt | 0 .build/images/dietpi-build | 12 +- {.meta => .build/images}/dietpi-imager | 0 .../images/dietpi-installer | 131 +++----------- boot_c2.ini | 146 ---------------- boot_n2.ini | 163 ------------------ boot_xu4.ini | 95 ---------- dietpi/dietpi-drive_manager | 8 +- dietpi/func/dietpi-globals | 4 +- dietpi/func/dietpi-obtain_hw_model | 2 +- dietpi/func/dietpi-set_software | 2 +- 11 files changed, 40 insertions(+), 523 deletions(-) rename config.txt => .build/images/RPi/config.txt (100%) rename {.meta => .build/images}/dietpi-imager (100%) mode change 100755 => 100644 rename PREP_SYSTEM_FOR_DIETPI.sh => .build/images/dietpi-installer (94%) mode change 100755 => 100644 delete mode 100644 boot_c2.ini delete mode 100644 boot_n2.ini delete mode 100644 boot_xu4.ini diff --git a/config.txt b/.build/images/RPi/config.txt similarity index 100% rename from config.txt rename to .build/images/RPi/config.txt diff --git a/.build/images/dietpi-build b/.build/images/dietpi-build index a69f3f9bfd..d9d28e35f2 100755 --- a/.build/images/dietpi-build +++ b/.build/images/dietpi-build @@ -283,16 +283,16 @@ G_EXEC_OUTPUT=1 G_EXEC debootstrap --variant=minbase --exclude="gcc-7-base,gcc-8 G_EXEC rm -R rootfs/var/{cache/apt,lib/apt/lists}/* ########################################## -# DietPi-PREP +# DietPi-Installer ########################################## -# Create rc.local to automate DietPi-PREP +# Create rc.local to automate DietPi-Installer cat << _EOF_ > rootfs/etc/rc.local #!/bin/dash { infocmp "$TERM" > /dev/null 2>&1 || TERM='dumb' -echo '[ INFO ] Running DietPi-PREP...' +echo '[ INFO ] Running DietPi-Installer...' export GITOWNER='$GITOWNER' GITBRANCH='$GITBRANCH' HW_MODEL='$HW_MODEL' IMAGE_CREATOR=0 PREIMAGE_INFO='from scratch' WIFI_REQUIRED=$WIFI_REQUIRED DISTRO_TARGET=$DISTRO -bash -c "\$(curl -sSf 'https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH/PREP_SYSTEM_FOR_DIETPI.sh')" || poweroff +bash -c "\$(curl -sSf 'https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH/.build/images/dietpi-installer')" || poweroff _EOF_ # - VM: Generate tiny-initramfs with explicit kernel modules, as auto-detection doesn't work correctly within container and loop devices @@ -339,7 +339,7 @@ G_EXEC losetup -d "$FP_LOOP" # Do not pack and upload raw VM image if not explicitly requested [[ $VMTYPE && ! $VMTYPE =~ ^(raw|all)$ ]] && SHRINK_ONLY='On' || SHRINK_ONLY='Off' export FP_ROOT_DEV CLONING_TOOL OUTPUT_IMG_NAME MOUNT_IT='Off' SHRINK_ONLY -[[ $EDITION && $EDITION != 'all' ]] || bash -c "$(curl -sSf "https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH/.meta/dietpi-imager")" 'DietPi-Imager' "$OUTPUT_IMG_NAME.img" || exit 1 +[[ $EDITION && $EDITION != 'all' ]] || bash -c "$(curl -sSf "https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH/.build/images/dietpi-imager")" 'DietPi-Imager' "$OUTPUT_IMG_NAME.img" || exit 1 # Amiberry edition: Install automatically on first boot, enable autostart option and onboard audio on RPi if [[ $EDITION =~ ^(Amiberry|all)$ ]] @@ -377,7 +377,7 @@ then G_EXEC rmdir rootfs G_EXEC losetup -d "$FP_LOOP" - bash -c "$(curl -sSf "https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH/.meta/dietpi-imager")" 'DietPi-Imager' "$OUTPUT_IMG_NAME.img" || exit 1 + bash -c "$(curl -sSf "https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH/.build/images/dietpi-imager")" 'DietPi-Imager' "$OUTPUT_IMG_NAME.img" || exit 1 fi [[ $VMTYPE ]] || exit 0 diff --git a/.meta/dietpi-imager b/.build/images/dietpi-imager old mode 100755 new mode 100644 similarity index 100% rename from .meta/dietpi-imager rename to .build/images/dietpi-imager diff --git a/PREP_SYSTEM_FOR_DIETPI.sh b/.build/images/dietpi-installer old mode 100755 new mode 100644 similarity index 94% rename from PREP_SYSTEM_FOR_DIETPI.sh rename to .build/images/dietpi-installer index a71381cc4b..8c6f488a6a --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/.build/images/dietpi-installer @@ -1,7 +1,7 @@ #!/bin/bash { #------------------------------------------------------------------------------------------------ - # Optimise current Debian install and prepare for DietPi installation + # Install DietPi on any Debian system #------------------------------------------------------------------------------------------------ # REQUIREMENTS # - Currently running Debian Buster or above, ideally minimal, e.g. Raspberry Pi OS Lite-ish =)) @@ -27,7 +27,7 @@ #------------------------------------------------------------------------------------------------ # Core globals - G_PROGRAM_NAME='DietPi-PREP' + G_PROGRAM_NAME='DietPi-Installer' #------------------------------------------------------------------------------------------------ # Critical checks and requirements to run this script @@ -61,7 +61,7 @@ # Work inside /tmp tmpfs to reduce disk I/O and speed up download and unpacking # - Save full script path beforehand: https://github.com/MichaIng/DietPi/pull/2341#discussion_r241784962 - FP_PREP_SCRIPT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/$(basename "${BASH_SOURCE[0]}")" + FP_SCRIPT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/$(basename "${BASH_SOURCE[0]}")" cd /tmp || exit 1 # APT pre-configuration @@ -310,7 +310,7 @@ _EOF_ if [[ ! $PREIMAGE_INFO ]] then 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.' + 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, Armbian or "forum.odroid.com/viewtopic.php?t=123456" etc.\n\nNB: An entry is required.' then G_DIETPI-NOTIFY 1 'Exit selected. Aborting...\n' exit 0 @@ -483,11 +483,11 @@ _EOF_ G_DIETPI-NOTIFY 2 'Moving kernel and boot configuration to /boot' - # HW specific config.txt, boot.ini + # Hardware specific boot configs if (( $G_HW_MODEL < 10 )); then echo "root=PARTUUID=$(findmnt -Ufnro PARTUUID -M /) rootfstype=ext4 rootwait fsck.repair=yes net.ifnames=0 logo.nologo console=serial0,115200 console=tty1" > /boot/cmdline.txt - G_EXEC mv "DietPi-$G_GITBRANCH/config.txt" /boot/ + G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/RPi/config.txt" /boot/ # Boot in 64-bit mode if this is a 64-bit image [[ $G_HW_ARCH == 3 ]] && G_CONFIG_INJECT 'arm_64bit=' 'arm_64bit=1' /boot/config.txt @@ -523,20 +523,6 @@ _EOF_ G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/dietpi-initramfs_cleanup" /etc/kernel/postinst.d/dietpi-initramfs_cleanup G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/99-dietpi-uboot" /etc/initramfs/post-update.d/99-dietpi-uboot - elif [[ $G_HW_MODEL == 11 && -f '/boot/boot.ini' && $(findmnt -t vfat -M /boot) ]]; then - - G_EXEC mv "DietPi-$G_GITBRANCH/boot_xu4.ini" /boot/boot.ini - G_EXEC sed -i "s/root=UUID=[^[:blank:]]*/root=UUID=$(findmnt -Ufnro UUID -M /)/" /boot/boot.ini - - elif [[ $G_HW_MODEL == 12 && -f '/boot/boot.ini' && $(findmnt -t vfat -M /boot) ]]; then - - G_EXEC mv "DietPi-$G_GITBRANCH/boot_c2.ini" /boot/boot.ini - - elif [[ $G_HW_MODEL == 15 && -f '/boot/boot.ini' && $(findmnt -t vfat -M /boot) ]]; then - - G_EXEC mv "DietPi-$G_GITBRANCH/boot_n2.ini" /boot/boot.ini - G_EXEC sed -i "s/root=UUID=[^[:blank:]]*/root=UUID=$(findmnt -Ufnro UUID -M /)/" /boot/boot.ini - fi G_EXEC mv "DietPi-$G_GITBRANCH/dietpi.txt" /boot/ @@ -589,9 +575,6 @@ _EOF_ # We need to forward $DISTRO_TARGET* to dietpi-set_software, as well as $G_HW_MODEL + $G_RASPBIAN for Debian vs Raspbian decision. G_DISTRO=$DISTRO_TARGET G_DISTRO_NAME=$DISTRO_TARGET_NAME G_HW_MODEL=$G_HW_MODEL G_RASPBIAN=$G_RASPBIAN G_EXEC /boot/dietpi/func/dietpi-set_software apt-mirror default - # Meveric: Update repo to use our own mirror: https://github.com/MichaIng/DietPi/issues/1519#issuecomment-368234302 - sed -Ei 's|https?://oph\.mdrjr\.net|https://dietpi.com|' /etc/apt/sources.list.d/meveric*.list &> /dev/null - # (Re)create DietPi runtime and logs dir, used by G_AGx G_EXEC mkdir -p /run/dietpi /var/tmp/dietpi/logs @@ -872,8 +855,8 @@ ln -sf "uInitrd-\$1" /boot/uInitrd > /dev/null 2>&1 || mv "/boot/uInitrd-\$1" /b exit 0 _EOF_ G_EXEC chmod +x /etc/initramfs/post-update.d/99-dietpi-uboot - G_EXEC mkdir -p /etc/kernel/preinst.d - cat << '_EOF_' > /etc/kernel/preinst.d/dietpi-initramfs_cleanup + G_EXEC mkdir -p /etc/kernel/postinst.d + cat << '_EOF_' > /etc/kernel/postinst.d/dietpi-initramfs_cleanup #!/bin/dash # Skip if initramfs-tools is not installed @@ -883,45 +866,32 @@ _EOF_ version="$1" if [ -z "$version" ] then - echo "W: initramfs-tools: ${DPKG_MAINTSCRIPT_PACKAGE:-kernel package} did not pass a version number" >&2 - exit 0 + echo "W: initramfs-tools: ${DPKG_MAINTSCRIPT_PACKAGE:-kernel package} did not pass a version number" >&2 + exit 0 fi # Avoid running multiple times if [ "$DEB_MAINT_PARAMS" ] then - eval set -- "$DEB_MAINT_PARAMS" - [ "$1" = 'upgrade' ] || exit 0 + eval set -- "$DEB_MAINT_PARAMS" + [ "$1" = 'upgrade' ] || exit 0 fi -_EOF_ - # Bullseye: initramfs-tools' /var/lib/initramfs-tools state directory is not used anymore - if (( $DISTRO_TARGET > 5 )) - then - cat << '_EOF_' >> /etc/kernel/preinst.d/dietpi-initramfs_cleanup -# Delete unused initrd images -find /boot -name 'initrd.img-*' -o -name 'uInitrd-*' ! -name "*-$version" -printf 'Removing obsolete file %f\n' -delete - -exit 0 -_EOF_ - else - cat << '_EOF_' >> /etc/kernel/preinst.d/dietpi-initramfs_cleanup -# Loop through existing initramfs images -for v in $(ls -1 /var/lib/initramfs-tools | linux-version sort --reverse); do - if ! linux-version compare $v eq $version; then - # Try to delete delete old initrd images via update-initramfs - INITRAMFS_TOOLS_KERNEL_HOOK=y update-initramfs -d -k $v 2>/dev/null - # Delete unused state files - find /var/lib/initramfs-tools -type f ! -name "$version" -printf 'Removing obsolete file %f\n' -delete - # Delete unused initrd images - find /boot -name 'initrd.img-*' -o -name 'uInitrd-*' ! -name "*-$version" -printf 'Removing obsolete file %f\n' -delete - fi +# Delete unused initramfs images +files="$(find /boot -maxdepth 1 -name 'initrd.img-*' -o -name 'uInitrd-*')" +for f in $files +do + [ -d "/lib/modules/${f#*-}" ] || continue + echo "Removing obsolete initramfs image: $f" + rm "$f" done exit 0 _EOF_ - fi - G_EXEC chmod +x /etc/kernel/preinst.d/dietpi-initramfs_cleanup + G_EXEC chmod +x /etc/kernel/postinst.d/dietpi-initramfs_cleanup + # Pre-v8.4 + [[ -f '/etc/kernel/preinst.d/dietpi-initramfs_cleanup' ]] && G_EXEC rm /etc/kernel/preinst.d/dietpi-initramfs_cleanup + [[ -d '/etc/kernel/preinst.d' ]] && G_EXEC rmdir --ignore-fail-on-non-empty /etc/kernel/preinst.d # Add Armbian repo key as dedicated file G_EXEC eval "curl -sSfL 'https://apt.armbian.com/armbian.key' | gpg --dearmor -o /etc/apt/trusted.gpg.d/dietpi-armbian.gpg --yes" @@ -931,6 +901,7 @@ _EOF_ [[ -f '/etc/apt/trusted.gpg~' ]] && G_EXEC rm '/etc/apt/trusted.gpg~' # Remove obsolete components from Armbian list and connect via HTTPS + G_EXEC rm /etc/apt/sources.list.d/* G_EXEC eval "echo 'deb http://apt.armbian.com/ ${DISTRO_TARGET_NAME/bookworm/bullseye} main' > /etc/apt/sources.list.d/armbian.list" # Exclude doubled device tree files, shipped with the kernel package @@ -954,50 +925,6 @@ _EOF_ [[ -f '/etc/apt/trusted.gpg' ]] && G_EXEC rm /etc/apt/trusted.gpg [[ -f '/etc/apt/trusted.gpg~' ]] && G_EXEC rm '/etc/apt/trusted.gpg~' - # - Odroid C4 legacy - elif (( $G_HW_MODEL == 16 )) && [[ $(find /etc/apt/sources.list.d -name 'meveric*.list') ]]; then - - 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 - - # Remove obsolete combined keyring - [[ -f '/etc/apt/trusted.gpg' ]] && G_EXEC rm /etc/apt/trusted.gpg - [[ -f '/etc/apt/trusted.gpg~' ]] && G_EXEC rm '/etc/apt/trusted.gpg~' - - # - Odroid N2 legacy - elif (( $G_HW_MODEL == 15 )) && [[ $(find /etc/apt/sources.list.d -name 'meveric*.list') ]]; then - - G_AGI linux-image-arm64-odroid-n2 meveric-keyring - - # 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 - - # Remove obsolete combined keyring - [[ -f '/etc/apt/trusted.gpg' ]] && G_EXEC rm /etc/apt/trusted.gpg - [[ -f '/etc/apt/trusted.gpg~' ]] && G_EXEC rm '/etc/apt/trusted.gpg~' - - # - Odroid C2 legacy - elif (( $G_HW_MODEL == 12 )) && [[ $(find /etc/apt/sources.list.d -name 'meveric*.list') ]]; then - - G_AGI linux-image-arm64-odroid-c2 meveric-keyring - - # Remove obsolete combined keyring - [[ -f '/etc/apt/trusted.gpg' ]] && G_EXEC rm /etc/apt/trusted.gpg - [[ -f '/etc/apt/trusted.gpg~' ]] && G_EXEC rm '/etc/apt/trusted.gpg~' - - # - Odroid XU3/XU4/MC1/HC1/HC2 legacy - elif (( $G_HW_MODEL == 11 )) && [[ $(find /etc/apt/sources.list.d -name 'meveric*.list') ]]; then - - G_AGI linux-image-4.14-armhf-odroid-xu4 meveric-keyring - - # Remove obsolete combined keyring - [[ -f '/etc/apt/trusted.gpg' ]] && G_EXEC rm /etc/apt/trusted.gpg - [[ -f '/etc/apt/trusted.gpg~' ]] && G_EXEC rm '/etc/apt/trusted.gpg~' - # - ROCK Pi S (official Radxa Debian image) elif (( $G_HW_MODEL == 73 )) && grep -q 'apt\.radxa\.com' /etc/apt/sources.list.d/*.list; then @@ -1215,8 +1142,6 @@ _EOF_ # - Stop, disable and remove not required 3rd party services local aservices=( - # Meveric - 'cpu_governor' # RPi 'sshswitch' # Radxa @@ -1293,10 +1218,6 @@ _EOF_ G_EXEC rm -f /etc/cron.*/openmediavault* G_EXEC rm -f /usr/sbin/omv-* - # - Meveric specific - [[ -f '/usr/local/sbin/setup-odroid' ]] && G_EXEC rm /usr/local/sbin/setup-odroid - G_EXEC rm -f /installed-packages*.txt - # - RPi specific: https://github.com/MichaIng/DietPi/issues/1631#issuecomment-373965406 [[ -f '/etc/profile.d/wifi-country.sh' ]] && G_EXEC rm /etc/profile.d/wifi-country.sh [[ -f '/etc/sudoers.d/010_pi-nopasswd' ]] && G_EXEC rm /etc/sudoers.d/010_pi-nopasswd @@ -1957,7 +1878,7 @@ _EOF_ rm -Rfv /{root,home/*}/.{bash_history,nano_history,wget-hsts,cache,local,config,gnupg,viminfo,dbus,gconf,nano,vim,zshrc,oh-my-zsh} /etc/*- /var/{cache/debconf,lib/dpkg}/*-old /var/lib/dhcp/{,.??,.[^.]}* # Remove PREP script - [[ -f $FP_PREP_SCRIPT ]] && G_EXEC rm -v "$FP_PREP_SCRIPT" + [[ -f $FP_SCRIPT ]] && G_EXEC rm -v "$FP_SCRIPT" sync @@ -1971,7 +1892,7 @@ _EOF_ G_DIETPI-NOTIFY 0 'Completed, disk can now be saved to .img for later use, or, reboot system to start first run of DietPi.' # shellcheck disable=SC2016 - G_DIETPI-NOTIFY 0 'To create an .img file, you can "poweroff" and run the following command from the host/external DietPi system:\n\t- bash -c "$(curl -sSfL https://raw.githubusercontent.com/MichaIng/DietPi/master/.meta/dietpi-imager)"' + G_DIETPI-NOTIFY 0 'To create an .img file, you can "poweroff" and run the following command from the host/external DietPi system:\n\t- bash -c "$(curl -sSfL https://raw.githubusercontent.com/MichaIng/DietPi/master/.build/images/dietpi-imager)"' } diff --git a/boot_c2.ini b/boot_c2.ini deleted file mode 100644 index f279aac47e..0000000000 --- a/boot_c2.ini +++ /dev/null @@ -1,146 +0,0 @@ -ODROIDC2-UBOOT-CONFIG - -# 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" - -# Custom modeline! -# To use custom modeline you need to disable the above resolution -# 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 mode: "dvi" or "vga" -#setenv vout "dvi" - -# 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" - -# 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: improves the video playback but breaks KVM/virtualization -# 0 = Arch Timer: allows KVM/virtualization to work but you'll experience poor video -setenv mesontimer "1" - -# 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" - -# 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 - -# Max CPU cores: "1", "2", "3" or "4" -setenv maxcpus "4" - -# Max CPU frequency in MHz: "1536" (default), "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} systemd.unified_cgroup_hierarchy=0" - -# Booting -setenv loadaddr "0x11000000" -setenv dtb_loadaddr "0x1000000" -setenv initrd_loadaddr "0x13000000" - -fatload mmc 0:1 ${initrd_loadaddr} uInitrd -fatload mmc 0:1 ${loadaddr} Image -fatload mmc 0:1 ${dtb_loadaddr} meson64_odroidc2.dtb -fdt addr ${dtb_loadaddr} - -if test "${mesontimer}" = "0"; then fdt rm /meson_timer; fdt rm /cpus/cpu@0/timer; fdt rm /cpus/cpu@1/timer; fdt rm /cpus/cpu@2/timer; fdt rm /cpus/cpu@3/timer; fi -if test "${mesontimer}" = "1"; then fdt rm /timer; fi - -if test "${nographics}" = "1"; then fdt rm /reserved-memory; fdt rm /aocec; fi -if test "${nographics}" = "1"; then fdt rm /meson-fb; fdt rm /amhdmitx; fdt rm /picdec; fdt rm /ppmgr; fi -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} diff --git a/boot_n2.ini b/boot_n2.ini deleted file mode 100644 index 14fb409691..0000000000 --- a/boot_n2.ini +++ /dev/null @@ -1,163 +0,0 @@ -ODROIDN2-UBOOT-CONFIG - -setenv board "odroidn2" - -# Boot/kernel messages to ttyS0 (serial) and tty1 (HDMI) -setenv condev "console=ttyS0,115200n8 console=tty1" - -# 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 -# ----------------------+------------- -# "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" - -# 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 -#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. -setenv overscan "100" - -# Output mode: "hdmi" or "dvi" -# "dvi" disables HDMI audio. -setenv voutmode "hdmi" - -# Disable HDMI hot-plug detection and force HDMI output: "false" or "true" -setenv disablehpd "false" - -# Disable Hardkernel ODROID-VU7 LCD support: "false" or "true" (default) -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 -# 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 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 - -# Apply CPU frequencies if assigned -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)" - -# Boot args -setenv bootargs "root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait ro fsck.repair=yes elevator=noop net.ifnames=0 ${condev} no_console_suspend consoleblank=0 logo=osd0,loaded systemd.unified_cgroup_hierarchy=0 hdmimode=${hdmimode} cvbsmode=${cvbsmode} maxcpus=${maxcpus} voutmode=${voutmode} disablehpd=${disablehpd} enable_wol=${enable_wol} sdrmode=${sdrmode} monitor_onoff=${monitor_onoff} overscan=${overscan} cvbscable=${cvbscable} ${hid_quirks} ${cec_enable} ${cmode} ${amlogic} ${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} - -# Load device tree overlays -if test "x${overlays}" != "x"; 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 -booti ${loadaddr} ${initrd_loadaddr} ${dtb_loadaddr} diff --git a/boot_xu4.ini b/boot_xu4.ini deleted file mode 100644 index 945327cad3..0000000000 --- a/boot_xu4.ini +++ /dev/null @@ -1,95 +0,0 @@ -ODROIDXU-UBOOT-CONFIG - -# U-Boot parameters -setenv initrd_high "0xffffffff" -setenv fdt_high "0xffffffff" - -# MAC address configuration -setenv macaddr "00:1e:06:61:7a:72" - -# Kernel command-line parameters -setenv bootrootfs "root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait ro console=ttySAC2,115200n8 console=tty1 consoleblank=0 fsck.repair=yes net.ifnames=0" - -# HDMI config -setenv videoconfig "drm_kms_helper.edid_firmware=edid/1920x1080.bin" - -# HDMI/DVI selection: "hdmi" or "dvi" -# - DVI mode disables HDMI sound -setenv vout "hdmi" - -# HDMI Hot Plug detection: "false" or "true" -# - "true" enables HDMI detection based on cable connection. -# - "false" disables auto-detection and forces HDMI output. -setenv HPD "true" - -# HDMI CEC: "false" or "true", defaults to "true" -#setenv cecenable "false" - -# ODROID-VU7 touchscreen: "false" or "true", defaults to "true" -#setenv disable_vu7 "false" - -# CPU governor -# - DietPi will override this setting to user configured in dietpi-config > Performance Options > CPU governor -setenv governor "performance" - -# DDR frequency [MHz]: "933", "825", "728" or "633", defaults to "825" -#setenv ddr_freq "933" - -# TMDS data amplitude control. -# - 1LSB corresponds to 20 mVdiff amplitude level -# - tx_amp_lvl : 0 = 760 mVdiff(Min), 31 = 1380 mVdiff(Max) -# - Hardkernel default: hdmi_tx_amp_lvl = 31(1380 mVdiff) -setenv hdmi_tx_amp_lvl "31" - -# TMDS data amplitude fine control for each channel -# - 1LSB corresponds to 20 mVdiff amplitude level -# - tx_lvl : 0 = 0 mVdiff(Min), 3 = 60 mVdiff(Max) -# - Hardkernel default: hdmi_tx_lvl_ch0=hdmi_tx_lvl_ch1=hdmi_tx_lvl_ch2 = 3 -setenv hdmi_tx_lvl_ch0 "3" -setenv hdmi_tx_lvl_ch1 "3" -setenv hdmi_tx_lvl_ch2 "3" - -# TMDS data pre-emphasis level control -# - 1LSB corresponds to -0.45dB emphasis level except for 1 -# - tx_emp_lvl : 0 = 0 db(Min), 1 = -0.25 db, 2 = 0.7 db, 15 = -7.45 db(Max) -# - Hardkernel default: hdmi_tx_emp_lvl = 6 (-2.50 db) -setenv hdmi_tx_emp_lvl "6" - -# TMDS clock amplitude control -# - 1LSB corresponds to 20 mVdiff amplitude level. -# - clk_amp_lvl : 0 = 790 mVdiff(Min), 31 = 1410 mVdiff(Max) -# - Hardkernel default hdmi_clk_amp_lvl = 31 (1410 mVdiff) -setenv hdmi_clk_amp_lvl "31" - -# TMDS data source termination resistor control -# - tx_res : 0 = Source Termination OFF(Min), 1 = 200 ohm, 2 = 300 ohm, 3 = 120 ohm(Max) -# - Hardkernel default hdmi_tx_res = 0 (Source Termination OFF) -setenv hdmi_tx_res "0" - -### DO NOT EDIT ANYTHING BELOW THIS LINE ### - -setenv hdmi_phy_control "hdmi_tx_amp_lvl=${hdmi_tx_amp_lvl} hdmi_tx_lvl_ch0=${hdmi_tx_lvl_ch0} hdmi_tx_lvl_ch1=${hdmi_tx_lvl_ch1} hdmi_tx_lvl_ch2=${hdmi_tx_lvl_ch2} hdmi_tx_emp_lvl=${hdmi_tx_emp_lvl} hdmi_clk_amp_lvl=${hdmi_clk_amp_lvl} hdmi_tx_res=${hdmi_tx_res} HPD=${HPD} vout=${vout}" - -# Load kernel, initrd and dtb in that sequence -fatload mmc 0:1 0x40008000 zImage -fatload mmc 0:1 0x42000000 uInitrd -if test "${board_name}" = "xu4"; then fatload mmc 0:1 0x44000000 exynos5422-odroidxu4.dtb; setenv fdtloaded "true"; fi -if test "${board_name}" = "xu3"; then fatload mmc 0:1 0x44000000 exynos5422-odroidxu3.dtb; setenv fdtloaded "true"; fi -if test "${board_name}" = "xu3l"; then fatload mmc 0:1 0x44000000 exynos5422-odroidxu3-lite.dtb; setenv fdtloaded "true"; fi -# Fallback to XU4 dtb if board was not detected -if test "x${board_name}" = "x"; then fatload mmc 0:1 0x44000000 exynos5422-odroidxu4.dtb; fi - -# Set FDT address -fdt addr 0x44000000 - -if test "${cecenable}" = "false"; then fdt rm /cec@101B0000; fi -if test "${disable_vu7}" = "false"; then setenv hid_quirks "usbhid.quirks=0x0eef:0x0005:0x0004"; fi - -# Set DDR frequency -if test "x${ddr_freq}" != "x"; then dmc "${ddr_freq}"; fi - -# Final boot args (DRM debugging: drm.debug=0xff) -setenv bootargs "${bootrootfs} ${videoconfig} smsc95xx.macaddr=${macaddr} governor=${governor} ${hdmi_phy_control} ${hid_quirks} systemd.unified_cgroup_hierarchy=0" - -# Boot the board -bootz 0x40008000 0x42000000 0x44000000 diff --git a/dietpi/dietpi-drive_manager b/dietpi/dietpi-drive_manager index b0c2659db6..f0e0f0c645 100755 --- a/dietpi/dietpi-drive_manager +++ b/dietpi/dietpi-drive_manager @@ -15,7 +15,7 @@ # - = Interactive menu # - 1 = Select an available drive mount which is then saved to: /tmp/dietpi-drive_manager_selmnt # - 3 = Scan for new drives and re-create fstab non-interactively, then exit - # - 4 = Reset /etc/fstab with currently attached local drives and /tmp + /var/log tmpfs mount. Used by: PREP_SYSTEM_FOR_DIETPI.sh + # - 4 = Reset /etc/fstab with currently attached local drives and /tmp + /var/log tmpfs mount. Used by: DietPi-Installer # #//////////////////////////////////// @@ -110,7 +110,7 @@ # Special mounts local swap_mounts tmpfs_mounts misc_mounts net_mounts - # Mode 4: Force reset/clean fstab (PREP) + # Mode 4: Force reset/clean fstab (DietPi-Installer) if (( $INPUT == 4 )); then local var_log_size=$(sed -n '/^[[:blank:]]*AUTO_SETUP_RAMLOG_MAXSIZE=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) @@ -1970,7 +1970,7 @@ _EOF_ # Mode 1: Select an active mount and return value, exits from within function (( $INPUT == 1 )) && Menu_Select_Mount_Location #----------------------------------------------------------------------------------- - # Offer to do a reboot if required as of missing kernel modules and not called for resetting fstab from PREP + # Offer to do a reboot if required as of missing kernel modules and not called for resetting fstab from DietPi-Installer if (( $INPUT != 4 )) && ! G_CHECK_KERNEL then G_WHIP_BUTTON_CANCEL_TEXT='Skip' G_WHIP_YESNO "[ INFO ] A reboot is recommended @@ -1983,7 +1983,7 @@ _EOF_ Init_Drives_and_Refresh #----------------------------------------------------------------------------------- # Mode 3: Scan for new drives, re-create fstab and exit - # Mode 4: Force fstab reset and exit (PREP) + # Mode 4: Force fstab reset and exit (DietPi-Installer) # Else : Run menus [[ $INPUT == [34] ]] || until (( $TARGETMENUID < 0 )) do diff --git a/dietpi/func/dietpi-globals b/dietpi/func/dietpi-globals index 541f70057d..8e4034e8dd 100644 --- a/dietpi/func/dietpi-globals +++ b/dietpi/func/dietpi-globals @@ -47,7 +47,7 @@ # - This variable is not pre-generated but checked via: [[ $G_DIETPI_SERVICES_DISABLE == 1 ]] #[[ $G_DIETPI_SERVICES_DISABLE == [01] ]] || G_DIETPI_SERVICES_DISABLE=0 - # DietPi first boot setup stage: -2 = PREP_SYSTEM/Unknown | -1 = 1st boot | 0 = 1st run dietpi-update | 1 = 1st run dietpi-software | 2 = completed | 10 = Pre-installed image, converts to 2 during 1st boot + # DietPi first boot setup stage: -2 = DietPi-Installer/Unknown | -1 = 1st boot | 0 = 1st run dietpi-update | 1 = 1st run dietpi-software | 2 = completed | 10 = Pre-installed image, converts to 2 during 1st boot [[ -f '/boot/dietpi/.install_stage' ]] && G_DIETPI_INSTALL_STAGE=$( /dev/null || G_WHIP_MENU_ARRAY+=('DietPi-Config' ': Edit network, APT/NTP mirror settings etc') G_WHIP_MENU_ARRAY+=('Open subshell' ': Open a subshell to investigate or solve the issue') # Allow to send bug report, if it was produced by one of our scripts - [[ ${G_PROGRAM_NAME,,} == 'dietpi-'* && $G_PROGRAM_NAME != 'DietPi-PREP' ]] && G_WHIP_MENU_ARRAY+=('Send report' ': Uploads bugreport containing system info to DietPi') + [[ ${G_PROGRAM_NAME,,} == 'dietpi-'* && $G_PROGRAM_NAME != 'DietPi-Installer' ]] && G_WHIP_MENU_ARRAY+=('Send report' ': Uploads bugreport containing system info to DietPi') G_WHIP_MENU_ARRAY+=('' '●─ Devs only ') G_WHIP_MENU_ARRAY+=('Change command' ': Adjust and rerun the command') diff --git a/dietpi/func/dietpi-obtain_hw_model b/dietpi/func/dietpi-obtain_hw_model index b14b47c6ea..d82da43760 100755 --- a/dietpi/func/dietpi-obtain_hw_model +++ b/dietpi/func/dietpi-obtain_hw_model @@ -300,7 +300,7 @@ } - # NB: PLEASE ENSURE HW_MODEL INDEX ENTRIES MATCH : PREP, dietpi-obtain_hw_model, dietpi-survey_results, + # NB: PLEASE ENSURE HW_MODEL INDEX ENTRIES MATCH : dietpi-installer, 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) Obtain_HW_Info(){ diff --git a/dietpi/func/dietpi-set_software b/dietpi/func/dietpi-set_software index c739390511..7d2d1d178e 100755 --- a/dietpi/func/dietpi-set_software +++ b/dietpi/func/dietpi-set_software @@ -393,7 +393,7 @@ deb $INPUT_MODE_VALUE $G_DISTRO_NAME-backports main contrib non-free' > /etc/apt GLOBAL_PW=$(openssl enc -d -a -md sha256 -aes-256-cbc -iter 10000 -salt -pass pass:'DietPiRocks!' -in /var/lib/dietpi/dietpi-software/.GLOBAL_PW.bin) - # - DietPi-PREP, 1st run setup or user cancelled manual password choice + # - DietPi-Installer, 1st run setup or user cancelled manual password choice else GLOBAL_PW=$(sed -n '/^[[:blank:]]*AUTO_SETUP_GLOBAL_PASSWORD=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) From 27c00d58833e3253058b7fec6e30c026865e3af6 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sat, 30 Apr 2022 20:57:05 +0200 Subject: [PATCH 48/59] v8.4 (#5465) - OpenBazaar | This software option has been removed from DietPi. The original project has been officially abandoned a while ago and a fork we recently switched to sadly doesn't show any activity anymore, leaving broken installs on ARM and no fully compatible clients. Since we really like the approach, as fast as there is a reliable and trustable revival of OpenBazaar, we will re-implement it, but for now it simply isn't functional. If you have OpenBazaar still installed on your DietPi system, see here for ways to uninstall it: https://github.com/MichaIng/DietPi/pull/5465 --- .meta/dietpi-survey_report | 1 + CHANGELOG.txt | 3 + README.md | 1 - dietpi/dietpi-software | 121 ------------------------------------- 4 files changed, 4 insertions(+), 122 deletions(-) diff --git a/.meta/dietpi-survey_report b/.meta/dietpi-survey_report index 26187663d3..68cf082625 100755 --- a/.meta/dietpi-survey_report +++ b/.meta/dietpi-survey_report @@ -609,6 +609,7 @@ shopt -s extglob do aSOFTWARE_NAME8_4[$i]=${aSOFTWARE_NAME8_3[$i]} done + unset -v 'aSOFTWARE_NAME8_4[58]' # OpenBazaar # Pre-create software counter array so that we can see also software (available in newest version) with 0 installs for i in "${aSOFTWARE_NAME8_4[@]}" diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 2ae588b032..30b8ff0853 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -5,6 +5,9 @@ New images: - NanoPi M2/T2/Fire2 | We updated our NanoPi 2 series image to be shipped with Linux 4.4, the latest Linux version for the S5P4418 SoC, provided by FriendlyELEC. It is compatible will all FriendlyELEC S5P4418 SBCs: NanoPi 2, NanoPi M2, NanoPC T2, NanoPi Fire2A, NanoPi 2 Fire and NanoPi S2. Sadly systems running the old image cannot be upgraded, since the new U-Boot requires more space and hence a different partitioning. The new image ships with two scripts to flash U-Boot and to change the U-Boot environment/config: One can now edit /boot/u-boot/env.txt and apply the changes by running /boot/u-boot/flash_env.sh. Run fw_printenv to see the current U-Boot environment, also to get an idea of available settings. Kernel, U-Boot, firmware and these scripts are installed as part of a self-hosted "firmware-nanopi2" package. The kernel sources can be found at https://github.com/friendlyarm/linux/tree/nanopi2-v4.4.y, so that headers can be compiled. We will probably provide a kernel headers package as well, if there is a demand, e.g. to enable the DKMS-based WireGuard VPN server software option. - Odroid XU4 | We updated our Odroid XU4 image to be shipped with Linux 5.4. Sadly systems running the old image cannot be upgraded, since the new U-Boot config requires a single ext4 partition without a dedicated boot partition. +Removed software: +- OpenBazaar | This software option has been removed from DietPi. The original project has been officially abandoned a while ago and a fork we recently switched to sadly doesn't show any activity anymore, leaving broken installs on ARM and no fully compatible clients. Since we really like the approach, as fast as there is a reliable and trustable revival of OpenBazaar, we will re-implement it, but for now it simply isn't functional. If you have OpenBazaar still installed on your DietPi system, see here for ways to uninstall it: https://github.com/MichaIng/DietPi/pull/5465 + CLI changes: - DietPi-Set_software | The "apt-cache" command has been renamed to "apt" to better reflect its options, which do not cover the APT cache only, but APT lists and the location of the downloaded package archive as well. For backwards compatibility, "apt-cache" however remains valid for now. diff --git a/README.md b/README.md index 672e473d74..396d177d9d 100644 --- a/README.md +++ b/README.md @@ -265,7 +265,6 @@ Links to hardware and software manufacturers, sources and build instructions use - [Shairport-Sync](https://github.com/mikebrady/shairport-sync) - [FreshRSS](https://github.com/FreshRSS/FreshRSS) - [Folding@Home](https://github.com/FoldingAtHome) -- [OpenBazaar](https://github.com/OpenBazaar/openbazaar-go) - [Medusa](https://github.com/pymedusa/Medusa) - [Grafana](https://github.com/grafana/grafana) - [Clonezilla](https://gitlab.com/stevenshiau/clonezilla) diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index a96c104a25..1508c7e01d 100755 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -966,15 +966,6 @@ Available commands: aSOFTWARE_DOCS[$software_id]='https://dietpi.com/docs/software/social/#baikal' aSOFTWARE_DEPS[$software_id]='88 89 webserver' #------------------ - software_id=58 - aSOFTWARE_NAME[$software_id]='OpenBazaar' - aSOFTWARE_DESC[$software_id]='Decentralised peer-to-peer Bitcoin marketplace' - aSOFTWARE_CATX[$software_id]=6 - aSOFTWARE_DOCS[$software_id]='https://dietpi.com/docs/software/social/#openbazaar' - # x86_64 uses pre-compiled binaries, ARM requires Go for compiling - (( $G_HW_ARCH == 10 )) || aSOFTWARE_DEPS[$software_id]+='188' - aSOFTWARE_INTERACTIVE[$software_id]=1 - #------------------ software_id=125 aSOFTWARE_NAME[$software_id]='Synapse' aSOFTWARE_DESC[$software_id]='Matrix homeserver implementation' @@ -4253,96 +4244,6 @@ _EOF_ fi - software_id=58 # OpenBazaar - if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then - - Banner_Installing - - # Pre-v7.1 reinstall: Remove old non-module install - command -v go > /dev/null && GO111MODULE='off' GOPATH='/mnt/dietpi_userdata/go' G_EXEC_NOEXIT=1 G_EXEC go clean -i github.com/OpenBazaar... - [[ -f '/mnt/dietpi_userdata/go/bin/openbazaar-go' ]] && G_EXEC_NOEXIT=1 G_EXEC rm /mnt/dietpi_userdata/go/bin/openbazaar-go - [[ -d '/mnt/dietpi_userdata/go/src/github.com/OpenBazaar' ]] && G_EXEC_NOEXIT=1 G_EXEC rm -R /mnt/dietpi_userdata/go/src/github.com/OpenBazaar - [[ -d '/mnt/dietpi_userdata/go/src/github.com' ]] && G_EXEC_NOEXIT=1 G_EXEC rmdir --ignore-fail-on-non-empty /mnt/dietpi_userdata/go/src/github.com - [[ -d '/etc/openbazaar-server' ]] && G_EXEC_NOEXIT=1 G_EXEC rm -R /etc/openbazaar-server # Pre-v6.15 - - # x86_64: Download pre-compiled binary - if (( $G_HW_ARCH == 10 )) - then - local fallback_url='https://github.com/mobazha/openbazaar-desktop/releases/download/v2.4.12/openbazaar-go-linux-amd64' - Download_Install "$(curl -sSfL 'https://api.github.com/repos/mobazha/openbazaar-desktop/releases/latest' | mawk -F\" '/"browser_download_url": ".*\/openbazaar-go-linux-amd64"/{print $4}')" - command -v strip > /dev/null && G_EXEC strip --remove-section=.comment --remove-section=.note openbazaar-go-linux-amd64 - G_EXEC mv openbazaar-go-linux-amd64 /usr/local/bin/openbazaar-go - G_EXEC chmod +x /usr/local/bin/openbazaar-go - - # ARM: Go build required - else - # OpenBazaar cannot be installed in module mode yet: https://github.com/OpenBazaar/openbazaar-go/issues/2072 - G_AGI gcc libc6-dev - # Build it in legacy mode in tmpfs and move only binary in place - G_EXEC cd "$G_WORKING_DIR" # Failsafe - GO111MODULE=off GOPATH=$PWD HOME=$PWD G_EXEC_OUTPUT=1 G_EXEC go get -v github.com/mobazha/openbazaar-go - G_EXEC strip --remove-section=.comment --remove-section=.note bin/openbazaar-go - G_EXEC mv bin/openbazaar-go /usr/local/bin/openbazaar-go - G_EXEC_NOHALT=1 G_EXEC rm -Rf .cache src bin - fi - - # Init OpenBazaar to have config file available, if not yet the case, and edit to allow remote client access - if [[ ! -f '/mnt/dietpi_userdata/openbazaar/config' ]] - then - # Data dir - [[ -d '/mnt/dietpi_userdata/openbazaar' ]] || G_EXEC mkdir /mnt/dietpi_userdata/openbazaar - - G_EXEC_OUTPUT=1 G_EXEC openbazaar-go init -d /mnt/dietpi_userdata/openbazaar - - # Add current IPv4 address as gateway to allow external client connection - G_CONFIG_INJECT '"Gateway": "' " \"Gateway\": \"/ip4/$(G_GET_NET -4 ip)/tcp/4002\"," /mnt/dietpi_userdata/openbazaar/config - - # Client connection credentials - G_DIETPI-NOTIFY 2 "Please enter username and password for your ${aSOFTWARE_NAME[$software_id]} client connection:" - G_EXEC_OUTPUT=1 G_EXEC openbazaar-go setapicreds -d /mnt/dietpi_userdata/openbazaar - - # Client IP needs to be added to allowed IP list - local ob_client_ip='' invalid_entry='' - while : - do - if G_WHIP_INPUTBOX "${invalid_entry}Please enter the IPv4 address of your ${aSOFTWARE_NAME[$software_id]} client machine. -\nThis is required, since the ${aSOFTWARE_NAME[$software_id]} server node by default does not allow any remote connection." && [[ $G_WHIP_RETURNED_VALUE =~ ^[0-9]+'.'[0-9]+'.'[0-9]+'.'[0-9]+$ ]] - then - ob_client_ip=$G_WHIP_RETURNED_VALUE - break - else - invalid_entry='[FAILED] Please enter a valid IPv4 address.\n\n' - fi - done - G_CONFIG_INJECT '"AllowedIPs":' " \"AllowedIPs\": [\"$ob_client_ip\"]," /mnt/dietpi_userdata/openbazaar/config - else - G_DIETPI-NOTIFY 2 "Existing ${aSOFTWARE_NAME[$software_id]} config found. Skipping pre-configuration..." - fi - - # User - Create_User -d /mnt/dietpi_userdata/openbazaar openbazaar - - # Service - cat << '_EOF_' > /etc/systemd/system/openbazaar.service -[Unit] -Description=OpenBazaar (DietPi) -Documentation=https://docs.openbazaar.org/ -Wants=network-online.target -After=network-online.target - -[Service] -User=openbazaar -WorkingDirectory=/mnt/dietpi_userdata/openbazaar -ExecStart=/usr/local/bin/openbazaar-go start -d /mnt/dietpi_userdata/openbazaar -f -l notice - -[Install] -WantedBy=multi-user.target -_EOF_ - # Permissions - G_EXEC chown -R openbazaar:openbazaar /mnt/dietpi_userdata/openbazaar - - fi - software_id=133 # YaCy if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then @@ -14453,28 +14354,6 @@ _EOF_ fi - software_id=58 # OpenBazaar - if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )) - then - Banner_Uninstalling - if [[ -f '/etc/systemd/system/openbazaar.service' ]] - then - G_EXEC systemctl disable --now openbazaar - G_EXEC rm /etc/systemd/system/openbazaar.service - fi - [[ -d '/etc/systemd/system/openbazaar.service.d' ]] && G_EXEC rm -R /etc/systemd/system/openbazaar.service.d - getent passwd openbazaar > /dev/null && G_EXEC userdel openbazaar - getent group openbazaar > /dev/null && G_EXEC groupdel openbazaar - [[ -f '/usr/local/bin/openbazaar-go' ]] && G_EXEC rm /usr/local/bin/openbazaar-go - [[ -d '/mnt/dietpi_userdata/openbazaar' ]] && G_EXEC rm -R /mnt/dietpi_userdata/openbazaar - # Pre-v7.1 - command -v go > /dev/null && GO111MODULE='off' GOPATH='/mnt/dietpi_userdata/go' G_EXEC_NOEXIT=1 G_EXEC go clean -i github.com/OpenBazaar... - [[ -f '/mnt/dietpi_userdata/go/bin/openbazaar-go' ]] && G_EXEC rm /mnt/dietpi_userdata/go/bin/openbazaar-go - [[ -d '/mnt/dietpi_userdata/go/src/github.com/OpenBazaar' ]] && G_EXEC rm -R /mnt/dietpi_userdata/go/src/github.com/OpenBazaar - [[ -d '/mnt/dietpi_userdata/go/src/github.com' ]] && G_EXEC rmdir --ignore-fail-on-non-empty /mnt/dietpi_userdata/go/src/github.com - [[ -d '/etc/openbazaar-server' ]] && G_EXEC rm -R /etc/openbazaar-server # Pre-v6.15 - fi - software_id=42 # Plex Media Server if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then From 17c4e17a680988fb196d4f7cab0307330c8c2348 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sat, 30 Apr 2022 21:06:42 +0200 Subject: [PATCH 49/59] v8.4 - DietPi-Patches | Remove obsolete OpenBazaar install state --- .update/patches | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.update/patches b/.update/patches index d14cb356af..8e16473a8c 100755 --- a/.update/patches +++ b/.update/patches @@ -741,6 +741,9 @@ Patch_8_4() G_EXEC systemctl daemon-reload G_EXEC systemctl restart haveged fi + + # Remove obsolete OpenBazaar install state + [[ -f '/boot/dietpi/.installed' ]] && grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[58\]=' /boot/dietpi/.installed && G_EXEC sed -i '/^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[58\]=/d' /boot/dietpi/.installed } # v6.35 => v7 migration From 5bbeb50ae8522a8632461904a1c98e31ada5171d Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sat, 30 Apr 2022 21:29:49 +0200 Subject: [PATCH 50/59] v8.4 - DietPi-Software | Make the serial console prompt on first run setup more informative, but with a clearer statement that it is safe to disable it when unsure what it is. --- dietpi/dietpi-software | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index 1508c7e01d..3ef30794a0 100755 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -15818,10 +15818,11 @@ This requires an account at: https://remote.it/ # Disable serial console? if (( $G_HW_MODEL != 75 )) && ! grep -q '^[[:blank:]]*CONFIG_SERIAL_CONSOLE_ENABLE=0' /boot/dietpi.txt && [[ ! $(readlink -f /proc/$$/fd/1) =~ ^/dev/tty(S|AMA|SAC|AML|SC)[0-9]$ ]] && - G_WHIP_YESNO 'A serial console is currently enabled, would you like to disable it? - - Disabling the serial console will reduce memory consumption slightly. - - If you are unsure what a serial console is, it is safe to disable it. - - But if this is a headless device and it is difficult or impossible to attach a screen and keyboard, we recommend to leave it enabled so that you can debug and fix early boot issues or when the network/SSH server is not coming up. All you need is a serial USB adapter cable and a notebook with e.g. PuTTY.' + G_WHIP_BUTTON_OK_TEXT='Yes' G_WHIP_BUTTON_CANCEL_TEXT='No' G_WHIP_YESNO 'A serial/UART console is currently enabled, would you like to disable it? +\nTL;DR: If you do not know what a UART device or a serial console is, it is safe to select "Yes", which frees some MiB memory by stopping the related process(es). +\nA serial console is a way to interact with a system without any screen or network (SSH) required, but from another system physically connected. It is accessed with a UART adapter cable (often UART-to-USB), connected to a special UART port or GPIO pins. It can then be accessed via COM port from the attached system with a serial console client, e.g. PuTTY (which supports both, SSH and serial console access). +\nAnother benefit is that you can view early boot logs, before network or even screen output is up, which makes it a great way to debug issues with the bootloader or kernel. However, to allow as well common user logins via serial console, at least one additional login prompt process is running, which you may want to avoid when not using this feature at all. +\nSerial consoles can re-enabled at any time via dietpi-config > Advanced Options > Serial/UART' then /boot/dietpi/func/dietpi-set_hardware serialconsole disable fi From 11e255ad7e5f1b1af9844d4e9af913cdbeded172 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sat, 30 Apr 2022 22:11:06 +0200 Subject: [PATCH 51/59] v8.4 - DietPi-Build | Add support for generating RPi and Sparky SBC images with pre-installed Allo GUI --- .build/images/dietpi-build | 114 +++++++++++++++++++++++++++++++++++-- 1 file changed, 109 insertions(+), 5 deletions(-) diff --git a/.build/images/dietpi-build b/.build/images/dietpi-build index d9d28e35f2..96de1e10a6 100755 --- a/.build/images/dietpi-build +++ b/.build/images/dietpi-build @@ -84,14 +84,15 @@ esac if [[ $VMTYPE ]] then - [[ $HW_MODEL == 20 ]] || { G_DIETPI-NOTIFY 1 "Invalid option \"-v\" (virtual machine type) for hardware model \"$HW_MODEL\", aborting..."; exit 1; } + [[ $HW_MODEL == 20 ]] || { G_DIETPI-NOTIFY 1 "Unsupported option \"-v\" (virtual machine type) for hardware model \"$HW_MODEL\" pased, aborting..."; exit 1; } [[ $VMTYPE =~ ^(raw|vbox|vmware|esxi|hyperv|utm|parallels|proxmox|all)$ ]] || { G_DIETPI-NOTIFY 1 "Invalid virtual machine type \"$VMTYPE\" passed, aborting..."; exit 1; } fi if [[ $EDITION ]] then - [[ $HW_MODEL == 0 ]] || { G_DIETPI-NOTIFY 1 "Invalid option \"-e\" (edition) for hardware model \"$HW_MODEL\", aborting..."; exit 1; } - [[ $EDITION =~ ^(Amiberry|all)$ ]] || { G_DIETPI-NOTIFY 1 "Invalid edition \"$EDITION\" passed, aborting..."; exit 1; } + [[ $HW_MODEL == 0 || $HW_MODEL == 70 ]] || { G_DIETPI-NOTIFY 1 "Unsupported option \"-e\" (edition) for hardware model \"$HW_MODEL\" passed, aborting..."; exit 1; } + [[ $EDITION =~ ^(Amiberry|AlloGUI|all)$ ]] || { G_DIETPI-NOTIFY 1 "Invalid edition \"$EDITION\" passed, aborting..."; exit 1; } + [[ $EDITION == 'AlloGUI' || $HW_MODEL == 0 ]] || { G_DIETPI-NOTIFY 1 "Unsupported edition \"$EDITION\" for hardware model \"$HW_MODEL\" passed, aborting..."; exit 1; } fi # Check for valid target architecture and set variables accordingly @@ -324,6 +325,8 @@ fi abind=() [[ -b ${FP_LOOP}p2 ]] && abind=("--bind=${FP_LOOP}p2") systemd-nspawn -bD rootfs --bind="$FP_LOOP"{,p1} "${abind[@]}" --bind=/dev/disk || exit 1 +(( $mask_dbus )) && { G_EXEC systemctl mask --now dbus dbus.socket && mask_dbus=0; } + [[ -f 'rootfs/success' ]] || { G_DIETPI-NOTIFY 1 'The container setup did not finish successfully, aborting...'; exit 1; } G_EXEC rm rootfs/success G_EXEC sync @@ -331,7 +334,6 @@ G_EXEC sleep 1 G_EXEC umount -R rootfs G_EXEC rmdir rootfs G_EXEC losetup -d "$FP_LOOP" -(( $mask_dbus )) && { G_EXEC systemctl mask --now dbus dbus.socket && mask_dbus=0; } ########################################## # DietPi-Imager @@ -341,7 +343,7 @@ G_EXEC losetup -d "$FP_LOOP" export FP_ROOT_DEV CLONING_TOOL OUTPUT_IMG_NAME MOUNT_IT='Off' SHRINK_ONLY [[ $EDITION && $EDITION != 'all' ]] || bash -c "$(curl -sSf "https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH/.build/images/dietpi-imager")" 'DietPi-Imager' "$OUTPUT_IMG_NAME.img" || exit 1 -# Amiberry edition: Install automatically on first boot, enable autostart option and onboard audio on RPi +# Amiberry edition: Install automatically on first boot, enable autostart option and onboard audio on RPi if [[ $EDITION =~ ^(Amiberry|all)$ ]] then G_EXEC mv "$OUTPUT_IMG_NAME.img" "${OUTPUT_IMG_NAME}_Amiberry.img" @@ -377,6 +379,108 @@ then G_EXEC rmdir rootfs G_EXEC losetup -d "$FP_LOOP" + bash -c "$(curl -sSf "https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH/.build/images/dietpi-imager")" 'DietPi-Imager' "$OUTPUT_IMG_NAME.img" || exit 1 + +# AlloGUI edition: Pre-install Allo GUI with all managed audiophile software +elif [[ $EDITION =~ ^(AlloGUI|all)$ ]] +then + G_EXEC mv "$OUTPUT_IMG_NAME.img" "${OUTPUT_IMG_NAME%_Amiberry}_AlloGUI.img" + OUTPUT_IMG_NAME="${OUTPUT_IMG_NAME%_Amiberry}_AlloGUI" + + # Create loop device + FP_LOOP=$(losetup -f) + G_EXEC losetup "$FP_LOOP" "$OUTPUT_IMG_NAME.img" + G_EXEC partprobe "$FP_LOOP" + G_EXEC partx -u "$FP_LOOP" + + # Mount filesystems + G_EXEC mkdir rootfs + if (( $boot_size )) + then + G_EXEC mount "${FP_LOOP}p2" rootfs + G_EXEC mount "${FP_LOOP}p1" rootfs/boot + else + G_EXEC mount "${FP_LOOP}p1" rootfs + fi + + # Install Allo GUI via automated first run setup right here + G_EXEC sed -i '/^AUTO_SETUP_AUTOMATED=/c\AUTO_SETUP_AUTOMATED=1' rootfs/boot/dietpi.txt + G_EXEC sed -i '/^#AUTO_SETUP_INSTALL_SOFTWARE_ID=/c\AUTO_SETUP_INSTALL_SOFTWARE_ID=159' rootfs/boot/dietpi.txt + # Revert autostart option, in case Amiberry image was generated before + G_EXEC sed -i '/^AUTO_SETUP_AUTOSTART_TARGET_INDEX=/c\AUTO_SETUP_AUTOSTART_TARGET_INDEX=0' rootfs/boot/dietpi.txt + + # Generate automation custom script for first boot and cleanup steps + cat << '_EOF_' > rootfs/boot/Automation_Custom_Script.sh +#!/bin/bash +{ +. /boot/dietpi/func/dietpi-globals +/boot/dietpi/dietpi-services stop + +# RPi +if (( $G_HW_MODEL < 10 )) +then + /boot/dietpi/func/dietpi-set_hardware serialconsole 0 ttyAMA0 + systemctl mask serial-getty@ttyAMA0 + /boot/dietpi/func/dietpi-set_hardware serialconsole 0 ttyS0 + systemctl mask serial-getty@ttyS0 + /boot/dietpi/func/dietpi-set_hardware serialconsole 1 serial0 + +# Sparky SBC +else + /boot/dietpi/func/dietpi-set_hardware serialconsole 0 +fi + +# FirstBoot +G_CONFIG_INJECT 'SURVEY_OPTED_IN=' 'SURVEY_OPTED_IN=-1' /boot/dietpi.txt +G_EXEC systemctl enable dietpi-fs_partition_resize +G_EXEC eval 'echo 10 > /boot/dietpi/.install_stage' + +# Cleanup +/boot/dietpi/func/dietpi-logclear 2 +G_EXEC systemctl stop dietpi-ramlog +G_EXEC rm -R /var/tmp/dietpi/logs +/boot/dietpi/func/dietpi-set_software apt-cache clean +G_EXEC rm /boot/dietpi/.{hw_model,dietpi-services_include_exclude} +G_EXEC rm /boot/dietpi-wifi.txt +G_EXEC rm -Rf /{root,home/*}/.{bash_history,nano_history,wget-hsts,cache,local,config,gnupg,viminfo,dbus,gconf,nano,vim,zshrc,oh-my-zsh} /etc/*- /var/{cache/debconf,lib/dpkg}/*-old /var/lib/dhcp/{,.??,.[^.]}* +# Remove unique Roon IDs: https://community.roonlabs.com/t/roon-core-will-not-recognize-two-dietpi-allo-gui-roon-bridges-simultaneously/32563/18?u=dan_knight +G_EXEC rm -f /mnt/dietpi_userdata/roon/{RoonBridge,RAATServer}/Settings/unique_id + +# Re-create required log dirs +G_EXEC mkdir -p /var/tmp/dietpi/logs/dietpi-ramlog_store/{netdata,mpd,samba,mysql,roon} +G_EXEC chown netdata:netdata /var/tmp/dietpi/logs/dietpi-ramlog_store/netdata +G_EXEC chown mpd:audio /var/tmp/dietpi/logs/dietpi-ramlog_store/mpd +G_EXEC chown mysql:mysql /var/tmp/dietpi/logs/dietpi-ramlog_store/mysql + +# Remove automation scripts +G_EXEC rm /boot/Automation_Custom_Script.sh /root/AUTO_CustomScript.sh + +> /success +poweroff +} +_EOF_ + + # Start container + # - dbus required for container spawn + mask_dbus=0 + if [[ $(readlink /etc/systemd/system/dbus.socket) == '/dev/null' ]] + then + mask_dbus=1 + G_EXEC systemctl unmask dbus.socket dbus + G_EXEC systemctl start dbus.socket + fi + # - Bind mounts required to allow container reading its own drive info, /dev/disk for GRUB and probably other tools to detect UUIDs + systemd-nspawn -bD rootfs --bind="$FP_LOOP"{,p1,p2} --bind=/dev/disk || exit 1 + (( $mask_dbus )) && { G_EXEC systemctl mask --now dbus dbus.socket && mask_dbus=0; } + + [[ -f 'rootfs/success' ]] || { G_DIETPI-NOTIFY 1 'The container setup did not finish successfully, aborting...'; exit 1; } + G_EXEC rm rootfs/success + G_EXEC sync + G_EXEC sleep 1 + G_EXEC umount -R rootfs + G_EXEC rmdir rootfs + G_EXEC losetup -d "$FP_LOOP" + bash -c "$(curl -sSf "https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH/.build/images/dietpi-imager")" 'DietPi-Imager' "$OUTPUT_IMG_NAME.img" || exit 1 fi From e3a9070a1e30b044576fbfd0df940121d8d59f85 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sat, 30 Apr 2022 22:16:31 +0200 Subject: [PATCH 52/59] v8.4 - RC up --- .update/version | 2 +- dietpi/func/dietpi-globals | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.update/version b/.update/version index 23ffa6388a..d52295cb76 100644 --- a/.update/version +++ b/.update/version @@ -3,7 +3,7 @@ # Available DietPi version G_REMOTE_VERSION_CORE=8 G_REMOTE_VERSION_SUB=4 -G_REMOTE_VERSION_RC=1 +G_REMOTE_VERSION_RC=2 # Minimum DietPi version to allow update G_MIN_VERSION_CORE=6 G_MIN_VERSION_SUB=14 diff --git a/dietpi/func/dietpi-globals b/dietpi/func/dietpi-globals index 8e4034e8dd..43150b2ff7 100644 --- a/dietpi/func/dietpi-globals +++ b/dietpi/func/dietpi-globals @@ -59,7 +59,7 @@ # - Assign defaults/code version as fallback [[ $G_DIETPI_VERSION_CORE ]] || G_DIETPI_VERSION_CORE=8 [[ $G_DIETPI_VERSION_SUB ]] || G_DIETPI_VERSION_SUB=4 - [[ $G_DIETPI_VERSION_RC ]] || G_DIETPI_VERSION_RC=1 + [[ $G_DIETPI_VERSION_RC ]] || G_DIETPI_VERSION_RC=2 [[ $G_GITBRANCH ]] || G_GITBRANCH='master' [[ $G_GITOWNER ]] || G_GITOWNER='MichaIng' # - Save current version and Git branch From 3505d2a3e4025f2d725199041b36808e6336759d Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sat, 30 Apr 2022 23:02:36 +0200 Subject: [PATCH 53/59] v8.4 - DietPi-Globals | G_WHIP: Add a new optional G_WHIP_NOCANCEL variable, which, when set to 1, hides the cancel button on inputbox, menu and checkbox dialogues. - DietPi-Software | Add the new G_WHIP_NOCANCEL=1 feature to hide the cancel button on dependency selection menus, where a choice is currently required. We may re-add it as "Abort" button in next release, but it is not so trivial since we want the default/dietpi.txt selection on automated first run installs, where no input can be done in which case all whiptail menus are cancelled automatically. --- dietpi/dietpi-software | 6 +++--- dietpi/func/dietpi-globals | 18 +++++++++++------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index 3ef30794a0..22a05fd149 100755 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -1906,7 +1906,7 @@ Available commands: ) G_WHIP_DEFAULT_ITEM=${aSOFTWARE_NAME[$software_id]} - G_WHIP_BUTTON_OK_TEXT='Confirm' G_WHIP_BUTTON_CANCEL_TEXT="Select ${aSOFTWARE_NAME[$software_id]}" + G_WHIP_BUTTON_OK_TEXT='Confirm' G_WHIP_NOCANCEL=1 G_WHIP_MENU "${aSOFTWARE_NAME[$dependant]} requires a webserver. Which one shall be installed? \n- Apache: Feature-rich and popular. Recommended for beginners and users who are looking to follow Apache based guides. \n- Nginx: Lightweight alternative to Apache. Nginx claims faster webserver performance compared to Apache. @@ -1979,7 +1979,7 @@ Available commands: ) G_WHIP_DEFAULT_ITEM=${aSOFTWARE_NAME[$software_id]} - G_WHIP_BUTTON_OK_TEXT='Confirm' G_WHIP_BUTTON_CANCEL_TEXT="Select ${aSOFTWARE_NAME[$software_id]}" + G_WHIP_BUTTON_OK_TEXT='Confirm' G_WHIP_NOCANCEL=1 G_WHIP_MENU "${aSOFTWARE_NAME[$dependant]} requires a desktop. Which one shall be installed?" || G_WHIP_RETURNED_VALUE=${aSOFTWARE_NAME[$software_id]} # Software name to ID and preference index @@ -2043,7 +2043,7 @@ Available commands: ) G_WHIP_DEFAULT_ITEM=${aSOFTWARE_NAME[$software_id]} - G_WHIP_BUTTON_OK_TEXT='Confirm' G_WHIP_BUTTON_CANCEL_TEXT="Select ${aSOFTWARE_NAME[$software_id]}" + G_WHIP_BUTTON_OK_TEXT='Confirm' G_WHIP_NOCANCEL=1 G_WHIP_MENU "Which web browser shall be installed with the ${aSOFTWARE_NAME[$dependant]} desktop environment?" || G_WHIP_RETURNED_VALUE=${aSOFTWARE_NAME[$software_id]} # Software name to ID and preference index diff --git a/dietpi/func/dietpi-globals b/dietpi/func/dietpi-globals index 43150b2ff7..d989bec2e9 100644 --- a/dietpi/func/dietpi-globals +++ b/dietpi/func/dietpi-globals @@ -446,13 +446,14 @@ $grey───────────────────────── # - G_WHIP_SIZE_X_MAX=50 | Optional, limits width [in chars], if below available screen width # - G_WHIP_BUTTON_OK_TEXT | Optional, change as needed, defaults to "Ok" # - G_WHIP_BUTTON_CANCEL_TEXT | Optional, change as needed, defaults to "Cancel" + # - G_WHIP_NOCANCEL=1 | Optional, hide the cancel button on inputbox, menu and checkbox dialogues # - G_WHIP_MENU_ARRAY | Required for G_WHIP_MENU to set available menu entries, 2 array indices per line: ('item' 'description') # - G_WHIP_CHECKLIST_ARRAY | Required for G_WHIP_CHECKLIST set available checklist options, 3 array indices per line: ('item' 'description' 'on'/'off') # Output: # - G_WHIP_RETURNED_VALUE | Returned value from inputbox/menu/checklist based whiptail items # G_WHIP_DESTROY | Clear vars after run of whiptail - G_WHIP_DESTROY(){ unset -v G_WHIP_DEFAULT_ITEM G_WHIP_SIZE_X_MAX G_WHIP_BUTTON_OK_TEXT G_WHIP_BUTTON_CANCEL_TEXT G_WHIP_MENU_ARRAY G_WHIP_CHECKLIST_ARRAY; } + G_WHIP_DESTROY(){ unset -v G_WHIP_DEFAULT_ITEM G_WHIP_SIZE_X_MAX G_WHIP_BUTTON_OK_TEXT G_WHIP_BUTTON_CANCEL_TEXT G_WHIP_NOCANCEL G_WHIP_MENU_ARRAY G_WHIP_CHECKLIST_ARRAY; } # Run once, to be failsafe in case any exported/environment variables are left from originating shell G_WHIP_DESTROY @@ -716,12 +717,13 @@ $grey───────────────────────── if [[ $G_INTERACTIVE == 1 ]]; then - local WHIP_ERROR WHIP_BACKTITLE WHIP_SCROLLTEXT WHIP_SIZE_X WHIP_SIZE_Y WHIP_MESSAGE=$* + local WHIP_ERROR WHIP_BACKTITLE WHIP_SCROLLTEXT WHIP_SIZE_X WHIP_SIZE_Y WHIP_MESSAGE=$* NOCANCEL=() + [[ $G_WHIP_NOCANCEL == 1 ]] && NOCANCEL=('--nocancel') while : do G_WHIP_INIT # shellcheck disable=SC2248 - G_WHIP_RETURNED_VALUE=$(whiptail ${G_PROGRAM_NAME:+--title "$G_PROGRAM_NAME"} --backtitle "$WHIP_BACKTITLE" --inputbox "$WHIP_ERROR$WHIP_MESSAGE" --ok-button "$G_WHIP_BUTTON_OK_TEXT" --cancel-button "$G_WHIP_BUTTON_CANCEL_TEXT" $WHIP_SCROLLTEXT "$WHIP_SIZE_Y" "$WHIP_SIZE_X" "$G_WHIP_DEFAULT_ITEM" 3>&1 1>&2 2>&3-; echo $? > /tmp/.G_WHIP_INPUTBOX_RESULT) + G_WHIP_RETURNED_VALUE=$(whiptail ${G_PROGRAM_NAME:+--title "$G_PROGRAM_NAME"} --backtitle "$WHIP_BACKTITLE" --inputbox "$WHIP_ERROR$WHIP_MESSAGE" --ok-button "$G_WHIP_BUTTON_OK_TEXT" --cancel-button "$G_WHIP_BUTTON_CANCEL_TEXT" "${NOCANCEL[@]}" $WHIP_SCROLLTEXT "$WHIP_SIZE_Y" "$WHIP_SIZE_X" "$G_WHIP_DEFAULT_ITEM" 3>&1 1>&2 2>&3-; echo $? > /tmp/.G_WHIP_INPUTBOX_RESULT) result=$(&1 1>&2 2>&3-; echo $? > /tmp/.WHIP_MENU_RESULT) + G_WHIP_RETURNED_VALUE=$(whiptail ${G_PROGRAM_NAME:+--title "$G_PROGRAM_NAME"} --backtitle "$WHIP_BACKTITLE" --menu "$WHIP_MESSAGE" --ok-button "$G_WHIP_BUTTON_OK_TEXT" --cancel-button "$G_WHIP_BUTTON_CANCEL_TEXT" "${NOCANCEL[@]}" --default-item "$G_WHIP_DEFAULT_ITEM" $WHIP_SCROLLTEXT "$WHIP_SIZE_Y" "$WHIP_SIZE_X" "$WHIP_SIZE_Z" "${G_WHIP_MENU_ARRAY[@]}" 3>&1 1>&2 2>&3-; echo $? > /tmp/.WHIP_MENU_RESULT) result=$(&1 1>&2 2>&3-; echo $? > /tmp/.WHIP_CHECKLIST_RESULT) + G_WHIP_RETURNED_VALUE=$(whiptail ${G_PROGRAM_NAME:+--title "$G_PROGRAM_NAME"} --backtitle "$WHIP_BACKTITLE | Use spacebar to toggle selection" --checklist "$WHIP_MESSAGE" --separate-output --ok-button "$G_WHIP_BUTTON_OK_TEXT" --cancel-button "$G_WHIP_BUTTON_CANCEL_TEXT" "${NOCANCEL[@]}" --default-item "$G_WHIP_DEFAULT_ITEM" $WHIP_SCROLLTEXT "$WHIP_SIZE_Y" "$WHIP_SIZE_X" "$WHIP_SIZE_Z" "${G_WHIP_CHECKLIST_ARRAY[@]}" 3>&1 1>&2 2>&3-; echo $? > /tmp/.WHIP_CHECKLIST_RESULT) G_WHIP_RETURNED_VALUE=$(echo -e "$G_WHIP_RETURNED_VALUE" | tr '\n' ' ') result=$( Date: Sat, 30 Apr 2022 23:18:35 +0200 Subject: [PATCH 54/59] v8.4 - DietPi-Build | Workaround invalid TERM on login in GitHub runner container --- .build/images/dietpi-build | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.build/images/dietpi-build b/.build/images/dietpi-build index 96de1e10a6..febb5927f6 100755 --- a/.build/images/dietpi-build +++ b/.build/images/dietpi-build @@ -409,6 +409,9 @@ then # Revert autostart option, in case Amiberry image was generated before G_EXEC sed -i '/^AUTO_SETUP_AUTOSTART_TARGET_INDEX=/c\AUTO_SETUP_AUTOSTART_TARGET_INDEX=0' rootfs/boot/dietpi.txt + # Workaround invalid TERM on login + G_EXEC eval 'echo '\''infocmp "$TERM" > /dev/null 2>&1 || export TERM=dumb'\'' > rootfs/bashrc.d/00-dietpi-build.sh' + # Generate automation custom script for first boot and cleanup steps cat << '_EOF_' > rootfs/boot/Automation_Custom_Script.sh #!/bin/bash @@ -453,13 +456,12 @@ G_EXEC chown mpd:audio /var/tmp/dietpi/logs/dietpi-ramlog_store/mpd G_EXEC chown mysql:mysql /var/tmp/dietpi/logs/dietpi-ramlog_store/mysql # Remove automation scripts -G_EXEC rm /boot/Automation_Custom_Script.sh /root/AUTO_CustomScript.sh +G_EXEC rm /etc/bashrc.d/00-dietpi-build.sh /boot/Automation_Custom_Script.sh /root/AUTO_CustomScript.sh > /success poweroff } _EOF_ - # Start container # - dbus required for container spawn mask_dbus=0 From b57ce4e35c8ccd256a3ae86bb012428df3c43423 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sat, 30 Apr 2022 23:21:30 +0200 Subject: [PATCH 55/59] v8.4 - DietPi-Build | Satisfy shellcheck --- .build/images/dietpi-build | 1 + 1 file changed, 1 insertion(+) diff --git a/.build/images/dietpi-build b/.build/images/dietpi-build index febb5927f6..9ea0b1a069 100755 --- a/.build/images/dietpi-build +++ b/.build/images/dietpi-build @@ -410,6 +410,7 @@ then G_EXEC sed -i '/^AUTO_SETUP_AUTOSTART_TARGET_INDEX=/c\AUTO_SETUP_AUTOSTART_TARGET_INDEX=0' rootfs/boot/dietpi.txt # Workaround invalid TERM on login + # shellcheck disable=SC2016 G_EXEC eval 'echo '\''infocmp "$TERM" > /dev/null 2>&1 || export TERM=dumb'\'' > rootfs/bashrc.d/00-dietpi-build.sh' # Generate automation custom script for first boot and cleanup steps From f3046505d151d030b6325778f50cfd795059179e Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sat, 30 Apr 2022 23:39:58 +0200 Subject: [PATCH 56/59] v8.4 - DietPi-Build | Fix bashrc.d path --- .build/images/dietpi-build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.build/images/dietpi-build b/.build/images/dietpi-build index 9ea0b1a069..eb7ae64af3 100755 --- a/.build/images/dietpi-build +++ b/.build/images/dietpi-build @@ -411,7 +411,7 @@ then # Workaround invalid TERM on login # shellcheck disable=SC2016 - G_EXEC eval 'echo '\''infocmp "$TERM" > /dev/null 2>&1 || export TERM=dumb'\'' > rootfs/bashrc.d/00-dietpi-build.sh' + G_EXEC eval 'echo '\''infocmp "$TERM" > /dev/null 2>&1 || export TERM=dumb'\'' > rootfs/etc/bashrc.d/00-dietpi-build.sh' # Generate automation custom script for first boot and cleanup steps cat << '_EOF_' > rootfs/boot/Automation_Custom_Script.sh From 0f8523b5b7547b7b37e1a38e10d812c830a374f1 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sun, 1 May 2022 00:14:53 +0200 Subject: [PATCH 57/59] v8.4 - DietPi-Build | Workaround for failing pings in GitHub action runners --- .build/images/dietpi-build | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.build/images/dietpi-build b/.build/images/dietpi-build index eb7ae64af3..d5ed81fd7f 100755 --- a/.build/images/dietpi-build +++ b/.build/images/dietpi-build @@ -366,10 +366,10 @@ then fi # Install Amiberry via automated first run setup - G_EXEC sed -i '/^AUTO_SETUP_AUTOMATED=/c\AUTO_SETUP_AUTOMATED=1' rootfs/boot/dietpi.txt - G_EXEC sed -i '/^#AUTO_SETUP_INSTALL_SOFTWARE_ID=/c\AUTO_SETUP_INSTALL_SOFTWARE_ID=108' rootfs/boot/dietpi.txt + G_CONFIG_INJECT 'AUTO_SETUP_AUTOMATED=' 'AUTO_SETUP_AUTOMATED=1' rootfs/boot/dietpi.txt + G_CONFIG_INJECT 'AUTO_SETUP_INSTALL_SOFTWARE_ID=' 'AUTO_SETUP_INSTALL_SOFTWARE_ID=108' rootfs/boot/dietpi.txt # Enable Amiberry fast boot autostart option - G_EXEC sed -i '/^AUTO_SETUP_AUTOSTART_TARGET_INDEX=/c\AUTO_SETUP_AUTOSTART_TARGET_INDEX=6' rootfs/boot/dietpi.txt + G_CONFIG_INJECT 'AUTO_SETUP_AUTOSTART_TARGET_INDEX=' 'AUTO_SETUP_AUTOSTART_TARGET_INDEX=6' rootfs/boot/dietpi.txt # RPi: Enable onboard audio so that it can be detected and configured on first boot [[ -f 'rootfs/boot/config.txt' ]] && G_EXEC sed -i '/^dtparam=audio=/c\dtparam=audio=on' rootfs/boot/config.txt @@ -404,15 +404,19 @@ then fi # Install Allo GUI via automated first run setup right here - G_EXEC sed -i '/^AUTO_SETUP_AUTOMATED=/c\AUTO_SETUP_AUTOMATED=1' rootfs/boot/dietpi.txt - G_EXEC sed -i '/^#AUTO_SETUP_INSTALL_SOFTWARE_ID=/c\AUTO_SETUP_INSTALL_SOFTWARE_ID=159' rootfs/boot/dietpi.txt + G_CONFIG_INJECT 'AUTO_SETUP_AUTOMATED=' 'AUTO_SETUP_AUTOMATED=1' rootfs/boot/dietpi.txt + G_CONFIG_INJECT 'AUTO_SETUP_INSTALL_SOFTWARE_ID=' 'AUTO_SETUP_INSTALL_SOFTWARE_ID=159' rootfs/boot/dietpi.txt # Revert autostart option, in case Amiberry image was generated before - G_EXEC sed -i '/^AUTO_SETUP_AUTOSTART_TARGET_INDEX=/c\AUTO_SETUP_AUTOSTART_TARGET_INDEX=0' rootfs/boot/dietpi.txt + G_CONFIG_INJECT 'AUTO_SETUP_AUTOSTART_TARGET_INDEX=' 'AUTO_SETUP_AUTOSTART_TARGET_INDEX=0' rootfs/boot/dietpi.txt # Workaround invalid TERM on login # shellcheck disable=SC2016 G_EXEC eval 'echo '\''infocmp "$TERM" > /dev/null 2>&1 || export TERM=dumb'\'' > rootfs/etc/bashrc.d/00-dietpi-build.sh' + # Workaround for network connection checks + G_CONFIG_INJECT 'CONFIG_CHECK_CONNECTION_IP=' 'CONFIG_CHECK_CONNECTION_IP=127.0.0.1' rootfs/boot/dietpi.txt + G_CONFIG_INJECT 'CONFIG_CHECK_DNS_DOMAIN=' 'CONFIG_CHECK_DNS_DOMAIN=localhost' rootfs/boot/dietpi.txt + # Generate automation custom script for first boot and cleanup steps cat << '_EOF_' > rootfs/boot/Automation_Custom_Script.sh #!/bin/bash @@ -476,6 +480,10 @@ _EOF_ systemd-nspawn -bD rootfs --bind="$FP_LOOP"{,p1,p2} --bind=/dev/disk || exit 1 (( $mask_dbus )) && { G_EXEC systemctl mask --now dbus dbus.socket && mask_dbus=0; } + # Reset network connection check settings + G_CONFIG_INJECT 'CONFIG_CHECK_CONNECTION_IP=' 'CONFIG_CHECK_CONNECTION_IP=9.9.9.9' rootfs/boot/dietpi.txt + G_CONFIG_INJECT 'CONFIG_CHECK_DNS_DOMAIN=' 'CONFIG_CHECK_DNS_DOMAIN=dns9.quad9.net' rootfs/boot/dietpi.txt + [[ -f 'rootfs/success' ]] || { G_DIETPI-NOTIFY 1 'The container setup did not finish successfully, aborting...'; exit 1; } G_EXEC rm rootfs/success G_EXEC sync From b10d3f9b7f2c54ebc17b833855304affbb571762 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sun, 1 May 2022 00:40:53 +0200 Subject: [PATCH 58/59] v8.4 - DietPi-Build | Raise size of loop device for Allo GUI image to 2 GiB --- .build/images/dietpi-build | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.build/images/dietpi-build b/.build/images/dietpi-build index d5ed81fd7f..1f543cea4f 100755 --- a/.build/images/dietpi-build +++ b/.build/images/dietpi-build @@ -387,11 +387,17 @@ then G_EXEC mv "$OUTPUT_IMG_NAME.img" "${OUTPUT_IMG_NAME%_Amiberry}_AlloGUI.img" OUTPUT_IMG_NAME="${OUTPUT_IMG_NAME%_Amiberry}_AlloGUI" - # Create loop device + # Create and raise size of loop device to 2 GiB + G_EXEC truncate -s $((2*1024**3)) "$OUTPUT_IMG_NAME.img" FP_LOOP=$(losetup -f) G_EXEC losetup "$FP_LOOP" "$OUTPUT_IMG_NAME.img" G_EXEC partprobe "$FP_LOOP" G_EXEC partx -u "$FP_LOOP" + G_EXEC_OUTPUT=1 G_EXEC eval "sfdisk -fN'${ROOT_DEV: -1}' '$LOOP_DEV' <<< ',+'" + G_EXEC partprobe "$LOOP_DEV" + G_EXEC partx -u "$LOOP_DEV" + G_EXEC_OUTPUT=1 G_EXEC resize2fs "$ROOT_DEV" + G_EXEC_OUTPUT=1 G_EXEC e2fsck -fp "$ROOT_DEV" # Mount filesystems G_EXEC mkdir rootfs From 39bc1aafd4d7e1ff9c8fa49e2706d26459fd0061 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sun, 1 May 2022 00:46:35 +0200 Subject: [PATCH 59/59] v8.4 - DietPi-Build | Fix loop device references --- .build/images/dietpi-build | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.build/images/dietpi-build b/.build/images/dietpi-build index 1f543cea4f..92a914a7b6 100755 --- a/.build/images/dietpi-build +++ b/.build/images/dietpi-build @@ -393,11 +393,11 @@ then G_EXEC losetup "$FP_LOOP" "$OUTPUT_IMG_NAME.img" G_EXEC partprobe "$FP_LOOP" G_EXEC partx -u "$FP_LOOP" - G_EXEC_OUTPUT=1 G_EXEC eval "sfdisk -fN'${ROOT_DEV: -1}' '$LOOP_DEV' <<< ',+'" - G_EXEC partprobe "$LOOP_DEV" - G_EXEC partx -u "$LOOP_DEV" - G_EXEC_OUTPUT=1 G_EXEC resize2fs "$ROOT_DEV" - G_EXEC_OUTPUT=1 G_EXEC e2fsck -fp "$ROOT_DEV" + G_EXEC_OUTPUT=1 G_EXEC eval "sfdisk -fN2 '$FP_LOOP' <<< ',+'" + G_EXEC partprobe "$FP_LOOP" + G_EXEC partx -u "$FP_LOOP" + G_EXEC_OUTPUT=1 G_EXEC resize2fs "${FP_LOOP}p2" + G_EXEC_OUTPUT=1 G_EXEC e2fsck -fp "${FP_LOOP}p2" # Mount filesystems G_EXEC mkdir rootfs