diff --git a/.conf/dps_2/config.xml b/.conf/dps_2/config.xml new file mode 100644 index 0000000000..d6f21b38d5 --- /dev/null +++ b/.conf/dps_2/config.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.conf/dps_93/apache.pihole.conf b/.conf/dps_93/apache.pihole.conf index c91c176b1b..2c1f8be219 100644 --- a/.conf/dps_93/apache.pihole.conf +++ b/.conf/dps_93/apache.pihole.conf @@ -1,8 +1,15 @@ -# If the URL starts with /admin, it is the Web interface +# Based on: https://github.com/pi-hole/pi-hole/blob/master/advanced/lighttpd.conf.debian + +# Admin panel - # Create a response header for debugging using curl -I + # Create response header for Pi-hole debugger Header set X-Pi-hole "The Pi-hole Web interface is working!" - Header set X-Frame-Options "deny" + Header set X-Frame-Options "DENY" + + # Allow access to local fonts + + Header set Access-Control-Allow-Origin "*" + # Block . files from being served, such as .git, .github, .gitignore diff --git a/.conf/dps_93/lighttpd.pihole.conf b/.conf/dps_93/lighttpd.pihole.conf index 4fe8db481a..d3fbd1c095 100644 --- a/.conf/dps_93/lighttpd.pihole.conf +++ b/.conf/dps_93/lighttpd.pihole.conf @@ -1,15 +1,15 @@ # Based on: https://github.com/pi-hole/pi-hole/blob/master/advanced/lighttpd.conf.debian -# If the URL starts with /admin, it is the Web interface +# Admin panel $HTTP["url"] =~ "^(/html)?/admin/" { - # Create a response header for debugging using curl -I + # Create response header for Pi-hole debugger setenv.add-response-header = ( "X-Pi-hole" => "The Pi-hole Web interface is working!", "X-Frame-Options" => "DENY" ) - $HTTP["url"] =~ "\.ttf$" { - # Allow Block Page access to local fonts + # Allow admin panel access to local fonts + $HTTP["url"] =~ "\.(eot|otf|tt[cf]|woff2?)$" { setenv.add-response-header = ( "Access-Control-Allow-Origin" => "*" ) } } @@ -19,11 +19,9 @@ $HTTP["url"] =~ "^(/html)?/admin/\." { url.access-deny = ("") } -# If it's a request to Pi-hole blocking page... +# Block public access to blocking page $HTTP["url"] =~ "^(/html)?/pihole/" { - # ... and the request isn't local $HTTP["remoteip"] !~ "^1(27|92\.168|0|72\.(1[6-9]|2[0-9]|3[0-1]))\." { - # block! url.access-deny = ("") } } diff --git a/.conf/dps_93/nginx.pihole.conf b/.conf/dps_93/nginx.pihole.conf index 04b05b36bf..40d6e3db80 100644 --- a/.conf/dps_93/nginx.pihole.conf +++ b/.conf/dps_93/nginx.pihole.conf @@ -1,16 +1,26 @@ +# Based on: https://github.com/pi-hole/pi-hole/blob/master/advanced/lighttpd.conf.debian + # Admin panel location ~ ^(?:/html|)/admin(?:$|/) { # Block public access to admin page, if enabled # - To enable: cd /etc/nginx/sites-dietpi; mv dietpi-pihole-block_public_admin.off dietpi-pihole-block_public_admin.on # - To disable: cd /etc/nginx/sites-dietpi; mv dietpi-pihole-block_public_admin.on dietpi-pihole-block_public_admin.off include sites-dietpi/dietpi-pihole-block_public_admin.*on; + # Block . files from being served, such as .git, .github, .gitignore location ~ ^(?:/html|)/admin/\. { deny all; } - # Create a response header for debugging using curl -I + + # Create response header for Pi-hole debugger add_header X-Pi-hole "The Pi-hole Web interface is working!"; add_header X-Frame-Options "DENY"; + + # Allow access to local fonts + location ~ \.(?:eot|otf|tt[cf]|woff2?)$ { + add_header Access-Control-Allow-Origin "*"; + } + # Standard PHP handler block try_files $uri $uri/ =404; location ~ ^(?:/html|)/admin/.+\.php(?:$|/) { @@ -21,12 +31,13 @@ location ~ ^(?:/html|)/admin(?:$|/) { # Blocking page location ~ ^(?:/html|)/pihole(?:$|/) { - # Block public access to blocking page by default + # Block public access to blocking page allow 127.0.0.0/8; allow 192.168.0.0/16; allow 10.0.0.0/8; allow 172.16.0.0/12; deny all; + # Standard PHP handler block try_files $uri $uri/ =404; location ~ ^(?:/html|)/pihole/.+\.php(?:$|/) { diff --git a/.conf/dps_96/conf b/.conf/dps_96/conf index cac23cf239..88da88576f 100644 --- a/.conf/dps_96/conf +++ b/.conf/dps_96/conf @@ -29,7 +29,7 @@ comment = DietPi Share path = /mnt/dietpi_userdata browseable = yes - create mask = 0775 + create mask = 0664 directory mask = 0775 valid users = dietpi writeable = yes diff --git a/.meta/dietpi-fan_control b/.meta/dietpi-fan_control index 5e26db3a32..1fe8baf5ac 100644 --- a/.meta/dietpi-fan_control +++ b/.meta/dietpi-fan_control @@ -33,7 +33,7 @@ dietpi-fan_control 1 => Non-interactively apply settings from $FP_SETTINGS. # Import DietPi-Globals --------------------------------------------------------------- . /boot/dietpi/func/dietpi-globals - export G_PROGRAM_NAME='DietPi-Fan_control' + G_PROGRAM_NAME='DietPi-Fan_control' G_CHECK_ROOT_USER G_INIT # Import DietPi-Globals --------------------------------------------------------------- @@ -60,15 +60,15 @@ dietpi-fan_control 1 => Non-interactively apply settings from $FP_SETTINGS. # Grab valid input INPUT=0 - if [[ $@ ]]; then + if [[ $* ]]; then - if disable_error=1 G_CHECK_VALIDINT "$@"; then + if disable_error=1 G_CHECK_VALIDINT "$*"; then - INPUT=$@ + INPUT=$* else - G_DIETPI-NOTIFY 1 "Invalid input argument ($@) found. Aborting...\n$AVAIABLE_COMMANDS" + G_DIETPI-NOTIFY 1 "Invalid input argument ($*) found. Aborting...\n$AVAIABLE_COMMANDS" exit 1 fi @@ -81,38 +81,37 @@ dietpi-fan_control 1 => Non-interactively apply settings from $FP_SETTINGS. # Read currently applied fan control values Read_Control_Files(){ - # - Read current fan control toggle + # Read current fan control toggle TEMP_CONTROLLED_CURRENT=$(<$FP_TEMP_CONTROLLED) - # - Read current trip point temperatures, assuming values of CPU0 for all CPUs - local fp_target='' - local i=0 - TRIP_TEMPS_CURRENT='' + # Read current trip point temperatures, assuming values of CPU0 for all CPUs + local fp_target i=0 + TRIP_TEMPS_CURRENT= for fp_target in /sys/devices/virtual/thermal/thermal_zone0/trip_point_*_temp do - # - Convert "XY000" to XY°C + # Convert "XY000" to XY°C TRIP_TEMPS_CURRENT+=" $(( $( Non-interactively apply settings from $FP_SETTINGS. # Verify valid settings, before applying Verify_Settings(){ - # - $TEMP_CONTROLLED is expected to be either 0 or 1. - if ! [[ $TEMP_CONTROLLED == 0 || $TEMP_CONTROLLED == 1 ]]; then + # $TEMP_CONTROLLED is expected to be either 0 or 1. + if [[ $TEMP_CONTROLLED != [01] ]]; then G_DIETPI-NOTIFY 1 "Invalid setting: \$TEMP_CONTROLLED=$TEMP_CONTROLLED" return 1 elif (( $TEMP_CONTROLLED )); then - # - $TRIP_SPEEDS and $TRIP_TEMPS are expected to follow scheme: [0-9]+[[:blank:]][0-9]+... - # - $TRIP_TEMPS need to match than $TRIP_POINT_COUNT: Amount of actual CPU0 thermal zone control files - # - $TRIP_SPEEDS values need to be exactly one more: Min speed + one each temp trip + # $TRIP_SPEEDS and $TRIP_TEMPS are expected to follow scheme: [0-9]+[[:blank:]][0-9]+... + # $TRIP_TEMPS need to match than $TRIP_POINT_COUNT: Amount of actual CPU0 thermal zone control files + # $TRIP_SPEEDS values need to be exactly one more: Min speed + one each temp trip if ! [[ $TRIP_TEMPS =~ ^[0-9[:blank:]]+$ && $TRIP_SPEEDS =~ ^[0-9[:blank:]]+$ ]] || ! (( $(wc -w <<< "$TRIP_TEMPS") == $TRIP_POINT_COUNT && $(wc -w <<< "$TRIP_SPEEDS") == $TRIP_POINT_COUNT + 1 )); then @@ -146,10 +145,10 @@ dietpi-fan_control 1 => Non-interactively apply settings from $FP_SETTINGS. fi - elif (( ! $TEMP_CONTROLLED )); then + else - # - $STATIC_SPEED is expected to be an integer. - if ! disable_error=1 G_CHECK_VALIDINT $STATIC_SPEED; then + # $STATIC_SPEED is expected to be an integer. + if ! disable_error=1 G_CHECK_VALIDINT "$STATIC_SPEED"; then G_DIETPI-NOTIFY 1 "Invalid setting: \$STATIC_SPEED=$STATIC_SPEED" return 1 @@ -166,12 +165,12 @@ dietpi-fan_control 1 => Non-interactively apply settings from $FP_SETTINGS. # Write settings to file Write_Settings(){ - # - Write fan control toggle to settings file + # Write fan control toggle to settings file echo "TEMP_CONTROLLED=$TEMP_CONTROLLED" > $FP_SETTINGS if (( $TEMP_CONTROLLED )); then - # - Write trip points and attached temperatures to settings file + # Write trip points and attached temperatures to settings file cat << _EOF_ >> $FP_SETTINGS TRIP_TEMPS='$TRIP_TEMPS' TRIP_SPEEDS='$TRIP_SPEEDS' @@ -200,10 +199,8 @@ _EOF_ local i=0 # Apply trip point temps - local j=0 - local temp=0 - local fp_target='' - for (( i=0; i<$G_HW_CPU_CORES; i++ )) + local j=0 temp=0 fp_target + for ((i=0; i<$G_HW_CPU_CORES; i++)) do j=0 @@ -223,7 +220,7 @@ _EOF_ done # Apply trip point fan speeds - local trip_speeds_target= + local trip_speeds_target for i in $TRIP_SPEEDS do @@ -250,8 +247,7 @@ _EOF_ #----------------------------------------------------------------------------------- Reset_Menu(){ - 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?' - if (( ! $? )); then + 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 G_EXEC_DESC='Resetting current selections' G_EXEC unset TEMP_CONTROLLED TRIP_TEMPS TRIP_SPEEDS STATIC_SPEED @@ -299,18 +295,18 @@ EG: To run the fan at 50%, enter\n \"60\"" && STATIC_SPEED=$G_WHIP_RETURNED_ Main_Menu(){ - local i='' + local i # Read currently applied fan controls, to generate status message Read_Control_Files - local whip_message='' + local whip_message if (( $TEMP_CONTROLLED_CURRENT )); then - # - Current control mode + # Current control mode whip_message+='Mode: Temperature controlled' - # - Current trip point temps + # Current trip point temps whip_message+='\nTemp points: ' for i in $TRIP_TEMPS_CURRENT do @@ -319,7 +315,7 @@ EG: To run the fan at 50%, enter\n \"60\"" && STATIC_SPEED=$G_WHIP_RETURNED_ done - # - Current trip point speeds + # Current trip point speeds whip_message+='\nFan speeds:' for i in $TRIP_SPEEDS_CURRENT do @@ -330,15 +326,15 @@ EG: To run the fan at 50%, enter\n \"60\"" && STATIC_SPEED=$G_WHIP_RETURNED_ else - # - Current control mode + # Current control mode whip_message+='Mode: Static fan speed' - # - Static fan speed + # Static fan speed whip_message+="\nFan speed: ${STATIC_SPEED_CURRENT}%" fi - # - Control mode setting + # Control mode setting TEMP_CONTROLLED=${TEMP_CONTROLLED:-$TEMP_CONTROLLED_CURRENT} local mode_text='Static fan speed' (( $TEMP_CONTROLLED )) && mode_text='Temperature controlled' @@ -351,9 +347,9 @@ EG: To run the fan at 50%, enter\n \"60\"" && STATIC_SPEED=$G_WHIP_RETURNED_ if (( $TEMP_CONTROLLED )); then - # - Trip point temperature settings + # Trip point temperature settings TRIP_TEMPS=${TRIP_TEMPS:-$TRIP_TEMPS_CURRENT} - local trip_temps_text='' + local trip_temps_text for i in $TRIP_TEMPS do @@ -362,9 +358,9 @@ EG: To run the fan at 50%, enter\n \"60\"" && STATIC_SPEED=$G_WHIP_RETURNED_ done G_WHIP_MENU_ARRAY+=( 'Temp points' "Selected: $trip_temps_text" ) - # - Trip point speed settings + # Trip point speed settings TRIP_SPEEDS=${TRIP_SPEEDS:-$TRIP_SPEEDS_CURRENT} - local trip_speeds_text='' + local trip_speeds_text for i in $TRIP_SPEEDS do @@ -392,15 +388,7 @@ EG: To run the fan at 50%, enter\n \"60\"" && STATIC_SPEED=$G_WHIP_RETURNED_ elif [[ $G_WHIP_RETURNED_VALUE == 'Mode' ]]; then - if (( $TEMP_CONTROLLED )); then - - TEMP_CONTROLLED=0 - - else - - TEMP_CONTROLLED=1 - - fi + (( $TEMP_CONTROLLED )) && TEMP_CONTROLLED=0 || TEMP_CONTROLLED=1 elif [[ $G_WHIP_RETURNED_VALUE == 'Temp points' ]]; then diff --git a/.meta/dietpi-imager b/.meta/dietpi-imager index f927780035..19132ad590 100755 --- a/.meta/dietpi-imager +++ b/.meta/dietpi-imager @@ -21,12 +21,15 @@ G_PROGRAM_NAME='DietPi-Imager' G_CHECK_ROOT_USER G_CHECK_ROOTFS_RW + FP_ORIGIN=$PWD # Store origin dir G_INIT + cd "$FP_ORIGIN" # Process everything in origin dir instead of /tmp/$G_PROGRAM_NAME # Import DietPi-Globals --------------------------------------------------------------- FP_SOURCE_IMG= FP_SOURCE= FP_ROOT_DEV= + FP_MNT_TMP="/tmp/$G_PROGRAM_NAME_rootfs" ROOT_PARTITION_INDEX=0 OUTPUT_IMG_NAME= OUTPUT_IMG_EXT='img' @@ -35,12 +38,12 @@ CLONEZILLA_REPO='https://sourceforge.net/projects/clonezilla/files/clonezilla_live_alternative' DIETPI_REPO="https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH" - Delete_Loopback(){ [[ -b $FP_SOURCE ]] && G_EXEC losetup -d $FP_SOURCE; } + Delete_Loopback(){ losetup $FP_SOURCE &> /dev/null && G_EXEC losetup -d $FP_SOURCE; } - Exit_On_Fail(){ + G_EXIT_CUSTOM(){ + findmnt $FP_MNT_TMP &> /dev/null && umount -R $FP_MNT_TMP [[ $FP_SOURCE_IMG ]] && Delete_Loopback - exit 1 } @@ -54,7 +57,7 @@ ) G_WHIP_MENU 'Please select how the input OS is stored: -\nNB: If you want to create a Clonezilla-based installer image, the input OS needs to be attached as physical drive, since Clonezilla currently does neither support .img files nor loop devices.' || Exit_On_Fail +\nNB: If you want to create a Clonezilla-based installer image, the input OS needs to be attached as physical drive, since Clonezilla currently does neither support .img files nor loop devices.' || exit 1 if [[ $G_WHIP_RETURNED_VALUE == 'Drive' ]]; then G_WHIP_MENU_ARRAY=( @@ -71,7 +74,7 @@ - Clonezilla: An installer ISO image is created which must be flashed to an external/USB/removeable drive. Boot from the external drive will launch Clonezilla and allow you to install DietPi to any internal drive. This is required e.g. for UEFI images. - NB: Only compatible with x86_64 systems!' || Exit_On_Fail + NB: Only compatible with x86_64 systems!' || exit 1 CLONING_TOOL=$G_WHIP_RETURNED_VALUE if [[ $CLONING_TOOL == 'dd' ]]; then @@ -95,14 +98,14 @@ G_DIETPI-NOTIFY 1 'No drive with an ext4 partition found, aborting...' G_DIETPI-NOTIFY 2 'Hint: This is the list of available block devices' lsblk -npo NAME,SIZE,MAJ:MIN,FSTYPE,MOUNTPOINT,MODEL - Exit_On_Fail + exit 1 fi # Visually separate dev name and size and add model and serial for ((i=1;i<${#G_WHIP_MENU_ARRAY[@]};i+=2)); do G_WHIP_MENU_ARRAY[$i]=": $(lsblk -drno SIZE,MODEL,SERIAL ${G_WHIP_MENU_ARRAY[$i-1]})"; done G_WHIP_MENU 'Please select the drive you wish to create the image from: -\nNB: All mounted partitions of the selected drive will be unmounted.' || Exit_On_Fail +\nNB: All mounted partitions of the selected drive will be unmounted.' || exit 1 FP_SOURCE=$G_WHIP_RETURNED_VALUE G_DIETPI-NOTIFY 2 'Unmounting all mounted file systems of the selected source drive...' @@ -111,7 +114,7 @@ do mountpoint=$(findmnt -no TARGET $i) - [[ $mountpoint ]] && { umount -R $mountpoint || Exit_On_Fail; } + [[ $mountpoint ]] && G_EXEC umount -R $mountpoint done @@ -120,23 +123,23 @@ # Open DietPi-Explorer for image file selection local fp_selected='/tmp/.dietpi-explorer_selected_location' [[ -f $fp_selected ]] && rm $fp_selected # Failsafe - /boot/dietpi/dietpi-explorer 1 $PWD - [[ -f $fp_selected && $(<$fp_selected) ]] || Exit_On_Fail + /boot/dietpi/dietpi-explorer 1 + [[ -f $fp_selected && $(<$fp_selected) ]] || exit 1 FP_SOURCE_IMG=$(<$fp_selected) rm $fp_selected if [[ ! -f $FP_SOURCE_IMG ]]; then G_DIETPI-NOTIFY 1 "Selected image file ($FP_SOURCE_IMG) does not exist, aborting..." - Exit_On_Fail + exit 1 fi # Create loopback device from .img file - modprobe loop || Exit_On_Fail + G_EXEC modprobe loop FP_SOURCE=$(losetup -f) - losetup $FP_SOURCE "$FP_SOURCE_IMG" || Exit_On_Fail - partprobe $FP_SOURCE || Exit_On_Fail - partx -u $FP_SOURCE || Exit_On_Fail + G_EXEC losetup $FP_SOURCE "$FP_SOURCE_IMG" + G_EXEC partprobe $FP_SOURCE + G_EXEC partx -u $FP_SOURCE G_DIETPI-NOTIFY 0 "Mounted the image ($FP_SOURCE_IMG) as loopback device: $FP_SOURCE" fi @@ -145,12 +148,12 @@ G_WHIP_MENU_ARRAY=($(lsblk -npo NAME,SIZE ${FP_SOURCE}?*)) # Visually separate dev name and size and add FS type for ((i=1;i<${#G_WHIP_MENU_ARRAY[@]};i+=2)); do G_WHIP_MENU_ARRAY[$i]=": $(lsblk -drno SIZE,FSTYPE ${G_WHIP_MENU_ARRAY[$i-1]})"; done - G_WHIP_MENU 'Please select the OS root partition:' || Exit_On_Fail + G_WHIP_MENU 'Please select the OS root partition:' || exit 1 FP_ROOT_DEV=$G_WHIP_RETURNED_VALUE ROOT_PARTITION_INDEX=${FP_ROOT_DEV: -1} G_WHIP_DEFAULT_ITEM='DietPi_--' - G_WHIP_INPUTBOX 'Please enter the filename for the new image:\n - DietPi_--\n - EG: DietPi_RPi-ARMv6-Buster' || Exit_On_Fail + G_WHIP_INPUTBOX 'Please enter the filename for the new image:\n - DietPi_--\n - EG: DietPi_RPi-ARMv6-Buster' || exit 1 OUTPUT_IMG_NAME=$G_WHIP_RETURNED_VALUE # Check for existing file, in case offer backup. Skip if source is image file and matches output file already. @@ -172,8 +175,10 @@ Do you want to overwrite or backup the existing file to $PWD/$OUTPUT_IMG_NAME.$O Menu_Main - # Install required packages - G_AG_CHECK_INSTALL_PREREQ parted zerofree p7zip + # Install required packages: fdisk is an own package since Debian Buster: https://packages.debian.org/fdisk + local fdisk + (( $G_DISTRO < 5 )) || fdisk='fdisk' + G_AG_CHECK_INSTALL_PREREQ parted zerofree p7zip $fdisk # Auto detect partition table type, failsafe detection of MBR to debug possibly other/unknown wording/partition table types if [[ $(parted -s $FP_SOURCE print) == *'Partition Table: msdos'* ]]; then @@ -195,28 +200,38 @@ Do you want to overwrite or backup the existing file to $PWD/$OUTPUT_IMG_NAME.$O else G_DIETPI-NOTIFY 1 "Unknown partition table type ($(parted -s $FP_SOURCE print | mawk '/^Partition Table:/ {print $3;exit}')), aborting..." - Exit_On_Fail + exit 1 fi - e2fsck -f $FP_ROOT_DEV || Exit_On_Fail + G_EXEC_OUTPUT= 1 G_EXEC e2fsck -f $FP_ROOT_DEV # Remount image for any required edits - fp_mnt='tmp_rootfs' - mkdir -p /mnt/$fp_mnt - if G_EXEC_NOHALT=1 G_EXEC mount $FP_ROOT_DEV /mnt/$fp_mnt; then - - # Remove bash history, which is stored on shutdown, hence cannot be removed via DietPi-PREP - rm -fv /mnt/$fp_mnt/{root,home/*}/.bash_history - G_WHIP_MSG "Image mounted for file editing, make changes if required: $FP_ROOT_DEV > /mnt/$fp_mnt\n\nPress 'Ok' when you are finished." - sync - G_EXEC umount /mnt/$fp_mnt - partprobe $FP_SOURCE # Failsafe - partx -u $FP_SOURCE # Failsafe - e2fsck -f $FP_ROOT_DEV || Exit_On_Fail # Failsafe + G_EXEC mkdir -p $FP_MNT_TMP + G_EXEC mount $FP_ROOT_DEV $FP_MNT_TMP + # - Remove bash history, which is stored on shutdown, hence cannot be removed via DietPi-PREP + rm -fv $FP_MNT_TMP/{root,home/*}/.bash_history + if G_WHIP_YESNO "Do you want to review/edit contained files? +\nAn interactive bash subshell will open. +\nPlease use the \"exit\" command when you are finished, to return to $G_PROGRAM_NAME. +\nMount is: $FP_ROOT_DEV > $FP_MNT_TMP"; then + + # Prevent dietpi-login call in subshell + local reallow_dietpi_login=1 + [[ $G_DIETPI_LOGIN ]] && reallow_dietpi_login=0 + export G_DIETPI_LOGIN=1 + G_EXEC cd $FP_MNT_TMP + bash &> /dev/tty < /dev/tty + G_EXEC cd $FP_ORIGIN + (( $reallow_dietpi_login )) && unset -v G_DIETPI_LOGIN fi - rmdir /mnt/$fp_mnt + sync + G_EXEC umount $FP_MNT_TMP + G_EXEC rmdir $FP_MNT_TMP + G_EXEC partprobe $FP_SOURCE # Failsafe + G_EXEC partx -u $FP_SOURCE # Failsafe + G_EXEC_OUTPUT= 1 G_EXEC e2fsck -f $FP_ROOT_DEV || exit 1 # Failsafe # Shrink file system to minimum # - Run multiple times until no change is done any more @@ -242,7 +257,7 @@ Do you want to overwrite or backup the existing file to $PWD/$OUTPUT_IMG_NAME.$O elif out=$(grep -im1 'no such file or directory' resize2fs_out); then G_DIETPI-NOTIFY 1 'Partition not found, aborting...' - Exit_On_Fail + exit 1 fi @@ -257,25 +272,25 @@ Do you want to overwrite or backup the existing file to $PWD/$OUTPUT_IMG_NAME.$O if (( $PART_END_CURRENT > $PART_END_TARGET )); then G_DIETPI-NOTIFY 2 "Shrinking root partition to: $(( $FS_SIZE / 2048 + 1 )) MiB" - parted $FP_SOURCE unit s resizepart $ROOT_PARTITION_INDEX $PART_END_TARGET - partprobe $FP_SOURCE - partx -u $FP_SOURCE + G_EXEC_OUTPUT=1 G_EXEC parted $FP_SOURCE unit s resizepart $ROOT_PARTITION_INDEX $PART_END_TARGET + G_EXEC partprobe $FP_SOURCE + G_EXEC partx -u $FP_SOURCE fi G_DIETPI-NOTIFY 2 'Overriding root partition free space with zeros to purge removed data and allow further archive size reduction...' - zerofree -v $FP_ROOT_DEV + G_EXEC_OUTPUT=1 G_EXEC zerofree -v $FP_ROOT_DEV sync # GPT images: # - "GPT PMBR size mismatch (4458495 != 15523839)" # - "Error: The backup GPT table is corrupt, but the primary appears OK, so that will be used." # - gdisk will correct this - (( $GPT )) && sgdisk -g $FP_SOURCE + (( $GPT )) && G_EXEC_OUTPUT=1 G_EXEC sgdisk -g $FP_SOURCE # Finished: Derive final image size from last partition end + failsafe buffer - partprobe $FP_SOURCE - partx -u $FP_SOURCE + G_EXEC partprobe $FP_SOURCE + G_EXEC partx -u $FP_SOURCE IMAGE_SIZE=$(( ( $(sfdisk -qlo End $FP_SOURCE | tail -1) + 1 ) * 512 )) # 512 byte sectors => Byte IMAGE_SIZE=$(( $IMAGE_SIZE + ( 512 * 256 ) )) # 64 byte for secondary GPT + safety net @@ -286,38 +301,38 @@ Do you want to overwrite or backup the existing file to $PWD/$OUTPUT_IMG_NAME.$O Delete_Loopback G_DIETPI-NOTIFY 2 "Truncating final image file to actually used size: $(( $IMAGE_SIZE / 1024 / 1024 + 1 )) MiB" - truncate --size=$IMAGE_SIZE "$FP_SOURCE_IMG" + G_EXEC truncate --size=$IMAGE_SIZE "$FP_SOURCE_IMG" # Rename, if source image != output image already [[ $PWD/$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT != $FP_SOURCE_IMG ]] && mv "$FP_SOURCE_IMG" $OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT # Check if there is enough free disk space to store the 7z file NEEDED_FREE_SPACE=$(( $IMAGE_SIZE / 100 * 15 / 1024 / 1024 )) - G_CHECK_FREESPACE . $(( $NEEDED_FREE_SPACE + 100 )) || Exit_On_Fail # Assure +100 MiB left partition space + G_CHECK_FREESPACE . $(( $NEEDED_FREE_SPACE + 100 )) || exit 1 # Assure +100 MiB left partition space # Drive source, clone with dd elif [[ $CLONING_TOOL == 'dd' ]]; then # Check if there is enough free disk space to store the image and the 7z file NEEDED_FREE_SPACE=$(( $IMAGE_SIZE / 100 * 115 / 1024 / 1024 )) - G_CHECK_FREESPACE . $(( $NEEDED_FREE_SPACE + 100 )) || Exit_On_Fail # Assure +100 MiB left partition space + G_CHECK_FREESPACE . $(( $NEEDED_FREE_SPACE + 100 )) || exit 1 # Assure +100 MiB left partition space G_DIETPI-NOTIFY 2 "Creating final image with actually used size: $(( $IMAGE_SIZE / 1024 / 1024 + 1 )) MiB" - dd if=$FP_SOURCE of=$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT bs=1M status=progress count=$(( $IMAGE_SIZE / 1024 / 1024 + 1 )) + G_EXEC dd if=$FP_SOURCE of=$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT bs=1M status=progress count=$(( $IMAGE_SIZE / 1024 / 1024 + 1 )) # Drive source, clone with Clonezilla else G_DIETPI-NOTIFY 2 'Creating final image with Clonezilla' # Install required packages - G_AG_CHECK_INSTALL_PREREQ clonezilla partclone xorriso isolinux syslinux-common unzip curl || Exit_On_Fail + G_AG_CHECK_INSTALL_PREREQ clonezilla partclone xorriso isolinux syslinux-common unzip curl # Download last version of Clonezilla Live CLONEZILLA_VERSION=$(curl -s "$CLONEZILLA_REPO/" | grep 'class="folder "' | head -n1 | cut -d\" -f2) if [[ -z "$CLONEZILLA_VERSION" ]]; then G_DIETPI-NOTIFY 1 'Could not retrieve version number of last Clonezilla Live, aborting...' - Exit_On_Fail + exit 1 fi CLONEZILLA_ZIP="clonezilla-live-${CLONEZILLA_VERSION}-amd64.zip" @@ -326,18 +341,18 @@ Do you want to overwrite or backup the existing file to $PWD/$OUTPUT_IMG_NAME.$O # Check if there is enough free disk space to store Clonezilla, the final image and the 7z file NEEDED_FREE_SPACE=$(( ( $CLONEZILLA_ZIP_SIZE + $IMAGE_SIZE / 100 * 23 ) * 2 / 1024 / 1024 )) - G_CHECK_FREESPACE . $(( $NEEDED_FREE_SPACE + 100 )) || Exit_On_Fail # Assure +100 MiB left partition space + G_CHECK_FREESPACE . $(( $NEEDED_FREE_SPACE + 100 )) || exit 1 # Assure +100 MiB left partition space # Download Clonezilla Live if [[ ! -f $CLONEZILLA_ZIP || $(stat -c %s "$CLONEZILLA_ZIP") != $CLONEZILLA_ZIP_SIZE ]]; then G_DIETPI-NOTIFY 2 "Downloading Clonezilla Live v$CLONEZILLA_VERSION..." - wget "$CLONEZILLA_ZIP_URL" -O "$CLONEZILLA_ZIP" || Exit_On_Fail + G_EXEC wget "$CLONEZILLA_ZIP_URL" -O "$CLONEZILLA_ZIP" fi # Extract Clonezilla Live - unzip "$CLONEZILLA_ZIP" -d 'tmpiso' || Exit_On_Fail + G_EXEC unzip "$CLONEZILLA_ZIP" -d 'tmpiso' rm "$CLONEZILLA_ZIP" # Clone disk with Clonezilla @@ -345,7 +360,7 @@ Do you want to overwrite or backup the existing file to $PWD/$OUTPUT_IMG_NAME.$O mkdir -p tmpiso/home/partimag G_DIETPI-NOTIFY 2 'Cloning disk with Clonezilla...' - ocs-sr -or $PWD/tmpiso/home/partimag -nogui -fsck -q2 -c -j2 -z1p -i 4096 -senc -sc savedisk $OUTPUT_IMG_NAME ${FP_SOURCE##*/} || Exit_On_Fail + ocs-sr -or $PWD/tmpiso/home/partimag -nogui -fsck -q2 -c -j2 -z1p -i 4096 -senc -sc savedisk $OUTPUT_IMG_NAME ${FP_SOURCE##*/} || exit 1 fi @@ -354,11 +369,11 @@ Do you want to overwrite or backup the existing file to $PWD/$OUTPUT_IMG_NAME.$O # Check image G_DIETPI-NOTIFY 2 'Checking Clonezilla image...' - ocs-chkimg -or $PWD/tmpiso/home/partimag -nogui -b $OUTPUT_IMG_NAME || Exit_On_Fail + ocs-chkimg -or $PWD/tmpiso/home/partimag -nogui -b $OUTPUT_IMG_NAME || exit 1 # Prepare custom files used by the installer when booting in UEFI mode - wget "$DIETPI_REPO"/.meta/images/dietpi-background_768p.png -O tmpiso/boot/grub/dietpibg.png || Exit_On_Fail - wget "$DIETPI_REPO"/.meta/images/select_bkg_c.png -O tmpiso/boot/grub/select_bkg_c.png || Exit_On_Fail + G_EXEC wget "$DIETPI_REPO"/.meta/images/dietpi-background_768p.png -O tmpiso/boot/grub/dietpibg.png + G_EXEC wget "$DIETPI_REPO"/.meta/images/select_bkg_c.png -O tmpiso/boot/grub/select_bkg_c.png cat << '_EOF_' > tmpiso/boot/grub/theme.txt title-text: "" desktop-image: "dietpibg.png" @@ -393,7 +408,7 @@ menuentry "Power off" { halt } _EOF_ # Prepare custom files used by the installer when booting in BIOS/CSM mode - wget "$DIETPI_REPO"/.meta/images/dietpi-background_480p.png -O tmpiso/syslinux/dietpibg.png || Exit_On_Fail + G_EXEC wget "$DIETPI_REPO"/.meta/images/dietpi-background_480p.png -O tmpiso/syslinux/dietpibg.png cp /usr/lib/syslinux/modules/bios/poweroff.c32 tmpiso/syslinux/ mv tmpiso/syslinux/{syslinux,clonezilla}.cfg sed -i 's|\(MENU TITLE\) .*|\1 Clonezilla live|' tmpiso/syslinux/clonezilla.cfg @@ -434,7 +449,7 @@ _EOF_ -A "clonezilla-live-${CLONEZILLA_VERSION}-amd64" \ -b syslinux/isolinux.bin -c syslinux/boot.cat -no-emul-boot -boot-load-size 4 \ -boot-info-table -eltorito-alt-boot --efi-boot boot/grub/efi.img -isohybrid-gpt-basdat \ - -isohybrid-apm-hfsplus tmpiso > $OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT || Exit_On_Fail + -isohybrid-apm-hfsplus tmpiso > $OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT || exit 1 rm -rf tmpiso fi @@ -449,21 +464,20 @@ SHA256: $(sha256sum $OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT | mawk '{print $1}') _EOF_ # Download current README - G_EXEC_DESC='Downloading current README.md to pack with image...' G_EXEC curl -sSfL "$DIETPI_REPO"/README.md -o README.md || Exit_On_Fail + G_EXEC_DESC='Downloading current README.md to pack with image...' G_EXEC curl -sSfL "$DIETPI_REPO"/README.md -o README.md # Generate 7z archive - # NB: LZMA2 ultra compression method requires 2G RAM + # NB: LZMA2 ultra compression requires much memory for usage and allocation, which is an issue on 32bit (ARM) devices. Use "-mmt" to limit used CPU threads to "" and lower memory usage and allocation. + local limit_threads + (( $(free -m | mawk '/Mem:/{print $2}') < 1750 && $(nproc) > 2 )) && limit_threads='-mmt2' [[ -f $OUTPUT_IMG_NAME.7z ]] && rm $OUTPUT_IMG_NAME.7z - G_DIETPI-NOTIFY 2 'Creating final 7zip archive...' - if 7zr a -m0=lzma2 -mx=9 $OUTPUT_IMG_NAME.7z $OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT hash.txt README.md; then + G_EXEC_DESC='Creating final 7zip archive' G_EXEC_OUTPUT=1 G_EXEC 7zr a -m0=lzma2 $limit_threads -mx=9 $OUTPUT_IMG_NAME.7z $OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT hash.txt README.md - rm hash.txt README.md - G_WHIP_MSG "[ OK ] DietPi-Imager has successfully finished.\n + rm hash.txt README.md + G_WHIP_MSG "[ OK ] DietPi-Imager has successfully finished.\n Final image file: $PWD/$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT Final 7z archive: $PWD/$OUTPUT_IMG_NAME.7z" - fi - } #///////////////////////////////////////////////////////////////////////////////////// diff --git a/.meta/dietpi-survey_report b/.meta/dietpi-survey_report index 7e79797200..171f1f23a1 100644 --- a/.meta/dietpi-survey_report +++ b/.meta/dietpi-survey_report @@ -3,6 +3,9 @@ # Created by MichaIng / micha@dietpi.com / dietpi.com + # Prevent concurrent executions + (( $(pgrep -cf dietpi-survey_report) > 1 )) && { echo 'Concurrent execution detected. Exiting...'; exit 1; } + #----------------------------------------------------------- # Globals - benchmarks #----------------------------------------------------------- @@ -20,6 +23,7 @@ aHW_NAME[13]='Odroid U3' aHW_NAME[14]='Odroid N1' aHW_NAME[15]='Odroid N2' + aHW_NAME[16]='Odroid C4' aHW_NAME[20]='x86_64 VM' aHW_NAME[21]='x86_64 PC' aHW_NAME[22]='Generic Device' @@ -84,7 +88,7 @@ declare -A aBENCH_NET_LAN_SPEED # Results - BENCH_RESULTS_CPU_SCALE=1 + BENCH_RESULTS_CPU_SCALE=2 aBENCH_RESULT_CPU_MIN=() aBENCH_RESULT_CPU_MAX=() aBENCH_RESULT_CPU_AVG=() @@ -138,13 +142,12 @@ declare -A aDISTRO_VERSION declare -A aAUTOSTART_OPTION declare -A aSOFTWARE - aAUTO_SETUP_AUTOMATED=( - [0]=0 - [1]=0 - ) + aAUTO_SETUP_AUTOMATED=(0 0) declare -A aNETWORK_INTERFACE # v6.17 addition declare -A aGIT_BRANCH + # v6.31 addition + aRASPBIAN=(0 0) # Convert autostart index to name array aAUTOSTART_NAME=() @@ -258,7 +261,7 @@ aSOFTWARE_NAME[89]='PHP' aSOFTWARE_NAME[90]='phpMyAdmin' aSOFTWARE_NAME[91]='Redis' - aSOFTWARE_NAME[92]='CertBot' + aSOFTWARE_NAME[92]='Certbot' aSOFTWARE_NAME[93]='Pi-hole' aSOFTWARE_NAME[94]='ProFTP' aSOFTWARE_NAME[95]='vsFTPD' @@ -337,9 +340,8 @@ aSOFTWARE_NAME[168]=168 aSOFTWARE_NAME[169]='Google AIY' - # v6.14 (earliest version that uploads to ssh.dietpi.com) + # v6.14 (earliest version that can currently upload) + v6.15 aSOFTWARE_NAME6_14=() - # v6.15 aSOFTWARE_NAME6_15=() for i in ${!aSOFTWARE_NAME[@]} do @@ -441,11 +443,22 @@ done aSOFTWARE_NAME6_29[140]='Domoticz' + # v6.30 + v6.31 + aSOFTWARE_NAME6_30=() + aSOFTWARE_NAME6_31=() + for i in ${!aSOFTWARE_NAME6_29[@]} + do + + aSOFTWARE_NAME6_30[$i]=${aSOFTWARE_NAME6_29[$i]} + aSOFTWARE_NAME6_31[$i]=${aSOFTWARE_NAME6_30[$i]} + + done + Main(){ - # Copy files to RAM to speed up grep + # Copy files to RAM to speed up sourcing #mkdir -p /tmp/dietpi-survey_report - #cp /home/dietpi-survey/survey/*.txt /tmp/dietpi-survey_report/ # /etc/cron.minutely/dietpi-survey_report: line 310: /bin/cp: Argument list too long + #cp /home/dietpi-survey/survey/*.txt /tmp/dietpi-survey_report/ # cp: Argument list too long [[ -e '/tmp/dietpi-survey_report' ]] && rm -R /tmp/dietpi-survey_report cp -R /home/dietpi-survey/survey /tmp/dietpi-survey_report @@ -463,90 +476,85 @@ fi # Source survey files - if [[ $(<$file) == '#!/bin/bash'* ]]; then - - . $file - - # Add bench to array - if [[ $BENCH_HW_MODEL =~ ^[0-9]+$ ]]; then + [[ $(<$file) == '#!/bin/bash'* ]] || continue - # CPU - # - Remove decimal places - BENCH_CPU_TEMP_START=${BENCH_CPU_TEMP_START%%.*} - BENCH_CPU_TEMP_END=${BENCH_CPU_TEMP_END%%.*} - if [[ ${BENCH_CPU%%.*} =~ ^[0-9]+$ && $BENCH_CPU_TEMP_START =~ ^-?[0-9]+$ && $BENCH_CPU_TEMP_END =~ ^-?[0-9]+$ ]]; then + . $file - aBENCH_CPU[$BENCH_HW_MODEL,${aBENCH_CPU_INDEX[$BENCH_HW_MODEL]:=0}]=$BENCH_CPU + # Add bench to array + [[ $BENCH_HW_MODEL =~ ^[0-9]+$ ]] || continue - # - Patch for 5 digit CPU temps: https://github.com/MichaIng/DietPi/issues/2715 - (( $BENCH_CPU_TEMP_START > 130 )) && (( BENCH_CPU_TEMP_START /= 1000 )) - (( $BENCH_CPU_TEMP_END > 130 )) && (( BENCH_CPU_TEMP_END /= 1000 )) + # CPU + # - BENCH_CPU: Remove decimal point, equals times 100 since CPU time is always in x.xx + BENCH_CPU=${BENCH_CPU/.} + if [[ $BENCH_CPU =~ ^[0-9]+$ && $BENCH_CPU_TEMP_START =~ ^-?[0-9]+$ && $BENCH_CPU_TEMP_END =~ ^-?[0-9]+$ ]]; then - aBENCH_CPU_TEMP_START[$BENCH_HW_MODEL,${aBENCH_CPU_INDEX[$BENCH_HW_MODEL]}]=$BENCH_CPU_TEMP_START - aBENCH_CPU_TEMP_END[$BENCH_HW_MODEL,${aBENCH_CPU_INDEX[$BENCH_HW_MODEL]}]=$BENCH_CPU_TEMP_END - ((aBENCH_CPU_INDEX[$BENCH_HW_MODEL]++)) + aBENCH_CPU[$BENCH_HW_MODEL,${aBENCH_CPU_INDEX[$BENCH_HW_MODEL]:=0}]=$BENCH_CPU - fi + # Patch for 5 digit CPU temps: https://github.com/MichaIng/DietPi/issues/2715 + (( $BENCH_CPU_TEMP_START > 200 )) && (( BENCH_CPU_TEMP_START /= 1000 )) + (( $BENCH_CPU_TEMP_END > 200 )) && (( BENCH_CPU_TEMP_END /= 1000 )) - # RootFS - # - Remove decimal places - BENCH_ROOTFS_WRITE=${BENCH_ROOTFS_WRITE%%.*} - BENCH_ROOTFS_READ=${BENCH_ROOTFS_READ%%.*} - if [[ $BENCH_ROOTFS_WRITE =~ ^[0-9]+$ && $BENCH_ROOTFS_READ =~ ^[0-9]+$ ]]; then + aBENCH_CPU_TEMP_START[$BENCH_HW_MODEL,${aBENCH_CPU_INDEX[$BENCH_HW_MODEL]}]=$BENCH_CPU_TEMP_START + aBENCH_CPU_TEMP_END[$BENCH_HW_MODEL,${aBENCH_CPU_INDEX[$BENCH_HW_MODEL]}]=$BENCH_CPU_TEMP_END + ((aBENCH_CPU_INDEX[$BENCH_HW_MODEL]++)) - aBENCH_ROOTFS_WRITE[$BENCH_HW_MODEL,${aBENCH_ROOTFS_INDEX[$BENCH_HW_MODEL]:=0}]=$BENCH_ROOTFS_WRITE - aBENCH_ROOTFS_READ[$BENCH_HW_MODEL,${aBENCH_ROOTFS_INDEX[$BENCH_HW_MODEL]}]=$BENCH_ROOTFS_READ - ((aBENCH_ROOTFS_INDEX[$BENCH_HW_MODEL]++)) - - fi + fi - # RAM - # - https://github.com/MichaIng/DietPi/issues/2715 | nullify this score and ignore it in min/max/avg processing. - # - Remove decimal places - BENCH_RAM_WRITE=${BENCH_RAM_WRITE%%.*} - BENCH_RAM_READ=${BENCH_RAM_READ%%.*} - if [[ $BENCH_VERSION =~ ^[0-9]+$ && $BENCH_RAM_WRITE =~ ^[0-9]+$ && $BENCH_RAM_READ =~ ^[0-9]+$ ]] && (( $BENCH_VERSION > 1 )); then + # RootFS + # - Remove decimal places + BENCH_ROOTFS_WRITE=${BENCH_ROOTFS_WRITE%%.*} + BENCH_ROOTFS_READ=${BENCH_ROOTFS_READ%%.*} + if [[ $BENCH_ROOTFS_WRITE =~ ^[0-9]+$ && $BENCH_ROOTFS_READ =~ ^[0-9]+$ ]]; then - aBENCH_RAM_WRITE[$BENCH_HW_MODEL,${aBENCH_RAM_INDEX[$BENCH_HW_MODEL]:=0}]=$BENCH_RAM_WRITE - aBENCH_RAM_READ[$BENCH_HW_MODEL,${aBENCH_RAM_INDEX[$BENCH_HW_MODEL]}]=$BENCH_RAM_READ - ((aBENCH_RAM_INDEX[$BENCH_HW_MODEL]++)) + aBENCH_ROOTFS_WRITE[$BENCH_HW_MODEL,${aBENCH_ROOTFS_INDEX[$BENCH_HW_MODEL]:=0}]=$BENCH_ROOTFS_WRITE + aBENCH_ROOTFS_READ[$BENCH_HW_MODEL,${aBENCH_ROOTFS_INDEX[$BENCH_HW_MODEL]}]=$BENCH_ROOTFS_READ + ((aBENCH_ROOTFS_INDEX[$BENCH_HW_MODEL]++)) - fi + fi - # Custom FS - # - Remove decimal places - BENCH_CUSTOMFS_WRITE=${BENCH_CUSTOMFS_WRITE%%.*} - BENCH_CUSTOMFS_READ=${BENCH_CUSTOMFS_READ%%.*} - if [[ $BENCH_CUSTOMFS_WRITE =~ ^[0-9]+$ && $BENCH_CUSTOMFS_READ =~ ^[0-9]+$ ]]; then + # RAM + # - https://github.com/MichaIng/DietPi/issues/2715 | nullify this score and ignore it in min/max/avg processing. + # - Remove decimal places + BENCH_RAM_WRITE=${BENCH_RAM_WRITE%%.*} + BENCH_RAM_READ=${BENCH_RAM_READ%%.*} + if [[ $BENCH_VERSION =~ ^[0-9]+$ && $BENCH_RAM_WRITE =~ ^[0-9]+$ && $BENCH_RAM_READ =~ ^[0-9]+$ ]] && (( $BENCH_VERSION > 1 )); then - aBENCH_CUSTOMFS_WRITE[$BENCH_HW_MODEL,${aBENCH_CUSTOMFS_INDEX[$BENCH_HW_MODEL]:=0}]=$BENCH_CUSTOMFS_WRITE - aBENCH_CUSTOMFS_READ[$BENCH_HW_MODEL,${aBENCH_CUSTOMFS_INDEX[$BENCH_HW_MODEL]}]=$BENCH_CUSTOMFS_READ - ((aBENCH_CUSTOMFS_INDEX[$BENCH_HW_MODEL]++)) + aBENCH_RAM_WRITE[$BENCH_HW_MODEL,${aBENCH_RAM_INDEX[$BENCH_HW_MODEL]:=0}]=$BENCH_RAM_WRITE + aBENCH_RAM_READ[$BENCH_HW_MODEL,${aBENCH_RAM_INDEX[$BENCH_HW_MODEL]}]=$BENCH_RAM_READ + ((aBENCH_RAM_INDEX[$BENCH_HW_MODEL]++)) - fi + fi - # LAN - # - Remove decimal places - BENCH_NET_LAN_SPEED=${BENCH_NET_LAN_SPEED%%.*} - if [[ $BENCH_NET_LAN_SPEED =~ ^[0-9]+$ ]]; then + # Custom FS + # - Remove decimal places + BENCH_CUSTOMFS_WRITE=${BENCH_CUSTOMFS_WRITE%%.*} + BENCH_CUSTOMFS_READ=${BENCH_CUSTOMFS_READ%%.*} + if [[ $BENCH_CUSTOMFS_WRITE =~ ^[0-9]+$ && $BENCH_CUSTOMFS_READ =~ ^[0-9]+$ ]]; then - aBENCH_NET_LAN_SPEED[$BENCH_HW_MODEL,${aBENCH_LAN_INDEX[$BENCH_HW_MODEL]:=0}]=$BENCH_NET_LAN_SPEED - ((aBENCH_LAN_INDEX[$BENCH_HW_MODEL]++)) + aBENCH_CUSTOMFS_WRITE[$BENCH_HW_MODEL,${aBENCH_CUSTOMFS_INDEX[$BENCH_HW_MODEL]:=0}]=$BENCH_CUSTOMFS_WRITE + aBENCH_CUSTOMFS_READ[$BENCH_HW_MODEL,${aBENCH_CUSTOMFS_INDEX[$BENCH_HW_MODEL]}]=$BENCH_CUSTOMFS_READ + ((aBENCH_CUSTOMFS_INDEX[$BENCH_HW_MODEL]++)) - fi + fi - # Done, clear vars - unset BENCH_VERSION BENCH_HW_MODEL - unset BENCH_CPU BENCH_CPU_TEMP_START BENCH_CPU_TEMP_END - unset BENCH_ROOTFS_WRITE BENCH_ROOTFS_READ - unset BENCH_RAM_WRITE BENCH_RAM_READ - unset BENCH_CUSTOMFS_WRITE BENCH_CUSTOMFS_READ - unset BENCH_NET_LAN_SPEED + # LAN + # - Remove decimal places + BENCH_NET_LAN_SPEED=${BENCH_NET_LAN_SPEED%%.*} + if [[ $BENCH_NET_LAN_SPEED =~ ^[0-9]+$ ]]; then - fi + aBENCH_NET_LAN_SPEED[$BENCH_HW_MODEL,${aBENCH_LAN_INDEX[$BENCH_HW_MODEL]:=0}]=$BENCH_NET_LAN_SPEED + ((aBENCH_LAN_INDEX[$BENCH_HW_MODEL]++)) fi + # Done, clear vars + unset BENCH_VERSION BENCH_HW_MODEL + unset BENCH_CPU BENCH_CPU_TEMP_START BENCH_CPU_TEMP_END + unset BENCH_ROOTFS_WRITE BENCH_ROOTFS_READ + unset BENCH_RAM_WRITE BENCH_RAM_READ + unset BENCH_CUSTOMFS_WRITE BENCH_CUSTOMFS_READ + unset BENCH_NET_LAN_SPEED + done # Navigate to parent /tmp @@ -555,6 +563,9 @@ # Clean up reports dir rm -R /tmp/dietpi-survey_report + # Optin count + SURVEY_COUNT_OPTIN=$(( $SURVEY_COUNT_TOTAL - $SURVEY_COUNT_EMPTY )) + # Process all results, for later use in HTML printout # - NB: HW_MODEL array based local default_min_value=100000 @@ -576,53 +587,26 @@ for (( j=0; j<${aBENCH_CPU_INDEX[$i]}; j++ )) do - # Use bc to allow floats - if (( $(bc -l <<< "${aBENCH_CPU[$i,$j]} < ${aBENCH_RESULT_CPU_MIN[$i]}") )); then - - aBENCH_RESULT_CPU_MIN[$i]=${aBENCH_CPU[$i,$j]} - - fi - if (( $(bc -l <<< "${aBENCH_CPU[$i,$j]} > ${aBENCH_RESULT_CPU_MAX[$i]}") )); then - - aBENCH_RESULT_CPU_MAX[$i]=${aBENCH_CPU[$i,$j]} - - fi - aBENCH_RESULT_CPU_AVG[$i]=$(bc -l <<< "${aBENCH_RESULT_CPU_AVG[$i]} + ${aBENCH_CPU[$i,$j]}") + (( ${aBENCH_CPU[$i,$j]} < ${aBENCH_RESULT_CPU_MIN[$i]} )) && aBENCH_RESULT_CPU_MIN[$i]=${aBENCH_CPU[$i,$j]} + (( ${aBENCH_CPU[$i,$j]} > ${aBENCH_RESULT_CPU_MAX[$i]} )) && aBENCH_RESULT_CPU_MAX[$i]=${aBENCH_CPU[$i,$j]} + (( aBENCH_RESULT_CPU_AVG[$i] += ${aBENCH_CPU[$i,$j]} )) - if (( ${aBENCH_CPU_TEMP_START[$i,$j]} < ${aBENCH_RESULT_CPU_TEMP_START_MIN[$i]} )); then - - aBENCH_RESULT_CPU_TEMP_START_MIN[$i]=${aBENCH_CPU_TEMP_START[$i,$j]} - - fi - if (( ${aBENCH_CPU_TEMP_START[$i,$j]} > ${aBENCH_RESULT_CPU_TEMP_START_MAX[$i]} )); then - - aBENCH_RESULT_CPU_TEMP_START_MAX[$i]=${aBENCH_CPU_TEMP_START[$i,$j]} - - fi + (( ${aBENCH_CPU_TEMP_START[$i,$j]} < ${aBENCH_RESULT_CPU_TEMP_START_MIN[$i]} )) && aBENCH_RESULT_CPU_TEMP_START_MIN[$i]=${aBENCH_CPU_TEMP_START[$i,$j]} + (( ${aBENCH_CPU_TEMP_START[$i,$j]} > ${aBENCH_RESULT_CPU_TEMP_START_MAX[$i]} )) && aBENCH_RESULT_CPU_TEMP_START_MAX[$i]=${aBENCH_CPU_TEMP_START[$i,$j]} (( aBENCH_RESULT_CPU_TEMP_START_AVG[$i] += ${aBENCH_CPU_TEMP_START[$i,$j]} )) - if (( ${aBENCH_CPU_TEMP_END[$i,$j]} < ${aBENCH_RESULT_CPU_TEMP_END_MIN[$i]} )); then - - aBENCH_RESULT_CPU_TEMP_END_MIN[$i]=${aBENCH_CPU_TEMP_END[$i,$j]} - - fi - if (( ${aBENCH_CPU_TEMP_END[$i,$j]} > ${aBENCH_RESULT_CPU_TEMP_END_MAX[$i]} )); then - - aBENCH_RESULT_CPU_TEMP_END_MAX[$i]=${aBENCH_CPU_TEMP_END[$i,$j]} - - fi + (( ${aBENCH_CPU_TEMP_END[$i,$j]} < ${aBENCH_RESULT_CPU_TEMP_END_MIN[$i]} )) && aBENCH_RESULT_CPU_TEMP_END_MIN[$i]=${aBENCH_CPU_TEMP_END[$i,$j]} + (( ${aBENCH_CPU_TEMP_END[$i,$j]} > ${aBENCH_RESULT_CPU_TEMP_END_MAX[$i]} )) && aBENCH_RESULT_CPU_TEMP_END_MAX[$i]=${aBENCH_CPU_TEMP_END[$i,$j]} (( aBENCH_RESULT_CPU_TEMP_END_AVG[$i] += ${aBENCH_CPU_TEMP_END[$i,$j]} )) - # Last item in current array. Scale and work out averages - if (( $j == ${aBENCH_CPU_INDEX[$i]} - 1 )); then - - aBENCH_RESULT_CPU_MIN[$i]=$(bc -l <<< "scale=$BENCH_RESULTS_CPU_SCALE; ${aBENCH_RESULT_CPU_MIN[$i]} / 1") - aBENCH_RESULT_CPU_MAX[$i]=$(bc -l <<< "scale=$BENCH_RESULTS_CPU_SCALE; ${aBENCH_RESULT_CPU_MAX[$i]} / 1") - aBENCH_RESULT_CPU_AVG[$i]=$(bc -l <<< "scale=$BENCH_RESULTS_CPU_SCALE; ${aBENCH_RESULT_CPU_AVG[$i]} / ${aBENCH_CPU_INDEX[$i]}") - aBENCH_RESULT_CPU_TEMP_START_AVG[$i]=$(( ${aBENCH_RESULT_CPU_TEMP_START_AVG[$i]} / ${aBENCH_CPU_INDEX[$i]} )) - aBENCH_RESULT_CPU_TEMP_END_AVG[$i]=$(( ${aBENCH_RESULT_CPU_TEMP_END_AVG[$i]} / ${aBENCH_CPU_INDEX[$i]} )) - - fi + # Last item in current array. Work out averages + (( $j == ${aBENCH_CPU_INDEX[$i]} - 1 )) || continue + # - Devide CPU times by 100 and scale to revert decimal point removal + aBENCH_RESULT_CPU_MIN[$i]=$(bc -l <<< "scale=$BENCH_RESULTS_CPU_SCALE; ${aBENCH_RESULT_CPU_MIN[$i]} / 100") + aBENCH_RESULT_CPU_MAX[$i]=$(bc -l <<< "scale=$BENCH_RESULTS_CPU_SCALE; ${aBENCH_RESULT_CPU_MAX[$i]} / 100") + aBENCH_RESULT_CPU_AVG[$i]=$(bc -l <<< "scale=$BENCH_RESULTS_CPU_SCALE; ${aBENCH_RESULT_CPU_AVG[$i]} / ${aBENCH_CPU_INDEX[$i]} / 100") + aBENCH_RESULT_CPU_TEMP_START_AVG[$i]=$(( ${aBENCH_RESULT_CPU_TEMP_START_AVG[$i]} / ${aBENCH_CPU_INDEX[$i]} )) + aBENCH_RESULT_CPU_TEMP_END_AVG[$i]=$(( ${aBENCH_RESULT_CPU_TEMP_END_AVG[$i]} / ${aBENCH_CPU_INDEX[$i]} )) done @@ -642,37 +626,18 @@ for (( j=0; j<${aBENCH_ROOTFS_INDEX[$i]}; j++ )) do - if (( ${aBENCH_ROOTFS_WRITE[$i,$j]} < ${aBENCH_RESULT_ROOTFS_WRITE_MIN[$i]} )); then - - aBENCH_RESULT_ROOTFS_WRITE_MIN[$i]=${aBENCH_ROOTFS_WRITE[$i,$j]} - - fi - if (( ${aBENCH_ROOTFS_WRITE[$i,$j]} > ${aBENCH_RESULT_ROOTFS_WRITE_MAX[$i]} )); then - - aBENCH_RESULT_ROOTFS_WRITE_MAX[$i]=${aBENCH_ROOTFS_WRITE[$i,$j]} - - fi + (( ${aBENCH_ROOTFS_WRITE[$i,$j]} < ${aBENCH_RESULT_ROOTFS_WRITE_MIN[$i]} )) && aBENCH_RESULT_ROOTFS_WRITE_MIN[$i]=${aBENCH_ROOTFS_WRITE[$i,$j]} + (( ${aBENCH_ROOTFS_WRITE[$i,$j]} > ${aBENCH_RESULT_ROOTFS_WRITE_MAX[$i]} )) && aBENCH_RESULT_ROOTFS_WRITE_MAX[$i]=${aBENCH_ROOTFS_WRITE[$i,$j]} (( aBENCH_RESULT_ROOTFS_WRITE_AVG[$i] += ${aBENCH_ROOTFS_WRITE[$i,$j]} )) - if (( ${aBENCH_ROOTFS_READ[$i,$j]} < ${aBENCH_RESULT_ROOTFS_READ_MIN[$i]} )); then - - aBENCH_RESULT_ROOTFS_READ_MIN[$i]=${aBENCH_ROOTFS_READ[$i,$j]} - - fi - if (( ${aBENCH_ROOTFS_READ[$i,$j]} > ${aBENCH_RESULT_ROOTFS_READ_MAX[$i]} )); then - - aBENCH_RESULT_ROOTFS_READ_MAX[$i]=${aBENCH_ROOTFS_READ[$i,$j]} - - fi + (( ${aBENCH_ROOTFS_READ[$i,$j]} < ${aBENCH_RESULT_ROOTFS_READ_MIN[$i]} )) && aBENCH_RESULT_ROOTFS_READ_MIN[$i]=${aBENCH_ROOTFS_READ[$i,$j]} + (( ${aBENCH_ROOTFS_READ[$i,$j]} > ${aBENCH_RESULT_ROOTFS_READ_MAX[$i]} )) && aBENCH_RESULT_ROOTFS_READ_MAX[$i]=${aBENCH_ROOTFS_READ[$i,$j]} (( aBENCH_RESULT_ROOTFS_READ_AVG[$i] += ${aBENCH_ROOTFS_READ[$i,$j]} )) # Last item in current array. Work out averages - if (( $j == ${aBENCH_ROOTFS_INDEX[$i]} - 1 )); then - - aBENCH_RESULT_ROOTFS_WRITE_AVG[$i]=$(( ${aBENCH_RESULT_ROOTFS_WRITE_AVG[$i]} / ${aBENCH_ROOTFS_INDEX[$i]} )) - aBENCH_RESULT_ROOTFS_READ_AVG[$i]=$(( ${aBENCH_RESULT_ROOTFS_READ_AVG[$i]} / ${aBENCH_ROOTFS_INDEX[$i]} )) - - fi + (( $j == ${aBENCH_ROOTFS_INDEX[$i]} - 1 )) || continue + aBENCH_RESULT_ROOTFS_WRITE_AVG[$i]=$(( ${aBENCH_RESULT_ROOTFS_WRITE_AVG[$i]} / ${aBENCH_ROOTFS_INDEX[$i]} )) + aBENCH_RESULT_ROOTFS_READ_AVG[$i]=$(( ${aBENCH_RESULT_ROOTFS_READ_AVG[$i]} / ${aBENCH_ROOTFS_INDEX[$i]} )) done @@ -692,37 +657,18 @@ for (( j=0; j<${aBENCH_RAM_INDEX[$i]}; j++ )) do - if (( ${aBENCH_RAM_WRITE[$i,$j]} < ${aBENCH_RESULT_RAM_WRITE_MIN[$i]} )); then - - aBENCH_RESULT_RAM_WRITE_MIN[$i]=${aBENCH_RAM_WRITE[$i,$j]} - - fi - if (( ${aBENCH_RAM_WRITE[$i,$j]} > ${aBENCH_RESULT_RAM_WRITE_MAX[$i]} )); then - - aBENCH_RESULT_RAM_WRITE_MAX[$i]=${aBENCH_RAM_WRITE[$i,$j]} - - fi + (( ${aBENCH_RAM_WRITE[$i,$j]} < ${aBENCH_RESULT_RAM_WRITE_MIN[$i]} )) && aBENCH_RESULT_RAM_WRITE_MIN[$i]=${aBENCH_RAM_WRITE[$i,$j]} + (( ${aBENCH_RAM_WRITE[$i,$j]} > ${aBENCH_RESULT_RAM_WRITE_MAX[$i]} )) && aBENCH_RESULT_RAM_WRITE_MAX[$i]=${aBENCH_RAM_WRITE[$i,$j]} (( aBENCH_RESULT_RAM_WRITE_AVG[$i] += ${aBENCH_RAM_WRITE[$i,$j]} )) - if (( ${aBENCH_RAM_READ[$i,$j]} < ${aBENCH_RESULT_RAM_READ_MIN[$i]} )); then - - aBENCH_RESULT_RAM_READ_MIN[$i]=${aBENCH_RAM_READ[$i,$j]} - - fi - if (( ${aBENCH_RAM_READ[$i,$j]} > ${aBENCH_RESULT_RAM_READ_MAX[$i]} )); then - - aBENCH_RESULT_RAM_READ_MAX[$i]=${aBENCH_RAM_READ[$i,$j]} - - fi + (( ${aBENCH_RAM_READ[$i,$j]} < ${aBENCH_RESULT_RAM_READ_MIN[$i]} )) && aBENCH_RESULT_RAM_READ_MIN[$i]=${aBENCH_RAM_READ[$i,$j]} + (( ${aBENCH_RAM_READ[$i,$j]} > ${aBENCH_RESULT_RAM_READ_MAX[$i]} )) && aBENCH_RESULT_RAM_READ_MAX[$i]=${aBENCH_RAM_READ[$i,$j]} (( aBENCH_RESULT_RAM_READ_AVG[$i] += ${aBENCH_RAM_READ[$i,$j]} )) # Last item in current array. Work out averages - if (( $j == ${aBENCH_RAM_INDEX[$i]} - 1 )); then - - aBENCH_RESULT_RAM_WRITE_AVG[$i]=$(( ${aBENCH_RESULT_RAM_WRITE_AVG[$i]} / ${aBENCH_RAM_INDEX[$i]} )) - aBENCH_RESULT_RAM_READ_AVG[$i]=$(( ${aBENCH_RESULT_RAM_READ_AVG[$i]} / ${aBENCH_RAM_INDEX[$i]} )) - - fi + (( $j == ${aBENCH_RAM_INDEX[$i]} - 1 )) || continue + aBENCH_RESULT_RAM_WRITE_AVG[$i]=$(( ${aBENCH_RESULT_RAM_WRITE_AVG[$i]} / ${aBENCH_RAM_INDEX[$i]} )) + aBENCH_RESULT_RAM_READ_AVG[$i]=$(( ${aBENCH_RESULT_RAM_READ_AVG[$i]} / ${aBENCH_RAM_INDEX[$i]} )) done @@ -739,24 +685,13 @@ for (( j=0; j<${aBENCH_LAN_INDEX[$i]}; j++ )) do - if (( ${aBENCH_NET_LAN_SPEED[$i,$j]} < ${aBENCH_RESULT_NET_LAN_SPEED_MIN[$i]} )); then - - aBENCH_RESULT_NET_LAN_SPEED_MIN[$i]=${aBENCH_NET_LAN_SPEED[$i,$j]} - - fi - if (( ${aBENCH_NET_LAN_SPEED[$i,$j]} > ${aBENCH_RESULT_NET_LAN_SPEED_MAX[$i]} )); then - - aBENCH_RESULT_NET_LAN_SPEED_MAX[$i]=${aBENCH_NET_LAN_SPEED[$i,$j]} - - fi + (( ${aBENCH_NET_LAN_SPEED[$i,$j]} < ${aBENCH_RESULT_NET_LAN_SPEED_MIN[$i]} )) && aBENCH_RESULT_NET_LAN_SPEED_MIN[$i]=${aBENCH_NET_LAN_SPEED[$i,$j]} + (( ${aBENCH_NET_LAN_SPEED[$i,$j]} > ${aBENCH_RESULT_NET_LAN_SPEED_MAX[$i]} )) && aBENCH_RESULT_NET_LAN_SPEED_MAX[$i]=${aBENCH_NET_LAN_SPEED[$i,$j]} (( aBENCH_RESULT_NET_LAN_SPEED_AVG[$i] += ${aBENCH_NET_LAN_SPEED[$i,$j]} )) # Last item in current array. Work out averages - if (( $j == ${aBENCH_LAN_INDEX[$i]} - 1 )); then - - aBENCH_RESULT_NET_LAN_SPEED_AVG[$i]=$(( ${aBENCH_RESULT_NET_LAN_SPEED_AVG[$i]} / ${aBENCH_LAN_INDEX[$i]} )) - - fi + (( $j == ${aBENCH_LAN_INDEX[$i]} - 1 )) || continue + aBENCH_RESULT_NET_LAN_SPEED_AVG[$i]=$(( ${aBENCH_RESULT_NET_LAN_SPEED_AVG[$i]} / ${aBENCH_LAN_INDEX[$i]} )) done @@ -776,37 +711,18 @@ for (( j=0; j<${aBENCH_CUSTOMFS_INDEX[$i]}; j++ )) do - if (( ${aBENCH_CUSTOMFS_WRITE[$i,$j]} < ${aBENCH_RESULT_CUSTOMFS_WRITE_MIN[$i]} )); then - - aBENCH_RESULT_CUSTOMFS_WRITE_MIN[$i]=${aBENCH_CUSTOMFS_WRITE[$i,$j]} - - fi - if (( ${aBENCH_CUSTOMFS_WRITE[$i,$j]} > ${aBENCH_RESULT_CUSTOMFS_WRITE_MAX[$i]} )); then - - aBENCH_RESULT_CUSTOMFS_WRITE_MAX[$i]=${aBENCH_CUSTOMFS_WRITE[$i,$j]} - - fi + (( ${aBENCH_CUSTOMFS_WRITE[$i,$j]} < ${aBENCH_RESULT_CUSTOMFS_WRITE_MIN[$i]} )) && aBENCH_RESULT_CUSTOMFS_WRITE_MIN[$i]=${aBENCH_CUSTOMFS_WRITE[$i,$j]} + (( ${aBENCH_CUSTOMFS_WRITE[$i,$j]} > ${aBENCH_RESULT_CUSTOMFS_WRITE_MAX[$i]} )) && aBENCH_RESULT_CUSTOMFS_WRITE_MAX[$i]=${aBENCH_CUSTOMFS_WRITE[$i,$j]} (( aBENCH_RESULT_CUSTOMFS_WRITE_AVG[$i] += ${aBENCH_CUSTOMFS_WRITE[$i,$j]} )) - if (( ${aBENCH_CUSTOMFS_READ[$i,$j]} < ${aBENCH_RESULT_CUSTOMFS_READ_MIN[$i]} )); then - - aBENCH_RESULT_CUSTOMFS_READ_MIN[$i]=${aBENCH_CUSTOMFS_READ[$i,$j]} - - fi - if (( ${aBENCH_CUSTOMFS_READ[$i,$j]} > ${aBENCH_RESULT_CUSTOMFS_READ_MAX[$i]} )); then - - aBENCH_RESULT_CUSTOMFS_READ_MAX[$i]=${aBENCH_CUSTOMFS_READ[$i,$j]} - - fi + (( ${aBENCH_CUSTOMFS_READ[$i,$j]} < ${aBENCH_RESULT_CUSTOMFS_READ_MIN[$i]} )) && aBENCH_RESULT_CUSTOMFS_READ_MIN[$i]=${aBENCH_CUSTOMFS_READ[$i,$j]} + (( ${aBENCH_CUSTOMFS_READ[$i,$j]} > ${aBENCH_RESULT_CUSTOMFS_READ_MAX[$i]} )) && aBENCH_RESULT_CUSTOMFS_READ_MAX[$i]=${aBENCH_CUSTOMFS_READ[$i,$j]} (( aBENCH_RESULT_CUSTOMFS_READ_AVG[$i] += ${aBENCH_CUSTOMFS_READ[$i,$j]} )) # Last item in current array. Work out averages - if (( $j == ${aBENCH_CUSTOMFS_INDEX[$i]} - 1 )); then - - aBENCH_RESULT_CUSTOMFS_WRITE_AVG[$i]=$(( ${aBENCH_RESULT_CUSTOMFS_WRITE_AVG[$i]} / ${aBENCH_CUSTOMFS_INDEX[$i]} )) - aBENCH_RESULT_CUSTOMFS_READ_AVG[$i]=$(( ${aBENCH_RESULT_CUSTOMFS_READ_AVG[$i]} / ${aBENCH_CUSTOMFS_INDEX[$i]} )) - - fi + (( $j == ${aBENCH_CUSTOMFS_INDEX[$i]} - 1 )) || continue + aBENCH_RESULT_CUSTOMFS_WRITE_AVG[$i]=$(( ${aBENCH_RESULT_CUSTOMFS_WRITE_AVG[$i]} / ${aBENCH_CUSTOMFS_INDEX[$i]} )) + aBENCH_RESULT_CUSTOMFS_READ_AVG[$i]=$(( ${aBENCH_RESULT_CUSTOMFS_READ_AVG[$i]} / ${aBENCH_CUSTOMFS_INDEX[$i]} )) done @@ -823,13 +739,13 @@ background-color: black; font-family: Verdana, Arial, Helvetica, sans-serif; } - th, td { - padding: 5px; - } + th, td { padding: 5px; } table, th, td { font-size: 14px; border: 1px solid grey; } + a { color: white; } + a:hover { color: #c5ff00; } @@ -838,68 +754,73 @@ Last update: $(TZ=UTC date "+%Y-%m-%d %T UTC")

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

DietPi versions:

+

DietPi versions:

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

Git branches:

+

Git branches:

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

Devices:

+

Devices:

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

CPU architectures:

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

CPU architectures:

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

CPU core counts:

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

CPU core counts:

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

Distro versions:

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

Distro versions:

+

RPi Debian (64-bit) vs Raspbian (32-bit):

- $(for i in "${!aDISTRO_VERSION[@]}"; do echo ""; done | sort -nrk 2 -t ' ') +
$i ${aDISTRO_VERSION[$i]}
Debian (64-bit) is used by${aRASPBIAN[0]} of $(( ${aRASPBIAN[0]} + ${aRASPBIAN[1]} )) RPi systems$(( ${aRASPBIAN[0]} * 100 / ( ${aRASPBIAN[0]} + ${aRASPBIAN[1]} ) ))%
-

Autostart options:

+

Autostart options:

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

DietPi-Automation:

+

DietPi-Automation:

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

Network interfaces:

+

Network interfaces:

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

Installed software titles:

+

Installed software titles:

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

DietPi-Benchmarks | CPU:

+

DietPi-Benchmarks | CPU:

- - + + @@ -914,15 +835,15 @@ - $(for i in "${!aBENCH_CPU_INDEX[@]}"; do echo ""; done | sort -nk 1 -t ' ') + $(for i in "${!aBENCH_CPU_INDEX[@]}"; do echo ""; done | sort -nk 2 -t ' ')
CPU time (seconds, lower is faster):CPU idle temp ('c):CPU full load temp ('c):CPU idle temp (°C):CPU full load temp (°C):
Device:Lowest: Highest:
${aHW_NAME[$i]:=$i} ${aBENCH_CPU_INDEX[$i]} ${aBENCH_RESULT_CPU_AVG[$i]} ${aBENCH_RESULT_CPU_MIN[$i]} ${aBENCH_RESULT_CPU_MAX[$i]} ${aBENCH_RESULT_CPU_TEMP_START_AVG[$i]} ${aBENCH_RESULT_CPU_TEMP_START_MIN[$i]} ${aBENCH_RESULT_CPU_TEMP_START_MAX[$i]}${aBENCH_RESULT_CPU_TEMP_END_AVG[$i]} ${aBENCH_RESULT_CPU_TEMP_END_MIN[$i]} ${aBENCH_RESULT_CPU_TEMP_END_MAX[$i]}
${aHW_NAME[$i]:=$i}${aBENCH_CPU_INDEX[$i]} ${aBENCH_RESULT_CPU_AVG[$i]}${aBENCH_RESULT_CPU_MIN[$i]}${aBENCH_RESULT_CPU_MAX[$i]}${aBENCH_RESULT_CPU_TEMP_START_AVG[$i]}${aBENCH_RESULT_CPU_TEMP_START_MIN[$i]}${aBENCH_RESULT_CPU_TEMP_START_MAX[$i]}${aBENCH_RESULT_CPU_TEMP_END_AVG[$i]}${aBENCH_RESULT_CPU_TEMP_END_MIN[$i]}${aBENCH_RESULT_CPU_TEMP_END_MAX[$i]}
-

DietPi-Benchmarks | IO (RAM):

+

DietPi-Benchmarks | IO (RAM):

- + + @@ -934,15 +855,15 @@ - $(for i in "${!aBENCH_RAM_INDEX[@]}"; do echo ""; done ) + $(for i in "${!aBENCH_RAM_INDEX[@]}"; do echo ""; done | sort -nrk 2 -t ' ')
- RAM write (MB/s):RAM read (MB/s):RAM write (MiB/s):RAM read (MiB/s):
Device:Fastest: Slowest:
${aHW_NAME[$i]:=$i} ${aBENCH_RAM_INDEX[$i]} ${aBENCH_RESULT_RAM_WRITE_AVG[$i]} ${aBENCH_RESULT_RAM_WRITE_MAX[$i]} ${aBENCH_RESULT_RAM_WRITE_MIN[$i]} ${aBENCH_RESULT_RAM_READ_AVG[$i]} ${aBENCH_RESULT_RAM_READ_MAX[$i]}${aBENCH_RESULT_RAM_READ_MIN[$i]}
${aHW_NAME[$i]:=$i}${aBENCH_RAM_INDEX[$i]} ${aBENCH_RESULT_RAM_WRITE_AVG[$i]}${aBENCH_RESULT_RAM_WRITE_MAX[$i]}${aBENCH_RESULT_RAM_WRITE_MIN[$i]}${aBENCH_RESULT_RAM_READ_AVG[$i]}${aBENCH_RESULT_RAM_READ_MAX[$i]}${aBENCH_RESULT_RAM_READ_MIN[$i]}
-

DietPi-Benchmarks | IO (RootFS):

+

DietPi-Benchmarks | IO (RootFS):

- + + @@ -954,15 +875,15 @@ - $(for i in "${!aBENCH_ROOTFS_INDEX[@]}"; do echo ""; done ) + $(for i in "${!aBENCH_ROOTFS_INDEX[@]}"; do echo ""; done | sort -nrk 2 -t ' ')
- RootFS write (MB/s):RootFS read (MB/s):RootFS write (MiB/s):RootFS read (MiB/s):
Device:Fastest: Slowest:
${aHW_NAME[$i]:=$i} ${aBENCH_ROOTFS_INDEX[$i]} ${aBENCH_RESULT_ROOTFS_WRITE_AVG[$i]} ${aBENCH_RESULT_ROOTFS_WRITE_MAX[$i]} ${aBENCH_RESULT_ROOTFS_WRITE_MIN[$i]} ${aBENCH_RESULT_ROOTFS_READ_AVG[$i]} ${aBENCH_RESULT_ROOTFS_READ_MAX[$i]}${aBENCH_RESULT_ROOTFS_READ_MIN[$i]}
${aHW_NAME[$i]:=$i}${aBENCH_ROOTFS_INDEX[$i]} ${aBENCH_RESULT_ROOTFS_WRITE_AVG[$i]}${aBENCH_RESULT_ROOTFS_WRITE_MAX[$i]}${aBENCH_RESULT_ROOTFS_WRITE_MIN[$i]}${aBENCH_RESULT_ROOTFS_READ_AVG[$i]}${aBENCH_RESULT_ROOTFS_READ_MAX[$i]}${aBENCH_RESULT_ROOTFS_READ_MIN[$i]}
-

DietPi-Benchmarks | IO (Custom FS):

+

DietPi-Benchmarks | IO (Custom FS):

- + + @@ -974,14 +895,14 @@ - $(for i in "${!aBENCH_CUSTOMFS_INDEX[@]}"; do echo ""; done ) + $(for i in "${!aBENCH_CUSTOMFS_INDEX[@]}"; do echo ""; done | sort -nrk 2 -t ' ')
- Custom FS write (MB/s):Custom FS read (MB/s):Custom FS write (MiB/s):Custom FS read (MiB/s):
Device:Fastest: Slowest:
${aHW_NAME[$i]:=$i} ${aBENCH_CUSTOMFS_INDEX[$i]} ${aBENCH_RESULT_CUSTOMFS_WRITE_AVG[$i]} ${aBENCH_RESULT_CUSTOMFS_WRITE_MAX[$i]} ${aBENCH_RESULT_CUSTOMFS_WRITE_MIN[$i]} ${aBENCH_RESULT_CUSTOMFS_READ_AVG[$i]} ${aBENCH_RESULT_CUSTOMFS_READ_MAX[$i]}${aBENCH_RESULT_CUSTOMFS_READ_MIN[$i]}
${aHW_NAME[$i]:=$i}${aBENCH_CUSTOMFS_INDEX[$i]} ${aBENCH_RESULT_CUSTOMFS_WRITE_AVG[$i]}${aBENCH_RESULT_CUSTOMFS_WRITE_MAX[$i]}${aBENCH_RESULT_CUSTOMFS_WRITE_MIN[$i]}${aBENCH_RESULT_CUSTOMFS_READ_AVG[$i]}${aBENCH_RESULT_CUSTOMFS_READ_MAX[$i]}${aBENCH_RESULT_CUSTOMFS_READ_MIN[$i]}
-

DietPi-Benchmarks | IO (Network LAN):

+

DietPi-Benchmarks | IO (Network LAN):

+ @@ -990,7 +911,7 @@ - $(for i in "${!aBENCH_LAN_INDEX[@]}"; do echo ""; done ) + $(for i in "${!aBENCH_LAN_INDEX[@]}"; do echo ""; done | sort -nrk 2 -t ' ')
- Transfer rate (MB/s):Transfer rate (MiB/s):
Device:Fastest: Slowest:
${aHW_NAME[$i]:=$i} ${aBENCH_LAN_INDEX[$i]} ${aBENCH_RESULT_NET_LAN_SPEED_AVG[$i]} ${aBENCH_RESULT_NET_LAN_SPEED_MAX[$i]}${aBENCH_RESULT_NET_LAN_SPEED_MIN[$i]}
${aHW_NAME[$i]:=$i}${aBENCH_LAN_INDEX[$i]} ${aBENCH_RESULT_NET_LAN_SPEED_AVG[$i]}${aBENCH_RESULT_NET_LAN_SPEED_MAX[$i]}${aBENCH_RESULT_NET_LAN_SPEED_MIN[$i]}
@@ -1012,9 +933,9 @@ _EOF_ #----------------------------------------------------------- # Main #----------------------------------------------------------- - Main 2>&1 | tee /var/log/dietpi-survey_report.log + Main #----------------------------------------------------------- exit 0 #----------------------------------------------------------- -} +} &>> /var/log/dietpi-survey_report.log diff --git a/CHANGELOG.txt b/CHANGELOG.txt index ad0e62c17a..557569fd4b 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,34 +1,70 @@ -v6.30 -(10/05/30 Hotfix) +v6.31 +(XX/06/20) Changes / Improvements / Optimisations: -- DietPi-Software | qBittorrent: Changed default download file permissions so that Sonarr/Radarr/Lidarr/.. are able to manipulate the downloads after import. Many thanks to @compdealer for doing this suggestion: https://github.com/MichaIng/DietPi/issues/3524 +- RPi | Support for Raspberry Pi OS (64-bit) has been added, including any other Debian pre-image on RPi. Many thanks to @FusionPlmH for doing this request: https://github.com/MichaIng/DietPi/issues/3570 +- Odroid C4 | Support for this new Hardkernel SBC has been added to allow image creation based on Meverics Odroid repository, including Kodi support. +- Network | "ping" can now be used by all users without any file capabilities, sudo or setuid. For this we allow all users to create native ICMP sockets which are available since Linux 3.X but disabled by default on Debian. Other distributions and systemd (upstream) have this enabled by default and for security and usability reasons we follow them: https://fedoraproject.org/wiki/Changes/EnableSysctlPingGroupRange +- DietPi-Login | A new setting has been added which allows to skip the interactive GPLv2 license agreement on first login. Add/set "AUTO_SETUP_ACCEPT_LICENSE=1" in (/boot/)dietpi.txt in which case we assume you read and agreed the license text at least once. Many thanks to @mrbluecoat for reporting the urgent use-case of Chromium kiosk mode autostart without keyboard attached: https://github.com/MichaIng/DietPi/issues/3326 +- DietPi-Cleaner | Enhanced performance of the files cleaner if /mnt is skipped, especially in combination with large drives or network mounts. Many thanks to @maartenlangeveld for revealing the underlying issue: https://github.com/MichaIng/DietPi/issues/3609 +- DietPi-Drive_Manager | SSHFS entries in fstab are now detected and preserved. Many thanks to @notwork for doing this suggestion: https://dietpi.com/phpbb/viewtopic.php?f=9&t=7781 +- DietPi-Config | Added Ethernet link speed selection to Network>Ethernet menu. The function and dietpi.txt entry exists for a long time but it was only exposed as first run setup option. +- DietPi-Software | WireGuard: Added generic support for all SBCs where the WireGuard kernel module is shipped together with the kernel package. This applies to most current Armbian-based images at the time of writing and will be the more regular case since Linux 5.6 has WireGuard natively integrated. +- DietPi-Software | Firefox Sync Server has been added to our software list, which allows to sync your Firefox bookmarks, history, tabs and passwords via your self-hosted server. Many thanks and all credits to @CedArctic for implementing this software title: https://github.com/MichaIng/DietPi/pull/3471 +- DietPi-Software | Folding@Home: Updated to latest v7.6.X, which includes an explicit option for prioritising COVID 19 projects: https://foldingathome.org/2020/04/17/new-foldinghome-software-with-the-option-to-prioritize-covid-19-projects/ + This update is applied to all systems with DietPi v6.31, existing config and data are preserved. +- DietPi-Software | Sonarr/Radarr/Lidarr: The /media directory as second common mount point can now also be used as download/media directory without manually adding it to the systemd units ReadWritePaths list. Many thanks to @ricardoandren for doing this suggestion: https://github.com/MichaIng/DietPi/issues/3561 +- DietPi-Software | Samba Server: Changed default server-side file permissions from 0775 to 0664, hence files on the server are by default created without execute permissions now, which suits usual standards. Many thanks to @maartenlangeveld for doing this suggestion: https://github.com/MichaIng/DietPi/issues/3581 +- DietPi-Software | QuiteRSS: Re-added the years ago accidentally removed install code block. If you ever wondered why there was no QuiteRSS after selecting it for install, now there will be. If it is marked as installed already, run either "dietpi-software install 22" or simply "apt install quiterss" to (really) get it. Bug Fixes: -- DietPi-Config | Resolved an issue where on RPi3/4/Zero W onboard WiFi could not be enabled. Many thanks to @elitearmedforce for reporting this issue: https://github.com/MichaIng/DietPi/issues/3510 -- DietPi-Drive_Manager | Resolved an issue on Raspberry Pi where, after running DietPi-Drive_Manager, the root file system was mount read-only. Many thanks to @Adsouza98 for reporting this issue: https://github.com/MichaIng/DietPi/issues/3511 -- DietPi-Banner | Resolved an issue where non-root users were unable to download a new MOTD (message of the day). Many thanks to @PeterLacknase and @fnsnyc for reporting this issue: https://github.com/MichaIng/DietPi/issues/3505, https://github.com/MichaIng/DietPi/issues/3520 -- DietPi-Boot | Resolved an issue where non-root users were unable to read or update DietPi-internal network info, which lead to e.g. error messages on login. Many thanks to @PeterLacknase for reporting this issue: https://github.com/MichaIng/DietPi/issues/3505 -- DietPi-Update | Resolved an issue where on DietPi pre-v6.16 system some DietPi scripts were accidentally removed during update. Many thanks to @Vec7or and @littis for reporting this issue: https://github.com/MichaIng/DietPi/issues/3509, https://github.com/MichaIng/DietPi/issues/3513 - -Check out all code changes of this release on GitHub: https://github.com/MichaIng/DietPi/pull/3526 +- System | Resolved potential issues due to missing /media directory on DietPi images, which is not used by default but is part of FHS and can hence be expected by Linux software, e.g. htpdate. Many thanks to @jokoren for reporting this issue: https://github.com/MichaIng/DietPi/issues/3558 +- DietPi-Login | Resolved an issue where the script called itself from within the error handler subshell. Generally the error handler subshell must never call dietpi-login (and related autostart programs) and dietpi-login must never call itself from an interactive subshell. Many thanks to @nosyaardvark for reporting this issue: https://github.com/MichaIng/DietPi/issues/3583#issuecomment-643583664 +- DietPi-Drive_Manager | Resolved an issue where moving the RootFS to an external drive did not include DietPi userdata. Many thanks to @sdomotica and @Joulinar for reporting this issue: https://github.com/MichaIng/DietPi/issues/3600#issuecomment-643261670 +- DietPi-Software | Logging choice: Resolved an issue where manually choosing logging options "None" and "Full" during firstrun installs did not uninstall DietPi-RAMlog as intended. Many thanks to @Pain-Patate for reporting this issue: https://github.com/MichaIng/DietPi/issues/3588 +- DietPi-Software | GMediaRender+WireGuard: Resolved an issue where service start could have failed due to invalid network information. Many thanks to @fnsnyc for reporting this issue: https://github.com/MichaIng/DietPi/issues/3519 +- DietPi-Software | rTorrent: Resolved an issue where startup fails because of invalid default config values. Many thanks to @PiTech and @vorrac for reporting and fixing this issue: https://dietpi.com/phpbb/viewtopic.php?f=15&t=7613, https://dietpi.com/phpbb/viewtopic.php?f=11&t=7607 +- DietPi-Software | Sonarr/Radarr/Lidarr: Resolved an issue where those software services crashed once an hour due to faulty SQLite database log file clearing. Many thanks to @Taloth from Sonarr and all the others who reported, investigated and finally solved the mystery: https://dietpi.com/phpbb/viewtopic.php?f=11&t=7598 +- DietPi-Software | WireGuard: Resolved an issue where WireGuard in client mode failed to start due to missing resolvconf. It is now installed together with WireGuard when choosing client setup. Many thanks to @yahoo456 for reporting this issue: https://dietpi.com/phpbb/viewtopic.php?f=11&t=7783 +- DietPi-Software | WireGuard: Worked around an issue where on some Odroids install failed due to missing symlinks to the Linux headers. Many thanks to @repomanz for reporting this issue: https://github.com/MichaIng/DietPi/issues/3577 +- DietPi-Software | Ubooquity: Updated the installer to pull the latest version from Vae Mendis Software directly and enhanced permissions to better integrate with other software. Many thanks to @Mr.Roboto for doing this suggestion: https://dietpi.com/phpbb/viewtopic.php?f=12&t=7786 +- DietPi-Software | Node.js: Resolved an issue where Node failed to start due to missing new libatmoic1 dependency. Many thanks to @larsno for reporting this issue: https://github.com/MichaIng/DietPi/issues/3614 +- DietPi-Software | TigerVNC: Worked around an external bug where the VNC server crashed after client logout or failed to start at all. Many thanks to @Joulinar for investigating this issue and providing the workaround: https://dietpi.com/phpbb/viewtopic.php?p=25285#p25285 +- DietPi-Software | XRDP: The above TigerVNC bug affected as well XRDP connections which have been resolved in the same turn: https://github.com/MichaIng/DietPi/issues/3615#issuecomment-650559035 + +As always, many smaller code performance and stability improvements, visual and spelling fixes have been done, too much to list all of them here. Check out all code changes of this release on GitHub: https://github.com/MichaIng/DietPi/pull/XXXX Known/Outstanding Issues: - DietPi-Config | Enabling WiFi + Ethernet adapters, both on different subnets, breaks WiFi connection in some cases: https://github.com/MichaIng/DietPi/issues/2103 - RPi | On TigerVNC virtual desktop, LXAppearance hangs on dbus-launch: https://github.com/MichaIng/DietPi/issues/1791 - Odroid C2 | Some WiFi adapters do no work as hotspot: https://github.com/MichaIng/DietPi/issues/1955 -- Odroid XU4 | Kodi freezes shortly on video playback: https://github.com/MichaIng/DietPi/issues/2584 -- Rock64 | 3.5mm A/V jack is currently not functional: https://github.com/MichaIng/DietPi/issues/2522 - DietPi-Software | Node-RED: Pre-installed modules cannot be updated via web UI: https://github.com/MichaIng/DietPi/issues/2073 - DietPi-Software | Raspimjpeg: With Lighttpd, streaming mjpeg does not work: https://github.com/MichaIng/DietPi/issues/1747 -- DietPi-Software | MATE desktop: When logging in as root, desktop items and right-clock context menu is missing: https://github.com/MichaIng/DietPi/issues/3160 -- DietPi-Software | Sonarr/Mono: With current Mono version 6, import to a file system without UNIX permissions support (exFAT, FAT32/vfat and NTFS without "permissions" option) fails, regardless of user/umask mount options: https://github.com/MichaIng/DietPi/issues/3179 +- DietPi-Software | MATE desktop: When logging in as root, desktop items and right-click context menu is missing: https://github.com/MichaIng/DietPi/issues/3160 +- DietPi-Software | Sonarr/Mono: With current Mono version 6, import to a file system without UNIX permissions support (exFAT, FAT32/vfat, CIFS mounts and NTFS without "permissions" option) fails, regardless of user/umask mount options: https://github.com/MichaIng/DietPi/issues/3179 - DietPi-Software | Transmission: On Raspbian/Debian Stretch, RAM usage raises unlimited over time: https://github.com/MichaIng/DietPi/issues/2413 For all additional issues that may appear after release, please see the following link for active tickets: https://github.com/MichaIng/DietPi/issues ----------------------------------------------------------------------------------------------------------- +v6.30 +(10/05/20 Hotfix) + +Changes / Improvements / Optimisations: +- DietPi-Software | qBittorrent: Changed default download file permissions so that Sonarr/Radarr/Lidarr/.. are able to manipulate the downloads after import. Many thanks to @compdealer for doing this suggestion: https://github.com/MichaIng/DietPi/issues/3524 + +Bug Fixes: +- DietPi-Config | Resolved an issue where on RPi3/4/Zero W onboard WiFi could not be enabled. Many thanks to @elitearmedforce for reporting this issue: https://github.com/MichaIng/DietPi/issues/3510 +- DietPi-Drive_Manager | Resolved an issue on Raspberry Pi where, after running DietPi-Drive_Manager, the root file system was mount read-only. Many thanks to @Adsouza98 for reporting this issue: https://github.com/MichaIng/DietPi/issues/3511 +- DietPi-Banner | Resolved an issue where non-root users were unable to download a new MOTD (message of the day). Many thanks to @PeterLacknase and @fnsnyc for reporting this issue: https://github.com/MichaIng/DietPi/issues/3505, https://github.com/MichaIng/DietPi/issues/3520 +- DietPi-Boot | Resolved an issue where non-root users were unable to read or update DietPi-internal network info, which lead to e.g. error messages on login. Many thanks to @PeterLacknase for reporting this issue: https://github.com/MichaIng/DietPi/issues/3505 +- DietPi-Update | Resolved an issue where on DietPi pre-v6.16 system some DietPi scripts were accidentally removed during update. Many thanks to @Vec7or and @littis for reporting this issue: https://github.com/MichaIng/DietPi/issues/3509, https://github.com/MichaIng/DietPi/issues/3513 + +Check out all code changes of this release on GitHub: https://github.com/MichaIng/DietPi/pull/3526 + +----------------------------------------------------------------------------------------------------------- + v6.29 (03/05/20) diff --git a/PREP_SYSTEM_FOR_DIETPI.sh b/PREP_SYSTEM_FOR_DIETPI.sh index 753825adab..2626b757eb 100644 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -14,6 +14,7 @@ # - G_HW_ARCH # - G_DISTRO # - G_DISTRO_NAME + # - G_RASPBIAN # # The following environment variables can be set to automate this script (adjust example values to your needs): # - GITOWNER='MichaIng' (optional, defaults to 'MichaIng') @@ -54,6 +55,9 @@ # Allow PDiffs on RPi since the "slow implementation" argument is outdated and PDiffs allow lower download size and less disk I/O [[ -f '/etc/apt/apt.conf.d/50raspi' ]] && rm /etc/apt/apt.conf.d/50raspi + # Disable package state translation downloads + echo 'Acquire::Languages "none";' > /etc/apt/apt.conf.d/98-dietpi-no_translations + # Removing conflicting /etc/apt/sources.list.d entries # - Meveric: https://github.com/MichaIng/DietPi/issues/1285#issuecomment-355759321 [[ -f '/etc/apt/sources.list.d/deb-multimedia.list' ]] && rm /etc/apt/sources.list.d/deb-multimedia.list @@ -95,7 +99,7 @@ for i in "${aAPT_PREREQS[@]}" do - if ! dpkg-query -s $i &> /dev/null && ! apt-get -y install $i; then + if ! dpkg-query -s $i &> /dev/null && ! apt-get -y --no-install-recommends install $i; then echo -e "[FAILED] Unable to install $i, please try to install it manually:\n\t # apt install $i\n" exit 1 @@ -138,12 +142,12 @@ fi + # - Export locale vars to assure the following whiptail being beautiful + export LC_ALL='C.UTF-8' LANG='C.UTF-8' + # - Update /etc/default/locales with new values (not effective until next load of bash session, eg: logout/in) update-locale 'LC_ALL=C.UTF-8' - # - Export locale vars to assure the following whiptail being beautiful - export LC_ALL='C.UTF-8' - # Set Git owner GITOWNER=${GITOWNER:-MichaIng} @@ -182,8 +186,8 @@ fi - # Assure no obsolete .hw_model is loaded or generated - rm -fv /boot/dietpi/{.,func/dietpi-obtain_}hw_model + # Assure no obsolete .hw_model is loaded + rm -fv /boot/dietpi/.hw_model # Load if ! . ./dietpi-globals; then @@ -286,7 +290,7 @@ # Delete any previous existing data # - /DietPi mount point: Pre-v6.29 - umount /DietPi # Failsafe + findmnt /DietPi &> /dev/null && umount /DietPi [[ -d '/DietPi' ]] && rm -R /DietPi rm -Rfv /{boot,mnt,etc,var/lib,var/tmp,run}/*dietpi* rm -fv /etc{,/cron.*,/{bashrc,profile,sysctl,network/if-up,udev/rules}.d}/{,.}*dietpi* @@ -394,6 +398,7 @@ #'4' ': Raspberry Pi 4' '11' ': Odroid XU3/XU4/MC1/HC1/HC2' '12' ': Odroid C2' + '15' ': Odroid N2' '44' ': Pinebook' '' '●─ x86_64 ' '21' ': x86_64 Native PC' @@ -402,7 +407,7 @@ '10' ': Odroid C1' '13' ': Odroid U3' '14' ': Odroid N1' - '15' ': Odroid N2' + '16' ': Odroid C4' '70' ': Sparky SBC' '52' ': ASUS Tinker Board' '40' ': PINE A64' @@ -475,8 +480,24 @@ G_HW_MODEL=$HW_MODEL unset HW_MODEL + # RPi: Detect Debian vs Raspbian and 64 vs 32 bit image + if (( $G_HW_MODEL < 10 )); then + + if grep -q '^ID=debian' /etc/os-release; then + + G_RASPBIAN=0 + [[ $(mawk 'NR==1' /var/lib/dpkg/arch) == 'arm64' ]] && G_HW_ARCH=3 || G_HW_ARCH=2 + + else + + G_RASPBIAN=1 G_HW_ARCH=1 + + fi + + fi + G_DIETPI-NOTIFY 2 "Selected hardware model ID: $G_HW_MODEL" - G_DIETPI-NOTIFY 2 "Detected CPU architecture: $G_HW_ARCH_NAME (ID: $G_HW_ARCH)" + G_DIETPI-NOTIFY 2 "Detected target CPU architecture: $G_HW_ARCH_NAME (ID: $G_HW_ARCH)" # WiFi selection if [[ $WIFI_REQUIRED != [01] ]]; then @@ -608,7 +629,7 @@ Currently installed: $G_DISTRO_NAME (ID: $G_DISTRO)"; then G_EXEC_DESC='Extracting DietPi sourcecode' G_EXEC tar xf package.tar.gz rm package.tar.gz - [[ -d '/boot' ]] || G_EXEC_DESC='Creating /boot' G_EXEC mkdir -p /boot + [[ -d '/boot' ]] || G_EXEC_DESC='Creating /boot' G_EXEC mkdir /boot G_DIETPI-NOTIFY 2 'Moving kernel and boot configuration to /boot' @@ -616,6 +637,8 @@ Currently installed: $G_DISTRO_NAME (ID: $G_DISTRO)"; then if (( $G_HW_MODEL < 10 )); then G_EXEC mv "DietPi-$G_GITBRANCH/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 elif (( $G_HW_MODEL == 11 )); then @@ -629,6 +652,7 @@ Currently installed: $G_DISTRO_NAME (ID: $G_DISTRO)"; then G_EXEC mv "DietPi-$G_GITBRANCH/dietpi.txt" /boot/ G_EXEC mv "DietPi-$G_GITBRANCH/README.md" /boot/dietpi-README.md + G_EXEC mv "DietPi-$G_GITBRANCH/LICENSE.txt" /boot/dietpi-LICENSE.txt G_EXEC mv "DietPi-$G_GITBRANCH/CHANGELOG.txt" /boot/dietpi-CHANGELOG.txt # Reading version string for later use @@ -657,8 +681,8 @@ Currently installed: $G_DISTRO_NAME (ID: $G_DISTRO)"; then G_DIETPI-NOTIFY 2 "Setting APT sources.list: $DISTRO_TARGET_NAME $DISTRO_TARGET" - # We need to forward $DISTRO_TARGET* to dietpi-set_software, as well as $G_HW_MODEL for Debian vs Raspbian decision. - G_DISTRO=$DISTRO_TARGET G_DISTRO_NAME=$DISTRO_TARGET_NAME G_HW_MODEL=$G_HW_MODEL G_EXEC /boot/dietpi/func/dietpi-set_software apt-mirror default + # 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 EU mirror: https://github.com/MichaIng/DietPi/issues/1519#issuecomment-368234302 sed -Ei 's@https?://oph\.mdrjr\.net@http://fuzon.co.uk@' /etc/apt/sources.list.d/meveric* &> /dev/null @@ -706,7 +730,7 @@ _EOF_' 'curl' # Web address testing, downloading, uploading etc. 'debconf' # APT package pre-configuration, e.g. "debconf-set-selections" for non-interactive install 'dirmngr' # GNU key management required for some APT installs via additional repos - 'ethtool' # Ethernet link checking + 'ethtool' # Force Ethernet link speed 'fake-hwclock' # Hardware clock emulation, to allow correct timestamps during boot before network time sync 'gnupg' # apt-key add 'htop' # System monitor @@ -750,27 +774,35 @@ _EOF_' # - systemd-timesyncd: Network time sync daemon # Available as dedicated package since Bullseye: https://packages.debian.org/systemd-timesyncd # While the above needs to be checked against current distro to not break SSH or APT before distro upgrade, this one should be checked against target distro version. - (( $G_DISTRO_TARGET > 5 )) && aPACKAGES_REQUIRED_INSTALL+=('systemd-timesyncd') + (( $DISTRO_TARGET > 5 )) && aPACKAGES_REQUIRED_INSTALL+=('systemd-timesyncd') - # G_HW_MODEL specific required repo key packages: https://github.com/MichaIng/DietPi/issues/1285#issuecomment-358301273 - if (( $G_HW_MODEL > 9 )); then + # - fdisk: Partitioning tool used by DietPi-FS_partition_resize and DietPi-Imager + # This has become an own package since Debian Buster: https://packages.debian.org/fdisk + (( $DISTRO_TARGET > 4 )) && aPACKAGES_REQUIRED_INSTALL+=('fdisk') + + # G_HW_MODEL specific + # - initramfs: Required for generic bootloader, but not required/used by RPi bootloader, on VM install tiny-initramfs with limited features but sufficient and much smaller + faster + if (( $G_HW_MODEL == 20 )); then - # RAM file system initialisation, required for generic bootloader, but not required/used by RPi bootloader - # - On VM, install tiny-initramfs with limited features but sufficient and much smaller + faster - if (( $G_HW_MODEL == 20 )); then + aPACKAGES_REQUIRED_INSTALL+=('tiny-initramfs') - aPACKAGES_REQUIRED_INSTALL+=('tiny-initramfs') + elif (( $G_HW_MODEL > 9 )); then - else + aPACKAGES_REQUIRED_INSTALL+=('initramfs-tools') - aPACKAGES_REQUIRED_INSTALL+=('initramfs-tools') + fi + # - Entropy daemon: Use modern rng-tools5 on all devices where it has been proven to work, on RPi rng-tools (default on Raspbian), else haveged: https://github.com/MichaIng/DietPi/issues/2806 + if [[ $G_HW_MODEL =~ ^(11|14|16|42|58|68|69|72)$ ]]; then # Odroid XU4, RK3399, Odroid C4 - fi - aPACKAGES_REQUIRED_INSTALL+=('haveged') # Entropy daemon: https://github.com/MichaIng/DietPi/issues/2806 + aPACKAGES_REQUIRED_INSTALL+=('rng-tools5') + + elif (( $G_HW_MODEL > 9 )); then + + aPACKAGES_REQUIRED_INSTALL+=('haveged') else - aPACKAGES_REQUIRED_INSTALL+=('rng-tools') # Entropy daemon: Alternative, that does not work on all devices, but is proven to work on RPi, is default on Raspbian and uses less RAM on idle. + aPACKAGES_REQUIRED_INSTALL+=('rng-tools') fi @@ -786,14 +818,13 @@ _EOF_' fi # G_HW_MODEL specific - if (( $G_HW_MODEL != 20 )); then + (( $G_HW_MODEL == 20 )) || aPACKAGES_REQUIRED_INSTALL+=('hdparm') # Drive power management adjustments - aPACKAGES_REQUIRED_INSTALL+=('hdparm') # Drive power management adjustments - - fi + # Install gdisk if root file system is on a GPT partition, used by DietPi-FS_partition_resize + [[ $(parted -s "$(lsblk -npo PKNAME "$(findmnt -no SOURCE /)")" print) == *'Partition Table: gpt'* ]] && aPACKAGES_REQUIRED_INSTALL+=('gdisk') # Install required filesystem packages - if [[ $(blkid -s TYPE -o value) =~ ([[:space:]]|v)'fat' ]]; then + if [[ $(blkid -s TYPE -o value) =~ (^|[[:space:]]|v)'fat' ]]; then aPACKAGES_REQUIRED_INSTALL+=('dosfstools') # DietPi-Drive_Manager + fat (boot) drive file system check and creation tools @@ -859,7 +890,15 @@ _EOF_' # RPi elif (( $G_HW_MODEL < 10 )); then - G_AGI libraspberrypi-bin libraspberrypi0 raspberrypi-bootloader raspberrypi-kernel raspberrypi-sys-mods raspi-copies-and-fills + # Add raspi-copies-and-fills for 32-bit images only + [[ $G_HW_ARCH == 3 ]] && arm_mem= || arm_mem='raspi-copies-and-fills' + G_AGI libraspberrypi-bin libraspberrypi0 raspberrypi-bootloader raspberrypi-kernel raspberrypi-sys-mods $arm_mem + + # Odroid C4 + elif (( $G_HW_MODEL == 16 )); then + + G_AGI linux-image-arm64-odroid-c4 meveric-keyring + G_EXEC_NOHALT=1 G_EXEC apt-mark manual u-boot # Workaround until C4 u-boot package has been added to repo # Odroid N2 elif (( $G_HW_MODEL == 15 )); then @@ -884,7 +923,7 @@ _EOF_' # ROCK Pi S (official Radxa Debian image) elif (( $G_HW_MODEL == 73 )) && grep -q 'apt\.radxa\.com' /etc/apt/sources.list.d/*.list; then - G_AGI rockpis-rk-u-boot-latest linux-4.4-rockpis-latest rockpis-dtbo rockchip-overlay + G_AGI rockpis-rk-u-boot-latest linux-4.4-rockpis-latest rockchip-overlay # - Auto detect kernel package incl. ARMbian/others DTB else @@ -958,7 +997,7 @@ _EOF_' # - initscripts: Pre-installed on Jessie systems (?), superseded and masked by systemd, but never autoremoved # Jessie workaround: https://github.com/MichaIng/DietPi/issues/3462 (( $G_DISTRO < 4 )) && G_EXEC_PRE_FUNC(){ acommand[2]='--force-yes'; } - G_AGP dbus dhcpcd5 mountall initscripts *office* *xfce* *qt5* *xserver* *xorg* glib-networking libgtk-3-0 + G_AGP dbus dhcpcd5 mountall initscripts '*office*' '*xfce*' '*qt5*' '*xserver*' '*xorg*' glib-networking libgtk-3-0 # Remove any autoremove prevention rm -f /etc/apt/apt.conf.d/01autoremove* G_AGA @@ -1014,10 +1053,10 @@ _EOF_' G_DIETPI-NOTIFY 2 'Removing misc files/folders/services, not required by DietPi' - [[ -d '/home' ]] && rm -vR /home - [[ -d '/media' ]] && rm -vR /media - [[ -d '/selinux' ]] && rm -vR /selinux - [[ -d '/var/cache/apparmor' ]] && rm -vR /var/cache/apparmor + [[ -d '/home' ]] && rm -Rfv /home/{,.??,.[^.]}* || mkdir /home + [[ -d '/media' ]] && rm -Rfv /media/{,.??,.[^.]}* || mkdir /media + [[ -d '/selinux' ]] && rm -Rv /selinux + [[ -d '/var/cache/apparmor' ]] && rm -Rv /var/cache/apparmor rm -Rfv /var/lib/dhcp/{,.??,.[^.]}* rm -Rfv /var/backups/{,.??,.[^.]}* @@ -1162,8 +1201,9 @@ _EOF_ # Below required if DietPi-PREP is executed from chroot/container, so RPi firstrun scripts are not executed [[ -f '/etc/init.d/resize2fs_once' ]] && rm -v /etc/init.d/resize2fs_once # https://github.com/RPi-Distro/pi-gen/blob/master/stage2/01-sys-tweaks/files/resize2fs_once [[ -f '/boot/cmdline.txt' ]] && sed -i 's| init=/usr/lib/raspi-config/init_resize\.sh||' /boot/cmdline.txt # https://github.com/RPi-Distro/pi-gen/blob/master/stage2/01-sys-tweaks/00-patches/07-resize-init.diff + [[ -f '/etc/systemd/system/getty@tty1.service.d/autologin.conf' ]] && rm -v /etc/systemd/system/getty@tty1.service.d/autologin.conf # https://github.com/MichaIng/DietPi/issues/3570#issuecomment-648988475 - # - make_nas_processes_faster cron job on Rock64 + NanoPi + Pine64(?) images + # - make_nas_processes_faster cron job on ROCK64 + NanoPi + PINE A64(?) images [[ -f '/etc/cron.d/make_nas_processes_faster' ]] && rm /etc/cron.d/make_nas_processes_faster #----------------------------------------------------------------------------------- @@ -1223,7 +1263,7 @@ _EOF_ #----------------------------------------------------------------------------------- # Install vmtouch to lock DietPi scripts and config in file system cache G_EXEC wget https://dietpi.com/downloads/binaries/$G_DISTRO_NAME/vmtouch_$G_HW_ARCH_NAME.deb - G_EXEC dpkg --force-hold,confdef,confold -i vmtouch_$G_HW_ARCH_NAME.deb + G_EXEC dpkg --force-hold,confnew -i vmtouch_$G_HW_ARCH_NAME.deb rm vmtouch_$G_HW_ARCH_NAME.deb #----------------------------------------------------------------------------------- @@ -1470,7 +1510,7 @@ _EOF_ elif (( $G_HW_ARCH == 3 )); then - G_EXEC_DESC='Removing foreign armhf DPKG architecture' G_EXEC dpkg --remove-architecture armhf + (( $G_HW_MODEL > 9 )) && G_EXEC_DESC='Removing foreign armhf DPKG architecture' G_EXEC dpkg --remove-architecture armhf fi @@ -1659,6 +1699,8 @@ _EOF_ [[ -e '/var/swap' ]] && rm -v /var/swap # still exists on some images... # - Re-enable for next run G_CONFIG_INJECT 'AUTO_SETUP_SWAPFILE_SIZE=' 'AUTO_SETUP_SWAPFILE_SIZE=1' /boot/dietpi.txt + # - Reset /tmp size to default (512 MiB) + sed -i '\|/tmp|s|size=[^,]*,||' /etc/fstab G_DIETPI-NOTIFY 2 'Resetting boot.ini, config.txt, cmdline.txt etc' @@ -1734,7 +1776,7 @@ $IMAGE_CREATOR $PREIMAGE_INFO _EOF_ - G_DIETPI-NOTIFY 2 'Generating GPL license readme' + G_DIETPI-NOTIFY 2 'Generating GPLv2 license readme' cat << _EOF_ > /var/lib/dietpi/license.txt ----------------------- DietPi - GPLv2 License: diff --git a/README.md b/README.md index bcf36dd895..53c53a0871 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@

- DietPi + DietPi

Lightweight justice for your single-board computer! @@ -16,9 +16,8 @@


- myVirtualServer -

- DietPi's web hosting is powered by myVirtualServer. + myVirtualserver
+ DietPi's web hosting is powered by myVirtualserver.

A wide range of SBCs and VMs are supported. Click here for the full list.

@@ -178,6 +177,7 @@ 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 @@ -199,6 +199,7 @@ Links to hardware and software manufacturers, sources and build instructions use - [Linux kernel](https://github.com/torvalds/linux) - [GNU operating system](https://www.gnu.org/) +- [Bash](https://git.savannah.gnu.org/cgit/bash.git) - [Debian distribution](https://salsa.debian.org/) - [Raspberry](https://github.com/raspberrypi) [Pi](https://github.com/RPi-Distro) - [Hardkernel](https://github.com/hardkernel?tab=repositories) @@ -222,6 +223,7 @@ Links to hardware and software manufacturers, sources and build instructions use - [qBittorrent](https://github.com/qbittorrent/qBittorrent) - [Nextcloud](https://github.com/nextcloud/server) - [ownCloud](https://github.com/owncloud/core) +- [Syncthing](https://github.com/syncthing/syncthing) - [MiniDLNA](https://sourceforge.net/p/minidlna/git/ci/master/tree/) - [MPD](https://github.com/MusicPlayerDaemon/MPD) - [YMPD](https://github.com/notandy/ympd) @@ -268,3 +270,4 @@ Links to hardware and software manufacturers, sources and build instructions use - [Home Assistant](https://github.com/home-assistant/core) - [TasmoAdmin](https://github.com/reloxx13/TasmoAdmin) - [Domoticz](https://github.com/domoticz/domoticz) +- [Firefox Sync Server](https://github.com/mozilla-services/syncserver) diff --git a/boot_xu4.ini b/boot_xu4.ini index 223c918204..612ab534f3 100644 --- a/boot_xu4.ini +++ b/boot_xu4.ini @@ -1,116 +1,70 @@ ODROIDXU-UBOOT-CONFIG -# U-Boot Parameters +# U-Boot parameters setenv initrd_high "0xffffffff" setenv fdt_high "0xffffffff" # Mac address configuration setenv macaddr "00:1e:06:61:7a:72" -#------------------------------------------------------------------------------------------------------ -# Basic Ubuntu Setup. Don't touch unless you know what you are doing. -# -------------------------------- +# 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" -# --- Screen Configuration for HDMI --- # +# HDMI config setenv videoconfig "drm_kms_helper.edid_firmware=edid/1920x1080.bin" -# --- HDMI / DVI Mode Selection --- -# ------------------------------------------ -# - HDMI Mode +# HDMI/DVI selection: "hdmi" or "dvi" +# - DVI mode disables HDMI sound setenv vout "hdmi" -# - DVI Mode (disables sound over HDMI as per DVI compat) -# setenv vout "dvi" -# --- CPU Governor Setup --- -# - DietPi will override this setting to user configured in dietpi-config > Performance Options > CPU gov. +# HDMI CEC: "false" or "true", defaults to "true" +#setenv cecenable "false" + +# CPU governor +# - DietPi will override this setting to user configured in dietpi-config > Performance Options > CPU governor setenv governor "performance" -#------------------------------------------------------------------------------ -# -# HDMI Hot Plug detection -# -#------------------------------------------------------------------------------ -# -# Forces the HDMI subsystem to ignore the check if the cable is connected or -# not. -# false : disable the detection and force it as connected. -# true : let cable, board and monitor decide the connection status. -# -# default: true -# -#------------------------------------------------------------------------------ +# ODROID-VU7 touchsreen: "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) -# -# 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 = 3, hdmi_tx_lvl_ch1 = 3, 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) -# -# Hardkernrel default hdmi_tx_res = 0 (Source Termination OFF) -#------------------------------------------------------------------------------ -setenv hdmi_tx_res "0" - -#------------------------------------------------------------------------------ +# 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) +# - Hardkernrel default hdmi_tx_res = 0 (Source Termination OFF) +setenv hdmi_tx_res "0" 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}" @@ -120,16 +74,19 @@ 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 -#failsafe +# 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 +# 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 -# final boot args +# Set DDR frequency +if test "${ddr_freq}"; then dmc "${ddr_freq}"; fi + +# Final boot args setenv bootargs "${bootrootfs} ${videoconfig} smsc95xx.macaddr=${macaddr} governor=${governor} ${hdmi_phy_control} ${hid_quirks}" # drm.debug=0xff" # Boot the board diff --git a/dietpi.txt b/dietpi.txt index 45877fa03f..71e0428c64 100644 --- a/dietpi.txt +++ b/dietpi.txt @@ -6,6 +6,10 @@ # D I E T - P I # 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 +AUTO_SETUP_ACCEPT_LICENSE=0 + ##### Language/Regional Options ##### # Locale: eg: "en_GB.UTF-8" / "de_DE.UTF-8" | One entry and UTF-8 ONLY! AUTO_SETUP_LOCALE=C.UTF-8 @@ -46,10 +50,10 @@ AUTO_SETUP_SWAPFILE_SIZE=1 # Swapfile location AUTO_SETUP_SWAPFILE_LOCATION=/var/swap -# Disable HDMI output (and GPU/VPU where supported) for supported devices: RPi, Odroid C1, Odroid C2 +# Set to "1" to disable HDMI output (and GPU/VPU where supported) for supported devices: RPi, Odroid C1, Odroid C2 AUTO_SETUP_HEADLESS=0 -# Unmask (enable) systemd-logind service, which is masked by default on DietPi +# Unmask (enable) systemd-logind service (including dbus), which is masked by default on DietPi AUTO_UNMASK_LOGIND=0 # Custom Script (pre-networking and pre-DietPi install) diff --git a/dietpi/boot b/dietpi/boot index 8f70c88c61..8e6a5c9c72 100644 --- a/dietpi/boot +++ b/dietpi/boot @@ -34,7 +34,7 @@ G_DIETPI-NOTIFY 2 "$(date) | Waiting for valid network connection before continuing boot | Mode=$mode" - if ip r s 0.0.0.0/0 &> /dev/null; then + if ip r l 0/0 &> /dev/null; then G_DIETPI-NOTIFY 0 "$(date) | Valid network connection found" return 0 @@ -51,26 +51,22 @@ } - Run_Init(){ - - #---------------------------------------------------------------- - # network-online.target should be an alternative, but ifup@.service is Type=simple which means that hotplug interfaces might not be fully configured before the target is reached. - Wait_For_Valid_Network_Connection - #---------------------------------------------------------------- - # Write network details to /run/dietpi/.network - /boot/dietpi/func/obtain_network_details - # - Make file world-writeable initially, required for DietPi-Login to update it as non-root user - chmod 666 /run/dietpi/.network - #---------------------------------------------------------------- - - } - #///////////////////////////////////////////////////////////////////////////////////// # Main Loop #///////////////////////////////////////////////////////////////////////////////////// #---------------------------------------------------------------- - # Init - Run_Init + # Wait for network + # - network-online.target should be an alternative, but ifup@.service is Type=simple which means that hotplug interfaces might not be fully configured before the target is reached. + Wait_For_Valid_Network_Connection + #---------------------------------------------------------------- + # Network time sync + # - Do not run before firstrun setup has finished, since related dietpi.txt settings are applied during first DietPi-Software run. + (( $G_DIETPI_INSTALL_STAGE > 1 )) && /boot/dietpi/func/run_ntpd 1 + #---------------------------------------------------------------- + # Write network details to /run/dietpi/.network + /boot/dietpi/func/obtain_network_details + # - Make file world-writeable initially, required for DietPi-Login to update it as non-root user + chmod 666 /run/dietpi/.network #---------------------------------------------------------------- # Pre-installed image, 1st run if (( $G_DIETPI_INSTALL_STAGE == 10 )); then @@ -90,10 +86,6 @@ echo $G_DIETPI_INSTALL_STAGE > /boot/dietpi/.install_stage fi - #---------------------------------------------------------------- - # Normal boot - # - Run time sync - (( $G_DIETPI_INSTALL_STAGE == 2 )) && /boot/dietpi/func/run_ntpd 1 #----------------------------------------------------------------------------------- exit #----------------------------------------------------------------------------------- diff --git a/dietpi/dietpi-backup b/dietpi/dietpi-backup index 46bb370f30..604f7ad5ad 100644 --- a/dietpi/dietpi-backup +++ b/dietpi/dietpi-backup @@ -166,10 +166,10 @@ _EOF_ G_WHIP_BUTTON_OK_TEXT='Ignore' G_WHIP_BUTTON_CANCEL_TEXT='Exit' - G_WHIP_YESNO 'The backup target location appears to have insufficient free space to successfully finish the backup.\nHowever, this check is a rough estimation in reasonable time, thus it could be marginally incorrect.\n\nWould you like to override this warning and continue with the backup?' - if (( $? )); then + if ! G_WHIP_YESNO 'The backup target location appears to have insufficient free space to successfully finish the backup.\nHowever, this check is a rough estimation in reasonable time, thus it could be marginally incorrect. +\nWould you like to override this warning and continue with the backup?'; then - echo -e "$RSYNC_MODE_TEXT canceled due to insufficient free space : $(Print_Date)" >> "$FP_TARGET/$BACKUP_STATS_FILENAME" + echo -e "$RSYNC_MODE_TEXT cancelled due to insufficient free space : $(Print_Date)" >> "$FP_TARGET/$BACKUP_STATS_FILENAME" break fi @@ -514,8 +514,7 @@ _EOF_ Input_User_Directory(){ G_WHIP_DEFAULT_ITEM=$FP_TARGET - G_WHIP_INPUTBOX "Please enter the filepath to your directory. \neg: /mnt/dietpi-backup\n - Must be located inside /mnt/* \n - Must be symlink compatible filesystem (ext2/3/4)" - (( $? == 0 )) && FP_TARGET=$G_WHIP_RETURNED_VALUE + G_WHIP_INPUTBOX "Please enter the filepath to your directory. \neg: /mnt/dietpi-backup\n - Must be located inside /mnt/* \n - Must be symlink compatible filesystem (ext2/3/4)" && FP_TARGET=$G_WHIP_RETURNED_VALUE } @@ -525,7 +524,6 @@ _EOF_ Error_Filesystem_Not_Supported(){ G_DIETPI-NOTIFY 1 "Filesystem not supported in $FP_TARGET" - G_WHIP_MSG "Error:\n\n$FP_TARGET Has a filesystem of: $TARGET_FILESYSTEM_TYPE, and is not supported.\n\nThe filesystem must be EXT2/3/4 for symlink compatibility." } @@ -533,7 +531,6 @@ _EOF_ Error_Not_Mnt_Directory(){ G_DIETPI-NOTIFY 1 "Target directory is not inside /mnt ($FP_TARGET)" - G_WHIP_MSG "Directory not supported:\n- $FP_TARGET\n\nThe location must be inside the /mnt/* directory.\n - eg: /mnt/dietpi-backup" } @@ -541,7 +538,6 @@ _EOF_ Error_DietpiUserdata_Directory(){ G_DIETPI-NOTIFY 1 "Target directory can not be contained within DietPi user data location ($FP_TARGET)" - G_WHIP_MSG "Directory not supported:\n- $FP_TARGET\n\nTarget directory can not be contained within DietPi user data location ($G_FP_DIETPI_USERDATA)" } @@ -549,9 +545,7 @@ _EOF_ Error_Rsync_Already_Running(){ G_DIETPI-NOTIFY 1 'Another Rsync process is already running.' - echo -e "$RSYNC_MODE_TEXT failed: $(date +"%d-%m-%Y_%H%M"). Rsync is already running." >> "$FP_TARGET/$BACKUP_STATS_FILENAME" - G_WHIP_MSG "$RSYNC_MODE_TEXT Error:\n\nA $RSYNC_MODE_TEXT could not be started as rsync is already running." } diff --git a/dietpi/dietpi-cleaner b/dietpi/dietpi-cleaner index 8c27731045..45d01efcbd 100644 --- a/dietpi/dietpi-cleaner +++ b/dietpi/dietpi-cleaner @@ -31,7 +31,7 @@ #///////////////////////////////////////////////////////////////////////////////////// # Globals #///////////////////////////////////////////////////////////////////////////////////// - FP_TEMP='.dietpi-cleaner' + FP_TMP='.dietpi-cleaner' #///////////////////////////////////////////////////////////////////////////////////// # Banners @@ -77,8 +77,7 @@ ) G_WHIP_BUTTON_CANCEL_TEXT='Exit' - G_WHIP_MENU "Free up used space and system resources:\n - RootFS usage current = $ROOT_SPACE_USED_CURRENT MiB\n - RootFS space cleared = $ROOT_SPACE_FREE_DELTA MiB" - if (( $? == 0 )); then + if G_WHIP_MENU "Free up used space and system resources:\n - RootFS usage current = $ROOT_SPACE_USED_CURRENT MiB\n - RootFS space cleared = $ROOT_SPACE_FREE_DELTA MiB"; then case "$G_WHIP_RETURNED_VALUE" in @@ -313,7 +312,7 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners INCLUDE_MNT=0 DRY_RUN=0 - INFO_CLEAN_NAME='' + INFO_CLEAN_NAME= Run_Cleaners(){ @@ -361,9 +360,8 @@ $G_PROGRAM_NAME simulation has finished: Press any key to continue..." Banner_Cleaning # Find packages and convert into 1 line string - local string_package_names=$(echo $(dpkg --get-selections *-dev build-essential make automake autoconf 2> /dev/null | mawk '{print $1}')) + local string_package_names=$(dpkg --get-selections '*-dev' build-essential make automake autoconf 2> /dev/null | mawk '{print $1}' ORS=' ') - # Mark for autoremoval if (( $DRY_RUN )); then G_DIETPI-NOTIFY 0 "The following dev packages have been found: ${string_package_names:-}" @@ -371,10 +369,9 @@ $G_PROGRAM_NAME simulation has finished: Press any key to continue..." else - apt-mark auto $string_package_names - G_AGA - sed -i '/^aSOFTWARE_INSTALL_STATE\[16\]=/c\aSOFTWARE_INSTALL_STATE\[16\]=0' /boot/dietpi/.installed &> /dev/null - sed -i '/^aSOFTWARE_INSTALL_STATE\[17\]=/c\aSOFTWARE_INSTALL_STATE\[17\]=0' /boot/dietpi/.installed &> /dev/null + # Mark for autoremoval + [[ $string_package_names ]] && { apt-mark auto $string_package_names; G_AGA; } + sed -i '/^aSOFTWARE_INSTALL_STATE\[16\]=/c\aSOFTWARE_INSTALL_STATE\[16\]=0' /boot/dietpi/.installed fi @@ -387,9 +384,8 @@ $G_PROGRAM_NAME simulation has finished: Press any key to continue..." Banner_Cleaning # Find packages and convert into 1 line string - local string_package_names=$(echo $(dpkg --get-selections man-db manpages 2> /dev/null | mawk '{print $1}')) + local string_package_names=$(dpkg --get-selections man-db manpages 2> /dev/null | mawk '{print $1}' ORS=' ') - # Mark for autoremoval if (( $DRY_RUN )); then G_DIETPI-NOTIFY 0 "The following man page/docs packages have been found: ${string_package_names:-}" @@ -399,13 +395,10 @@ $G_PROGRAM_NAME simulation has finished: Press any key to continue..." else - apt-mark auto $string_package_names - G_AGA - if G_WHIP_YESNO '[WARNING] Removing installed man pages and docs causes errors during "apt-get upgrade" in rare cases (https://github.com/MichaIng/DietPi/issues/2751).\n\nNB: If unsure, please select "Cancel".\n\nDo you wish to continue?'; then - - rm -Rf /usr/share/{man,doc,doc-base} - - fi + # Mark for autoremoval + [[ $string_package_names ]] && { apt-mark auto $string_package_names; G_AGA; } + G_WHIP_YESNO '[WARNING] Removing installed man pages and docs causes errors during "apt-get upgrade" in rare cases: https://github.com/MichaIng/DietPi/issues/2751 +\nNB: If unsure, please select "Cancel".\n\nDo you wish to continue?' && rm -Rf /usr/share/{man,doc,doc-base} fi @@ -418,77 +411,59 @@ $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_TEMP + sed -E '/([#[:blank:]]|^$)/d' $FP_CUSTOM > $FP_TMP - # Check include file has at least one value/line to process. - local line_count=$(wc -l < $FP_TEMP) - if (( ! $line_count )); then + # Check if include file has any left content + if [[ ! -s $FP_TMP ]]; then - echo -e '\nNo files to find. Have you setup the Files options and added filename entries to match?\n' + echo -e '\nNo files to find. Have you setup the Files options and added file name entries to match?\n' else - # Create array to hold user includes - local aCustomFiles=() - readarray aCustomFiles < $FP_TEMP - # Generate the find string - local find_string='' - echo -e '\nSearching for filenames matching:' - local i - for i in ${!aCustomFiles[@]} + echo -e '\nSearching for file names matching:' + local find_string + while read -r line do - echo -e "- ${aCustomFiles[$i]}" - - if (( $i == 0 )); then - - find_string="-name ${aCustomFiles[$i]}" + echo "- $line" + [[ $find_string ]] && find_string+=' -o ' + find_string+="-name $line" - else - - find_string+=" -or -name ${aCustomFiles[$i]}" - - fi - - done + done < $FP_TMP echo 'Please wait...' - # Find all matching filenames. - find / -type f $find_string > $FP_TEMP + # Find all matching files + # - Skip traversing /mnt if not selected for inclusion + local exclude_mnt + (( $INCLUDE_MNT )) || exclude_mnt='! ( -path /mnt -prune )' + find / $exclude_mnt -type f $find_string > $FP_TMP - # Remove /mnt from find list - (( $INCLUDE_MNT )) || sed -i '/\/mnt/d' $FP_TEMP + if [[ ! -s $FP_TMP ]]; then - line_count=$(wc -l < $FP_TEMP) - if (( $line_count == 0 )); then - - echo -e '\nNo matching filenames were found.\n' + echo -e '\nNo matching files were found.\n' else - echo -e '\nFound the following matching files:\n' + echo -e '\nFound the following matching files:' fi - # Remove files - while read line + # Process matches + while read -r line do - echo "- Filepath: $line" - if (( ! $DRY_RUN )); then - - echo -e 'Deleted.\n' - rm "$line" - - fi + # Dry run: Print matches only + (( $DRY_RUN )) && { echo "- $line"; continue; } + # Else remove and print result + rm "$line" && echo "- $line ..Deleted!" || echo "- $line ..Failed!" - done < $FP_TEMP + done < $FP_TMP fi - rm $FP_TEMP + rm $FP_TMP } @@ -566,10 +541,10 @@ $G_PROGRAM_NAME simulation has finished: Press any key to continue..." # - Press Y # - Press Enter # ------------------------------------------------------------------ -# Uncomment line below to include temp files during scan. +# Uncomment line below to include tmp files during scan. #*.tmp -# Uncomment line below to include Windows Thumbnail cache during scan. +# Uncomment line below to include Windows thumbnail cache during scan. #Thumbs.db _EOF_ fi diff --git a/dietpi/dietpi-cloudshell b/dietpi/dietpi-cloudshell index 3b64d35ed5..bd02b3600c 100644 --- a/dietpi/dietpi-cloudshell +++ b/dietpi/dietpi-cloudshell @@ -1184,6 +1184,10 @@ _EOF_ #///////////////////////////////////////////////////////////////////////////////////// Init(){ + #-------------------------------------------------------------------------------- + # Override (slow) external "clear" command with function that prints the pure control sequence, clearing the screen MUCH faster! + eval "clear(){ printf '$(clear)'; }" + #-------------------------------------------------------------------------------- # Storage array Init_STORAGE @@ -1202,27 +1206,9 @@ _EOF_ [[ -f '/etc/pihole/gravity.list' ]] || aEnabledScenes[8]=0 #-------------------------------------------------------------------------------- - # Ensure we have at least 1 Scene enabled in the settings file. - local enabled_scene=0 - for ((i=0; i<$MAX_SCENES; i++)) - do - - if (( ${aEnabledScenes[$i]} )); then - - enabled_scene=1 - break + # Ensure we have at least 1 scene (dietpi) enabled in the settings file. + [[ ${aEnabledScenes[*]} == *1* ]] || aEnabledScenes[4]=1 SCENE_CURRENT=4 - fi - - done - - # No Scenes selected! Override user setting and enable at least 1 scene (dietpi) - if (( $enabled_scene == 0 )); then - - aEnabledScenes[4]=1 - SCENE_CURRENT=4 - - fi #-------------------------------------------------------------------------------- # Update DietPi network shared data: https://github.com/MichaIng/DietPi/issues/359 /boot/dietpi/func/obtain_network_details @@ -1602,8 +1588,7 @@ _EOF_ ) G_WHIP_BUTTON_CANCEL_TEXT='Back' - G_WHIP_MENU 'Automatically power down the screen and disable DietPi-Cloudshell processing during a specific time.\n\nNB: This feature will only work if DietPi-Cloudshell was launched with the DietPi-Autostart option, or, launched from the main screen (tty1).' - if (( $? == 0 )); then + if G_WHIP_MENU 'Automatically power down the screen and disable DietPi-Cloudshell processing during a specific time.\n\nNB: This feature will only work if DietPi-Cloudshell was launched with the DietPi-Autostart option, or, launched from the main screen (tty1).'; then if [[ $G_WHIP_RETURNED_VALUE == 'Toggle' ]];then @@ -1659,8 +1644,7 @@ _EOF_ done G_WHIP_BUTTON_CANCEL_TEXT='Back' - G_WHIP_MENU 'Storage Device Mount Location:\n\nDietPi-Cloudshell pulls the storage stats from the drive mount location. If you have custom drives/mounts, please set them here to be displayed during storage scene updates.\n\n - Drive 1 = Displayed during main storage scene\n - Drive 2/3 = Displayed during additional storage scene\n - Drive 4/5 = Displayed during additional storage scene' - if (( $? == 0 )); then + if G_WHIP_MENU 'Storage Device Mount Location:\n\nDietPi-Cloudshell pulls the storage stats from the drive mount location. If you have custom drives/mounts, please set them here to be displayed during storage scene updates.\n\n - Drive 1 = Displayed during main storage scene\n - Drive 2/3 = Displayed during additional storage scene\n - Drive 4/5 = Displayed during additional storage scene'; then local index=$G_WHIP_RETURNED_VALUE diff --git a/dietpi/dietpi-config b/dietpi/dietpi-config index 6e4d040d77..8ecf44f687 100644 --- a/dietpi/dietpi-config +++ b/dietpi/dietpi-config @@ -251,20 +251,12 @@ # - Overscan sizes if (( ! $overscan_disabled )); then - local overscan_options=( - - 'overscan_left' - 'overscan_right' - 'overscan_top' - 'overscan_bottom' - - ) - + local overscan_options=('overscan_left' 'overscan_right' 'overscan_top' 'overscan_bottom') local overscan_left=$(grep -m1 '^[[:blank:]]*overscan_left=' /boot/config.txt || vcgencmd get_config overscan_left); overscan_left=${overscan_left#*=} local overscan_right=$(grep -m1 '^[[:blank:]]*overscan_right=' /boot/config.txt || vcgencmd get_config overscan_right); overscan_right=${overscan_right#*=} local overscan_top=$(grep -m1 '^[[:blank:]]*overscan_top=' /boot/config.txt || vcgencmd get_config overscan_top); overscan_top=${overscan_top#*=} local overscan_bottom=$(grep -m1 '^[[:blank:]]*overscan_bottom=' /boot/config.txt || vcgencmd get_config overscan_bottom); overscan_bottom=${overscan_bottom#*=} - G_WHIP_MENU_ARRAY+=('15' ": Overscan Compensation [L:${overscan_left:=N/A}] [R:${overscan_right:=N/A}] [T:${overscan_top:=N/A}] [B:${overscan_bottom:=N/A}]") + G_WHIP_MENU_ARRAY+=('15' ": Overscan Compensation [L:${overscan_left:-N/A}] [R:${overscan_right:-N/A}] [T:${overscan_top:-N/A}] [B:${overscan_bottom:-N/A}]") fi @@ -272,7 +264,7 @@ if (( $G_HW_MODEL < 4 )); then local hdmi_boost_current=$(grep -m1 '^[[:blank:]]*config_hdmi_boost=' /boot/config.txt || vcgencmd get_config config_hdmi_boost); hdmi_boost_current=${hdmi_boost_current#*=} - G_WHIP_MENU_ARRAY+=('7' ": HDMI Boost : [${hdmi_boost_current:=N/A}]") + G_WHIP_MENU_ARRAY+=('7' ": HDMI Boost : [${hdmi_boost_current:-N/A}]") fi @@ -286,7 +278,7 @@ local rpi_camera_led_disabled=$(grep -cm1 '^[[:blank:]]*disable_camera_led=1' /boot/config.txt) local rpi_camera_led_text='On' (( $rpi_camera_led_disabled )) && rpi_camera_led_text='Off' - G_WHIP_MENU_ARRAY+=('9' ": RPI Camera led : [$rpi_camera_led_text]") + G_WHIP_MENU_ARRAY+=('9' ": RPi Camera LED : [$rpi_camera_led_text]") # JustBoom IR Remote local justboom_ir_remote_text='Off' @@ -301,26 +293,24 @@ # VC1 key local vc1_key_current=$(sed -n '/^[[:blank:]]*decode_WVC1=/{s/^[^=]*=//p;q}' /boot/config.txt) - G_WHIP_MENU_ARRAY+=('12' ": VC1 Key : [${vc1_key_current:=none}]") + G_WHIP_MENU_ARRAY+=('12' ": VC1 Key : [${vc1_key_current:-none}]") # MPEG2 key local mpeg2_key_current=$(sed -n '/^[[:blank:]]*decode_MPG2=/{s/^[^=]*=//p;q}' /boot/config.txt) - G_WHIP_MENU_ARRAY+=('13' ": MPEG2 Key : [${mpeg2_key_current:=none}]") - - fi + G_WHIP_MENU_ARRAY+=('13' ": MPEG2 Key : [${mpeg2_key_current:-none}]") - # Odroid Remote - if (( $G_HW_MODEL > 9 && $G_HW_MODEL < 13 )); then + # Odroids only + elif (( $G_HW_MODEL < 13 )); then + # Remote local odroid_remote_text='Off' local odroid_remote_enabled=0 - if [[ -f /etc/systemd/system/odroid-remote.service ]]; then + if [[ -f '/etc/systemd/system/odroid-remote.service' ]]; then odroid_remote_text='On' odroid_remote_enabled=1 fi - G_WHIP_MENU_ARRAY+=('10' ": Odroid remote : [$odroid_remote_text]") fi @@ -339,7 +329,7 @@ do G_WHIP_DEFAULT_ITEM=${!i} - G_WHIP_INPUTBOX "Please enter a value (pixel count) for $i\n - EG: 16" || break + G_WHIP_INPUTBOX "Please enter a value (pixel count) for $i\n - E.g.: 16" || break G_CONFIG_INJECT "$i=" "$i=$G_WHIP_RETURNED_VALUE" /boot/config.txt REBOOT_REQUIRED=1 @@ -631,8 +621,7 @@ A long (or insufficiently manufactured) cable may required a higher boost settin MIN_VALUE=0 MAX_VALUE=255 - local fp_brightness='' - local current_brightness='' + local fp_brightness current_brightness for fp_brightness in "${afp_current_set_brightness[@]}" do @@ -650,8 +639,7 @@ A long (or insufficiently manufactured) cable may required a higher boost settin if disable_error=1 G_CHECK_VALIDINT "$current_brightness"; then G_WHIP_DEFAULT_ITEM=$current_brightness - G_WHIP_INPUTBOX "Please enter a brightness value:\n - Min = $MIN_VALUE | Max = $MAX_VALUE" - if (( $? == 0 )) && G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" $MIN_VALUE $MAX_VALUE; then + if G_WHIP_INPUTBOX "Please enter a brightness value:\n - Min = $MIN_VALUE | Max = $MAX_VALUE" && G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" $MIN_VALUE $MAX_VALUE; then echo $G_WHIP_RETURNED_VALUE > $fp_brightness/brightness @@ -721,12 +709,12 @@ A long (or insufficiently manufactured) cable may required a higher boost settin G_WHIP_MENU_ARRAY=( + 'System default' '' '1600x1200' '' '1280x1024' '' '1152x864' '' '1024x768' '' '800x600' '' - 'System default' '' ) @@ -759,7 +747,7 @@ A long (or insufficiently manufactured) cable may required a higher boost settin if dpkg-query -s nvidia-driver &> /dev/null; then nvidia_installed=1 - nvidia_text='Uninstall GPU driver' + nvidia_text='[Installed] Uninstall GPU driver' fi @@ -768,7 +756,16 @@ A long (or insufficiently manufactured) cable may required a higher boost settin if dpkg-query -s xserver-xorg-video-intel &> /dev/null; then intel_installed=1 - intel_text='Uninstall GPU driver' + intel_text='[Installed] Uninstall GPU driver' + + fi + + local amd_installed=0 + local amd_text='Install GPU driver' + if dpkg-query -s xserver-xorg-video-amdgpu &> /dev/null; then + + amd_installed=1 + amd_text='[Installed] Uninstall GPU driver' fi @@ -776,6 +773,7 @@ A long (or insufficiently manufactured) cable may required a higher boost settin 'Nvidia' ": $nvidia_text" 'Intel' ": $intel_text" + 'AMD' ": $amd_text" ) @@ -809,6 +807,19 @@ A long (or insufficiently manufactured) cable may required a higher boost settin fi + elif [[ $G_WHIP_RETURNED_VALUE == 'AMD' ]]; then + + if (( $amd_installed )); then + + G_AGP firmware-amd-graphics xserver-xorg-video-amdgpu + + else + + G_AG_CHECK_INSTALL_PREREQ firmware-amd-graphics xserver-xorg-video-amdgpu libgl1-mesa-dri + Xorg_Configure + + fi + fi fi @@ -831,8 +842,8 @@ A long (or insufficiently manufactured) cable may required a higher boost settin fi - # RPi4 doesn't support full KMS driver currently - (( $G_HW_MODEL == 4 )) && G_WHIP_MENU_ARRAY=() || G_WHIP_MENU_ARRAY=('vc4-kms-v3d' ': OpenGL | 1920 x 1080') + # RPi4 has its own full KMS overlay + (( $G_HW_MODEL == 4 )) && G_WHIP_MENU_ARRAY=('vc4-kms-v3d-pi4' ': OpenGL | 1920 x 1080') || G_WHIP_MENU_ARRAY=('vc4-kms-v3d' ': OpenGL | 1920 x 1080') G_WHIP_MENU_ARRAY+=( @@ -1331,7 +1342,7 @@ NB: You now need to run "apt update" or "G_AGUP" once after each reboot, before G_WHIP_MENU_ARRAY+=('Update RPi4 EEPROM firmware' ': Install rpi-eeprom APT package') - fi + fi fi @@ -1503,7 +1514,7 @@ Further information: https://www.raspberrypi.org/documentation/hardware/raspberr if (( $rpi_max_usb_current_enabled )); then if G_WHIP_YESNO "Current setting: [$rpi_max_usb_current_text] (1.2AMP)\nWould you like to disable this setting? -\nOnce Disabled:\n - Max USB current will be limited to 0.6AMP.\n - Shared by all USB ports."; then +\nOnce disabled:\n - Max USB current will be limited to 0.6AMP.\n - Shared by all USB ports."; then G_CONFIG_INJECT 'max_usb_current=' 'max_usb_current=0' /boot/config.txt REBOOT_REQUIRED=1 @@ -1511,7 +1522,7 @@ Further information: https://www.raspberrypi.org/documentation/hardware/raspberr fi elif G_WHIP_YESNO "Current setting: [$rpi_max_usb_current_text] (0.6AMP)\nWould you like to enable this setting? -\nOnce Enabled:\n - Max USB current will be set to 1.2AMP.\n - Shared by all USB ports."; then +\nOnce enabled:\n - Max USB current will be set to 1.2AMP.\n - Shared by all USB ports."; then G_CONFIG_INJECT 'max_usb_current=' 'max_usb_current=1' /boot/config.txt REBOOT_REQUIRED=1 @@ -2092,8 +2103,7 @@ Current setting: $user_frequency_min_text" && G_CONFIG_INJECT 'CONFIG_CPU_MIN_FR ) - G_WHIP_MENU "Hardware : $G_HW_MODEL_NAME\nCurrent : HDMI: [$display_output_text] | VPU: [$display_output_text]\nMemory : $gpu_mem_current MB GPU | $ram_mem_current MB RAM\nNB: GPU/RAM figures require a reboot after a change is made." - if (( $? == 0 )); then + if G_WHIP_MENU "Hardware : $G_HW_MODEL_NAME\nCurrent : HDMI: [$display_output_text] | VPU: [$display_output_text]\nMemory : $gpu_mem_current MB GPU | $ram_mem_current MB RAM\nNB: GPU/RAM figures require a reboot after a change is made."; then REBOOT_REQUIRED=1 @@ -2643,7 +2653,7 @@ NB: All Ethernet connections will be dropped!' && Network_ApplyChanges WIFI_DNS='0.0.0.0' WIFI_MODE=1 WIFI_MODE_TARGET=$WIFI_MODE - + # Get extra WiFi stats command -v iwgetid &> /dev/null && WIFI_SSID_CURRENT=$(iwgetid -r) [[ $WIFI_SSID_CURRENT ]] || WIFI_SSID_CURRENT='Disconnected / No SSID' @@ -3003,10 +3013,9 @@ Would you like to disable WiFi?\n - NB: Connections may drop!'; then # Mode local mode_text='DHCP' (( $ETH_MODE_TARGET == 0 )) && mode_text='STATIC' - G_WHIP_MENU_ARRAY=('' '●─ DHCP/STATIC IP ') - G_WHIP_MENU_ARRAY+=('Change Mode' ": [$mode_text]") + # Show static options if (( $ETH_MODE_TARGET == 0 )); then @@ -3019,6 +3028,9 @@ Would you like to disable WiFi?\n - NB: Connections may drop!'; then fi G_WHIP_MENU_ARRAY+=('' '●─ Additional Options ') + local eth_speed='auto (default)' + [[ -f '/etc/systemd/system/ethtool_force_speed.service' ]] && eth_speed=$(mawk '/^ExecStart=/{print $5;exit}' /etc/systemd/system/ethtool_force_speed.service) + G_WHIP_MENU_ARRAY+=('Link Speed' ": [$eth_speed]") G_WHIP_MENU_ARRAY+=('Disable' ': Disable Ethernet adapter') G_WHIP_MENU_ARRAY+=('' '●─ Apply ') @@ -3027,8 +3039,7 @@ Would you like to disable WiFi?\n - NB: Connections may drop!'; then Net_Update_UsageStats eth$ETH_DEV_INDEX G_WHIP_DEFAULT_ITEM=$WHIP_SELECTION_PREVIOUS - G_WHIP_MENU "Ethernet Details:\nUsage : Sent = $NET_TX_MB | Recieved = $NET_RX_MB\nAddress : IP = $ETH_IP | Mask = $ETH_MASK | Gateway = $ETH_GATEWAY | DNS = $ETH_DNS" - if (( $? == 0 )); then + if G_WHIP_MENU "Ethernet Details:\nUsage : Sent = $NET_TX_MB | Recieved = $NET_RX_MB\nAddress : IP = $ETH_IP | Mask = $ETH_MASK | Gateway = $ETH_GATEWAY | DNS = $ETH_DNS"; then TARGETMENUID=9 # Return to this menu @@ -3043,6 +3054,23 @@ Would you like to disable WiFi?\n - NB: Connections may drop!'; then ;; + 'Link Speed') + + G_AG_CHECK_INSTALL_PREREQ ethtool + G_WHIP_MENU_ARRAY=('0' ': Auto-negotiation (default, recommended)') + local aspeeds=( $(ethtool eth0 | sed -n '/Supported link modes:/,/^[[:blank:]]*[[:alpha:]]/p' | head -n -1 | mawk '{print $NF}') ) + for i in ${aspeeds[@]//[^0-9]} + do + + G_WHIP_MENU_ARRAY+=("$i" ": Force $i Mbit link speed") + + done + G_WHIP_MENU 'Please select a supported Ethernet link speed to force or auto-negotiation. +NB: Auto-negotiation is highly recommended as long as you do not have issues with the auto estimated link speed. + This is mainly aimed at PINE A64 which may have a hardware issue that causes unstable 1000 Mbit link.' && /boot/dietpi/func/dietpi-set_hardware eth-forcespeed $G_WHIP_RETURNED_VALUE + + ;; + 'Disable') if G_WHIP_YESNO 'Would you like to disable the Ethernet adapter?\n - (NOTICE) All Ethernet connections will be dropped.'; then @@ -3249,8 +3277,7 @@ Would you like to disable WiFi?\n - NB: Connections may drop!'; then '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' - (( $? == 0 )) && HOTSPOT_KEY=$G_WHIP_RETURNED_VALUE + G_WHIP_INPUTBOX 'Please enter a key/password for the WiFi hotspot\n - NB: Minimum of 8 characters' && HOTSPOT_KEY=$G_WHIP_RETURNED_VALUE ;; @@ -3484,8 +3511,7 @@ Additional benchmarks: ) - 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.' - if (( $? == 0 )); 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 if [[ $G_WHIP_RETURNED_VALUE == 'Server' ]]; then @@ -3588,10 +3614,10 @@ Additional benchmarks: TARGETMENUID=4 # Get Current Overclocking Settings - local over_voltage_value=$(grep -m1 'over_voltage=' /boot/config.txt | tr -d '#over_voltage=') - local arm_freq_value=$(grep -m1 'arm_freq=' /boot/config.txt | tr -d '#arm_freq=') - local core_freq_value=$(grep -m1 'core_freq=' /boot/config.txt | tr -d '#core_freq=') - (( $G_HW_MODEL == 4 )) || local sdram_freq_value=$(grep -m1 'sdram_freq=' /boot/config.txt | tr -d '#sdram_freq=') + local over_voltage_value=$(sed -n '/over_voltage=/{s/^[^=]*=//p;q}' /boot/config.txt) + local arm_freq_value=$(sed -n '/arm_freq=/{s/^[^=]*=//p;q}' /boot/config.txt) + local core_freq_value=$(sed -n '/core_freq=/{s/^[^=]*=//p;q}' /boot/config.txt) + (( $G_HW_MODEL == 4 )) || local sdram_freq_value=$(sed -n '/sdram_freq=/{s/^[^=]*=//p;q}' /boot/config.txt) # Overclocking RPi1 # - Zero @@ -3599,8 +3625,7 @@ Additional benchmarks: G_WHIP_MENU_ARRAY=('none' ': 1000 MHz ARM | 400 MHz core | 450 MHz SDRAM | 0 overvolt') - G_WHIP_MENU "Hardware : $G_HW_MODEL_NAME\nCurrent: $arm_freq_value MHz ARM | $core_freq_value MHz core | $sdram_freq_value MHz SDRAM | $over_voltage_value overvolt" - if (( $? == 0 )); then + if G_WHIP_MENU "Hardware : $G_HW_MODEL_NAME\nCurrent: $arm_freq_value MHz ARM | $core_freq_value MHz core | $sdram_freq_value MHz SDRAM | $over_voltage_value overvolt"; then TARGETMENUID=13 # Return to this menu @@ -3627,8 +3652,7 @@ Additional benchmarks: ) - G_WHIP_MENU "Hardware : $G_HW_MODEL_NAME\nCurrent: $arm_freq_value MHz ARM | $core_freq_value MHz core | $sdram_freq_value MHz SDRAM | $over_voltage_value overvolt" - if (( $? == 0 )); then + if G_WHIP_MENU "Hardware : $G_HW_MODEL_NAME\nCurrent: $arm_freq_value MHz ARM | $core_freq_value MHz core | $sdram_freq_value MHz SDRAM | $over_voltage_value overvolt"; then TARGETMENUID=13 # Return to this menu @@ -3690,8 +3714,7 @@ Additional benchmarks: ) - G_WHIP_MENU "Hardware : $G_HW_MODEL_NAME\nCurrent: $arm_freq_value MHz ARM | $core_freq_value MHz core | $sdram_freq_value MHz SDRAM | $over_voltage_value overvolt" - if (( $? == 0 )); then + if G_WHIP_MENU "Hardware : $G_HW_MODEL_NAME\nCurrent: $arm_freq_value MHz ARM | $core_freq_value MHz core | $sdram_freq_value MHz SDRAM | $over_voltage_value overvolt"; then TARGETMENUID=13 # Return to this menu @@ -3765,8 +3788,7 @@ Additional benchmarks: fi - G_WHIP_MENU "Hardware : $G_HW_MODEL_NAME\nCurrent: $arm_freq_value MHz ARM | $core_freq_value MHz core | $sdram_freq_value MHz SDRAM | $over_voltage_value overvolt" - if (( $? == 0 )); then + if G_WHIP_MENU "Hardware : $G_HW_MODEL_NAME\nCurrent: $arm_freq_value MHz ARM | $core_freq_value MHz core | $sdram_freq_value MHz SDRAM | $over_voltage_value overvolt"; then TARGETMENUID=13 # Return to this menu @@ -3836,8 +3858,7 @@ Additional benchmarks: ) - G_WHIP_MENU "Hardware : $G_HW_MODEL_NAME\nCurrent: $arm_freq_value MHz ARM | $core_freq_value MHz core | $over_voltage_value overvolt" - if (( $? == 0 )); then + if G_WHIP_MENU "Hardware : $G_HW_MODEL_NAME\nCurrent: $arm_freq_value MHz ARM | $core_freq_value MHz core | $over_voltage_value overvolt"; then TARGETMENUID=13 # Return to this menu Reset_Overclocking @@ -3845,7 +3866,7 @@ Additional benchmarks: case "$G_WHIP_RETURNED_VALUE" in 'energy saving') - + G_CONFIG_INJECT 'over_voltage=' 'over_voltage=-2' /boot/config.txt ;; @@ -3993,16 +4014,20 @@ The following will now be applied:\n - CPU governor = Powersave\n - Display outp G_WHIP_MENU_ARRAY+=('hifiberry-dacplus' ': HifiBerry DAC+ / DAC+ Pro / AMP2') G_WHIP_MENU_ARRAY+=('hifiberry-dacplusadc' ': HifiBerry DAC+ADC') G_WHIP_MENU_ARRAY+=('hifiberry-dacplusadcpro' ': HifiBerry DAC+ADC Pro') + G_WHIP_MENU_ARRAY+=('hifiberry-dacplusdsp' ': HifiBerry DAC+DSP') + G_WHIP_MENU_ARRAY+=('hifiberry-dacplushd' ': HifiBerry DAC+ HD') G_WHIP_MENU_ARRAY+=('hifiberry-digi' ': HifiBerry Digi / Digi+') G_WHIP_MENU_ARRAY+=('hifiberry-digi-pro' ': HifiBerry Digi+ Pro') G_WHIP_MENU_ARRAY+=('i-sabre-q2m' ': AudioPhonics I-Sabre ES9028Q2M / ES9038Q2M') - G_WHIP_MENU_ARRAY+=('iqaudio-dac' ': IQaudio DAC audio card') - G_WHIP_MENU_ARRAY+=('iqaudio-dacplus' ': Pi-DAC+, Pi-DACZero, Pi-DAC Pro, Pi-DigiAMP+') - G_WHIP_MENU_ARRAY+=('iqaudio-digi-wm8804-audio' ': Pi-DIGI+') + G_WHIP_MENU_ARRAY+=('iqaudio-codec' ': IQaudIO Pi-Codec HAT') + G_WHIP_MENU_ARRAY+=('iqaudio-dac' ': IQaudIO DAC audio card') + G_WHIP_MENU_ARRAY+=('iqaudio-dacplus' ': Pi-DAC+, Pi-DACZero, Pi-DAC+ Pro, Pi-DigiAMP+') + G_WHIP_MENU_ARRAY+=('iqaudio-digi-wm8804-audio' ': Pi-Digi+') G_WHIP_MENU_ARRAY+=('iqaudio-dacplus,auto_mute_amp' ': Pi-DigiAMP+') G_WHIP_MENU_ARRAY+=('iqaudio-dacplus,unmute_amp' ': Pi-DigiAMP+') G_WHIP_MENU_ARRAY+=('justboom-dac' ': JustBoom: DAC HAT, Amp HAT, DAC Zero and Amp Zero') G_WHIP_MENU_ARRAY+=('justboom-digi' ': JustBoom: Digi HAT and Digi Zero') + G_WHIP_MENU_ARRAY+=('justboom-both' ': JustBoom: Simultaneous DAC and Digi usage') G_WHIP_MENU_ARRAY+=('rpi-dac' ': Soekris DAM1021 (pcm1794a)') # - C2 @@ -4276,24 +4301,22 @@ The following will now be applied:\n - CPU governor = Powersave\n - Display outp [[ $ntp_mirror_current ]] || ntp_mirror_current='Unknown, no string from scrape' # Network boot wait - local boot_wait_for_network=$(grep -m1 '^[[:blank:]]*CONFIG_BOOT_WAIT_FOR_NETWORK=' /boot/dietpi.txt | sed 's/^[^=]*=//') - local boot_wait_for_network_text='' - if (( $boot_wait_for_network == 0 )); then - - boot_wait_for_network_text+='Off' + local boot_wait_for_network=$(sed -n '/^[[:blank:]]*CONFIG_BOOT_WAIT_FOR_NETWORK=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) + local boot_wait_for_network_text='10 Seconds MAX (default)' + if [[ $boot_wait_for_network == 0 ]]; then - elif (( $boot_wait_for_network == 1 )); then + boot_wait_for_network_text='Off' - boot_wait_for_network_text+='10 Seconds MAX (default)' + elif [[ $boot_wait_for_network == 2 ]]; then - elif (( $boot_wait_for_network == 2 )); then - - boot_wait_for_network_text+='Infinite wait' + boot_wait_for_network_text='Infinite wait' fi local check_url_timeout=$(sed -n '/^[[:blank:]]*CONFIG_G_CHECK_URL_TIMEOUT=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) + disable_error=1 G_CHECK_VALIDINT "$check_url_timeout" 0 || check_url_timeout=10 local check_url_attempts=$(sed -n '/^[[:blank:]]*CONFIG_G_CHECK_URL_ATTEMPTS=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) + disable_error=1 G_CHECK_VALIDINT "$check_url_attempts" 1 || check_url_attempts=2 G_WHIP_MENU_ARRAY=( @@ -4318,10 +4341,10 @@ The following will now be applied:\n - CPU governor = Powersave\n - Display outp 'G_CHECK_URL Timeout') - local min=5 max=60 + 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 G_CHECK_URL assumes a dead connection attempt (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 + 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 G_CONFIG_INJECT 'CONFIG_G_CHECK_URL_TIMEOUT=' "CONFIG_G_CHECK_URL_TIMEOUT=$G_WHIP_RETURNED_VALUE" /boot/dietpi.txt @@ -4331,9 +4354,9 @@ Please enter a value between $min and $max." && G_CHECK_VALIDINT "$G_WHIP_RETURN 'G_CHECK_URL Attempts') - local min=2 max=10 + local min=1 max=10 G_WHIP_DEFAULT_ITEM=$check_url_attempts - if G_WHIP_INPUTBOX "This setting tells DietPi how many times to check a URL, before G_CHECK_URL assumes a dead URL link (and failure).\nIncrease this value if you have a 'flaky' connection.\n + 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 G_CONFIG_INJECT 'CONFIG_G_CHECK_URL_ATTEMPTS=' "CONFIG_G_CHECK_URL_ATTEMPTS=$G_WHIP_RETURNED_VALUE" /boot/dietpi.txt @@ -4344,8 +4367,7 @@ Please enter a value between $min and $max." && G_CHECK_VALIDINT "$G_WHIP_RETURN 'Network Drives') - G_WHIP_YESNO 'The ability to mount and control networked drives has moved to:\n - DietPi-Drive_manager\n\nWould you like to launch the program now?' - (( $? == 0 )) && /boot/dietpi/dietpi-drive_manager + G_WHIP_YESNO 'The ability to mount and control networked drives has moved to:\n - DietPi-Drive_manager\n\nWould you like to launch the program now?' && /boot/dietpi/dietpi-drive_manager ;; @@ -4360,14 +4382,13 @@ Please enter a value between $min and $max." && G_CHECK_VALIDINT "$G_WHIP_RETURN ) G_WHIP_DEFAULT_ITEM=$boot_wait_for_network - G_WHIP_MENU 'The following options will allow you to delay boot, until a valid network connection is available:' - (( $? == 0 )) && G_CONFIG_INJECT 'CONFIG_BOOT_WAIT_FOR_NETWORK=' "CONFIG_BOOT_WAIT_FOR_NETWORK=$G_WHIP_RETURNED_VALUE" /boot/dietpi.txt + G_WHIP_MENU 'The following options will allow you to delay boot, until a valid network connection is available:' && G_CONFIG_INJECT 'CONFIG_BOOT_WAIT_FOR_NETWORK=' "CONFIG_BOOT_WAIT_FOR_NETWORK=$G_WHIP_RETURNED_VALUE" /boot/dietpi.txt ;; 'APT Mirror') - local failure='' + local failure= while : do @@ -4375,7 +4396,7 @@ Please enter a value between $min and $max." && G_CHECK_VALIDINT "$G_WHIP_RETURN G_WHIP_MENU_ARRAY=('Custom' ': Manually enter APT mirror') # - Raspbian - if (( $G_HW_MODEL < 10 )); then + if (( $G_HW_MODEL < 10 )) && (( $G_RASPBIAN )); then local mirror_list='https://www.raspbian.org/RaspbianMirrors/' G_WHIP_MENU_ARRAY+=('http://raspbian.raspberrypi.org/raspbian/' ': Global mirror director (default)') @@ -4439,12 +4460,11 @@ Please enter a value between $min and $max." && G_CHECK_VALIDINT "$G_WHIP_RETURN ) G_WHIP_DEFAULT_ITEM=$ntp_mirror_current - G_WHIP_MENU 'Please select an NTP mirror:\n + if G_WHIP_MENU 'Please select an NTP mirror:\n "Gateway": Try to detect and use local router for time sync. Recommended, allows fastest sync and reduces load to the *.pool.ntp.org servers.\n "Custom": Manually enter local or external NTP server address(es).\n "Default": Leave mirror choice to system. Usually falls back to local gateway (Stretch+ only) or "debian.pool.ntp.org".\n -Use "*.pool.ntp.org" mirrors, if your device is mobile or should act as local NTP server. Further information: "http://www.pool.ntp.org/zone/@"' - if [[ $? == 0 && $G_WHIP_RETURNED_VALUE ]]; then +Use "*.pool.ntp.org" mirrors, if your device is mobile or should act as local NTP server. Further information: "http://www.pool.ntp.org/zone/@"' && [[ $G_WHIP_RETURNED_VALUE ]]; then case $G_WHIP_RETURNED_VALUE in diff --git a/dietpi/dietpi-drive_manager b/dietpi/dietpi-drive_manager index 4f5fb5e760..4a3adf9b63 100644 --- a/dietpi/dietpi-drive_manager +++ b/dietpi/dietpi-drive_manager @@ -121,8 +121,8 @@ tmpfs /var/log tmpfs size=${var_log_size:-50}M,noatime,lazytime,nodev,nosuid,mod tmpfs_mounts=$(grep '^[[:blank:]]*tmpfs[[:blank:]]' $fp_fstab_tmp) # ecryptfs, vboxsf, glusterfs, bind mounts misc_mounts=$(grep -E '^[[:blank:]]*[^#].*([[:blank:]](ecryptfs|vboxsf|glusterfs)[[:blank:]]|[[:blank:],]bind[[:blank:],])' $fp_fstab_tmp) - # CurlFtpFS, CIFS/SMB/Samba, NFS - net_mounts=$(grep -E '^[[:blank:]]*(curlftpfs|[^#].*[[:blank:]](cifs|nfs4?)[[:blank:]])' $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) fi @@ -159,7 +159,7 @@ $swap_mounts df -a --output=source --exclude-type=tmpfs --exclude-type=ecryptfs --exclude-type=vboxsf --exclude-type=glusterfs | mawk '/\// && !x[$0]++' > .df_out_tmp # Process df result - while read line + while read -r line do # Workaround for /dev/root under RPi, force physical location @@ -274,7 +274,7 @@ $swap_mounts # Check blkid for unmounted drives, if drive is not mounted, add entry as disabled/commented mount blkid -o device > .blkid_out_tmp - while read line + while read -r line do [[ $line ]] || continue @@ -316,7 +316,7 @@ $swap_mounts # Find unformated drives # - Exclude mtdblock devices: https://github.com/MichaIng/DietPi/issues/2067#issuecomment-422400520 lsblk -nro NAME | sed '/^mtdblock[0-9]/d' > .lsblk_out_tmp - while read line + while read -r line do [[ $line ]] || continue @@ -711,56 +711,67 @@ Do you wish to ignore this warning, and, mount the drive regardless?" || return # Install rsync G_AG_CHECK_INSTALL_PREREQ rsync - # Update fstab - cp -a /etc/fstab /etc/fstab.bak # in case of rsync fail + # Disable swap + /boot/dietpi/func/dietpi-set_swapfile 0 + + # Create new fstab + G_EXEC cp -a /etc/fstab /etc/fstab_new # - Remove automatic entry for new UUID - sed -i "\@[[:blank:]]${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]}[[:blank:]]@d" /etc/fstab + G_EXEC sed -i "\@[[:blank:]]${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]}[[:blank:]]@d" /etc/fstab_new # - Replace old with new rootfs entry local dev_entry="UUID=${aDRIVE_UUID[$MENU_DRIVE_INDEX]}" (( $G_HW_MODEL < 10 )) && dev_entry="PARTUUID=${aDRIVE_PART_UUID[$MENU_DRIVE_INDEX]}" - sed -i "\@UUID=[^[:blank:]]*[[:blank:]][[:blank:]]*/[[:blank:]]@c $dev_entry / ${aDRIVE_FSTYPE[$MENU_DRIVE_INDEX]} noatime,lazytime,rw 0 1" /etc/fstab - - # Disable swap - /boot/dietpi/func/dietpi-set_swapfile 0 + G_EXEC sed -i "\@UUID=[^[:blank:]]*[[:blank:]]\+/[[:blank:]]@c$dev_entry / ${aDRIVE_FSTYPE[$MENU_DRIVE_INDEX]} noatime,lazytime,rw 0 1" /etc/fstab_new - # Exclude /var/log in case it is a mount point - local exclude_var_log - findmnt -no SOURCE /var/log &> /dev/null && exclude_var_log='--exclude /var/log/*' + # Mount rootfs to tmp mountpoint to allow rsync + # - rsync "-x" option prevents copying mounts content, but it copies permissions of mountpoint dirs according to mount options instead of those of the dir on the parent fs. + # - Since mount permissions might not be wanted for the underlying file system dir, we copy from a temporary mountpoint to assure that underlying rootfs content matches 100%. + G_EXEC mkdir -p /tmp/tmp_rootfs + G_EXEC mount $G_ROOTFS_DEV /tmp/tmp_rootfs - if ! rsync -aHv --delete --exclude '/dev/*' --exclude '/sys/*' --exclude '/proc/*' --exclude '/run/*' --exclude '/tmp/*' $exclude_var_log --exclude '/lost+found/' --exclude '/boot/*' --exclude '/mnt/*' --exclude "${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]}/" / "${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]}/"; then + # Start rsync + if ! G_EXEC_NOEXIT=1 G_EXEC rsync -aHv --delete /tmp/tmp_rootfs/ "${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]}/"; then G_DIETPI-NOTIFY 1 'Rsync has failed, RootFS transfer has been aborted.' - # Revert fstab changes - cp -a /etc/fstab.bak /etc/fstab - exit 1 + rm /etc/fstab_new + umount /tmp/tmp_rootfs + rmdir /tmp/tmp_rootfs + return 1 fi + # Remove volatile systemd service PrivateTmp dirs in /var/tmp and target drive mountpoint dir + rm -Rf "${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]}"/var/tmp/systemd-private-* + rmdir "${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]}${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]}" + + # Move new fstab in place + G_EXEC mv /etc/fstab_new "${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]}/etc/fstab" + # Recreate swap #/boot/dietpi/func/dietpi-set_swapfile 1 "${aDRIVE_MOUNT_TARGET[$MENU_DRIVE_INDEX]}/var/swap" # - Manually update location #G_CONFIG_INJECT 'AUTO_SETUP_SWAPFILE_LOCATION=' 'AUTO_SETUP_SWAPFILE_LOCATION=/var/swap' /boot/dietpi.txt - # RPi | /boot/cmdline.txt + # RPi: /boot/cmdline.txt if (( $G_HW_MODEL < 10 )); then # Find current root= and replace local rootfs_current=$(mawk '{for(i=1;i<=NF;i++) {print $i} }' /boot/cmdline.txt | grep -m1 '^root=') - sed -i "s#$rootfs_current#root=PARTUUID=${aDRIVE_PART_UUID[$MENU_DRIVE_INDEX]}#g" /boot/cmdline.txt + G_EXEC sed -i "s#$rootfs_current#root=PARTUUID=${aDRIVE_PART_UUID[$MENU_DRIVE_INDEX]}#g" /boot/cmdline.txt # Set FS type local rootfstype_current=$(mawk '{for(i=1;i<=NF;i++) {print $i} }' /boot/cmdline.txt | grep -m1 '^rootfstype=') - sed -i "s#$rootfstype_current#rootfstype=${aDRIVE_FSTYPE[$MENU_DRIVE_INDEX]}#g" /boot/cmdline.txt + G_EXEC sed -i "s#$rootfstype_current#rootfstype=${aDRIVE_FSTYPE[$MENU_DRIVE_INDEX]}#g" /boot/cmdline.txt # Add root delay - grep -qE '(^|[[:blank:]])rootdelay=' /boot/cmdline.txt || sed -i "s#rootfstype=${aDRIVE_FSTYPE[$MENU_DRIVE_INDEX]}#rootfstype=${aDRIVE_FSTYPE[$MENU_DRIVE_INDEX]} rootdelay=10#" /boot/cmdline.txt + grep -qE '(^|[[:blank:]])rootdelay=' /boot/cmdline.txt || G_EXEC sed -i "s#rootfstype=${aDRIVE_FSTYPE[$MENU_DRIVE_INDEX]}#rootfstype=${aDRIVE_FSTYPE[$MENU_DRIVE_INDEX]} rootdelay=10#" /boot/cmdline.txt - # C2/XU4 | /boot/boot.ini + # C2/XU4: /boot/boot.ini elif [[ $G_HW_MODEL == 1[12] ]]; then # Find current root= to replace local rootfs_current=$(mawk '{for(i=1;i<=NF;i++) {print $i} }' /boot/boot.ini | grep -m1 '^root=' | sed 's/\"//') - sed -i "s#$rootfs_current#root=UUID=${aDRIVE_UUID[$MENU_DRIVE_INDEX]}#g" /boot/boot.ini + G_EXEC sed -i "s#$rootfs_current#root=UUID=${aDRIVE_UUID[$MENU_DRIVE_INDEX]}#g" /boot/boot.ini fi @@ -1177,7 +1188,7 @@ Do you wish to ignore this warning, and, mount the drive regardless?" || return for i in $(<$io_schedulers) do - if [[ $i == \[*\] ]]; then + if [[ $i == '['*']' ]]; then i=${i#[}; i=${i%]} local io_scheduler_current=$i @@ -1611,8 +1622,7 @@ Read more about I/O scheduling: https://wiki.archlinux.org/index.php/Improving_p G_WHIP_BUTTON_OK_TEXT='MBR' G_WHIP_BUTTON_CANCEL_TEXT='GPT' - G_WHIP_YESNO 'Would you like to use GPT or MBR parition table?\n - GPT is required for 2TB+ drives\n - MBR does NOT support 2TB+ drives\n\nIf unsure, select GPT (default)' - (( $? )) && FORMAT_GPT=1 || FORMAT_GPT=0 + G_WHIP_YESNO 'Would you like to use GPT or MBR parition table?\n - GPT is required for 2TB+ drives\n - MBR does NOT support 2TB+ drives\n\nIf unsure, select GPT (default)' && FORMAT_GPT=0 || FORMAT_GPT=1 elif [[ $G_WHIP_RETURNED_VALUE == 'Format Mode' ]]; then @@ -1892,7 +1902,7 @@ NTFS:\nRecommended if you plan to use this drive on a Windows system. High CPU u df -Ph | tail -n +2 | sed -E '/(^udev|tmpfs)/d' > .df_out_tmp - while read line + while read -r line do G_WHIP_MENU_ARRAY+=("$(mawk '{print $6}' <<< $line)" ": $(mawk '{print $1" | size: "$2"iB | available: "$4"iB"}' <<< $line)") diff --git a/dietpi/dietpi-explorer b/dietpi/dietpi-explorer index e3281c0aa7..e8c6df5bba 100644 --- a/dietpi/dietpi-explorer +++ b/dietpi/dietpi-explorer @@ -17,7 +17,7 @@ # - dietpi-explorer 1 Select a file/folder mode, start from #//////////////////////////////////// - # Use $2, else current dir to start in, which needs to be stored before G_INIT navigates to /tmp/$G_PROGRAM_NAME + # Start in $2, else in current dir, which needs to be stored before G_INIT navigates to /tmp/$G_PROGRAM_NAME TARGET_FP=${2:-$PWD} # Import DietPi-Globals -------------------------------------------------------------- @@ -37,17 +37,13 @@ Process_Copy_Move(){ - if [[ $CP_TARGET ]]; then + if (( $CP_MODE == 0 )); then - if (( $CP_MODE == 0 )); then + G_EXEC_NOHALT=1 G_EXEC cp -a "$CP_SOURCE" "$CP_TARGET"/ - G_EXEC_NOHALT=1 G_EXEC cp -a "$CP_SOURCE" "$CP_TARGET"/ + elif (( $CP_MODE == 1 )); then - elif (( $CP_MODE == 1 )); then - - G_EXEC_NOHALT=1 G_EXEC mv "$CP_SOURCE" "$CP_TARGET"/ - - fi + G_EXEC_NOHALT=1 G_EXEC mv "$CP_SOURCE" "$CP_TARGET"/ fi @@ -71,7 +67,7 @@ G_WHIP_MENU_ARRAY=('' '●─ Navigation') if [[ -f $TARGET_FP && $INPUT != 1 ]]; then # Disable open of files in select mode. - G_WHIP_MENU_ARRAY+=('Open' " : Open '$TARGET_FP' in Nano (text edit)") + G_WHIP_MENU_ARRAY+=('Open' " : Open '$TARGET_FP' in nano (text editor)") elif [[ -d $TARGET_FP ]]; then @@ -186,22 +182,14 @@ done <<< "$(getent group | cut -d: -f1 | sort)" G_WHIP_DEFAULT_ITEM=$group_current - if G_WHIP_MENU 'Chown permissions:\n - Please select a Group'; then - - G_EXEC_NOHALT=1 G_EXEC chown -R $user_target:$G_WHIP_RETURNED_VALUE "$CURRENT_DIRECTORY/$TARGET_FP" - - fi + G_WHIP_MENU 'Chown permissions:\n - Please select a Group' && G_EXEC_NOHALT=1 G_EXEC chown -R "$user_target:$G_WHIP_RETURNED_VALUE" "$CURRENT_DIRECTORY/$TARGET_FP" fi elif [[ $G_WHIP_RETURNED_VALUE == 'Chmod' ]]; then G_WHIP_DEFAULT_ITEM=$chmod_current - if G_WHIP_INPUTBOX 'Chmod permissions:\n - Please enter a value'; then - - G_EXEC_NOHALT=1 G_EXEC chmod -R $G_WHIP_RETURNED_VALUE "$CURRENT_DIRECTORY/$TARGET_FP" - - fi + G_WHIP_INPUTBOX 'Chmod permissions:\n - Please enter a value' && G_EXEC_NOHALT=1 G_EXEC chmod -R "$G_WHIP_RETURNED_VALUE" "$CURRENT_DIRECTORY/$TARGET_FP" fi @@ -220,11 +208,11 @@ Menu_Main(){ CURRENT_DIRECTORY=$PWD - G_WHIP_MENU_ARRAY=() if [[ $CURRENT_DIRECTORY == '/' ]]; then CURRENT_DIRECTORY= + G_WHIP_MENU_ARRAY=() else @@ -237,12 +225,16 @@ fi + # Print info since this can take some seconds on slower drives and/or when large files are contained. + # - Probably we should better scrape "ls -Al" and e.g. show owner and modes as well? + echo -ne 'Scanning current directory...\r' + for item in "$CURRENT_DIRECTORY"/{..?,.[^.],}* do if [[ -f $item ]]; then - G_WHIP_MENU_ARRAY+=( "${item##*/}" " : $(wc -c < "$item") Bytes" ) + G_WHIP_MENU_ARRAY+=( "${item##*/}" ": $(wc -c < "$item") Bytes" ) elif [[ -e $item || -L $item ]]; then diff --git a/dietpi/dietpi-led_control b/dietpi/dietpi-led_control index f1e3ad06c8..ec9ccc3efe 100644 --- a/dietpi/dietpi-led_control +++ b/dietpi/dietpi-led_control @@ -124,9 +124,9 @@ 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 - unset aTRIGGER_SELECTED[$SELECTED_LED] + unset "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 diff --git a/dietpi/dietpi-login b/dietpi/dietpi-login index c05e2385ae..9e71a57c1d 100644 --- a/dietpi/dietpi-login +++ b/dietpi/dietpi-login @@ -21,12 +21,9 @@ Show_License(){ - if [[ -f '/var/lib/dietpi/license.txt' ]] && (( $G_INTERACTIVE )); then - - G_WHIP_VIEWFILE /var/lib/dietpi/license.txt - rm /var/lib/dietpi/license.txt - - fi + (( $G_INTERACTIVE )) && [[ -f '/var/lib/dietpi/license.txt' ]] || return + grep -q '^[[:blank:]]*AUTO_SETUP_ACCEPT_LICENSE=1' /boot/dietpi.txt || G_WHIP_VIEWFILE /var/lib/dietpi/license.txt + rm /var/lib/dietpi/license.txt } @@ -202,6 +199,9 @@ Please login again as user "root" with password "dietpi", respectively the one y Main(){ + # Prevent automated nested dietpi-login calls from subshells + export G_DIETPI_LOGIN=1 + # Wait for full system boot local i=0 while pgrep -f '/boot/dietpi/postboot' &> /dev/null diff --git a/dietpi/dietpi-services b/dietpi/dietpi-services index ca39dfaa74..6052d334e8 100644 --- a/dietpi/dietpi-services +++ b/dietpi/dietpi-services @@ -146,6 +146,7 @@ Available services: 'tonido' 'gogs' 'gitea' + 'firefox-sync' # - Emulation/Gaming 'supervisor' @@ -261,7 +262,7 @@ _EOF_ aSERVICE_EXCLUDED=() local i - while read line + while read -r line do # Include @@ -294,7 +295,7 @@ _EOF_ if [[ $INPUT_CMD ]]; then [[ $G_DEBUG == 1 ]] && G_DIETPI-NOTIFY 2 "Excluding service: $line" - unset aSERVICE_NAME[$i] + unset "aSERVICE_NAME[$i]" else @@ -329,7 +330,7 @@ _EOF_ for i in ${!aSERVICE_NAME[@]} do - [[ ${aSERVICE_NAME[$i]} ]] || { unset aSERVICE_NAME[$i]; continue; } # Failsafe + [[ ${aSERVICE_NAME[$i]} ]] || { unset "aSERVICE_NAME[$i]"; continue; } # Failsafe # Check for sysvinit services from systemd-sysv-generator dir: /run/systemd/generator.late/ for j in /{{etc,usr/local/lib,lib,usr/lib}/systemd/system,run/systemd/generator.late}/"${aSERVICE_NAME[$i]}.service" @@ -346,7 +347,7 @@ _EOF_ done # Remove non-available services from array - [[ ${aFP_SERVICE[$i]} ]] || unset aSERVICE_NAME[$i] + [[ ${aFP_SERVICE[$i]} ]] || unset "aSERVICE_NAME[$i]" done @@ -384,7 +385,7 @@ _EOF_ # - start/restart: Standard service order else - services=${!aSERVICE_NAME[@]} + services=${!aSERVICE_NAME[*]} fi @@ -425,7 +426,7 @@ _EOF_ local index=$2 local services i - [[ $index ]] && services=$index || services=${!aSERVICE_NAME[@]} + [[ $index ]] && services=$index || services=${!aSERVICE_NAME[*]} # start/stop/restart if [[ $command == 'start' || $command == 'stop' || $command == 'restart' ]]; then @@ -540,14 +541,14 @@ _EOF_ # Reset all process tool settings if [[ $setting == 'reset' ]]; then - for i in {0..5}; do unset ${aarray[$i]}[$index]; done + for i in {0..5}; do unset "${aarray[$i]}[$index]"; done [[ -f $fp ]] && G_EXEC rm "$fp" [[ -d $dp ]] && G_EXEC rmdir --ignore-fail-on-non-empty "$dp" # Reset single process tool setting elif [[ $value == 'reset' ]]; then - unset ${aarray[$setting]}[$index] + unset "${aarray[$setting]}[$index]" [[ -f $fp ]] && G_EXEC sed -i "/^${asetting[$setting]}=/d" "$fp" # Apply process tool setting @@ -858,7 +859,7 @@ _EOF_ (( $SYSTEMD_RELOAD_REQUIRED )) && G_EXEC systemctl daemon-reload && SYSTEMD_RELOAD_REQUIRED=0 Set_Running_State $command $MENU_SERVICE_INDEX - unset aSERVICE_RESTART_REQUIRED[$MENU_SERVICE_INDEX] + unset "aSERVICE_RESTART_REQUIRED[$MENU_SERVICE_INDEX]" sleep 0.5 ;; @@ -913,7 +914,7 @@ This affects starts/stops/restarts during DietPi-Software installs, DietPi-Updat if grep -q "^+ ${aSERVICE_NAME[$MENU_SERVICE_INDEX]}" $FP_INCLUDE_EXCLUDE; then sed -i "/^+ ${aSERVICE_NAME[$MENU_SERVICE_INDEX]}/d" $FP_INCLUDE_EXCLUDE - unset aSERVICE_NAME[$MENU_SERVICE_INDEX] + unset "aSERVICE_NAME[$MENU_SERVICE_INDEX]" # Service needs to be re-added from main menu MENU_TARGETID=0 # Return to main menu @@ -1064,7 +1065,7 @@ Info:\n - Negative values have a higher priority (eg: -10).\n - Positive values 'CPU Scheduling Priority') - # - 7 step description scale + # 7 step description scale local scale_value_lowest=1 local scale_value_highest=99 local scale_value_lower=$(( $scale_value_highest / 6 )) diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index dd83a412a6..1dcfeb1773 100644 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -217,6 +217,7 @@ DietPi-Software will decrypt and use it for software installs. You can change it WIFIHOTSPOT_RTL8188C_DEVICE=0 WIFIHOTSPOT_RTL8188C_PACKAGE=0 USER_LINUX_AUTOINSTALL_PROMPT_DISPLAYED=0 + WIREGUARD_BUILTIN=0 # Is the WireGuard kernel module natively shipped by the kernel package? # PHP version specific directories, APT package-, module- and command names PHP_NAME='php7.3' @@ -412,8 +413,8 @@ DietPi-Software will decrypt and use it for software installs. You can change it aSOFTWARE_NAME[$software_id]='TigerVNC Server' aSOFTWARE_DESC[$software_id]='desktop for remote connection' - aSOFTWARE_CATEGORY_INDEX[$software_id]=1 aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_CATEGORY_INDEX[$software_id]=1 aSOFTWARE_REQUIRES_DESKTOP[$software_id]=1 aSOFTWARE_ONLINEDOC_URL[$software_id]='p=408#p408' #------------------ @@ -421,8 +422,8 @@ DietPi-Software will decrypt and use it for software installs. You can change it aSOFTWARE_NAME[$software_id]='XRDP' aSOFTWARE_DESC[$software_id]='remote desktop protocol (rdp) server' - aSOFTWARE_CATEGORY_INDEX[$software_id]=1 aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_CATEGORY_INDEX[$software_id]=1 aSOFTWARE_REQUIRES_DESKTOP[$software_id]=1 aSOFTWARE_ONLINEDOC_URL[$software_id]='p=2074#p2074' #------------------ @@ -439,11 +440,11 @@ DietPi-Software will decrypt and use it for software installs. You can change it aSOFTWARE_NAME[$software_id]='RealVNC Server' aSOFTWARE_DESC[$software_id]='desktop for remote connection' - aSOFTWARE_CATEGORY_INDEX[$software_id]=1 aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_CATEGORY_INDEX[$software_id]=1 aSOFTWARE_REQUIRES_DESKTOP[$software_id]=1 aSOFTWARE_ONLINEDOC_URL[$software_id]='p=4149#p4149' - # RPi only (archive.raspberrypi.org repo) + # RPi only (archive.raspberrypi.org repo, libraspberrypi dependency, license) for ((i=10; i<=$MAX_G_HW_MODEL; i++)) do @@ -461,8 +462,8 @@ DietPi-Software will decrypt and use it for software installs. You can change it aSOFTWARE_CATEGORY_INDEX[$software_id]=2 aSOFTWARE_ONLINEDOC_URL[$software_id]='p=43#p43' aSOFTWARE_REQUIRES_ALSA[$software_id]=1 - # Odroid N2 has not GPU support for Xserver, hence it's not required for Kodi - (( $G_HW_MODEL == 15 )) || aSOFTWARE_REQUIRES_XSERVERXORG[$software_id]=1 + # Odroid N2+C4 have not GPU support for Xserver, hence it's not required for Kodi + [[ $G_HW_MODEL == 1[56] ]] || aSOFTWARE_REQUIRES_XSERVERXORG[$software_id]=1 # Only RPi + Odroid + x86_64 for ((i=22; i<=$MAX_G_HW_MODEL; i++)) do @@ -483,8 +484,8 @@ DietPi-Software will decrypt and use it for software installs. You can change it aSOFTWARE_NAME[$software_id]='ympd' aSOFTWARE_DESC[$software_id]='lightweight web interface music player for mpd' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 aSOFTWARE_REQUIRES_ALSA[$software_id]=1 aSOFTWARE_ONLINEDOC_URL[$software_id]='p=50#p50' #------------------ @@ -525,8 +526,8 @@ DietPi-Software will decrypt and use it for software installs. You can change it aSOFTWARE_NAME[$software_id]='Subsonic' aSOFTWARE_DESC[$software_id]='web interface media streaming server' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 aSOFTWARE_REQUIRES_ALSA[$software_id]=1 aSOFTWARE_REQUIRES_FFMPEG[$software_id]=1 aSOFTWARE_REQUIRES_JAVA_JRE_JDK[$software_id]=1 @@ -539,16 +540,16 @@ DietPi-Software will decrypt and use it for software installs. You can change it aSOFTWARE_NAME[$software_id]='Logitech Media Server' aSOFTWARE_DESC[$software_id]='aka LMS, Squeezebox Server' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1009#p1009' #------------------ software_id=36 aSOFTWARE_NAME[$software_id]='SqueezeLite' aSOFTWARE_DESC[$software_id]='audio player for lms & squeezebox' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 aSOFTWARE_REQUIRES_ALSA[$software_id]=1 aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1009#p1009' #------------------ @@ -1032,6 +1033,18 @@ DietPi-Software will decrypt and use it for software installs. You can change it aSOFTWARE_ONLINEDOC_URL[$software_id]='p=9863#p9863' aSOFTWARE_REQUIRES_GIT[$software_id]=1 aSOFTWARE_REQUIRES_MYSQL[$software_id]=1 + #------------------ + software_id=177 + + aSOFTWARE_NAME[$software_id]='Firefox Sync Server' + aSOFTWARE_DESC[$software_id]='Sync bookmarks, tabs, history & passwords' + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_CATEGORY_INDEX[$software_id]=4 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=24713#p24713' + aSOFTWARE_REQUIRES_BUILDESSENTIAL[$software_id]=1 + aSOFTWARE_REQUIRES_SQLITE[$software_id]=1 + # Bullseye: python(2)-virtualenv not available (yet): https://packages.debian.org/python-virtualenv + aSOFTWARE_AVAIL_G_DISTRO[$software_id,6]=0 # Emulation / Gaming #-------------------------------------------------------------------------------- @@ -1220,8 +1233,8 @@ DietPi-Software will decrypt and use it for software installs. You can change it aSOFTWARE_NAME[$software_id]='Folding@Home' aSOFTWARE_DESC[$software_id]='distributed disease research project' - aSOFTWARE_CATEGORY_INDEX[$software_id]=20 aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_CATEGORY_INDEX[$software_id]=20 aSOFTWARE_ONLINEDOC_URL[$software_id]='p=13704#p13704' # x86_64 only for ((i=1; i<$MAX_G_HW_ARCH; i++)) @@ -1675,8 +1688,8 @@ DietPi-Software will decrypt and use it for software installs. You can change it #------------------ software_id=92 - aSOFTWARE_NAME[$software_id]='CertBot' - aSOFTWARE_DESC[$software_id]='free, ssl cert install allowing https://' + aSOFTWARE_NAME[$software_id]='Certbot' + aSOFTWARE_DESC[$software_id]="Obtain and renew Let's Encrypt SSL certs for HTTPS" aSOFTWARE_TYPE[$software_id]=0 aSOFTWARE_CATEGORY_INDEX[$software_id]=13 aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1062#p1062' @@ -1689,8 +1702,8 @@ DietPi-Software will decrypt and use it for software installs. You can change it aSOFTWARE_TYPE[$software_id]=0 aSOFTWARE_ONLINEDOC_URL[$software_id]='p=4316#p4316' aSOFTWARE_REQUIRES_JAVA_JRE_JDK[$software_id]=1 - # - non-RPi Buster: https://packages.debian.org/tomcat8 - (( $G_HW_MODEL > 9 )) && aSOFTWARE_AVAIL_G_DISTRO[$software_id,5]=0 && aSOFTWARE_AVAIL_G_DISTRO[$software_id,6]=0 + # - non-Raspbian Buster: https://packages.debian.org/tomcat8 + (( $G_HW_MODEL > 9 )) || (( ! $G_RASPBIAN )) && aSOFTWARE_AVAIL_G_DISTRO[$software_id,5]=0 aSOFTWARE_AVAIL_G_DISTRO[$software_id,6]=0 # Pi-hole #-------------------------------------------------------------------------------- @@ -1770,6 +1783,16 @@ DietPi-Software will decrypt and use it for software installs. You can change it done # - Odroid U3 aSOFTWARE_AVAIL_G_HW_MODEL[$software_id,13]=0 + # Re-enable if module is shipped with (kernel) package, e.g. Armbian 5.X + for i in /lib/modules/*/kernel/net/wireguard/wireguard.ko + do + + [[ -f $i ]] || continue + dpkg-query -S "$i" &> /dev/null || continue + aSOFTWARE_AVAIL_G_HW_MODEL[$software_id,$G_HW_MODEL]=1 WIREGUARD_BUILTIN=1 + break + + done #------------------ software_id=117 @@ -2105,8 +2128,9 @@ DietPi-Software will decrypt and use it for software installs. You can change it aSOFTWARE_NAME[$software_id]='QuiteRSS' aSOFTWARE_DESC[$software_id]='cross-platform, free rss reader' - aSOFTWARE_CATEGORY_INDEX[$software_id]=8 aSOFTWARE_TYPE[$software_id]=1 + aSOFTWARE_CATEGORY_INDEX[$software_id]=8 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=2075#p2075' aSOFTWARE_REQUIRES_DESKTOP[$software_id]=1 #-------------------------------------------------------------------------------- @@ -2629,7 +2653,7 @@ DietPi-Software will decrypt and use it for software installs. You can change it fi # Update PHP variables after all software titles have been marked - # - Never install PHP7.2 if PHP7.3 is already present + # - Never install PHP7.2 if PHP7.3 or PHP7.4 is already present if (( ${aSOFTWARE_INSTALL_STATE[89]} > 0 )) && ! command -v php7.3 &> /dev/null && ! command -v php7.4 &> /dev/null; then # Do not upgrade PHP7.2, since we can support it for a long time @@ -2913,10 +2937,6 @@ DietPi-Software will decrypt and use it for software installs. You can change it Banner_Installing - # For desktop entries/icons hosted on dietpi.com - INSTALL_URL_ADDRESS='https://dietpi.com/downloads/conf/desktop' - G_CHECK_URL "$INSTALL_URL_ADDRESS" - # APT deps: upower policykit-1 are needed for LXDE logout menu item to show shutdown/restart ... G_AGI lxde upower policykit-1 firefox-esr @@ -2930,10 +2950,6 @@ DietPi-Software will decrypt and use it for software installs. You can change it Banner_Installing - # For desktop entries/icons hosted on dietpi.com - INSTALL_URL_ADDRESS='https://dietpi.com/downloads/conf/desktop' - G_CHECK_URL "$INSTALL_URL_ADDRESS" - # Buster: No leafpad available, use featherpad instead: https://github.com/MichaIng/DietPi/issues/1918#issuecomment-489319719 local editor='leafpad' (( $G_DISTRO > 4 )) && editor='featherpad' @@ -2946,12 +2962,7 @@ DietPi-Software will decrypt and use it for software installs. You can change it if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - - # For desktop entries/icons hosted on dietpi.com - INSTALL_URL_ADDRESS='https://dietpi.com/downloads/conf/desktop' - G_CHECK_URL "$INSTALL_URL_ADDRESS" - - G_AGI mate-desktop-environment-extras upower policykit-1 firefox-esr + G_AGI mate-desktop-environment-core upower policykit-1 firefox-esr fi @@ -2959,11 +2970,6 @@ DietPi-Software will decrypt and use it for software installs. You can change it if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - - # For desktop entries/icons hosted on dietpi.com - INSTALL_URL_ADDRESS='https://dietpi.com/downloads/conf/desktop' - G_CHECK_URL "$INSTALL_URL_ADDRESS" - G_AGI x-window-system-core wmaker gnustep gnustep-devel gnustep-games libc-dbg upower policykit-1 firefox-esr fi @@ -2972,12 +2978,15 @@ DietPi-Software will decrypt and use it for software installs. You can change it if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing + G_AGI xfce4 xfce4-terminal gnome-icon-theme tango-icon-theme upower policykit-1 firefox-esr - # For desktop entries/icons hosted on dietpi.com - INSTALL_URL_ADDRESS='https://dietpi.com/downloads/conf/desktop' - G_CHECK_URL "$INSTALL_URL_ADDRESS" + fi - G_AGI xfce4 xfce4-terminal gnome-icon-theme tango-icon-theme upower policykit-1 firefox-esr + software_id=22 # QuiteRSS + if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then + + Banner_Installing + G_AGI quiterss fi @@ -3002,7 +3011,7 @@ DietPi-Software will decrypt and use it for software installs. You can change it Banner_Installing # On Stretch, use backports, which resolves missing /etc/profile (e.g. $PATH) load and failing install+service if IPv6 is disabled: https://github.com/MichaIng/DietPi/issues/3017 - (( $G_DISTRO == 4 )) && cat << _EOF_ > /etc/apt/preferences.d/dietpi-xrdp + (( $G_DISTRO == 4 )) && [[ $G_RASPBIAN != 1 ]] && cat << _EOF_ > /etc/apt/preferences.d/dietpi-xrdp Package: xrdp Pin: release n=stretch-backports Pin-Priority: 500 @@ -3135,7 +3144,7 @@ _EOF_ G_EXEC ln -s $G_FP_DIETPI_USERDATA/mysql /var/lib/mysql local package_list='mariadb-server' - # Install php-mysql module, if PHP was already installed + # Install PHP module, if PHP was already installed (( ${aSOFTWARE_INSTALL_STATE[89]} == 2 )) && package_list+=" $PHP_NAME-mysql" G_AGI $package_list @@ -3156,7 +3165,7 @@ _EOF_ Banner_Installing local package_list='sqlite3' - # Install php-sqlite module, if PHP was already installed + # Install PHP module, if PHP was already installed (( ${aSOFTWARE_INSTALL_STATE[89]} == 2 )) && package_list+=" $PHP_NAME-sqlite3" G_AGI $package_list @@ -3167,7 +3176,7 @@ _EOF_ Banner_Installing local package_list='redis-server' - # Install php-redis module, if PHP was already installed + # Install PHP module, if PHP was already installed (( ${aSOFTWARE_INSTALL_STATE[89]} == 2 )) && package_list+=" $PHP_NAME-redis" G_AGI $package_list @@ -3184,7 +3193,7 @@ _EOF_ # Debian (+sury.org) armhf is not ARMv6 compatible: https://github.com/MichaIng/DietPi/issues/2794 if (( $G_HW_ARCH < 2 )); then - INSTALL_URL_ADDRESS='http://raspbian.raspberrypi.org/raspbian' + INSTALL_URL_ADDRESS='http://raspbian.raspberrypi.org/raspbian/' # Actually we do not support any non-RPi ARMv6 devices currently, but lets be failsafe here (( $G_HW_MODEL > 9 )) && INSTALL_URL_ADDRESS='https://deb.debian.org/debian/' @@ -3204,7 +3213,7 @@ Package: *\nPin: release n=buster\nPin-Priority: 100' > /etc/apt/preferences.d/d INSTALL_URL_ADDRESS='https://packages.sury.org/php/apt.gpg' G_CHECK_URL "$INSTALL_URL_ADDRESS" # APT key - curl -sSL "$INSTALL_URL_ADDRESS" | apt-key add - + curl -sSfL "$INSTALL_URL_ADDRESS" | apt-key add - # APT source echo "deb https://packages.sury.org/php/ $G_DISTRO_NAME main" > /etc/apt/sources.list.d/dietpi-php.list # Pin down libssl1.1 version from this repo on Stretch: https://github.com/MichaIng/DietPi/issues/2734 @@ -3264,7 +3273,7 @@ Package: openssl libssl*\nPin: origin packages.sury.org\nPin-Priority: -1' > /et # - Get latest version name INSTALL_URL_ADDRESS='https://api.github.com/repos/phpmyadmin/phpmyadmin/releases/latest' G_CHECK_URL "$INSTALL_URL_ADDRESS" - local version=$(curl -s "$INSTALL_URL_ADDRESS" | grep -m1 '^[[:blank:]]*"name":' | cut -d \" -f 4) + local version=$(curl -sf "$INSTALL_URL_ADDRESS" | grep -m1 '^[[:blank:]]*"name":' | cut -d \" -f 4) local fallback_url='https://files.phpmyadmin.net/phpMyAdmin/5.0.2/phpMyAdmin-5.0.2-english.tar.gz' Download_Install "https://files.phpmyadmin.net/phpMyAdmin/$version/phpMyAdmin-$version-english.tar.gz" # - Reinstall: Clean install but preserve existing config file @@ -3373,24 +3382,14 @@ _EOF_ Banner_Installing - # We must uninstall previous package for reinstall, else it will fail: https://github.com/MichaIng/DietPi/issue_comments#issuecomment-411688073 - if dpkg-query -s 'fahclient' &> /dev/null; then - - G_DIETPI-NOTIFY 2 'Removing previous package before installing the latest version' - G_AGP fahclient - - fi - G_DIETPI-NOTIFY 2 'Pre-configuring FAHClient deb package' - debconf-set-selections <<< 'fahclient fahclient/autostart boolean true' # external bug with setting false https://github.com/FoldingAtHome/fah-issues/issues/1193 + debconf-set-selections <<< 'fahclient fahclient/autostart boolean false' # Do not start SysV service after package install debconf-set-selections <<< 'fahclient fahclient/power select light' debconf-set-selections <<< 'fahclient fahclient/team string 234437' # Team "DietPi" - debconf-set-selections <<< 'fahclient fahclient/user string DietPi' # Default, until user chooses an own username - debconf-set-selections <<< 'fahclient fahclient/passkey string 06c869246e88c00cb05cc4d1758a97f9' - - Download_Install 'https://download.foldingathome.org/releases/public/release/fahclient/debian-stable-64bit/v7.5/latest.deb' + debconf-set-selections <<< 'fahclient fahclient/user string DietPi' # User "DietPi" + debconf-set-selections <<< 'fahclient fahclient/passkey string 06c869246e88c00cb05cc4d1758a97f9' # Passkey for user "DietPi" - killall -w FAHClient # Due to https://github.com/FoldingAtHome/fah-issues/issues/1193 + Download_Install 'https://download.foldingathome.org/releases/public/release/fahclient/debian-stable-64bit/v7.6/latest.deb' fi @@ -3648,13 +3647,16 @@ _EOF_ # Odroids if [[ $G_HW_MODEL == 1[0-9] ]]; then - # Odroid C2+N2: aml-libs-odroid - [[ $G_HW_MODEL == 1[25] ]] && package_list+=' aml-libs-odroid' + # Odroid C2+N2+C4: aml-libs-odroid + [[ $G_HW_MODEL == 1[256] ]] && package_list+=' aml-libs-odroid' + + # Odroid N1: librockchip-mpp1 + [[ $G_HW_MODEL == 11 ]] && package_list+=' librockchip-mpp1' # Odroid N2: https://github.com/MichaIng/DietPi/issues/3255 if (( $G_HW_MODEL == 15 )); then - package_list+=' malig52-fbdev-opencl-odroid kodi-n2-fbdev-odroid' + package_list+=' malig52-fbdev-opencl-odroid kodi-aml-fbdev-odroid' echo 'media_clock firmware decoder_common @@ -3674,6 +3676,29 @@ amvdec_real amvdec_vc1 amvdec_vp9' > /etc/modules-load.d/dietpi-n2-kodi.conf + # Odroid C4 + elif (( $G_HW_MODEL == 16 )); then + + package_list+=' malig31-fbdev-opencl-odroid kodi-aml-fbdev-odroid' + echo 'media_clock +firmware +decoder_common +stream_input +amvdec_avs +amvdec_h264 +amvdec_h264_4k2k +amvdec_mh264 +amvdec_h264mvc +amvdec_h265 +amvdec_mjpeg +amvdec_mmjpeg +amvdec_mpeg12 +amvdec_mpeg4 +amvdec_mmpeg4 +amvdec_real +amvdec_vc1 +amvdec_vp9' > /etc/modules-load.d/dietpi-c4-kodi.conf + else package_list+=' kodi-odroid' @@ -3842,19 +3867,19 @@ amvdec_vp9' > /etc/modules-load.d/dietpi-n2-kodi.conf if (( $G_HW_ARCH == 2 )); then local fallback_url="https://hndl.urbackup.org/Server/$latest/urbackup-server_${latest}_armhf.deb" - local file=$(curl -sL "$INSTALL_URL_ADDRESS" | grep -m1 'urbackup-server_.*_armhf\.deb' | cut -d \" -f 8) + local file=$(curl -sfL "$INSTALL_URL_ADDRESS" | grep -m1 'urbackup-server_.*_armhf\.deb' | cut -d \" -f 8) # x86_64 elif (( $G_HW_ARCH == 10 )); then local fallback_url="https://hndl.urbackup.org/Server/$latest/urbackup-server_${latest}_amd64.deb" - local file=$(curl -sL "$INSTALL_URL_ADDRESS" | grep -m1 'urbackup-server_.*_amd64\.deb' | cut -d \" -f 8) + local file=$(curl -sfL "$INSTALL_URL_ADDRESS" | grep -m1 'urbackup-server_.*_amd64\.deb' | cut -d \" -f 8) # ARMv8 elif (( $G_HW_ARCH == 3 )); then local fallback_url="https://hndl.urbackup.org/Server/$latest/urbackup-server_${latest}_arm64.deb" - local file=$(curl -sL "$INSTALL_URL_ADDRESS" | grep -m1 'urbackup-server-.*_arm64\.deb' | cut -d \" -f 8) + local file=$(curl -sfL "$INSTALL_URL_ADDRESS" | grep -m1 'urbackup-server-.*_arm64\.deb' | cut -d \" -f 8) fi @@ -3871,10 +3896,12 @@ amvdec_vp9' > /etc/modules-load.d/dietpi-n2-kodi.conf Banner_Installing - if (( $G_HW_MODEL > 9 )); then + # Debian + if (( $G_HW_MODEL > 9 )) || (( ! $G_RASPBIAN )); then G_AGI opentyrian + # Raspbian: No build available: http://raspbian.raspberrypi.org/raspbian/pool/contrib/o/opentyrian/ else DEPS_LIST='ibsdl1.2debian libsdl-net1.2' @@ -3940,7 +3967,7 @@ amvdec_vp9' > /etc/modules-load.d/dietpi-n2-kodi.conf INSTALL_URL_ADDRESS='http://www.webmin.com/jcameron-key.asc' G_CHECK_URL "$INSTALL_URL_ADDRESS" - curl -sSL "$INSTALL_URL_ADDRESS" | apt-key add - + curl -sSfL "$INSTALL_URL_ADDRESS" | apt-key add - echo 'deb https://download.webmin.com/download/repository sarge contrib' > /etc/apt/sources.list.d/webmin.list G_AGUP G_AGI webmin @@ -3957,7 +3984,7 @@ amvdec_vp9' > /etc/modules-load.d/dietpi-n2-kodi.conf # - "wget --spider" and "curl -LI" fail with 403 Forbidden INSTALL_URL_ADDRESS='https://yt-dl.org/downloads/latest' G_CHECK_URL "$INSTALL_URL_ADDRESS" - G_THREAD_START curl -sSL "$INSTALL_URL_ADDRESS/youtube-dl" -o /usr/local/bin/youtube-dl + G_THREAD_START curl -sSfL "$INSTALL_URL_ADDRESS/youtube-dl" -o /usr/local/bin/youtube-dl DEPS_LIST='python-requests' Download_Install 'https://github.com/ArturSierzant/OMPD/archive/master.tar.gz' /var/www @@ -4014,7 +4041,7 @@ amvdec_vp9' > /etc/modules-load.d/dietpi-n2-kodi.conf G_AGI $PHP_NAME-xml $PHP_NAME-sqlite3 $PHP_NAME-intl # Install - curl -sSL "$INSTALL_URL_ADDRESS" -o install.sh + curl -sSfL "$INSTALL_URL_ADDRESS" -o install.sh chmod +x install.sh # - Skip Lighttpd install, since we allow to choose and install prior to Pi-hole G_EXEC_NOEXIT=1 G_EXEC_OUTPUT=1 G_EXEC ./install.sh --disable-install-webserver || aSOFTWARE_INSTALL_STATE[$software_id]=0 @@ -4029,7 +4056,7 @@ amvdec_vp9' > /etc/modules-load.d/dietpi-n2-kodi.conf INSTALL_URL_ADDRESS='https://api.github.com/repos/airsonic/airsonic/releases/latest' G_CHECK_URL "$INSTALL_URL_ADDRESS" #full filepath below, returns --spider error :( - INSTALL_URL_ADDRESS=$(curl -s "$INSTALL_URL_ADDRESS" | grep -m1 'browser_download_url.*\.war"' | cut -d \" -f 4) + INSTALL_URL_ADDRESS=$(curl -sf "$INSTALL_URL_ADDRESS" | grep -m1 'browser_download_url.*\.war"' | cut -d \" -f 4) mkdir -p $G_FP_DIETPI_USERDATA/airsonic/transcode wget "$INSTALL_URL_ADDRESS" -O $G_FP_DIETPI_USERDATA/airsonic/airsonic.war @@ -4068,7 +4095,7 @@ amvdec_vp9' > /etc/modules-load.d/dietpi-n2-kodi.conf fi - INSTALL_URL_ADDRESS=$(curl -s "$INSTALL_URL_ADDRESS" | grep -m1 "browser_download_url.*connectd_.*_$arch\.deb" | cut -d \" -f 4) + INSTALL_URL_ADDRESS=$(curl -sf "$INSTALL_URL_ADDRESS" | grep -m1 "browser_download_url.*connectd_.*_$arch\.deb" | cut -d \" -f 4) no_check_url=1 Download_Install "$INSTALL_URL_ADDRESS" fi @@ -4162,7 +4189,7 @@ amvdec_vp9' > /etc/modules-load.d/dietpi-n2-kodi.conf # On Stretch and ARMv6 (RPi 1/Zero) use Java 8, else most current local java='[^a].' # Exclude "a" from jav[a]8 but allow "8" as this can be from version string (( $G_DISTRO < 5 || G_HW_ARCH == 1 )) && java='java8' - INSTALL_URL_ADDRESS=$(curl -s "$INSTALL_URL_ADDRESS" | grep -m1 "browser_download_url.*$java\.jar" | cut -d \" -f 4) + INSTALL_URL_ADDRESS=$(curl -sf "$INSTALL_URL_ADDRESS" | grep -m1 "browser_download_url.*$java\.jar" | cut -d \" -f 4) # Fallback URL if [[ ! $INSTALL_URL_ADDRESS ]]; then @@ -4211,7 +4238,7 @@ amvdec_vp9' > /etc/modules-load.d/dietpi-n2-kodi.conf # Get latest version: No Bullseye packages available yet local distro=$G_DISTRO_NAME (( $G_DISTRO > 5 )) && distro='buster' - local package=$(curl -s "$url/$distro/" | sed -n "/networkaudiod_.*_$arch.deb/{s/^[^\"]*\"//;s/\".*$//p}" | tail -1) + local package=$(curl -sf "$url/$distro/" | sed -n "/networkaudiod_.*_$arch.deb/{s/^[^\"]*\"//;s/\".*$//p}" | tail -1) # Check final URL before applying debconf settings G_CHECK_URL "$url/$distro/$package" @@ -4273,7 +4300,7 @@ amvdec_vp9' > /etc/modules-load.d/dietpi-n2-kodi.conf Banner_Installing - local version='2.1.3' + local version='2.1.7' DEPS_LIST='libpcre3-dev libssl-dev zlib1g-dev libsystemd-dev' Download_Install "https://www.haproxy.org/download/${version%.*}/src/haproxy-$version.tar.gz" @@ -4312,7 +4339,7 @@ amvdec_vp9' > /etc/modules-load.d/dietpi-n2-kodi.conf G_CHECK_URL "$INSTALL_URL_ADDRESS" # - Install, failsafe checking this URL again - Download_Install "$(curl -s "$INSTALL_URL_ADDRESS")" + Download_Install "$(curl -sf "$INSTALL_URL_ADDRESS")" fi @@ -4343,9 +4370,24 @@ amvdec_vp9' > /etc/modules-load.d/dietpi-n2-kodi.conf Banner_Installing # TigerVNC allows connecting to a virtual desktop # X11VNC allows connecting to a real desktop session, thus shared desktop sessions as well - # netbase is required to solve: "Use of uninitialized value $proto in socket at /usr/bin/tigervncserver" + # netbase is required until Bullseye to solve: "Use of uninitialized value $proto in socket at /usr/bin/tigervncserver" # - It is a recommendation and no dependency of perl, but expected by some packages depending on perl only: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=939055 - G_AGI tigervnc-standalone-server tigervnc-common x11vnc netbase + local netbase= + (( $G_DISTRO < 6 )) && netbase='netbase' + G_AGI tigervnc-standalone-server tigervnc-common x11vnc $netbase + + # Patch binary on Buster + ARM due to external bug: https://github.com/MichaIng/DietPi/issues/3615 + if (( $G_DISTRO == 5 && $G_HW_ARCH < 4 )) && [[ $(ldd /usr/bin/Xtigervnc | grep -m1 'libgcc_s\|libunwind') =~ ^[[:blank:]]*'libunwind' ]]; then + + G_DIETPI-NOTIFY 2 'Patching Xtigervnc binary: https://github.com/MichaIng/DietPi/issues/3615' + local patchelf_installed=0 + dpkg-query -s patchelf &> /dev/null && patchelf_installed=1 + (( $patchelf_installed )) || G_AGI patchelf + # Removing and re-adding libgcc_s will place it at the top of the list, as does LD_PRELOAD when executing X(tiger)vnc. + patchelf --remove-needed libgcc_s.so.1 /usr/bin/Xtigervnc + patchelf --add-needed libgcc_s.so.1 /usr/bin/Xtigervnc + + fi fi @@ -4402,7 +4444,7 @@ _EOF_ INSTALL_URL_ADDRESS='https://repos.influxdata.com/influxdb.key' G_CHECK_URL "$INSTALL_URL_ADDRESS" - curl -sSL "$INSTALL_URL_ADDRESS" | apt-key add - + curl -sSfL "$INSTALL_URL_ADDRESS" | apt-key add - # Use Buster branch on Bullseye echo "deb https://repos.influxdata.com/debian/ ${G_DISTRO_NAME/bullseye/buster} stable" > /etc/apt/sources.list.d/influxdb.list G_AGUP @@ -4427,7 +4469,7 @@ _EOF_ # APT key INSTALL_URL_ADDRESS='https://packages.grafana.com/gpg.key' G_CHECK_URL "$INSTALL_URL_ADDRESS" - curl -sSL "$INSTALL_URL_ADDRESS" | apt-key add - + curl -sSfL "$INSTALL_URL_ADDRESS" | apt-key add - # APT list echo 'deb https://packages.grafana.com/oss/deb/ stable main' > /etc/apt/sources.list.d/grafana.list @@ -4455,11 +4497,11 @@ _EOF_ Banner_Installing - INSTALL_URL_ADDRESS='https://dietpi.com/downloads/binaries/all/Ubooquity.jar' - G_CHECK_URL "$INSTALL_URL_ADDRESS" - - mkdir -p $G_FP_DIETPI_USERDATA/ubooquity - G_EXEC wget "$INSTALL_URL_ADDRESS" -O $G_FP_DIETPI_USERDATA/ubooquity/Ubooquity.jar + G_EXEC curl -sSfL https://vaemendis.net/ubooquity/service/download.php -o Ubooquity.zip + G_EXEC unzip -o Ubooquity.zip + G_EXEC_NOEXIT=1 G_EXEC rm Ubooquity.zip + G_EXEC mkdir -p $G_FP_DIETPI_USERDATA/ubooquity + G_EXEC mv {,$G_FP_DIETPI_USERDATA/ubooquity/}Ubooquity.jar fi @@ -4544,76 +4586,99 @@ _EOF_ Banner_Installing - # Kernel headers and matching kernel image required for wireguard-dkms to build the wireguard kernel module - local kernel_packages= - # - x86_64 - if (( $G_HW_ARCH == 10 )); then + # Packages available on Buster backports and Bullseye: For Stretch and Raspbian Buster add Bullseye repo + if (( $G_DISTRO < 5 || ( $G_HW_MODEL < 10 && ${G_RASPBIAN:-1} && $G_DISTRO == 5 ) )); then - kernel_packages='linux-image-amd64 linux-headers-amd64' + # Raspbian or Debian? + local url='http://raspbian.raspberrypi.org/raspbian/' + (( $G_HW_MODEL > 9 )) || (( ! $G_RASPBIAN )) && url='https://deb.debian.org/debian/' - # - RPi - elif (( $G_HW_MODEL < 10 )); then + echo "deb $url bullseye main" > /etc/apt/sources.list.d/dietpi-wireguard.list - kernel_packages='raspberrypi-bootloader raspberrypi-kernel libraspberrypi-bin libraspberrypi0 raspberrypi-kernel-headers' + # Disable repo via priority "-1", to prevent any accidental package upgrades: https://github.com/MichaIng/DietPi/issues/2568 + # Enable but set WireGuard package priorities low enough to install only if not available in main repo(s) + echo -e 'Package: *\nPin: release n=bullseye\nPin-Priority: -1\n +Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=bullseye\nPin-Priority: 100' > /etc/apt/preferences.d/dietpi-wireguard - # - Odroid XU4 - elif (( $G_HW_MODEL == 11 )); then + G_AGUP - kernel_packages='linux-image-4.14-armhf-odroid-xu4 linux-headers-4.14-armhf-odroid-xu4' + fi - # - Odroid C2 - elif (( $G_HW_MODEL == 12 )); then + # If the kernel module is shipped with the kernel (e.g. Armbian 5.X) + if [[ $WIREGUARD_BUILTIN == 1 ]]; then - kernel_packages='linux-image-arm64-odroid-c2 linux-headers-arm64-odroid-c2' + # Purge DKMS as it is not required and might mess with available kernel module + dpkg-query -s wireguard-dkms &> /dev/null && G_AGP wireguard-dkms + # Install userspace tools only + G_AGI wireguard-tools iptables qrencode - # - Odroid N1 - elif (( $G_HW_MODEL == 14 )); then + # Else, kernel headers and matching kernel image is required for wireguard-dkms to build the WireGuard kernel module + else - kernel_packages='linux-image-arm64-odroid-n1 linux-headers-arm64-odroid-n1' + local kernel_packages= + # x86_64 + if (( $G_HW_ARCH == 10 )); then - # - Rock64 - elif (( $G_HW_MODEL == 43 )); then + kernel_packages='linux-image-amd64 linux-headers-amd64' - kernel_packages='linux-image-rockchip64 linux-headers-rockchip64' + # RPi + elif (( $G_HW_MODEL < 10 )); then - fi + # Install bootloader package as well to assure we have a corretly booting system with intended kernel + kernel_packages='raspberrypi-kernel raspberrypi-kernel-headers raspberrypi-bootloader' - # Odroids need to purge before we install, else, does not update to latest version... - (( $G_HW_MODEL > 9 && $G_HW_MODEL < 20 )) && G_AGP $kernel_packages + # Odroid XU4 + elif (( $G_HW_MODEL == 11 )); then - # Since G_AGUG does not upgrade packages with changed dependencies, in case of kernel image meta packages, those need to be installed+upgraded via G_AGI. - G_AGI $kernel_packages # apt-get install overrides hold state + kernel_packages='linux-image-4.14-armhf-odroid-xu4 linux-headers-4.14-armhf-odroid-xu4' - # Add Bullseye repo, which contains the WireGuard packages - if (( $G_DISTRO < 6 )); then + # Odroid C2 + elif (( $G_HW_MODEL == 12 )); then - # Raspbian or Debian? - local url='http://raspbian.raspberrypi.org/raspbian/' - (( $G_HW_MODEL > 9 )) && url='https://deb.debian.org/debian/' + kernel_packages='linux-image-arm64-odroid-c2 linux-headers-arm64-odroid-c2' - echo "deb $url bullseye main" > /etc/apt/sources.list.d/dietpi-wireguard.list + # Odroid N1 + elif (( $G_HW_MODEL == 14 )); then - # Disable repo via priority "-1", to prevent any accidental package upgrades: https://github.com/MichaIng/DietPi/issues/2568 - # Enable but set WireGuard package priorities low enough to install only if not available in main repo(s) - echo -e 'Package: *\nPin: release n=bullseye\nPin-Priority: -1\n -Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=bullseye\nPin-Priority: 100' > /etc/apt/preferences.d/dietpi-wireguard + kernel_packages='linux-image-arm64-odroid-n1 linux-headers-arm64-odroid-n1' - G_AGUP + # Odroid N2 + elif (( $G_HW_MODEL == 15 )); then - fi + kernel_packages='linux-image-arm64-odroid-n2 linux-headers-arm64-odroid-n2' - # Check for existing WireGuard install - local existing_install=0 - dpkg-query -s wireguard-dkms &> /dev/null && existing_install=1 + # Odroid C4 + elif (( $G_HW_MODEL == 16 )); then - # iptables required to forward incoming VPN traffic to local LAN/internet interface - # qrencode required to print client config QR code to console - G_AGI wireguard iptables qrencode + kernel_packages='linux-image-arm64-odroid-c4 linux-headers-arm64-odroid-c4' - # If existing install, reconfigure to rebuild WireGuard kernel module against current kernel + headers - (( $existing_install )) && G_EXEC dpkg-reconfigure wireguard-dkms + fi + + # Odroids need to purge before we install, else, does not update to latest version... + (( $G_HW_MODEL > 9 && $G_HW_MODEL < 20 )) && G_AGP $kernel_packages + + # Since G_AGUG does not upgrade packages with changed dependencies, in case of kernel image meta packages, those need to be installed+upgraded via G_AGI. + G_AGI $kernel_packages # apt-get install overrides hold state + unset kernel_packages + + # Workaround for missing /lib/modules//build symlink: https://github.com/MichaIng/DietPi/issues/3577 + # - Known as issue currently on Odroid C2/N1/N2, check for new build system if linux-/ holds current headers instead of linux-source-/: http://fuzon.co.uk/meveric/pool/c2/l/ + for i in /lib/modules/* + do - unset kernel_packages existing_install + [[ -d $i/build ]] && continue + [[ -d /usr/src/linux-headers-${i##*/} ]] && ln -sfv "/usr/src/linux-headers-${i##*/}" "$i/build" + + done + + # If existing install, reconfigure to rebuild WireGuard kernel module against current kernel + headers + dpkg-query -s wireguard-dkms &> /dev/null && G_EXEC dpkg-reconfigure -f noninteractive wireguard-dkms + + # iptables required to forward incoming VPN traffic to local LAN/internet interface + # qrencode required to print client config QR code to console + G_AGI wireguard-dkms wireguard-tools iptables qrencode + + fi fi @@ -4627,11 +4692,11 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=bullseye\nPin- mkdir -p /var/lib/dietpi/dietpi-software/installed/dietpi-nordvpn - G_WHIP_MSG "DietPi-NordVPN has been installed.\nOnce DietPi-Software has finished all other installations, you can run the GUI using the following command:\n - dietpi-nordvpn" + G_WHIP_MSG '[ INFO ] DietPi-NordVPN has been installed.\n\nOnce DietPi-Software has finished all other installations, you can run the GUI using the following command:\n - dietpi-nordvpn' fi - software_id=92 # Let's Encrypt + software_id=92 # Certbot if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -4902,7 +4967,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=bullseye\nPin- fi local fallback_url="https://github.com/MediaBrowser/Emby.Releases/releases/download/4.4.0.40/emby-server-deb_4.4.0.40_$arch.deb" - no_check_url=1 Download_Install "$(curl -s "$INSTALL_URL_ADDRESS" | grep -m1 "browser_download_url.*emby-server-deb_.*_$arch\.deb" | cut -d \" -f 4)" + no_check_url=1 Download_Install "$(curl -sf "$INSTALL_URL_ADDRESS" | grep -m1 "browser_download_url.*emby-server-deb_.*_$arch\.deb" | cut -d \" -f 4)" unset arch @@ -4916,7 +4981,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=bullseye\nPin- # Apply APT key INSTALL_URL_ADDRESS='https://downloads.plex.tv/plex-keys/PlexSign.key' G_CHECK_URL "$INSTALL_URL_ADDRESS" - curl -sSL "$INSTALL_URL_ADDRESS" | apt-key add - + curl -sSfL "$INSTALL_URL_ADDRESS" | apt-key add - # Apply APT repo echo 'deb https://downloads.plex.tv/repo/deb/ public main' > /etc/apt/sources.list.d/plexmediaserver.list @@ -5013,7 +5078,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=bullseye\nPin- fi G_CHECK_URL 'https://api.github.com/repos/gogs/gogs/releases/latest' - INSTALL_URL_ADDRESS=$(curl -s 'https://api.github.com/repos/gogs/gogs/releases/latest' | grep -m1 "browser_download_url.*$file" | cut -d \" -f 4) + INSTALL_URL_ADDRESS=$(curl -sf 'https://api.github.com/repos/gogs/gogs/releases/latest' | grep -m1 "browser_download_url.*$file" | cut -d \" -f 4) local no_check_url=1 # G_CHECK_URL faces 403 fi @@ -5054,7 +5119,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=bullseye\nPin- # - Grab current version INSTALL_URL_ADDRESS='https://api.github.com/repos/Novik/ruTorrent/releases/latest' G_CHECK_URL "$INSTALL_URL_ADDRESS" - local version=$(curl -s "$INSTALL_URL_ADDRESS" | grep -m1 '^[[:blank:]]*"tag_name":' | cut -d \" -f 4) + local version=$(curl -sf "$INSTALL_URL_ADDRESS" | grep -m1 '^[[:blank:]]*"tag_name":' | cut -d \" -f 4) local fallback_url='https://github.com/Novik/ruTorrent/archive/v3.9.tar.gz' Download_Install "https://github.com/Novik/ruTorrent/archive/$version.tar.gz" @@ -5158,7 +5223,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=bullseye\nPin- fi local fallback_url="https://github.com/syncthing/syncthing/releases/download/v1.4.0/syncthing-linux-$arch-v1.4.0.tar.gz" - no_check_url=1 Download_Install "$(curl -s "$INSTALL_URL_ADDRESS" | grep -m1 "browser_download_url.*linux-$arch-v[0-9.]*tar\.gz" | cut -d \" -f 4)" + no_check_url=1 Download_Install "$(curl -sf "$INSTALL_URL_ADDRESS" | grep -m1 "browser_download_url.*linux-$arch-v[0-9.]*tar\.gz" | cut -d \" -f 4)" mv syncthing-* /opt/syncthing fi @@ -5300,6 +5365,29 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=bullseye\nPin- fi + software_id=177 # Firefox Sync Server + if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then + + Banner_Installing + + # Dependencies + DEPS_LIST='python-virtualenv python-dev' + # - Pre-compiling required on ARM + (( $G_HW_ARCH < 10 )) && DEPS_LIST+=' libffi-dev libssl-dev' + + # Download & Install + INSTALL_URL_ADDRESS='https://github.com/mozilla-services/syncserver/archive/master.tar.gz' + Download_Install "$INSTALL_URL_ADDRESS" + [[ -d '/opt/firefox-sync' ]] && rm -R /opt/firefox-sync + mv syncserver-master /opt/firefox-sync + + # Build + cd /opt/firefox-sync + make build + cd /tmp/$G_PROGRAM_NAME + + fi + software_id=141 # Spotify Connect Web if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then @@ -5340,7 +5428,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=bullseye\nPin- # Grab latest release INSTALL_URL_ADDRESS='https://api.github.com/repos/koel/koel/releases/latest' G_CHECK_URL "$INSTALL_URL_ADDRESS" - local version=$(curl -s "$INSTALL_URL_ADDRESS" | grep -m1 '^[[:blank:]]*"tag_name":' | cut -d \" -f 4) + local version=$(curl -sf "$INSTALL_URL_ADDRESS" | grep -m1 '^[[:blank:]]*"tag_name":' | cut -d \" -f 4) [[ $version ]] || version='v4.2.2' Download_Install "https://github.com/koel/koel/archive/$version.tar.gz" @@ -5393,7 +5481,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=bullseye\nPin- else DEPS_LIST='mediainfo' - Download_Install 'https://download.sonarr.tv/v2/develop/mono/NzbDrone.develop.tar.gz' /opt + Download_Install 'https://download.sonarr.tv/v2/master/mono/NzbDrone.master.tar.gz' /opt fi @@ -5401,7 +5489,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=bullseye\nPin- else apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0xA236C58F409091A18ACA53CBEBFF6B99D9B78493 - echo 'deb https://apt.sonarr.tv/ develop main' > /etc/apt/sources.list.d/sonarr.list + echo 'deb https://apt.sonarr.tv/ master main' > /etc/apt/sources.list.d/sonarr.list G_AGUP G_AGI nzbdrone @@ -5425,7 +5513,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=bullseye\nPin- INSTALL_URL_ADDRESS='https://api.github.com/repos/Radarr/Radarr/releases' G_CHECK_URL "$INSTALL_URL_ADDRESS" - INSTALL_URL_ADDRESS=$(curl -s "$INSTALL_URL_ADDRESS" | grep -m1 'browser_download_url.*linux\.tar\.gz' | cut -d \" -f 4) + INSTALL_URL_ADDRESS=$(curl -sf "$INSTALL_URL_ADDRESS" | grep -m1 'browser_download_url.*linux\.tar\.gz' | cut -d \" -f 4) local fallback_url='https://github.com/Radarr/Radarr/releases/download/v0.2.0.1480/Radarr.develop.0.2.0.1480.linux.tar.gz' DEPS_LIST='mediainfo' @@ -5451,7 +5539,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=bullseye\nPin- INSTALL_URL_ADDRESS='https://api.github.com/repos/Lidarr/Lidarr/releases' G_CHECK_URL "$INSTALL_URL_ADDRESS" - INSTALL_URL_ADDRESS=$(curl -s "$INSTALL_URL_ADDRESS" | grep -m1 'browser_download_url.*linux\.tar\.gz' | cut -d \" -f 4) + INSTALL_URL_ADDRESS=$(curl -sf "$INSTALL_URL_ADDRESS" | grep -m1 'browser_download_url.*linux\.tar\.gz' | cut -d \" -f 4) local fallback_url='https://github.com/lidarr/Lidarr/releases/download/v0.7.1.1381/Lidarr.master.0.7.1.1381.linux.tar.gz' DEPS_LIST='mediainfo' @@ -5496,7 +5584,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=bullseye\nPin- G_CHECK_URL "$INSTALL_URL_ADDRESS" # - ARMv6: Requires Mono: https://github.com/Jackett/Jackett#installation-on-linux-armv6-or-below - INSTALL_URL_ADDRESS=$(curl -s "$INSTALL_URL_ADDRESS" | grep -m1 'browser_download_url.*Jackett\.Binaries\.Mono\.tar\.gz' | cut -d \" -f 4) + INSTALL_URL_ADDRESS=$(curl -sf "$INSTALL_URL_ADDRESS" | grep -m1 'browser_download_url.*Jackett\.Binaries\.Mono\.tar\.gz' | cut -d \" -f 4) local fallback_url='https://github.com/Jackett/Jackett/releases/download/v0.14.376/Jackett.Binaries.Mono.tar.gz' # - ARMv7 @@ -5771,7 +5859,7 @@ If you want to update ${aSOFTWARE_NAME[$software_id]}, please use it's internal fi - INSTALL_URL_ADDRESS=$(curl -s "$INSTALL_URL_ADDRESS" | grep -m1 "\"browser_download_url.*gitea-[0-9.]*-linux-$arch\"" | cut -d \" -f 4) + INSTALL_URL_ADDRESS=$(curl -sf "$INSTALL_URL_ADDRESS" | grep -m1 "\"browser_download_url.*gitea-[0-9.]*-linux-$arch\"" | cut -d \" -f 4) # - Fallback URL [[ $INSTALL_URL_ADDRESS ]] || INSTALL_URL_ADDRESS="https://github.com/go-gitea/gitea/releases/download/v1.11.3/gitea-1.11.3-linux-$arch" wget "$INSTALL_URL_ADDRESS" -O $G_FP_DIETPI_USERDATA/gitea/gitea @@ -5826,7 +5914,7 @@ If you want to update ${aSOFTWARE_NAME[$software_id]}, please use it's internal INSTALL_URL_ADDRESS='https://dtcooper.github.io/raspotify/key.asc' G_CHECK_URL "$INSTALL_URL_ADDRESS" - curl -sSL "$INSTALL_URL_ADDRESS" | apt-key add - + curl -sSfL "$INSTALL_URL_ADDRESS" | apt-key add - echo 'deb https://dtcooper.github.io/raspotify/ raspotify main' > /etc/apt/sources.list.d/raspotify.list G_AGUP @@ -6066,7 +6154,7 @@ $ha_pyenv_activation pyenv install $ha_python_version pyenv local $ha_python_version pip3 install -U pip wheel -[ -z "$custom_pip_deps" ] || pip3 install $custom_pip_deps +[ -z \"$custom_pip_deps\" ] || pip3 install $custom_pip_deps pip3 install homeassistant" # Generate script to launch HA using pyenv @@ -6112,7 +6200,7 @@ sudo -u $ha_user dash -c '$ha_pyenv_activation; pip3 install -U homeassistant'" # Enable defaults, if set to "none" if [[ $soundcard == 'none' ]]; then - # - RPi: Onboard auto, Others: default + # RPi: Onboard auto, Others: default (( $G_HW_MODEL < 10 )) && soundcard='rpi-bcm2835-auto' || soundcard='default' fi @@ -6465,7 +6553,7 @@ sudo -u $ha_user dash -c '$ha_pyenv_activation; pip3 install -U homeassistant'" fi - software_id=103 + software_id=103 # DietPi-RAMlog if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -6538,14 +6626,17 @@ sudo -u $ha_user dash -c '$ha_pyenv_activation; pip3 install -U homeassistant'" INSTALL_URL_ADDRESS='https://raw.githubusercontent.com/taaem/nodejs-linux-installer/master/node-install.sh' G_CHECK_URL "$INSTALL_URL_ADDRESS" - wget "$INSTALL_URL_ADDRESS" + G_EXEC wget "$INSTALL_URL_ADDRESS" # ARMv6 workaround: https://github.com/MichaIng/DietPi/issues/2755 (( $G_HW_ARCH == 1 )) && sed -i 's|nodejs.org/dist/latest/|nodejs.org/dist/latest-v11.x/|g' node-install.sh - mkdir -p /usr/local # failsafe - chmod +x node-install.sh - ./node-install.sh - rm node-install.sh + G_EXEC mkdir -p /usr/local # failsafe + G_EXEC chmod +x node-install.sh + G_EXEC_OUTPUT=1 G_EXEC ./node-install.sh + G_EXEC_NOHALT=1 G_EXEC rm node-install.sh + + # Deps: https://github.com/MichaIng/DietPi/issues/3614 + G_AGI libatomic1 fi @@ -6577,7 +6668,7 @@ sudo -u $ha_user dash -c '$ha_pyenv_activation; pip3 install -U homeassistant'" # On RPi use separate Raspbian repo: https://github.com/MichaIng/DietPi/issues/1023 # Use Buster branch on Bullseye - if (( $G_HW_MODEL < 10 )); then + if (( $G_HW_MODEL < 10 )) && (( $G_RASPBIAN )); then echo "deb https://download.mono-project.com/repo/debian/ raspbian${G_DISTRO_NAME/bullseye/buster} main" > /etc/apt/sources.list.d/mono-xamarin.list @@ -6599,8 +6690,8 @@ sudo -u $ha_user dash -c '$ha_pyenv_activation; pip3 install -U homeassistant'" Banner_Installing - # On Raspbian, only "unrar-free" is available in repos, but does not support all rar formats, thus we use "unrar" [non-free] from Debian repo - if (( $G_HW_MODEL < 10 )); then + # On Raspbian, only "unrar-free" is available in repos, but does not support all rar formats, thus we use "unrar" [non-free] from Debian repo: http://raspbian.raspberrypi.org/raspbian/pool/non-free/u/unrar-nonfree/ + if (( $G_HW_MODEL < 10 )) && (( $G_RASPBIAN )); then Download_Install "https://dietpi.com/downloads/binaries/rpi/unrar-armhf-$G_DISTRO_NAME.deb" @@ -6626,8 +6717,8 @@ sudo -u $ha_user dash -c '$ha_pyenv_activation; pip3 install -U homeassistant'" # Check currently installed SSH servers via "dpkg --get-selections" to be failsafe local dpkg_out=$(dpkg --get-selections) - grep -q '^dropbear[^[:blank:]]*[[:blank:]]' <<< "$dpkg_out" && aSOFTWARE_INSTALL_STATE[104]=-1 && UNINSTALL_REQUIRED=1 - grep -q '^openssh-server[[:blank:]]' <<< "$dpkg_out" && aSOFTWARE_INSTALL_STATE[105]=-1 && UNINSTALL_REQUIRED=1 + grep -q '^dropbear[^[:blank:]]*[[:blank:]]' <<< "$dpkg_out" && aSOFTWARE_INSTALL_STATE[104]=-1 UNINSTALL_REQUIRED=1 + grep -q '^openssh-server[[:blank:]]' <<< "$dpkg_out" && aSOFTWARE_INSTALL_STATE[105]=-1 UNINSTALL_REQUIRED=1 # Dropbear elif (( $INDEX_SSHSERVER_TARGET == -1 )); then @@ -6683,8 +6774,8 @@ sudo -u $ha_user dash -c '$ha_pyenv_activation; pip3 install -U homeassistant'" Apply_Logging_Choices(){ - # Work out which Logging system needs installing from IDs (if any) - # Work out which Logging system needs removing (if any) + # Work out which logging system needs installing from IDs (if any) + # Work out which logging system needs removing (if any) if (( $INDEX_LOGGING_TARGET != $INDEX_LOGGING_CURRENT )); then # Run uninstall of old logging systems, after install loop @@ -6697,14 +6788,14 @@ sudo -u $ha_user dash -c '$ha_pyenv_activation; pip3 install -U homeassistant'" (( ${aSOFTWARE_INSTALL_STATE[102]} == 2 )) && aSOFTWARE_INSTALL_STATE[102]=-1 (( ${aSOFTWARE_INSTALL_STATE[103]} == 2 )) && aSOFTWARE_INSTALL_STATE[103]=-1 - # Ramlog - clear every hour + # RAMlog - clear every hour elif (( $INDEX_LOGGING_TARGET == -1 )); then aSOFTWARE_INSTALL_STATE[103]=1 (( ${aSOFTWARE_INSTALL_STATE[101]} == 2 )) && aSOFTWARE_INSTALL_STATE[101]=-1 (( ${aSOFTWARE_INSTALL_STATE[102]} == 2 )) && aSOFTWARE_INSTALL_STATE[102]=-1 - # Ramlog - backup every 1H to /root/logfile_storage, then clear. + # RAMlog - backup every hour to /root/logfile_storage, then clear elif (( $INDEX_LOGGING_TARGET == -2 )); then aSOFTWARE_INSTALL_STATE[103]=1 @@ -6725,6 +6816,9 @@ sudo -u $ha_user dash -c '$ha_pyenv_activation; pip3 install -U homeassistant'" fi + # Reinstall DietPi-RAMlog on firstrun installs, if enabled, to apply AUTO_SETUP_RAMLOG_MAXSIZE + (( $G_DIETPI_INSTALL_STAGE == 1 && ${aSOFTWARE_INSTALL_STATE[103]} == 2 )) && aSOFTWARE_INSTALL_STATE[103]=1 + } Apply_Webserver_Preference(){ @@ -6766,7 +6860,7 @@ sudo -u $ha_user dash -c '$ha_pyenv_activation; pip3 install -U homeassistant'" # Openbox config G_THREAD_START wget https://raw.githubusercontent.com/MichaIng/DietPi/$G_GITBRANCH/.conf/desktop/lxde/lxde-rc.xml -O /root/.config/openbox/lxde-rc.xml - # Remove Lxrandr Menu item (monitor configuration tool as we set res in dietpi-config) + # Remove Lxrandr menu item (monitor configuration tool as we set res in dietpi-config) [[ -f '/usr/share/applications/lxrandr.desktop' ]] && rm /usr/share/applications/lxrandr.desktop # Disable Trash @@ -7215,9 +7309,8 @@ _EOF_ while : do - G_WHIP_INPUTBOX "${invalid_entry}Please enter the IP address of your ${aSOFTWARE_NAME[$software_id]} client machine -This is required, since the ${aSOFTWARE_NAME[$software_id]} server node by default does not allow any remote connection." - if (( ! $? )) && [[ $G_WHIP_RETURNED_VALUE =~ ^[0-9.]+$ ]]; then + if G_WHIP_INPUTBOX "${invalid_entry}Please enter the IP address of your ${aSOFTWARE_NAME[$software_id]} client machine +This is required, since the ${aSOFTWARE_NAME[$software_id]} server node by default does not allow any remote connection." && [[ $G_WHIP_RETURNED_VALUE =~ ^[0-9.]+$ ]]; then ob_client_ip=$G_WHIP_RETURNED_VALUE break @@ -7278,33 +7371,39 @@ _EOF_ Banner_Configuration - # Remove old data + config directories and init.d service + # Remove obsolete config + data directories and SysV service + config [[ -d '/var/lib/fahclient' ]] && rm -R /var/lib/fahclient [[ -d '/etc/fahclient' ]] && rm -R /etc/fahclient + [[ -f '/etc/default/fahclient' ]] && rm /etc/default/fahclient [[ -f '/etc/init.d/FAHClient' ]] && rm /etc/init.d/FAHClient update-rc.d -f FAHClient remove - # Create new working (data + config) directory and log file - mkdir -p $G_FP_DIETPI_USERDATA/fahclient - > /var/log/fahclient.log + # Prepare our new config + data directory if not yet present + if [[ ! -f $G_FP_DIETPI_USERDATA/fahclient/config.xml ]]; then + + mkdir -p $G_FP_DIETPI_USERDATA/fahclient + dps_index=$software_id Download_Install 'config.xml' $G_FP_DIETPI_USERDATA/fahclient/config.xml - # Create new systemd service - cat << _EOF_ > /lib/systemd/system/fahclient.service + fi + + # Service + cat << _EOF_ > /etc/systemd/system/fahclient.service [Unit] Description=Folding@Home (DietPi) +Wants=network-online.target +After=network-online.target dietpi-boot.service [Service] User=fahclient -Group=dietpi WorkingDirectory=$G_FP_DIETPI_USERDATA/fahclient -ExecStart=$(command -v FAHClient) --allow='0/0' --web-allow='0/0' --daemon=false --user=DietPi --team=234437 --passkey=06c869246e88c00cb05cc4d1758a97f9 --gpu=true --log-rotate=false --log=/var/log/fahclient.log --power=light --data-directory=$G_FP_DIETPI_USERDATA/fahclient +ExecStart=$(command -v FAHClient) [Install] WantedBy=multi-user.target _EOF_ # Permissions - chown -R fahclient:dietpi $G_FP_DIETPI_USERDATA/fahclient /var/log/fahclient.log + chown -R fahclient $G_FP_DIETPI_USERDATA/fahclient fi @@ -7809,8 +7908,7 @@ The install script will now exit. After applying one of the the above, rerun die do G_WHIP_DEFAULT_ITEM=$domain - G_WHIP_INPUTBOX "${invalid_text}Please enter your servers external domain to allow Nextcloud Talk access your TURN server:" - if [[ $? == 0 && $G_WHIP_RETURNED_VALUE ]]; then + if G_WHIP_INPUTBOX "${invalid_text}Please enter your servers external domain to allow Nextcloud Talk access your TURN server:" && [[ $G_WHIP_RETURNED_VALUE ]]; then domain=${G_WHIP_RETURNED_VALUE#http*://} break @@ -7828,9 +7926,8 @@ The install script will now exit. After applying one of the the above, rerun die do G_WHIP_DEFAULT_ITEM=$port - G_WHIP_INPUTBOX "${invalid_text}Please enter the network port, that should be used for your TURN server:\n -NB: This port needs to be forwarded by your router and/or opened in your firewall settings. Default value is: 3478" - if (( $? == 0 )) && disable_error=1 G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" 0; then + if G_WHIP_INPUTBOX "${invalid_text}Please enter the network port, that should be used for your TURN server:\n +NB: This port needs to be forwarded by your router and/or opened in your firewall settings. Default value is: 3478" && disable_error=1 G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" 0; then port=$G_WHIP_RETURNED_VALUE break @@ -8236,7 +8333,7 @@ _EOF_ local version=11 (( $G_DISTRO < 5 || G_HW_MODEL == 1 )) && version=8 - G_CONFIG_INJECT 'JAVA_HOME=' "JAVA_HOME=$(find /usr/lib/jvm/ -name java-$version-openjdk*)" /etc/default/tomcat8 + G_CONFIG_INJECT 'JAVA_HOME=' "JAVA_HOME=$(find /usr/lib/jvm/ -name "java-$version-openjdk*")" /etc/default/tomcat8 fi @@ -9041,7 +9138,8 @@ _EOF_ [Unit] Description=Manage VNC Server (DietPi) Before=xrdp.service xrdp-sesman.service -After=dietpi-boot.service +Wants=network-online.target +After=network-online.target dietpi-boot.service [Service] RemainAfterExit=yes @@ -9060,62 +9158,65 @@ _EOF_ cat << _EOF_ > /usr/local/bin/vncserver #!/bin/bash -# Check shared mode +# Shared or virtual desktop? SHARED_MODE=\$(grep -cm1 '^[[:blank:]]*SOFTWARE_VNCSERVER_SHARE_DESKTOP=1' /boot/dietpi.txt) -# RealVNC | Slightly different launch method to TigerVNC -REALVNC=0 -if dpkg-query -s realvnc-vnc-server &> /dev/null; then +# RealVNC or TigerVNC? +if [[ -f '/usr/bin/vncserver-virtual' ]]; then REALVNC=1 + FP_BINARY='/usr/bin/vncserver-virtual' # Set shared desktop mode if autostart is enabled for desktops. This prevents another VNC server being launched on :1. [[ -f '/boot/dietpi/.dietpi-autostart_index' && \$( /dev/null - killall -qw x11vnc Xtigervnc + \$FP_BINARY -kill :\${DISPLAY:-1} 2> /dev/null + (( \$REALVNC )) && systemctl stop vncserver-x11-serviced + killall -qw x11vnc Xtigervnc /usr/bin/vncserver-x11-serviced vncserver-x11-serviced Xvnc-core ;; esac @@ -9124,15 +9225,7 @@ exit 0 _EOF_ chmod +x /usr/local/bin/vncserver - # + RealVNC | enable services - if (( ${aSOFTWARE_INSTALL_STATE[120]} == 1 )); then - - systemctl enable vncserver-x11-serviced - systemctl enable vncserver-virtuald - - fi - - # - Stretch + TigerVNC: Disable Localhost only by default + # Stretch + TigerVNC: Disable Localhost only by default [[ -f '/etc/vnc.conf' ]] && GCI_PRESERVE=1 G_CONFIG_INJECT '\$localhost[[:blank:]]*=' '$localhost = "no";' /etc/vnc.conf local cmd_launch_desktop= @@ -9175,12 +9268,16 @@ $cmd_launch_desktop & _EOF_ chmod +x /root/.vnc/xstartup - # Set control + read-only passwords - vncpasswd -f << _EOF_ > /root/.vnc/passwd + # TigerVNC: Set control + read-only passwords (RealVNC uses UNIX user authentication by default, does not support the "-f" option and uses different files!) + if command -v tigervncpasswd &> /dev/null; then + + tigervncpasswd -f << _EOF_ > /root/.vnc/passwd $GLOBAL_PW $GLOBAL_PW _EOF_ - chmod 600 /root/.vnc/passwd + chmod 600 /root/.vnc/passwd + + fi fi @@ -9239,12 +9336,21 @@ _EOF_ Banner_Configuration + # User local usercmd='useradd -rMU' getent passwd ubooquity &> /dev/null && usercmd='usermod -a' - $usercmd -G dietpi -s $(command -v nologin) ubooquity + G_EXEC $usercmd -G dietpi -d $G_FP_DIETPI_USERDATA/ubooquity -s $(command -v nologin) ubooquity - mkdir -p $G_FP_DIETPI_USERDATA/{ebooks,comics} + # Data + G_EXEC mkdir -p $G_FP_DIETPI_USERDATA/{ebooks,comics} + # Logs + G_EXEC rm -Rf $G_FP_DIETPI_USERDATA/ubooquity/logs /var/log/ubooquity + G_EXEC mkdir -p /var/log/ubooquity + G_EXEC ln -s /var/log/ubooquity $G_FP_DIETPI_USERDATA/ubooquity/logs + + # Service + G_DIETPI-NOTIFY 2 "Generating systemd service to start ${aSOFTWARE_NAME[$software_id]} on boot" cat << _EOF_ > /etc/systemd/system/ubooquity.service [Unit] Description=Ubooquity (DietPi) @@ -9259,10 +9365,11 @@ ExecStart=$(command -v java) -jar $G_FP_DIETPI_USERDATA/ubooquity/Ubooquity.jar [Install] WantedBy=multi-user.target _EOF_ - # Permissions - chmod +x $G_FP_DIETPI_USERDATA/ubooquity/Ubooquity.jar - chown -R ubooquity:dietpi $G_FP_DIETPI_USERDATA/ubooquity + G_EXEC chmod +x $G_FP_DIETPI_USERDATA/ubooquity/Ubooquity.jar + G_EXEC chown -R ubooquity {$G_FP_DIETPI_USERDATA,/var/log}/ubooquity + G_EXEC chown ubooquity:dietpi $G_FP_DIETPI_USERDATA/{ebooks,comics} + G_EXEC chmod 775 $G_FP_DIETPI_USERDATA/{ebooks,comics} fi @@ -9357,7 +9464,7 @@ _EOF_ INSTALL_URL_ADDRESS='https://api.github.com/repos/OpenVPN/easy-rsa/releases/latest' G_CHECK_URL "$INSTALL_URL_ADDRESS" fallback_url='https://github.com/OpenVPN/easy-rsa/releases/download/v3.0.6/EasyRSA-unix-v3.0.6.tgz' - no_check_url=1 Download_Install "$(curl -s "$INSTALL_URL_ADDRESS" | grep -m1 '"browser_download_url.*EasyRSA-.*\.tgz' | cut -d \" -f 4)" + no_check_url=1 Download_Install "$(curl -sf "$INSTALL_URL_ADDRESS" | grep -m1 '"browser_download_url.*EasyRSA-.*\.tgz' | cut -d \" -f 4)" [[ -d '/etc/openvpn/easy-rsa' ]] && rm -R /etc/openvpn/easy-rsa mv EasyRSA-* /etc/openvpn/easy-rsa @@ -9492,8 +9599,7 @@ _EOF_ do G_WHIP_DEFAULT_ITEM=$domain - G_WHIP_INPUTBOX "${invalid_text}Please enter your servers public IP/domain for WireGuard client access:" - if (( $? == 0 )) && [[ $G_WHIP_RETURNED_VALUE ]]; then + if G_WHIP_INPUTBOX "${invalid_text}Please enter your servers public IP/domain for WireGuard client access:" && [[ $G_WHIP_RETURNED_VALUE ]]; then domain=${G_WHIP_RETURNED_VALUE#http*://} break @@ -9511,9 +9617,8 @@ _EOF_ do G_WHIP_DEFAULT_ITEM=$port - G_WHIP_INPUTBOX "${invalid_text}Please enter the network port, that should be used to access your WireGuard server:\n -NB: This port needs to be forwarded by your router and/or opened in your firewall settings. Default value is: 51820" - if (( $? == 0 )) && disable_error=1 G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" 0; then + if G_WHIP_INPUTBOX "${invalid_text}Please enter the network port, that should be used to access your WireGuard server:\n +NB: This port needs to be forwarded by your router and/or opened in your firewall settings. Default value is: 51820" && disable_error=1 G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" 0; then port=$G_WHIP_RETURNED_VALUE break @@ -9545,6 +9650,7 @@ Address = 10.9.0.1/24 PrivateKey = $( /etc/default/hostapd @@ -10471,7 +10579,7 @@ schedule2 = session_save, 240, 300, ((session.save)) schedule2 = monitor_diskspace, 15, 60, ((close_low_diskspace, 1000M)) system.umask.set = 002 # Max memory mapping size, not max physical RAM usage! -pieces.memory.max.set = $RAM_TOTAL +pieces.memory.max.set = ${RAM_TOTAL}M pieces.hash.on_completion.set = no ### Connection settings @@ -10507,7 +10615,7 @@ throttle.max_peers.seed.set = -1 trackers.numwant.set = $(Optimise_BitTorrent 2) # Public tracker support trackers.use_udp.set = yes -dht.mode.set = enable +dht.mode.set = on #dht.port.set = 6881 protocol.pex.set = yes protocol.encryption.set = allow_incoming,try_outgoing,enable_retry @@ -11155,6 +11263,64 @@ _EOF_ fi + software_id=177 # Firefox Sync Server + if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then + + Banner_Configuration + + # User + local usercmd='useradd -rMU' + getent passwd ffsync &> /dev/null && usercmd='usermod' + $usercmd -d /opt/firefox-sync -s $(command -v nologin) ffsync + + # Create database and config directory + mkdir -p $G_FP_DIETPI_USERDATA/firefox-sync + + # Create database if it doesn't exist + [[ -f $G_FP_DIETPI_USERDATA/firefox-sync/FF-Sync-DB.db ]] || sqlite3 $G_FP_DIETPI_USERDATA/firefox-sync/FF-Sync-DB.db "create table aTable(field1 int); drop table aTable;" + + # Copy and modify default config file if it doesn't exist + local ffsync_conf="$G_FP_DIETPI_USERDATA/firefox-sync/syncserver.ini" + if [[ ! -f $ffsync_conf ]]; then + + cp -a /opt/firefox-sync/syncserver.ini $ffsync_conf + local ffsync_ip=$(mawk 'NR==4' /run/dietpi/.network) + G_CONFIG_INJECT 'host =' "host = $ffsync_ip" $ffsync_conf + G_CONFIG_INJECT 'port =' 'port = 5000' $ffsync_conf # To be failsafe if the default changes in future releases + G_CONFIG_INJECT 'public_url =' "public_url = http://$ffsync_ip:5000/" $ffsync_conf + G_CONFIG_INJECT 'sqluri = sqlite:' "sqluri = sqlite:///$G_FP_DIETPI_USERDATA/firefox-sync/FF-Sync-DB.db" $ffsync_conf + + fi + + cat << _EOF_ > /etc/systemd/system/firefox-sync.service +[Unit] +Description=Firefox Sync Server (DietPi) +Documentation=https://github.com/mozilla-services/syncserver +Wants=network-online.target +After=network-online.target dietpi-boot.service + +[Service] +User=ffsync +WorkingDirectory=$G_FP_DIETPI_USERDATA/firefox-sync +ExecStart=/opt/firefox-sync/local/bin/gunicorn --paste $ffsync_conf + +# Hardening +ProtectSystem=strict +ProtectHome=true +PrivateDevices=true +ProtectKernelTunables=true +ProtectControlGroups=true +ReadWritePaths=$G_FP_DIETPI_USERDATA/firefox-sync + +[Install] +WantedBy=multi-user.target +_EOF_ + + # Permissions + chown -R ffsync:ffsync $G_FP_DIETPI_USERDATA/firefox-sync + + fi + software_id=141 # Spotify Connect Web if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then @@ -11270,7 +11436,7 @@ _EOF_ [Unit] Description=Sonarr Daemon (DietPi) Wants=network-online.target -After=network-online.target +After=network-online.target dietpi-boot.service [Service] SyslogIdentifier=Sonarr @@ -11287,7 +11453,7 @@ ProtectHome=true PrivateDevices=true ProtectKernelTunables=true ProtectControlGroups=true -ReadWritePaths=/opt/NzbDrone /mnt /var/log/sonarr /tmp +ReadWritePaths=/opt/NzbDrone /mnt /media /var/log/sonarr /tmp [Install] WantedBy=multi-user.target @@ -11324,7 +11490,7 @@ _EOF_ [Unit] Description=Radarr Daemon (DietPi) Wants=network-online.target -After=network-online.target +After=network-online.target dietpi-boot.service [Service] SyslogIdentifier=Radarr @@ -11341,7 +11507,7 @@ ProtectHome=true PrivateDevices=true ProtectKernelTunables=true ProtectControlGroups=true -ReadWritePaths=/opt/Radarr /mnt /var/log/radarr /tmp +ReadWritePaths=/opt/Radarr /mnt /media /var/log/radarr /tmp [Install] WantedBy=multi-user.target @@ -11378,7 +11544,7 @@ _EOF_ [Unit] Description=Lidarr Daemon (DietPi) Wants=network-online.target -After=network-online.target +After=network-online.target dietpi-boot.service [Service] SyslogIdentifier=Lidarr @@ -11395,7 +11561,7 @@ ProtectHome=true PrivateDevices=true ProtectKernelTunables=true ProtectControlGroups=true -ReadWritePaths=/opt/Lidarr /mnt /var/log/lidarr /tmp +ReadWritePaths=/opt/Lidarr /mnt /media /var/log/lidarr /tmp [Install] WantedBy=multi-user.target @@ -11468,7 +11634,7 @@ _EOF_ [Unit] Description=Jackett (DietPi) Wants=network-online.target -After=network-online.target +After=network-online.target dietpi-boot.service [Service] SyslogIdentifier=jackett @@ -11913,6 +12079,7 @@ After=network-online.target sound.target dietpi-boot.service [Service] User=gmrender +ExecStartPre=/boot/dietpi/func/obtain_network_details ExecStartPre=+/bin/dash -c 'systemctl set-environment ACTIVE_IP=\$(mawk 'NR==4' /run/dietpi/.network)' ExecStart=/usr/local/bin/gmediarender -u '$G_HW_UUID' -f '$( /dev/null && userdel -rf ffsync + getent group ffsync &> /dev/null && groupdel ffsync + [[ -d '/opt/firefox-sync' ]] && rm -R /opt/firefox-sync + [[ -d $G_FP_DIETPI_USERDATA/firefox-sync ]] && rm -R $G_FP_DIETPI_USERDATA/firefox-sync + + fi + software_id=141 if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then @@ -13100,12 +13288,12 @@ _EOF_ if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then Banner_Uninstalling - #apt-mark auto libcec4 libcurl3-gnutls libnfs* # Odroid N2: aml-libs-odroid malig52-fbdev-opencl-odroid - G_AGP kodi kodi-odroid kodi-n2-fbdev-odroid + G_AGP kodi kodi-odroid kodi-n2-fbdev-odroid kodi-aml-fbdev-odroid [[ -f '/usr/share/applications/kodi.desktop' ]] && rm /usr/share/applications/kodi.desktop rm -f /{root,home/*}/Desktop/kodi.desktop [[ -f '/etc/udev/rules.d/99-dietpi-kodi.rules' ]] && rm /etc/udev/rules.d/99-dietpi-kodi.rules [[ -f '/etc/modules-load.d/dietpi-n2-kodi.conf' ]] && rm /etc/modules-load.d/dietpi-n2-kodi.conf + [[ -f '/etc/modules-load.d/dietpi-c4-kodi.conf' ]] && rm /etc/modules-load.d/dietpi-c4-kodi.conf fi @@ -13126,7 +13314,7 @@ _EOF_ if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then Banner_Uninstalling - if (( $G_HW_MODEL >= 10 )); then + if (( $G_HW_MODEL > 9 )) || (( ! $G_RASPBIAN )); then G_AGP opentyrian @@ -13165,10 +13353,21 @@ _EOF_ if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then Banner_Uninstalling + if [[ -f '/etc/systemd/system/deluge-web.service' ]]; then + + systemctl disable --now deluge-web + rm -R /etc/systemd/system/deluge-web.service* + + fi + if [[ -f '/etc/systemd/system/deluged.service' ]]; then + + systemctl disable --now deluged + rm -R /etc/systemd/system/deluged.service* + + fi G_AGP deluged deluge-web deluge-console - userdel -rf debian-deluged - [[ -f '/etc/systemd/system/deluged.service' ]] && rm /etc/systemd/system/deluged.service - [[ -f '/etc/systemd/system/deluge-web.service' ]] && rm /etc/systemd/system/deluge-web.service + getent passwd debian-deluged &> /dev/null && userdel -rf debian-deluged + getent group debian-deluged &> /dev/null && groupdel debian-deluged [[ -d $G_FP_DIETPI_USERDATA/deluge ]] && rm -R $G_FP_DIETPI_USERDATA/deluge fi @@ -13394,6 +13593,13 @@ _EOF_ (( ${aSOFTWARE_INSTALL_STATE[28]} == -1 )) && software_id=28 || software_id=120 Banner_Uninstalling + + # RealVNC services + systemctl unmask vncserver-x11-serviced 2> /dev/null + systemctl disable --now vncserver-x11-serviced 2> /dev/null + systemctl unmask vncserver-virtuald 2> /dev/null + systemctl disable --now vncserver-virtuald 2> /dev/null + G_AGP tigervnc-* x11vnc realvnc-vnc-server if [[ -f '/etc/systemd/system/vncserver.service' ]]; then @@ -13402,13 +13608,14 @@ _EOF_ rm -R /etc/systemd/system/vncserver.service* fi - [[ -f '/etc/init.d/vncserver' ]] && rm /etc/init.d/vncserver - [[ -f '/usr/local/bin/vncserver' ]] && rm /usr/local/bin/vncserver - [[ -d '/root/.vnc' ]] && rm -R /root/.vnc + if [[ -f '/etc/init.d/vncserver' ]]; then + + rm /etc/init.d/vncserver + update-rc.d -f vncserver remove - # + RealVNC services - systemctl disable vncserver-x11-serviced.service 2> /dev/null - systemctl disable vncserver-virtuald.service 2> /dev/null + fi + [[ -f '/usr/local/bin/vncserver' ]] && rm /usr/local/bin/vncserver + rm -Rf /{root,home/*}/.vnc fi @@ -13491,22 +13698,27 @@ _EOF_ if [[ -f '/etc/systemd/system/dietpi-nordvpn.service' ]]; then systemctl disable --now dietpi-nordvpn - rm /etc/systemd/system/dietpi-nordvpn.service + rm -R /etc/systemd/system/dietpi-nordvpn.service* fi - rm -Rf /etc/openvpn/ovpn_{tcp,udp}/*nordvpn* + rm -Rf /etc/openvpn/ovpn_{tcp,udp}/*nordvpn* /var/lib/dietpi/dietpi-software/installed/dietpi-nordvpn rmdir --ignore-fail-on-non-empty /etc/openvpn/ovpn_{tcp,udp} - [[ -d '/var/lib/dietpi/dietpi-software/installed/dietpi-nordvpn' ]] && rm -R /var/lib/dietpi/dietpi-software/installed/dietpi-nordvpn fi - software_id=92 + software_id=92 # Certbot if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then Banner_Uninstalling G_AGP python3-certbot-apache python3-certbot-nginx certbot - [[ -f '/etc/systemd/system/certbot.service' ]] && rm /etc/systemd/system/certbot.service [[ -d '/etc/systemd/system/certbot.service.d' ]] && rm -R /etc/systemd/system/certbot.service.d + # Pre-v6.3 + if [[ -f '/etc/systemd/system/certbot.service' ]]; then + + systemctl disable --now certbot + rm /etc/systemd/system/certbot.service + + fi fi @@ -13717,6 +13929,14 @@ _EOF_ Banner_Uninstalling G_AGP plexmediaserver + # Remove systemd unit which currently survives the package purging: https://github.com/MichaIng/DietPi/issues/3551 + if [[ -f '/lib/systemd/system/plexmediaserver.service' ]]; then + + systemctl unmask plexmediaserver + systemctl disable --now plexmediaserver + rm -R /lib/systemd/system/plexmediaserver.service* + + fi [[ -d '/var/lib/plexmediaserver' ]] && rm -R /var/lib/plexmediaserver # Left over from purging package, still... [[ -d '/etc/systemd/system/plexmediaserver.service.d' ]] && rm -R /etc/systemd/system/plexmediaserver.service.d @@ -14205,6 +14425,7 @@ _EOF_ fi getent passwd ubooquity &> /dev/null && userdel -rf ubooquity + getent group ubooquity &> /dev/null && groupdel ubooquity [[ -d $G_FP_DIETPI_USERDATA/ubooquity ]] && rm -R $G_FP_DIETPI_USERDATA/ubooquity fi @@ -14503,14 +14724,14 @@ _EOF_ fi - software_id=9 + software_id=9 # Node.js if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then Banner_Uninstalling npm r -g n yarn npm - G_AGP nodejs # Old install via repo + G_AGP nodejs [[ -f '/etc/apt/sources.list.d/nodesource_nodejs.list' ]] && rm /etc/apt/sources.list.d/nodesource_nodejs.list [[ -f '/usr/local/bin/node' ]] && rm /usr/local/bin/node @@ -14803,9 +15024,6 @@ _EOF_ INDEX_LOGGING_TARGET=$AUTOINSTALL_LOGGINGINDEX INDEX_WEBSERVER_TARGET=$AUTOINSTALL_WEBSERVERINDEX - # Re-flag RAMlog for install, if enabled, ensures AUTO_SETUP_RAMLOG_MAXSIZE gets applied - [[ $INDEX_LOGGING_TARGET == -[12] ]] && aSOFTWARE_INSTALL_STATE[103]=1 - # Set time sync mode /boot/dietpi/func/dietpi-set_software ntpd-mode $AUTOINSTALL_TIMESYNCMODE @@ -14816,7 +15034,7 @@ _EOF_ #///////////////////////////////////////////////////////////////////////////////////// Input_Modes(){ - local input=$@ + local input=$* input=${input#*[[:blank:]]} # Process software and exit @@ -15226,22 +15444,20 @@ You can free up the camera by selecting "Stop Camera" from the web interface:\n # EmonHUB/EmonPi if (( ${aSOFTWARE_INSTALL_STATE[99]} == 1 )); then - # - Enter API KEY - # - Grab key from dietpi.txt - USER_EMONHUB_APIKEY_CURRENT=$(grep -m1 '^[[:blank:]]*SOFTWARE_EMONHUB_APIKEY=' /boot/dietpi.txt | sed 's/^.*=//') + # Enter API KEY + # Grab key from dietpi.txt + USER_EMONHUB_APIKEY_CURRENT=$(sed -n '/^[[:blank:]]*SOFTWARE_EMONHUB_APIKEY=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) while (( $USER_EMONHUB_APIKEY_COMPLETED == 0 )); do - G_WHIP_INPUTBOX "EmonHUB/EmonPi:\n\nPlease enter the \"Write API KEY\":\n - Visit https://emoncms.org to register an account and login. - - Select \"Setup\" from the top right of screen, then select \"My Account\"\n - Enter the \"Write API Key\" into the box below." - if (( $? == 0 )); then + if G_WHIP_INPUTBOX "EmonHUB/EmonPi:\n\nPlease enter the \"Write API KEY\":\n - Visit https://emoncms.org to register an account and login. + - Select \"Setup\" from the top right of screen, then select \"My Account\"\n - Enter the \"Write API Key\" into the box below."; then USER_EMONHUB_APIKEY_CURRENT=$G_WHIP_RETURNED_VALUE - G_WHIP_YESNO "The following \"Write API KEY\" will be applied during installation:\n$USER_EMONHUB_APIKEY_CURRENT\n\nIs this key correct?" - if (( $? == 0 )); then + if G_WHIP_YESNO "The following \"Write API KEY\" will be applied during installation:\n$USER_EMONHUB_APIKEY_CURRENT\n\nIs this key correct?"; then - # - update dietpi.txt so the value will be applied during installation. + # Update dietpi.txt so the value will be applied during installation. sed -i "/^[[:blank:]]*SOFTWARE_EMONHUB_APIKEY=/c\SOFTWARE_EMONHUB_APIKEY=$USER_EMONHUB_APIKEY_CURRENT" /boot/dietpi.txt USER_EMONHUB_APIKEY_COMPLETED=1 @@ -15257,7 +15473,7 @@ You can free up the camera by selecting "Stop Camera" from the web interface:\n # Pi-hole if (( ${aSOFTWARE_INSTALL_STATE[93]} == 1 )); then - # - prompt for static ip. + # Prompt for static IP if G_WHIP_YESNO 'A static IP address is essential for Pi-hole installations. DietPi-Config can be used to quickly setup your static IP address.\n If you have already setup your static IP, please ignore this message.\n\nWould you like to setup your static IP address now?'; then @@ -15276,12 +15492,13 @@ Once completed, select "Apply Save Changes", then exit DietPi-Config to resume s # Enable WiFi modules /boot/dietpi/func/dietpi-set_hardware wifimodules enable - while :; do + while : + do local criteria_passed=1 local output_string='The following criteria must be met, for the installation of WiFi Hotspot to succeed:' - if ip r | grep -qi "eth$(mawk 'NR==1' /run/dietpi/.network)"; then + if ip r | grep -q "eth$(mawk 'NR==1' /run/dietpi/.network)"; then output_string+='\n\n - Ethernet online: PASSED' @@ -15294,12 +15511,12 @@ Once completed, select "Apply Save Changes", then exit DietPi-Config to resume s if [[ -d /sys/class/net/wlan$(mawk 'NR==2' /run/dietpi/.network) ]]; then - output_string+='\n\n - Wifi adapter detected: PASSED' + output_string+='\n\n - WiFi adapter detected: PASSED' else criteria_passed=0 - output_string+='\n\n - Wifi adapter detected: FAILED.\nPlease connect a WiFi adapter and try again.' + output_string+='\n\n - WiFi adapter detected: FAILED.\nPlease connect a WiFi adapter and try again.' fi @@ -15333,23 +15550,23 @@ Once completed, select "Apply Save Changes", then exit DietPi-Config to resume s if (( ${aSOFTWARE_INSTALL_STATE[68]} == 1 )); then G_WHIP_MSG 'Remot3.it requires you to create an online account, and, link it this device.\n -Once DietPi has completed your software installations, and rebooted, please follow the First Run tutorial link below:\nhttps://dietpi.com/phpbb/viewtopic.php?f=8&t=5&p=188#p188' +Once DietPi has completed your software installations, and rebooted, please follow the First Run tutorial link below:\nhttps://dietpi.com/phpbb/viewtopic.php?p=188#p188' fi # Let's Encrypt if (( ${aSOFTWARE_INSTALL_STATE[92]} == 1 )); then - G_WHIP_MSG 'The DietPi installation of CertBot supports all offered web servers.\n\nOnce the installation has finished, you can setup your free SSL cert with: - - DietPi-LetsEncrypt\n\nThis is a easy to use frontend for CertBot and allows integration into DietPi systems.\n\nMore information:\n - https://dietpi.com/phpbb/viewtopic.php?f=8&t=5&p=1061#p1062' + G_WHIP_MSG 'The DietPi installation of Certbot supports all offered web servers.\n\nOnce the installation has finished, you can setup your free SSL cert with: + - DietPi-LetsEncrypt\n\nThis is a easy to use frontend for Certbot and allows integration into DietPi systems.\n\nMore information:\n - https://dietpi.com/phpbb/viewtopic.php?p=1062#p1062' fi # dietpi-config can be used to install/configure the following software. Ask user. - # - NoIp + # - No-IP if (( ${aSOFTWARE_INSTALL_STATE[67]} == 1 )); then - if G_WHIP_YESNO 'NoIp can be setup and configured by using DietPi-Config. Would you like to complete this now? \n\n- Once finished, exit DietPi-Config to resume setup.\n + if G_WHIP_YESNO 'No-IP can be setup and configured by using DietPi-Config. Would you like to complete this now? \n\n- Once finished, exit DietPi-Config to resume setup.\n - More information:\nhttps://dietpi.com/phpbb/viewtopic.php?p=58#p58'; then # Write installed states to temp @@ -15534,9 +15751,9 @@ This will allow you to choose which program loads automatically, after the syste G_WHIP_MENU_ARRAY=( - 'None' ': Not required / manual setup.' - 'Dropbear' ': Lightweight SSH Server (Recommended).' - 'OpenSSH' ': Feature Rich SSH Server with SFTP/SCP support.' + 'None' ': Not required / manual setup' + 'Dropbear' ': Lightweight SSH Server (Recommended)' + 'OpenSSH' ': Feature rich SSH Server with SFTP/SCP support' ) @@ -15547,7 +15764,7 @@ This will allow you to choose which program loads automatically, after the syste - Dropbear (Recommended): Lightweight SSH server, installed by default on DietPi systems.\n - OpenSSH: A feature rich SSH server with SFTP/SCP support, at the cost of increased resource usage.'; then - # - Assign target index + # Assign target index if [[ $G_WHIP_RETURNED_VALUE == 'None' ]]; then INDEX_SSHSERVER_TARGET=0 @@ -15563,7 +15780,7 @@ This will allow you to choose which program loads automatically, after the syste INDEX_SSHSERVER_TARGET=-2 toberemoved_text='Dropbear' - # - Reset to current + # Reset to current else INDEX_SSHSERVER_TARGET=$INDEX_SSHSERVER_CURRENT @@ -15587,21 +15804,20 @@ This will allow you to choose which program loads automatically, after the syste G_WHIP_MENU_ARRAY=( - 'None' ': Not required / manual setup.' - 'ProFTPD' ': Efficient, lightweight fileserver (recommended).' - 'Samba' ': Feature-rich fileserver.' + 'None' ': Not required / manual setup' + 'ProFTPD' ': Efficient, lightweight fileserver (recommended)' + 'Samba' ': Feature rich fileserver' ) G_WHIP_DEFAULT_ITEM=$index_fileserver_text G_WHIP_BUTTON_CANCEL_TEXT='Back' - G_WHIP_MENU 'Please select desired fileserver:\n + if G_WHIP_MENU 'Please select desired fileserver:\n - None: Select this option if you do NOT require a method of accessing files and folders on this device, over a network.\n - ProFTPD (Recommended for RPi v1): Allows you to access/share files on this device efficiently with minimal cpu usage. Uses FTP protocol.\n -- Samba (Recommended for RPi v2): Allows you to easily access/share files on this device, at the cost of higher cpu usage.\n\nMore info: https://dietpi.com/phpbb/viewtopic.php?f=8&t=15#p19' - if (( $? == 0 )); then +- Samba (Recommended for RPi v2): Allows you to easily access/share files on this device, at the cost of higher cpu usage.\n\nMore info: https://dietpi.com/phpbb/viewtopic.php?f=8&t=15#p19'; then - # - Assign target index + # Assign target index if [[ $G_WHIP_RETURNED_VALUE == 'None' ]]; then INDEX_FILESERVER_TARGET=0 @@ -15617,7 +15833,7 @@ This will allow you to choose which program loads automatically, after the syste INDEX_FILESERVER_TARGET=-2 toberemoved_text='ProFTPD' - # - Reset to current + # Reset to current else INDEX_FILESERVER_TARGET=$INDEX_FILESERVER_CURRENT @@ -15641,23 +15857,22 @@ This will allow you to choose which program loads automatically, after the syste G_WHIP_MENU_ARRAY=( - 'None' ': Not required / manual setup.' - 'DietPi-Ramlog #1' ': Hourly clear (recommended).' - 'DietPi-Ramlog #2' ': Hourly save, then clear.' - 'Full' ': Logrotate and Rsyslog.' + 'None' ': Not required / manual setup' + 'DietPi-Ramlog #1' ': Hourly clear (recommended)' + 'DietPi-Ramlog #2' ': Hourly save, then clear' + 'Full' ': Logrotate and Rsyslog' ) G_WHIP_DEFAULT_ITEM=$index_logging_text G_WHIP_BUTTON_CANCEL_TEXT='Back' - G_WHIP_MENU 'Please select desired logging system:\n + if G_WHIP_MENU 'Please select desired logging system:\n - None: Selecting this option will uninstall DietPi-Ramlog, Logrotate, Rsyslog.\n - DietPi-Ramlog #1 (Max performance): Mounts /var/log to RAM, reducing filesystem IO. Logfiles are cleared every hour. Does NOT save logfiles to disk.\n - DietPi-Ramlog #2: Same as #1, with the added feature of saving logfile contents to disk (/root/logfile_storage/*), before being cleared.\n -- Full (Reduces performance): Mounts /var/log to DISK, reduces SDcard lifespan. Full logging system with Logrotate and Rsyslog.' - if (( $? == 0 )); then +- Full (Reduces performance): Mounts /var/log to DISK, reduces SDcard lifespan. Full logging system with Logrotate and Rsyslog.'; then - # - Assign target index + # Assign target index if [[ $G_WHIP_RETURNED_VALUE == 'None' ]]; then INDEX_LOGGING_TARGET=0 @@ -15678,7 +15893,7 @@ This will allow you to choose which program loads automatically, after the syste INDEX_LOGGING_TARGET=-3 toberemoved_text='DietPi-Ramlog' - # - Reset to current + # Reset to current else INDEX_LOGGING_TARGET=$INDEX_LOGGING_CURRENT @@ -15712,16 +15927,15 @@ This will allow you to choose which program loads automatically, after the syste ) G_WHIP_BUTTON_CANCEL_TEXT='Back' - G_WHIP_MENU 'Choose where to store your user data. User data includes software such as ownCloud data store, BitTorrent downloads etc.\n -More information on user data in DietPi:\n- https://dietpi.com/phpbb/viewtopic.php?p=2087\n\n- DietPi-Drive_Manager: Launch DietPi-Drive_Manager to setup external drives, and, move user data to different locations.' - if (( $? == 0 )); then + if G_WHIP_MENU 'Choose where to store your user data. User data includes software such as ownCloud data store, BitTorrent downloads etc.\n +More information on user data in DietPi:\n- https://dietpi.com/phpbb/viewtopic.php?p=2087\n\n- DietPi-Drive_Manager: Launch DietPi-Drive_Manager to setup external drives, and, move user data to different locations.'; then - # - DriveMan + # DriveMan if [[ $G_WHIP_RETURNED_VALUE == 'Drive' ]]; then /boot/dietpi/dietpi-drive_manager - # - List + # List elif [[ $G_WHIP_RETURNED_VALUE == 'List' ]]; then /boot/dietpi/dietpi-drive_manager 1 @@ -15736,7 +15950,7 @@ More information on user data in DietPi:\n- https://dietpi.com/phpbb/viewtopic.p fi - # - Manual filepath entry + # Manual filepath entry elif [[ $G_WHIP_RETURNED_VALUE == 'Custom' ]]; then if G_WHIP_INPUTBOX 'Please input a location. Your user data will be stored inside this location.\n - eg: /mnt/MyDrive/MyData'; then @@ -15747,14 +15961,14 @@ More information on user data in DietPi:\n- https://dietpi.com/phpbb/viewtopic.p fi - # - Move data if the new entry has changed + # Move data if the new entry has changed if [[ $user_data_location_current != $move_data_target ]]; then - # - Ask before we begin + # Ask before we begin if G_WHIP_YESNO "DietPi will now attempt to transfer your existing user data to the new location: \n- From: $user_data_location_current\n- To: $move_data_target\n\nWould you like to begin?"; then - # - Move data, setup symlinks + # Move data, setup symlinks if /boot/dietpi/func/dietpi-set_userdata "$user_data_location_current" "$move_data_target"; then G_WHIP_MSG "User data transfer: Completed\n\nYour user data has been successfully moved:\n\n- From: $user_data_location_current\n- To: $move_data_target" @@ -15777,15 +15991,15 @@ More information on user data in DietPi:\n- https://dietpi.com/phpbb/viewtopic.p G_WHIP_MENU_ARRAY=( - 'Apache2' ': Popular webserver.' - 'Nginx' ': Lightweight webserver.' - 'Lighttpd' ': Extremely lightweight webserver.' + 'Apache2' ': Popular webserver' + 'Nginx' ': Lightweight webserver' + 'Lighttpd' ': Extremely lightweight webserver' ) G_WHIP_DEFAULT_ITEM=$index_webserver_text G_WHIP_BUTTON_CANCEL_TEXT='Back' - if G_WHIP_MENU 'Please select a Webserver preference, more info https://dietpi.com/phpbb/viewtopic.php?f=8&t=5&p=1549#p1549:\n + if G_WHIP_MENU 'Please select a Webserver preference, more info https://dietpi.com/phpbb/viewtopic.php?p=1549#p1549:\n - Apache2: Feature-rich and popular. Recommended for beginners and users who are looking to follow Apache2 based guides.\n - Nginx: Lightweight alternative to Apache2. Nginx claims faster webserver performance compared to Apache2.\n - Lighttpd: Extremely lightweight and is generally considered to offer the \"best\" webserver performance for SBCs. Recommended for users who expect low webserver traffic.'; then @@ -15813,7 +16027,7 @@ More information on user data in DietPi:\n- https://dietpi.com/phpbb/viewtopic.p # Check for changes if (( $INDEX_WEBSERVER_TARGET != $INDEX_WEBSERVER_CURRENT )); then - # - Check for existing and compatible installed stacks before allowing the change + # Check for existing and compatible installed stacks before allowing the change local incompatible_webserver_preference=0 local info_currently_installed_webserver='None' @@ -15837,22 +16051,22 @@ More information on user data in DietPi:\n- https://dietpi.com/phpbb/viewtopic.p fi - # - Reset preference selection + # Reset preference selection if (( $incompatible_webserver_preference == 1 )); then INDEX_WEBSERVER_TARGET=$INDEX_WEBSERVER_CURRENT - # - inform user + # Inform user G_WHIP_MSG "Error: Incompatible Webserver Preference:\n\nUnable to change your webserver preference to $G_WHIP_RETURNED_VALUE.\n This is due to an existing and incompatible webserver installation on your system ($info_currently_installed_webserver). Please remove all webserver based software (using dietpi-software > uninstall), before trying again." - # - Apply preference selection + # Apply preference selection else - # - Inform user + # Inform user G_WHIP_MSG "Webserver Preference Changed:\n\n$G_WHIP_RETURNED_VALUE has been selected as your webserver preference.\n When you select any software for install that requires a webserver, DietPi will automatically install your prefered choice ($G_WHIP_RETURNED_VALUE)." - # - NB: INDEX_WEBSERVER_CURRENT=$INDEX_WEBSERVER_TARGET | is applied during installation with func Apply_Webserver_Preference(). + # NB: INDEX_WEBSERVER_CURRENT=$INDEX_WEBSERVER_TARGET | is applied during installation with func Apply_Webserver_Preference(). fi @@ -15884,7 +16098,7 @@ https://dietpi.com/software\n List of installed software and their URL links for online docs: ───────────────────────────────────────────────────────────────\n' - # - Installed software + # Installed software for i in ${!aSOFTWARE_INSTALL_STATE[@]} do @@ -16206,10 +16420,10 @@ Do you wish to continue with DietPi as a pure minimal image?'; then if [[ $keep_serial0 == 1 && -L '/dev/serial0' ]]; then - tty=$(readlink -f /dev/serial0); tty={tty#\/dev\/} + tty=$(readlink -f /dev/serial0); tty={tty#/dev/} if [[ $( -1 )); do - printf '\ec' # clear current terminal screen + G_TERM_CLEAR Menu_Main done diff --git a/dietpi/dietpi-survey b/dietpi/dietpi-survey index 1e308fa435..4657be4403 100644 --- a/dietpi/dietpi-survey +++ b/dietpi/dietpi-survey @@ -72,12 +72,15 @@ ((aNETWORK_INTERFACE[$network_interface]++)) _EOF_ + # RPi: Raspbian/Raspberry Pi OS (32-bt) or Debian/Raspberry Pi OS (64-bit)? + (( $G_HW_MODEL < 10 )) && echo "((aRASPBIAN[$G_RASPBIAN]++))" >> $FP_UPLOAD + # DietPi-Software installs if [[ -f '/boot/dietpi/.installed' ]]; then echo -e '# -------------------------\n# DietPi-Software installs\n# -------------------------' >> $FP_UPLOAD - while read software + while read -r software do software=${software##*[} diff --git a/dietpi/func/change_hostname b/dietpi/func/change_hostname index f6c693d230..4f83b25c55 100644 --- a/dietpi/func/change_hostname +++ b/dietpi/func/change_hostname @@ -25,7 +25,7 @@ # Import DietPi-Globals -------------------------------------------------------------- # Grab input - INPUT=$@ + INPUT=$* #///////////////////////////////////////////////////////////////////////////////////// # Main Loop diff --git a/dietpi/func/dietpi-banner b/dietpi/func/dietpi-banner index aac73a1bf7..07704b8a42 100644 --- a/dietpi/func/dietpi-banner +++ b/dietpi/func/dietpi-banner @@ -218,8 +218,8 @@ $GREEN_LINE" # MOTD if (( ${aENABLED[12]} == 1 )); then - local fp_motd='/run/dietpi/.dietpi_motd' - [[ -f $fp_motd ]] || curl -sSfLm 2 https://dietpi.com/motd > $fp_motd + local motd fp_motd='/run/dietpi/.dietpi_motd' + [[ -f $fp_motd ]] && [[ -s $fp_motd || ! -w $fp_motd ]] || curl -sSfLm 2 https://dietpi.com/motd > $fp_motd if [[ -f $fp_motd ]]; then if . $fp_motd &> /dev/null && [[ $motd ]]; then diff --git a/dietpi/func/dietpi-benchmark b/dietpi/func/dietpi-benchmark index 2b443e1287..51c7cb382b 100644 --- a/dietpi/func/dietpi-benchmark +++ b/dietpi/func/dietpi-benchmark @@ -48,7 +48,7 @@ BENCH_FILESIZE=${BENCH_FILESIZE:-0} # Optional input for automated FP_BENCHFILE=${FP_BENCHFILE:-/} # Optional input for automated - FP_TEMP="/tmp/$G_PROGRAM_NAME" # CPU benchmark files + FP_TMP="/tmp/$G_PROGRAM_NAME" # CPU benchmark files BENCH_ROOTFS_WRITE='Not tested' BENCH_ROOTFS_READ='Not tested' BENCH_RAM_WRITE='Not tested' @@ -92,7 +92,7 @@ _EOF_ Update_Survey_Opted_Status(){ - SURVEY_OPTED_IN=$(sed -n '/^[[:blank:]]*SURVEY_OPTED_IN=[01]$/{s/^[^=]*=//;p;q}' /boot/dietpi.txt) + SURVEY_OPTED_IN=$(sed -n '/^[[:blank:]]*SURVEY_OPTED_IN=[01]$/{s/^[^=]*=//p;q}' /boot/dietpi.txt) } @@ -116,7 +116,7 @@ _EOF_ G_DIETPI-NOTIFY 0 "Running DietPi-CPU Benchmark with max value of 1000000 over $G_HW_CPU_CORES cores, please wait..." - cat << _EOF_ > $FP_TEMP/bench + cat << _EOF_ > $FP_TMP/bench #!/bin/bash target_max_int=$CPUBENCH_INT_MAX cores=$G_HW_CPU_CORES @@ -162,17 +162,17 @@ do done _EOF_ - chmod +x $FP_TEMP/bench + chmod +x $FP_TMP/bench sync sleep 1 BENCH_CPU_TEMP_START=$(G_OBTAIN_CPU_TEMP) - { time -p $FP_TEMP/bench; } 2> $FP_TEMP/bench_result + { time -p $FP_TMP/bench; } 2> $FP_TMP/bench_result BENCH_CPU_TEMP_END=$(G_OBTAIN_CPU_TEMP) - BENCH_CPU=$(mawk '/real/ {print $2;exit}' $FP_TEMP/bench_result) + BENCH_CPU=$(mawk '/real/{print $2;exit}' $FP_TMP/bench_result) if (( $SHOW_RESULTS )); then @@ -223,7 +223,7 @@ _EOF_ local temp_bytes_result=$(mawk '{print $1}' <<< "$bench_write_result") local temp_time_result=$(mawk '{print $8}' <<< "$bench_write_result") # - Convert results from bytes and time to MiB/s - bench_write_result=$(bc -l <<< "scale=0; $temp_bytes_result / $temp_time_result / 1024 / 1024") + bench_write_result=$(( $temp_bytes_result / $temp_time_result / 1024 / 1024 )) # - Clear cache sync @@ -235,7 +235,7 @@ _EOF_ temp_bytes_result=$(mawk '{print $1}' <<< "$bench_read_result") temp_time_result=$(mawk '{print $8}' <<< "$bench_read_result") # - Convert results from bytes and time to MiB/s - bench_read_result=$(bc -l <<< "scale=0; $temp_bytes_result / $temp_time_result / 1024 / 1024") + bench_read_result=$(( $temp_bytes_result / $temp_time_result / 1024 / 1024 )) # - RootFS if [[ $FP_BENCHFILE == '/'$benchmark_file_name ]]; then @@ -282,11 +282,10 @@ _EOF_ The test duration will depend on hardware specs, however, most devices will not exceed 40 seconds.\n\nIf you are opted in to the DietPi-Survey, your scores will uploaded automatically. You can compare results against other users and hardware using the following link:\n - https://dietpi.com/survey#benchmark\n\nPlease select 'Ok' to begin the benchmark tests."; then - # - Additional checks + # Additional checks if (( $G_HW_CPU_CORES < 3 )); then - G_WHIP_YESNO "We have detected a low CPU core count ($G_HW_CPU_CORES). The tests may take upto 5 minutes to complete (eg: RaspberryPi Zero).\n\nDo you wish to continue?" - (( $? )) && exit 0 + G_WHIP_YESNO "We have detected a low CPU core count ($G_HW_CPU_CORES). The tests may take upto 5 minutes to complete (eg: RaspberryPi Zero).\n\nDo you wish to continue?" || exit 0 fi diff --git a/dietpi/func/dietpi-globals b/dietpi/func/dietpi-globals index 05f19d0035..1ce5883c03 100644 --- a/dietpi/func/dietpi-globals +++ b/dietpi/func/dietpi-globals @@ -10,30 +10,31 @@ # # Info: # - Provides shared/global DietPi variables and functions for current bash session and DietPi scripts - # - CRITICAL, use local index variables in for/while loops, or unset them afterwards, else havoc: https://github.com/MichaIng/DietPi/issues/1454 - # - Sourced/Loaded in interactive bash sessions: /etc/bashrc.d/dietpi.bash - # - Sourced/Loaded as start of most DietPi script + # - CRITICAL: Use local index variables in for/while loops, or unset them afterwards, else havoc: https://github.com/MichaIng/DietPi/issues/1454 + # - Sourced/Loaded in interactive bash sessions via /etc/bashrc.d/dietpi.bash + # - Sourced/Loaded at start of most DietPi script #//////////////////////////////////// #----------------------------------------------------------------------------------- - # Core variables, functions and environment, used at start of all scripts + # Core variables, functions and environment, used at start of most DietPi scripts #----------------------------------------------------------------------------------- - # To be set by the originating script, after loading globals and before calling G_INIT() + # Script/Program name + # - Set this in originating script, after loading globals and before calling G_INIT() # - Used in G_EXEC, G_WHIP and G_DIETPI-NOTIFY functions unset -v G_PROGRAM_NAME # Debug mode - # - Do no pre-generate to reduce bash session variables => Needs to be checked via: [[ $G_DEBUG == 1 ]] + # - Set G_DEBUG=1 to enable additional debug output for some DietPi scripts and functions + # - This variable is not pre-generated but checked via: [[ $G_DEBUG == 1 ]] #[[ $G_DEBUG == [01] ] || G_DEBUG=0 - # Interactive mode - # - Affects whether G_EXEC and G_WHIP prompts are displayed or not - # - Run "export G_INTERACTIVE=0" prior to script call to force non-interactive/automated mode. - # - Run "unset -v G_INTERACTIVE" afterwards to return to auto detection. - # - If not set, check for STDIN availability: - # OK | systemd = no STDIN - # OK | Cron = no STDIN - # NB | /etc/profile, ~/.profile, /etc/profile.d/, /etc/bash.bashrc, ~/.bashrc and /etc/bashrc.d/ are interactive since those are sourced from originating shell/bash session. + # Non-interactive mode + # - Set G_INTERACTIVE=0 to disable interactive G_EXEC and G_WHIP dialogues + # - Set G_INTERACTIVE=1 to force interactive G_EXEC and G_WHIP dialogues + # - Default is based on whether STDIN is attached to an open terminal or not: [[ -t 0 ]] + # OK | systemd = [[ -t 0 ]] is false + # OK | Cron = [[ -t 0 ]] is false + # NB | /etc/profile, ~/.profile, /etc/profile.d/, /etc/bash.bashrc, ~/.bashrc and /etc/bashrc.d/ are usually interactive since those are sourced from originating shell/bash session. if [[ $G_INTERACTIVE != [01] ]]; then # Backwards compatibility to keep user scripts valid for a while @@ -49,14 +50,26 @@ fi - # DietPi First-Run 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 + # Disable DietPi-Services + # - Set G_DIETPI_SERVICES_DISABLE=1 to disable DietPi-Services + # - This variable is not pre-generated but checked via: [[ $G_DIETPI_SERVICES_DISABLE == 1 ]] + #[[ $G_DIETPI_SERVICES_DISABLE == [01] ]] || G_DIETPI_SERVICES_DISABLE=0 + + # Default DietPi userdata location, which must NEVER change! + # - NB: In case of moved userdata location, a symlink stays here to keep this path valid. + G_FP_DIETPI_USERDATA='/mnt/dietpi_userdata' + + # 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 [[ -f '/boot/dietpi/.install_stage' ]] && G_DIETPI_INSTALL_STAGE=$( /boot/dietpi/.version } - # Default DietPi userdata location, which must NEVER change! - # - NB: In case of moved userdata location, a symlink stays here to keep this path valid. - G_FP_DIETPI_USERDATA='/mnt/dietpi_userdata' - - # Allows to disable dietpi-services handling, e.g. if already handled within parent script. - # - Do no pre-generate to reduce bash session variables => Needs to be checked via: [[ $G_DIETPI_SERVICES_DISABLE == 1 ]] - #[[ $G_DIETPI_SERVICES_DISABLE == [01] ]] || G_DIETPI_SERVICES_DISABLE=0 - - # Hardware details - [[ -f '/boot/dietpi/.hw_model' ]] && . /boot/dietpi/.hw_model - - # Init functions for originating script + # Init function for originating script # - Stuff we can't init in main globals/funcs due to /etc/bashrc.d/ load into login session. # - Optional input variables: # G_INIT_ALLOW_CONCURRENT=1 = Allow concurrent DietPi script execution (default: 0) @@ -135,7 +137,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then disable_error=1 G_CHECK_VALIDINT "$HIERARCHY" 0 && export HIERARCHY=$((HIERARCHY+1)) || export HIERARCHY=0 # Set locale for scripts to prevent incorrect scraping due to translated command outputs - export LC_ALL='C.UTF-8' + export LC_ALL='C.UTF-8' LANG='C.UTF-8' # Declare exit trap, that runs on EXIT signal, which includes INT (interruption) and TERM (kill) G_EXIT(){ @@ -445,7 +447,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then #----------------------------------------------------------------------------------- # DietPi scripts, moved from /etc/bash.bashrc # - sudo wrapper that ensures DietPi-Globals with G_* commands are loaded - G_SUDO(){ local input=$@; sudo bash -c ". /boot/dietpi/func/dietpi-globals && $input"; } + G_SUDO(){ local input=$*; sudo bash -c ". /boot/dietpi/func/dietpi-globals && $input"; } # - sudo alias that allows running other aliases with "sudo": https://github.com/MichaIng/DietPi/issues/424 alias sudo='sudo ' @@ -916,7 +918,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then if [[ $G_EXEC_OUTPUT == 1 ]]; then # Print $G_EXEC_DESC if given, else raw input command string and show current non-interactive attempt count if $G_EXEC_RETRIES is given - G_DIETPI-NOTIFY 2 "${G_EXEC_DESC:-$*}, please wait... ${G_EXEC_RETRIES:+ ($attempt/$((G_EXEC_RETRIES+1)))}" + G_DIETPI-NOTIFY 2 "${G_EXEC_DESC:-$*}, please wait...${G_EXEC_RETRIES:+ ($attempt/$((G_EXEC_RETRIES+1)))}" [[ $G_EXEC_OUTPUT_COL ]] && printf "$G_EXEC_OUTPUT_COL" "${acommand[@]}" 2>&1 | tee $fp_log exit_code=${PIPESTATUS[0]} @@ -974,7 +976,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then - Pre-image | $preimage_name - Hardware | $G_HW_MODEL_NAME (ID=$G_HW_MODEL) - Kernel version | $(uname -a) -- Distro | $G_DISTRO_NAME (ID=$G_DISTRO) +- Distro | $G_DISTRO_NAME (ID=$G_DISTRO${G_RASPBIAN:+,RASPBIAN=$G_RASPBIAN}) - Command | $* - Exit code | $exit_code - Software title | $G_PROGRAM_NAME @@ -1037,7 +1039,12 @@ $log_content" || break # Exit error handler menu loop on cancel G_WHIP_MSG 'A bash subshell will now open which allows you to investigate and/or fix the issue. \nPlease use the "exit" command when you are finished, to return to this error handler menu.' - bash + # Prevent dietpi-login call in subshell + local reallow_dietpi_login=1 + [[ $G_DIETPI_LOGIN ]] && reallow_dietpi_login=0 + export G_DIETPI_LOGIN=1 + bash &> /dev/tty < /dev/tty + (( $reallow_dietpi_login )) && unset -v G_DIETPI_LOGIN elif [[ $G_WHIP_RETURNED_VALUE == 'Send report' ]]; then @@ -1100,15 +1107,12 @@ $log_content" || break # Exit error handler menu loop on cancel } - #----------------------------------------------------------------------------------- - # Network connection checks - #----------------------------------------------------------------------------------- # General network connection check # - Checks general network connectivity by pinging a raw IP that must be publicly reachable at all time. # - Uses the given input argument as IP to test against, else CONFIG_CHECK_CONNECTION_IP from dietpi.txt, else defaults to 9.9.9.9 (Quad9 DNS IP). # - Uses G_CHECK_URL_TIMEOUT and G_CHECK_URL_ATTEMPTS variables, else CONFIG_G_CHECK_URL_TIMEOUT + CONFIG_G_CHECK_URL_ATTEMPTS from dietpi.txt, else defaults to 10 seconds and 2 attempts (1 retry). # - Optional arguments: - # $@ = IP + optional ping arguments + # $* = IP + optional ping arguments # - Optional variables: # G_CHECK_URL_TIMEOUT to override default and dietpi.txt set timeout # G_CHECK_URL_ATTEMPTS to override default and dietpi.txt set attempts @@ -1116,7 +1120,7 @@ $log_content" || break # Exit error handler menu loop on cancel # Obtain IP local ip - if [[ ! $@ ]]; then + if [[ ! $* ]]; then ip=$(sed -n '/^[[:blank:]]*CONFIG_CHECK_CONNECTION_IP=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) [[ $ip ]] || ip='9.9.9.9' @@ -1132,10 +1136,10 @@ $log_content" || break # Exit error handler menu loop on cancel fi # Obtain attempts - if ! disable_error=1 G_CHECK_VALIDINT "$G_CHECK_URL_ATTEMPTS" 0; then + if ! disable_error=1 G_CHECK_VALIDINT "$G_CHECK_URL_ATTEMPTS" 1; then G_CHECK_URL_ATTEMPTS=$(sed -n '/^[[:blank:]]*CONFIG_G_CHECK_URL_ATTEMPTS=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) - disable_error=1 G_CHECK_VALIDINT "$G_CHECK_URL_ATTEMPTS" 0 || G_CHECK_URL_ATTEMPTS=2 + disable_error=1 G_CHECK_VALIDINT "$G_CHECK_URL_ATTEMPTS" 1 || G_CHECK_URL_ATTEMPTS=2 fi G_EXEC_RETRIES=$(( $G_CHECK_URL_ATTEMPTS - 1 )) # 2 attempts = 1 retry @@ -1158,7 +1162,7 @@ $log_content" || break # Exit error handler menu loop on cancel # - Uses the given input argument as domain to test against, else CONFIG_CHECK_DNS_DOMAIN from dietpi.txt, else defaults to dns9.quad9.net (Quad9 DNS domain). # - Uses G_CHECK_URL_TIMEOUT and G_CHECK_URL_ATTEMPTS variables, else CONFIG_G_CHECK_URL_TIMEOUT + CONFIG_G_CHECK_URL_ATTEMPTS from dietpi.txt, else defaults to 10 seconds and 2 attempts (1 retry). # - Optional arguments: - # $@ = domain + optional ping arguments + # $* = domain + optional ping arguments # - Optional variables: # G_CHECK_URL_TIMEOUT to override default and dietpi.txt set timeout # G_CHECK_URL_ATTEMPTS to override default and dietpi.txt set attempts @@ -1166,7 +1170,7 @@ $log_content" || break # Exit error handler menu loop on cancel # Obtain IP local domain - if [[ ! $@ ]]; then + if [[ ! $* ]]; then domain=$(sed -n '/^[[:blank:]]*CONFIG_CHECK_DNS_DOMAIN=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) [[ $domain ]] || domain='dns9.quad9.net' @@ -1182,10 +1186,10 @@ $log_content" || break # Exit error handler menu loop on cancel fi # Obtain attempts - if ! disable_error=1 G_CHECK_VALIDINT "$G_CHECK_URL_ATTEMPTS" 0; then + if ! disable_error=1 G_CHECK_VALIDINT "$G_CHECK_URL_ATTEMPTS" 1; then G_CHECK_URL_ATTEMPTS=$(sed -n '/^[[:blank:]]*CONFIG_G_CHECK_URL_ATTEMPTS=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) - disable_error=1 G_CHECK_VALIDINT "$G_CHECK_URL_ATTEMPTS" 0 || G_CHECK_URL_ATTEMPTS=2 + disable_error=1 G_CHECK_VALIDINT "$G_CHECK_URL_ATTEMPTS" 1 || G_CHECK_URL_ATTEMPTS=2 fi G_EXEC_RETRIES=$(( $G_CHECK_URL_ATTEMPTS - 1 )) # 2 attempts = 1 retry @@ -1206,7 +1210,7 @@ $log_content" || break # Exit error handler menu loop on cancel # URL connection test # - Checks a specific HTTP/HTTPS/FTP online resource via its URL # - Required arguments: - # $@ = URL + optional wget arguments + # $* = URL + optional wget arguments # - Optional variables: # G_CHECK_URL_TIMEOUT to override default and dietpi.txt set timeout # G_CHECK_URL_ATTEMPTS to override default and dietpi.txt set attempts @@ -1221,10 +1225,10 @@ $log_content" || break # Exit error handler menu loop on cancel fi # Obtain attempts - if ! disable_error=1 G_CHECK_VALIDINT "$G_CHECK_URL_ATTEMPTS" 0; then + if ! disable_error=1 G_CHECK_VALIDINT "$G_CHECK_URL_ATTEMPTS" 1; then G_CHECK_URL_ATTEMPTS=$(sed -n '/^[[:blank:]]*CONFIG_G_CHECK_URL_ATTEMPTS=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) - disable_error=1 G_CHECK_VALIDINT "$G_CHECK_URL_ATTEMPTS" 0 || G_CHECK_URL_ATTEMPTS=2 + disable_error=1 G_CHECK_VALIDINT "$G_CHECK_URL_ATTEMPTS" 1 || G_CHECK_URL_ATTEMPTS=2 fi G_EXEC_RETRIES=$(( $G_CHECK_URL_ATTEMPTS - 1 )) # 2 attempts = 1 retry @@ -1479,7 +1483,7 @@ $log_content" || break # Exit error handler menu loop on cancel # Read CPU temp from file local temp - # - Sparky/Asus: Requires special case as in others array this would break other SBC temp readouts with 2 zones + # - Sparky/ASUS: Requires special case as in others array this would break other SBC temp readouts with 2 zones if (( $G_HW_MODEL == 70 || $G_HW_MODEL == 52 )); then [[ -f '/sys/class/thermal/thermal_zone1/temp' ]] && temp=$(= 150 )) && temp=$(mawk '{print $1/1000}' <<< $temp | xargs printf "%0.0f") + (( $temp >= 200 )) && temp=$(( $temp / 1000 )) if [[ $print_full_info == 1 ]]; then @@ -1708,29 +1713,22 @@ $log_content" || break # Exit error handler menu loop on cancel } # Prompt user to create a backup before system changes. Exit existing scripts if failed. - [[ $G_PROMPT_BACKUP_DISABLED == [01] ]] || G_PROMPT_BACKUP_DISABLED=0 G_PROMPT_BACKUP(){ - if (( ! $G_PROMPT_BACKUP_DISABLED )); then - - G_WHIP_YESNO 'Would you like to create (or update) a "DietPi-Backup" of the system, before proceeding?\n\n"DietPi-Backup" creates a system restore point, which can be recovered if unexpected issues occur.\n\nFor more information on "DietPi-Backup", please use the link below:\n - https://dietpi.com/phpbb/viewtopic.php?p=255#p255' - if (( $? == 0 )); then - - /boot/dietpi/dietpi-backup 1 - local exit_code=$? + [[ $G_PROMPT_BACKUP_DISABLED == 1 ]] && return 0 - G_DIETPI-NOTIFY -1 $exit_code 'DietPi-Backup' - if (( $exit_code )); then + G_WHIP_YESNO 'Would you like to create (or update) a "DietPi-Backup" of the system, before proceeding?\n\n"DietPi-Backup" creates a system restore point, which can be recovered if unexpected issues occur.\n\nFor more information on "DietPi-Backup", please use the link below:\n - https://dietpi.com/phpbb/viewtopic.php?p=255#p255' || return 0 - # Kill current scripts, excluding shell - G_WHIP_MSG 'DietPi-Backup was unable to complete sucessfully. To avoid issues, the current program will now be terminated.\n - logfile = /var/log/dietpi-backup.log' - kill -INT $$ - - fi + /boot/dietpi/dietpi-backup 1 + local exit_code=$? - fi + G_DIETPI-NOTIFY -1 $exit_code 'DietPi-Backup' + (( $exit_code )) || return 0 - fi + # Kill current scripts, excluding shell + G_WHIP_MSG '[FAILED] DietPi-Backup was unable to complete sucessfully.\n\nTo avoid issues, the current program will now be terminated.\n\nLog file: /var/log/dietpi-backup.log' + kill -INT $$ + return 1 } @@ -1745,30 +1743,28 @@ $log_content" || break # Exit error handler menu loop on cancel for i in "${ainput_string[@]}" do - if [[ -e $i ]]; then - - local fp_backup_target="$i.bak_$(date +%d%m%y)" - local index=0 - while [[ -e ${fp_backup_target}_$index ]] - do - - ((index++)) + [[ -e $i ]] || continue - done + local fp_backup_target="$i.bak_$(date +%d%m%y)" + local index=0 + while [[ -e ${fp_backup_target}_$index ]] + do - local notify_code=1 - if cp -a $i ${fp_backup_target}_$index; then + ((index++)) - notify_code=0 - print_fp_db_info=1 - echo "${fp_backup_target}_$index # $G_PROGRAM_NAME" >> $fp_db_log + done - fi + local notify_code=1 + if cp -a "$i" "${fp_backup_target}_$index"; then - G_DIETPI-NOTIFY $notify_code "$i: backup to ${fp_backup_target}_$index" + notify_code=0 + print_fp_db_info=1 + echo "${fp_backup_target}_$index # $G_PROGRAM_NAME" >> $fp_db_log fi + G_DIETPI-NOTIFY $notify_code "$i: backup to ${fp_backup_target}_$index" + done (( $print_fp_db_info )) && G_DIETPI-NOTIFY 2 "For a full list of backup items, please see $fp_db_log" @@ -1779,29 +1775,27 @@ $log_content" || break # Exit error handler menu loop on cancel # Multithreading handler #----------------------------------------------------------------------------------- # Not yet compatible with dietpi global commands. single bash commands only with no error handling. - [[ $G_THREADING_ENABLED == [01] ]] || G_THREADING_ENABLED=1 - G_THREAD_START(){ - # Launch as BG process - if (( $G_THREADING_ENABLED )); then + # Run in blocking mode + if [[ $G_THREADING_ENABLED == 0 ]]; then + + local command=$* + G_DIETPI-NOTIFY 2 "G_THREADING disabled, running command in blocking mode | $command" + $command + + # Launch as background process + else [[ $G_THREAD_COUNT =~ ^[0-9]+$ ]] || G_THREAD_COUNT=-1 ((G_THREAD_COUNT++)) - G_THREAD_COMMAND[$G_THREAD_COUNT]=$@ + G_THREAD_COMMAND[$G_THREAD_COUNT]=$* echo -1337 > /tmp/.G_THREAD_EXITCODE_$G_THREAD_COUNT { { G_INTERACTIVE=0 ${G_THREAD_COMMAND[$G_THREAD_COUNT]} &> /tmp/.G_THREAD_COMMAND_$G_THREAD_COUNT; echo $? > /tmp/.G_THREAD_EXITCODE_$G_THREAD_COUNT; } & disown; } &> /dev/null G_DIETPI-NOTIFY 2 "G_THREAD_START_$G_THREAD_COUNT | ${G_THREAD_COMMAND[$G_THREAD_COUNT]}" - # Run in blocking mode - else - - local command=$@ - G_DIETPI-NOTIFY 2 "G_THREADING disabled, running command in blocking mode | $command" - $command - fi } diff --git a/dietpi/func/dietpi-logclear b/dietpi/func/dietpi-logclear index 0f4bccff1b..8c6e156fc9 100644 --- a/dietpi/func/dietpi-logclear +++ b/dietpi/func/dietpi-logclear @@ -49,7 +49,7 @@ INFO_BACKUPS_MADE=0 #//////////////////////////////////////////////////////////////// - # Process log files. + # Process log files #//////////////////////////////////////////////////////////////// Process_Logfiles(){ @@ -76,16 +76,16 @@ PROCESS_FILE=1 FILE_TYPE=0 - # Filetypes - # - Compessed files (zip etc) | FILE_TYPE 1 + # Special files + # - Compessed | FILE_TYPE 1 if [[ $FILE_NAME == *'.zip' || $FILE_NAME == *'.gz' ]]; then FILE_TYPE=1 - # - Normal Log Files - # Exclude <= 10 byte size - # Exclude .db* extentions SQLite (.db .db-shm .db.wal) - elif (( $FILESIZE_BYTES < 11 )) || [[ $FILE_NAME == *'.db' ]]; then + # - Excluded + # Size < 11 byte + # SQLite database files (Sonarr/Radarr/Lidarr): .db .db-shm .db-wal + elif (( $FILESIZE_BYTES < 11 )) || [[ $FILE_NAME == *'.db'* ]]; then PROCESS_FILE=0 @@ -114,15 +114,15 @@ fi - # Write current logfile contents to existing. + # Write current log file contents to existing cat "$i" >> "$FP_BACKUP/$FILE_NAME" ((INFO_BACKUPS_MADE++)) - # Clear logfile contents + # Clear log file contents > "$i" ((INFO_LOGS_CLEARED++)) - # Clear logfile contents + # Clear log file contents elif (( $INPUT == 1 )); then > "$i" @@ -136,7 +136,7 @@ fi - # Update Size cleared + # Update size cleared INFO_SIZE_CLEARED=$(($INFO_SIZE_CLEARED + $FILESIZE_BYTES)) fi @@ -169,7 +169,7 @@ Process_Logfiles - # Delete logfile backups + # Delete log file backups [[ $INPUT == 2 && -f $FP_BACKUP ]] && rm -R $FP_BACKUP # Print Info diff --git a/dietpi/func/dietpi-obtain_hw_model b/dietpi/func/dietpi-obtain_hw_model index ed6c40649e..b63b919488 100644 --- a/dietpi/func/dietpi-obtain_hw_model +++ b/dietpi/func/dietpi-obtain_hw_model @@ -57,6 +57,7 @@ # G_HW_MODEL 22 Generic Device # G_HW_MODEL 21 x86_64 PC # G_HW_MODEL 20 x86_64 VM + # G_HW_MODEL 16 Odroid C4 # G_HW_MODEL 15 Odroid N2 # G_HW_MODEL 14 Odroid N1 # G_HW_MODEL 13 Odroid U3 @@ -79,7 +80,7 @@ # G_HW_CPUID 1 Allwinner H3 # G_HW_CPUID 2 Allwinner H5 # G_HW_CPUID 3 Rockchip RK3399 - # G_HW_CPUID 4 Samsung S922X + # G_HW_CPUID 4 Amlogic S922X # G_HW_CPUID 5 Allwinner H6 # ---------------- # G_DISTRO 0 unknown/unsupported @@ -115,6 +116,7 @@ G_HW_UUID=${G_HW_UUID:-$(= 8 @@ -151,6 +156,7 @@ 0e) G_HW_MODEL_NAME='RPi 3 Model A+' G_HW_MODEL=3 G_HW_ONBOARD_WIFI=1;; 10) G_HW_MODEL_NAME='RPi CM 3+' G_HW_MODEL=3;; 11) G_HW_MODEL_NAME='RPi 4 Model B' G_HW_MODEL=4 G_HW_ONBOARD_WIFI=1;; + 12) G_HW_MODEL_NAME='RPi CM 4' G_HW_MODEL=4;; esac # Manufacturer case ${G_HW_REVISION: -5:1} in @@ -490,6 +496,10 @@ G_HW_MODEL_NAME='Virtual Machine' + elif (( $G_HW_MODEL == 16 )); then + + G_HW_MODEL_NAME='Odroid C4' + elif (( $G_HW_MODEL == 15 )); then G_HW_MODEL_NAME='Odroid N2' @@ -524,13 +534,13 @@ fi - # RPi/Raspbian - elif grep -q '^ID=raspbian' /etc/os-release; then + # RPi? Detect via ondisk device tree file instead of /proc content, for chroot/systemd-nspawn support + elif for i in /boot/bcm*-rpi-*\.dtb; do [[ -f $i ]] && break; done; then - # Grab hardware description from /proc/cpuinfo revision code + # Detect exact RPi model RPi_BoardInfo - # No hardware identifier and no Raspbian, revert to "Generic Device" + # No hardware identifier and no RPi, revert to "Generic Device" else echo $G_HW_MODEL > $FP_G_HW_MODEL_IDENTIFIER @@ -595,7 +605,8 @@ G_ROOTFS_DEV='$G_ROOTFS_DEV' G_HW_UUID='$G_HW_UUID'" > /boot/dietpi/.hw_model # - RPi extras - (( $G_HW_MODEL < 10 )) && echo "G_HW_ONBOARD_WIFI=$G_HW_ONBOARD_WIFI + (( $G_HW_MODEL < 10 )) && echo "G_RASPBIAN=$G_RASPBIAN +G_HW_ONBOARD_WIFI=$G_HW_ONBOARD_WIFI G_HW_REVISION='$G_HW_REVISION' G_HW_PCB_REVISION=$G_HW_PCB_REVISION G_HW_MEMORY_SIZE=$G_HW_MEMORY_SIZE diff --git a/dietpi/func/dietpi-set_hardware b/dietpi/func/dietpi-set_hardware index b67f9fb5d7..2bb0f5d6e4 100644 --- a/dietpi/func/dietpi-set_hardware +++ b/dietpi/func/dietpi-set_hardware @@ -27,7 +27,7 @@ $FP_SCRIPT lcdpanel target_panel (none to remove all) $FP_SCRIPT headless enable/disable $FP_SCRIPT gpumemsplit 64/128/256 # RPi only $FP_SCRIPT rpi-camera enable/disable -$FP_SCRIPT rpi-opengl vc4-kms-v3d/vc4-fkms-v3d/disable +$FP_SCRIPT rpi-opengl vc4-kms-v3d/vc4-kms-v3d-pi4/vc4-fkms-v3d/disable $FP_SCRIPT rpi3_usb_boot enable $FP_SCRIPT rpi-eeprom " #//////////////////////////////////// @@ -543,8 +543,8 @@ _EOF_ if disable_error=1 G_CHECK_VALIDINT "$INPUT_DEVICE_VALUE" 1; then - local eth_force_speed=$INPUT_DEVICE_VALUE - local eth_adapter="eth$(mawk 'NR==1' /run/dietpi/.network)" + local speed_mbit=$INPUT_DEVICE_VALUE + local iface="eth$(mawk 'NR==1' /run/dietpi/.network)" cat << _EOF_ > /etc/systemd/system/ethtool_force_speed.service [Unit] @@ -554,15 +554,15 @@ After=network-online.target [Service] Type=oneshot -ExecStart=$(command -v ethtool) -s $eth_adapter speed $eth_force_speed duplex full autoneg off +ExecStart=$(command -v ethtool) -s $iface speed $speed_mbit duplex full autoneg off [Install] -WantedBy=ifup@$eth_adapter.service +WantedBy=ifup@$iface.service _EOF_ systemctl daemon-reload systemctl enable --now ethtool_force_speed - elif [[ $INPUT_DEVICE_VALUE == 'disable' ]]; then # 0 is converted to 'disable' + elif [[ $INPUT_DEVICE_VALUE == 'disable' ]]; then # 0 is converted to "disable" if [[ -f '/etc/systemd/system/ethtool_force_speed.service' ]]; then @@ -589,7 +589,11 @@ _EOF_ # Always remove previous vc4 overlay entry sed -i '/^[[:blank:]]*dtoverlay=vc4-/d' /boot/config.txt - if [[ $INPUT_DEVICE_VALUE == 'vc4-kms-v3d' || $INPUT_DEVICE_VALUE == 'vc4-fkms-v3d' ]]; then + if [[ $INPUT_DEVICE_VALUE == 'vc4-kms-v3d' || $INPUT_DEVICE_VALUE == 'vc4-kms-v3d-pi4' || $INPUT_DEVICE_VALUE == 'vc4-fkms-v3d' ]]; then + + # Failsafe: Switch to correct full KMS overlay based on RPi model + [[ $G_HW_MODEL != 4 && $INPUT_DEVICE_VALUE == 'vc4-kms-v3d-pi4' ]] && INPUT_DEVICE_VALUE='vc4-kms-v3d' + [[ $G_HW_MODEK == 4 && $INPUT_DEVICE_VALUE == 'vc4-kms-v3d' ]] && INPUT_DEVICE_VALUE='vc4-kms-v3d-pi4' # GL packages local libegl1='libegl1' @@ -1986,13 +1990,8 @@ _EOF_ ;; # dtoverlay - # hifiberry-dac - # hifiberry-dacplus - # hifiberry-digi - # hifiberry-digi-pro - # hifiberry-amp - # JustBoom-dac: DAC HAT, Amp HAT, DAC Zero and Amp Zero - # JustBoom-digi: Digi HAT and Digi Zero + # hifiberry-* + # JustBoom-[dac|digi|both] # allo-boss-dac-pcm512x-audio # allo-digione # allo-katana-dac-audio diff --git a/dietpi/func/dietpi-set_software b/dietpi/func/dietpi-set_software index 1da4eb04de..eced8a5d11 100644 --- a/dietpi/func/dietpi-set_software +++ b/dietpi/func/dietpi-set_software @@ -67,21 +67,23 @@ $FP_SCRIPT passwords NULL=Prompt user to change DietPi related passwords | X=op if [[ $INPUT_MODE_VALUE == 'C.UTF-8' ]] || grep -q "^$INPUT_MODE_VALUE UTF-8$" /usr/share/i18n/SUPPORTED; then - # List of locales to generate, used by: dpkg-reconfigure => locale-gen + # Create list of locales to generate echo "$INPUT_MODE_VALUE UTF-8" > /etc/locale.gen - # - Add C.UTF-8 back in, if not chosen, as DietPi scripts require it + # - Add C.UTF-8 back in, if not chosen, required by DietPi scripts [[ $INPUT_MODE_VALUE == 'C.UTF-8' ]] || echo 'C.UTF-8 UTF-8' >> /etc/locale.gen - # Remove current defaults, will be recreated by dpkg-reconfigure with: LANG= + # Remove current defaults [[ -f '/etc/default/locale' ]] && rm /etc/default/locale - # Generate locales and set default LANG= - G_EXEC dpkg-reconfigure -f noninteractive locales + # Generate locales and set new default + # - 1. this calls locale-gen to regenerate locale cache with /etc/locale.gen entries. + # - 2. this calls update-locale LANG= to set the new default locale. + G_CHECK_OUTPUT=1 G_EXEC dpkg-reconfigure -f noninteractive locales - # Reassign override locale to current script, as in case of wrong locale variables update-locale command will produce ugly errors - export LC_ALL='C.UTF-8' + # Reassign locale to current script, as in case of wrong locale variables update-locale command will produce ugly errors + export LC_ALL='C.UTF-8' LANG='C.UTF-8' - # Add new override locale to /etc/default/locales which is effective on next shell session (logout+in/reboot) + # Additionally set new locale via override variable $LC_ALL in /etc/default/locales which is effective from next shell session on update-locale "LC_ALL=$INPUT_MODE_VALUE" # Update dietpi.txt entry @@ -102,17 +104,24 @@ $FP_SCRIPT passwords NULL=Prompt user to change DietPi related passwords | X=op if [[ $INPUT_MODE_VALUE ]]; then - # Raspbian + # RPi if (( $G_HW_MODEL < 10 )); then + # Component "ui" is in use until Stretch + local components='main' + (( $G_DISTRO < 5 )) && components+=' ui' + # Bullseye is not yet available, revert to Buster + echo "deb https://archive.raspberrypi.org/debian/ ${G_DISTRO_NAME/bullseye/buster} $components" > /etc/apt/sources.list.d/raspi.list + + fi + + # Raspbian + if (( $G_HW_MODEL < 10 )) && (( $G_RASPBIAN )); then + # Default? [[ $INPUT_MODE_VALUE == 'default' ]] && INPUT_MODE_VALUE='http://raspbian.raspberrypi.org/raspbian/' echo "deb $INPUT_MODE_VALUE $G_DISTRO_NAME main contrib non-free" > /etc/apt/sources.list - # Component "ui" is in use until Stretch - local components='main' - (( $G_DISTRO < 5 )) && components+=' ui' - echo "deb https://archive.raspberrypi.org/debian/ $G_DISTRO_NAME $components" > /etc/apt/sources.list.d/raspi.list # Update dietpi.txt entry G_CONFIG_INJECT 'CONFIG_APT_RASPBIAN_MIRROR=' "CONFIG_APT_RASPBIAN_MIRROR=$INPUT_MODE_VALUE" /boot/dietpi.txt @@ -264,8 +273,8 @@ _EOF_ # Gateway, auto detect local gateway(s) (router) to use as NTP server. if [[ ${ntp_mirror,,} == 'gateway' ]]; then - # NB: Convert output to single line via echo - local gateway=$(echo $(ip r s 0.0.0.0/0 | mawk '{print $3}')) + # NB: Convert output to single line via ORS, remove trailing space afterwards + local gateway=$(ip r l 0/0 | mawk '{print $3}' ORS=' '); gateway=${gateway% } if [[ $gateway ]]; then G_DIETPI-NOTIFY 0 "Gateway(s) detected: $gateway, adding as NTP server(s)." @@ -484,9 +493,8 @@ _EOF_ else # DietPi-Software PW - G_WHIP_YESNO 'Do you want to adjust the default global software password for DietPi-Software installations? We especially recommend to change the default password "dietpi". This does not affect any existing software passwords.\n -NB: This password will be saved and encrypted within "/var/lib/dietpi/dietpi-software/.GLOBAL_PW.bin" to be useable by DietPi scripts for e.g. web application and database logins. We highly recommend to apply individual passwords for each software title after first login.' - if (( ! $? )); then + if G_WHIP_YESNO 'Do you want to adjust the default global software password for DietPi-Software installations? We especially recommend to change the default password "dietpi". This does not affect any existing software passwords.\n +NB: This password will be saved and encrypted within "/var/lib/dietpi/dietpi-software/.GLOBAL_PW.bin" to be useable by DietPi scripts for e.g. web application and database logins. We highly recommend to apply individual passwords for each software title after first login.'; then G_WHIP_PASSWORD "Please enter a new global software password:\nNB: The following characters are not supported \$|\\\"'" pw_dietpi_software=$result @@ -495,9 +503,8 @@ NB: This password will be saved and encrypted within "/var/lib/dietpi/dietpi-sof fi # Root/DietPi user PW - G_WHIP_YESNO 'Change existing unix user passwords?\n\nDietPi has two accounts by default "root" and "dietpi". On first boot, both share the global password "dietpi", respectively the one set in "dietpi.txt".\n -It is highly recommended to change this password, ideally, it should be different than the global software password.\n\nWould you like to change the login passwords for "root" and "dietpi"?' - if (( ! $? )); then + if G_WHIP_YESNO 'Change existing unix user passwords?\n\nDietPi has two accounts by default "root" and "dietpi". On first boot, both share the global password "dietpi", respectively the one set in "dietpi.txt".\n +It is highly recommended to change this password, ideally, it should be different than the global software password.\n\nWould you like to change the login passwords for "root" and "dietpi"?'; then G_WHIP_PASSWORD 'Please enter a new unix user password:' pw_root_dietpi_users=$result diff --git a/dietpi/func/dietpi-wifidb b/dietpi/func/dietpi-wifidb index 8d3d67809a..92a7a1cd7b 100644 --- a/dietpi/func/dietpi-wifidb +++ b/dietpi/func/dietpi-wifidb @@ -18,7 +18,7 @@ $FP_SCRIPT 1 Applies WiFi creds from DB store to system " #//////////////////////////////////// # Grab Input - INPUT=${@,,} + INPUT=${*,,} ERROR_CODE=0 # Import DietPi-Globals -------------------------------------------------------------- diff --git a/dietpi/misc/dietpi-arr_to_RAM b/dietpi/misc/dietpi-arr_to_RAM index 7cd98c7e24..384f9475af 100644 --- a/dietpi/misc/dietpi-arr_to_RAM +++ b/dietpi/misc/dietpi-arr_to_RAM @@ -45,7 +45,7 @@ Supported programs: unset error Print(){ - local message=$@ + local message=$* [[ $error ]] && { message="[ERROR] $message"; EXIT_CODE=$error; } unset error echo "$(date '+%Y-%m-%d %T') | $PROGRAM_NAME: $message" diff --git a/dietpi/misc/start_kodi b/dietpi/misc/start_kodi index 04d28e2bae..bc8f6cc7cf 100644 --- a/dietpi/misc/start_kodi +++ b/dietpi/misc/start_kodi @@ -23,8 +23,8 @@ #///////////////////////////////////////////////////////////////////////////////////// # Main Loop #///////////////////////////////////////////////////////////////////////////////////// - # RPi + Odroid N2 - if (( $G_HW_MODEL < 10 || $G_HW_MODEL == 15 )); then + # RPi + Odroid N2 + Odroid C4 + if (( $G_HW_MODEL < 10 || $G_HW_MODEL == 15 || $G_HW_MODEL == 16 )); then kodi --standalone diff --git a/dietpi/patch_file b/dietpi/patch_file index ed62380d6e..102772e3cb 100644 --- a/dietpi/patch_file +++ b/dietpi/patch_file @@ -93,9 +93,9 @@ fi # - Pre-create new DietPi runtime dir for later used scripts, created via /etc/tmpfiles.d/dietpi.conf from next boot on - [[ -d '/run/dietpi' ]] || mkdir -p /run/dietpi + [[ -d '/run/dietpi' ]] || { mkdir -p /run/dietpi; chmod 777 /run/dietpi; } # - Create network info file on new location - [[ -f '/run/dietpi/.network' ]] || /boot/dietpi/func/obtain_network_details && chmod 666 /run/dietpi/.network + [[ -f '/run/dietpi/.network' ]] || { /boot/dietpi/func/obtain_network_details; chmod 666 /run/dietpi/.network; } # Pre-v6.22: Update Git owner due to official lead transfer from Fourdee to MichaIng: https://github.com/MichaIng/DietPi/issues/2589 grep -q '^[[:blank:]]*DEV_GITOWNER=Fourdee' /boot/dietpi.txt && sed -i '/^[[:blank:]]*DEV_GITOWNER=/c\DEV_GITOWNER=MichaIng' /boot/dietpi.txt @@ -489,10 +489,10 @@ _EOF_' #------------------------------------------------------------------------------- # RPi APT mirror fix: https://github.com/MichaIng/DietPi/issues/1659 - if (( $G_HW_MODEL < 10 )); then + if (( $G_HW_MODEL < 10 )) && (( $G_RASPBIAN )); then G_AGDUG - /boot/dietpi/func/dietpi-set_software apt-mirror 'http://raspbian.raspberrypi.org/raspbian' + /boot/dietpi/func/dietpi-set_software apt-mirror 'http://raspbian.raspberrypi.org/raspbian/' G_AGUP fi @@ -798,7 +798,7 @@ _EOF_' [[ -f $fp_new ]] || /boot/dietpi/dietpi-services stop cron # Transfer existing entries over - while read line + while read -r line do [[ $line != '#'* ]] && echo "+ $line" >> $fp_new @@ -945,11 +945,10 @@ _EOF_ ) G_WHIP_DEFAULT_ITEM=0 - G_WHIP_MENU '[WARNING] IPv6 is disabled via kernel module blacklist or boot cmd line.\n + if G_WHIP_MENU '[WARNING] IPv6 is disabled via kernel module blacklist or boot cmd line.\n This feature was previously offered via DietPi-Config and has since been removed.\n Since more and more software requires and expects IPv6 kernel settings to be available. If you keep the current settings, this might lead to APT install errors and/or general system instability.\n -We strongly recommend you select "0 : Re-enable IPv6 on kernel level". By doing so, IPv6 will remain disabled for the interfaces at sysctl level, and, no IPv6 addresses will be assigned to your network devices.\n\nTLDR: Select option "0" :)' - if (( ! $? && ! $G_WHIP_RETURNED_VALUE )); then +We strongly recommend you select "0 : Re-enable IPv6 on kernel level". By doing so, IPv6 will remain disabled for the interfaces at sysctl level, and, no IPv6 addresses will be assigned to your network devices.\n\nTLDR: Select option "0" :)' && (( $G_WHIP_RETURNED_VALUE == 0 )); then # Remove kernel module blacklisting [[ -f '/etc/modprobe.d/99-dietpi-blacklist-ipv6.conf' ]] && rm /etc/modprobe.d/99-dietpi-blacklist-ipv6.conf @@ -971,7 +970,7 @@ We strongly recommend you select "0 : Re-enable IPv6 on kernel level". By doing sed -i '/^[[:blank:]]*root=/s/ipv6.disable=1[[:blank:]]//' /boot/cmdline.txt # - Odroid - elif (( $G_HW_MODEL < 15 )); then + elif (( $G_HW_MODEL < 20 )); then sed -i '/^[[:blank:]]*setenv boot/s/[[:blank:]]ipv6.disable=1//' /boot/boot.ini sed -i '/^[[:blank:]]*setenv boot/s/ipv6.disable=1[[:blank:]]//' /boot/boot.ini @@ -1307,9 +1306,6 @@ Also have a look at "Sonarr", another alternative TV show manager, available for # Mopidy fix: https://github.com/MichaIng/DietPi/issues/2536 getent passwd mopidy &> /dev/null && usermod -aG dietpi,audio -d $G_FP_DIETPI_USERDATA/mopidy mopidy #------------------------------------------------------------------------------- - # Remove obsolete workaround for archive.raspberrypi.org repo on Buster: https://github.com/MichaIng/DietPi/issues/1286#issuecomment-463856159 - (( $G_DISTRO == 5 && $G_HW_MODEL < 10 )) && sed -i 's/stretch/buster/g' /etc/apt/sources.list.d/raspi.list - #------------------------------------------------------------------------------- # Removed dependency on "p7zip-full", use "7zr" (p7zip) instead: https://github.com/MichaIng/DietPi/pull/2559 G_AGI p7zip if dpkg-query -s p7zip-full &> /dev/null && @@ -1758,16 +1754,16 @@ _EOF_ fi #------------------------------------------------------------------------------- - # RPi Buster: Re-apply firmware Buster-only repo, remove Stretch branch, reinstall raspi-copies-and-fills which is now compatible + # RPi Buster: Re-apply firmware Buster-only repo, remove Stretch branch, reinstall raspi-copies-and-fills (on ARMv6/7 models) which is now compatible if (( $G_HW_MODEL < 10 && $G_DISTRO > 4 )); then echo 'deb https://archive.raspberrypi.org/debian/ buster main ui' > /etc/apt/sources.list.d/raspi.list G_AGUP - G_AGI raspi-copies-and-fills + (( $G_HW_ARCH == 3 )) || G_AGI raspi-copies-and-fills fi #------------------------------------------------------------------------------- - # Install "haveged" entropy daemon by default on all DietPi systems: https://github.com/MichaIng/DietPi/issues/2806 + # Install "haveged" entropy daemon by default on all non-RPi systems: https://github.com/MichaIng/DietPi/issues/2806 (( $G_HW_MODEL > 9 )) && G_AGI haveged #------------------------------------------------------------------------------- # RPi3: Remove doubled config.txt temp_limit value due to: https://github.com/MichaIng/DietPi/commit/cafcbc599ef23c337e75003fb8eacc446877eaba#diff-68acf994541fd7b6ea4f6b02d04ee328L60 @@ -2418,6 +2414,44 @@ To reinstall now, run: "dietpi-software reinstall 106 144 145" /boot/dietpi/dietpi-drive_manager 3 fi + + elif (( $G_DIETPI_VERSION_SUB == 30 )); then + + #------------------------------------------------------------------------------- + # Make userdata dir world-executable so service users don't need to be in dietpi group to access their data dir: https://github.com/MichaIng/DietPi/pull/3536#issuecomment-628515444 + G_EXEC chmod a+x /mnt/dietpi_userdata + #------------------------------------------------------------------------------- + # Assure /media exists to fulfil FHS, fix htpdate service startup and probably other issues: https://github.com/MichaIng/DietPi/issues/3558 + [[ -d '/media' ]] || G_EXEC mkdir /media + #------------------------------------------------------------------------------- + # All users are permitted to "ping" now without any further capabilities, hence remove them for security reasons: https://github.com/MichaIng/DietPi/commit/caec92e92e136a2f731f6d4c45db8463896fc80a + local fp_ping=$(readlink -e $(command -v ping)) + if [[ $fp_ping ]]; then + + sysctl -p /etc/sysctl.d/dietpi.conf + command -v getcap &> /dev/null && [[ $(getcap $fp_ping) ]] && setcap -r $fp_ping + chmod a-s $fp_ping + + fi + #------------------------------------------------------------------------------- + # Reinstalls + # Folding@Home: https://github.com/MichaIng/DietPi/pull/3546 + if (( $G_DIETPI_INSTALL_STAGE == 2 )); then + + # Reset QuiteRSS install state if the package has not actually been installed: https://github.com/MichaIng/DietPi/commit/49f960a7953f44e5571ff2dde68a93efca37ec03 + dpkg-query -s quiterss &> /dev/null || sed -i 's/aSOFTWARE_INSTALL_STATE\[22\]=2/aSOFTWARE_INSTALL_STATE\[22\]=0/' /boot/dietpi/.installed + + if grep -q '^aSOFTWARE_INSTALL_STATE\[2\]=2' /boot/dietpi/.installed; then + + G_DIETPI-NOTIFY 2 'Preparing Folding@Home update...' + [[ -f '/lib/systemd/system/fahclient.service' ]] && rm /lib/systemd/system/fahclient.service + [[ -f '/var/log/fahclient.log' ]] && rm /var/log/fahclient.log + dpkg-query -s fahclient &> /dev/null && G_AGP fahclient + + fi + echo 2 >> /var/tmp/dietpi/dietpi-update_reinstalls + + fi #------------------------------------------------------------------------------- # Last subversion patch completed # - Apply reinstalls diff --git a/dietpi/pre-patch_file b/dietpi/pre-patch_file index 56c08e5871..7ec69af258 100644 --- a/dietpi/pre-patch_file +++ b/dietpi/pre-patch_file @@ -26,7 +26,7 @@ else echo -e "\e[90m[\e[0m\e[31mFAILED\e[0m\e[90m]\e[0m Invalid input argument ($1)" - exit -1 + exit 255 fi @@ -180,8 +180,8 @@ _EOF_ if [[ -f '/etc/apt/sources.list.d/dietpi-wireguard.list' ]]; then echo -e '\e[90m[\e[0m INFO \e[90m]\e[0m Pre-patch 14 | Switch to "bullseye" repo for WireGuard installs' - # RPi - if (( $G_HW_MODEL < 10 )); then + # Raspbian + if (( $G_HW_MODEL < 10 )) && (( ${G_RASPBIAN:=1} )); then echo 'deb http://raspbian.raspberrypi.org/raspbian/ bullseye main' > /etc/apt/sources.list.d/dietpi-wireguard.list || exit 14 diff --git a/dietpi/server_version-6 b/dietpi/server_version-6 index 11c4d1b578..43331cdd2e 100644 --- a/dietpi/server_version-6 +++ b/dietpi/server_version-6 @@ -1,3 +1,3 @@ 6 -30 +31 0 diff --git a/rootfs/etc/bashrc.d/dietpi.bash b/rootfs/etc/bashrc.d/dietpi.bash index 7a2d828435..5c416aec58 100644 --- a/rootfs/etc/bashrc.d/dietpi.bash +++ b/rootfs/etc/bashrc.d/dietpi.bash @@ -56,5 +56,6 @@ Please change your SSH clients terminal, respectively the passed \$TERM string$n fi # DietPi-Login: First run setup, autostarts and login banner - /boot/dietpi/dietpi-login + # - Prevent call if $G_DIETPI_LOGIN has been set. E.g. when shell is called as subshell of G_EXEC or dietpi-login itself, we don't want autostart programs to be launched. + [[ $G_DIETPI_LOGIN ]] || /boot/dietpi/dietpi-login } diff --git a/rootfs/etc/cron.daily/dietpi b/rootfs/etc/cron.daily/dietpi index 2ca5195f90..91e6015745 100644 --- a/rootfs/etc/cron.daily/dietpi +++ b/rootfs/etc/cron.daily/dietpi @@ -13,7 +13,7 @@ #---------------------------------------------------------------- # Main Loop #---------------------------------------------------------------- - # Sync system time, if mode 2 (daily) is detected + # Sync system time if mode 2 (daily) is detected grep -q '^[[:blank:]]*CONFIG_NTP_MODE=2' /boot/dietpi.txt && /boot/dietpi/func/run_ntpd 1 #---------------------------------------------------------------- # Check for DietPi updates @@ -22,7 +22,7 @@ # Refresh DietPi MOTD if [[ -f '/boot/dietpi/.dietpi-banner' ]] && grep -q '^[[:blank:]]*aENABLED\[12\]=1' /boot/dietpi/.dietpi-banner; then - curl -sSL https://dietpi.com/motd > /run/dietpi/.dietpi_motd + curl -sSfL https://dietpi.com/motd > /run/dietpi/.dietpi_motd fi #---------------------------------------------------------------- diff --git a/rootfs/etc/sysctl.d/dietpi.conf b/rootfs/etc/sysctl.d/dietpi.conf index e6dfc7c26a..177e2bb12d 100644 --- a/rootfs/etc/sysctl.d/dietpi.conf +++ b/rootfs/etc/sysctl.d/dietpi.conf @@ -1 +1,5 @@ +# Reduce swap file usage to a minimum vm.swappiness=1 + +# Allow all users to "ping" without further capabilities: https://fedoraproject.org/wiki/Changes/EnableSysctlPingGroupRange +net.ipv4.ping_group_range = 0 2147483647 diff --git a/rootfs/var/lib/dietpi/services/dietpi-firstboot.bash b/rootfs/var/lib/dietpi/services/dietpi-firstboot.bash index 05a05550b0..637641f45f 100755 --- a/rootfs/var/lib/dietpi/services/dietpi-firstboot.bash +++ b/rootfs/var/lib/dietpi/services/dietpi-firstboot.bash @@ -177,7 +177,7 @@ # Set APT mirror local target_repo='CONFIG_APT_DEBIAN_MIRROR' - (( $G_HW_MODEL < 10 )) && target_repo='CONFIG_APT_RASPBIAN_MIRROR' + (( $G_HW_MODEL < 10 )) && (( $G_RASPBIAN )) && target_repo='CONFIG_APT_RASPBIAN_MIRROR' /boot/dietpi/func/dietpi-set_software apt-mirror "$(sed -n "/^[[:blank:]]*$target_repo=/{s/^[^=]*=//p;q}" /boot/dietpi.txt)" # Regenerate unique Dropbear host keys @@ -263,7 +263,16 @@ sed -i "/address/c\address $static_ip" /etc/network/interfaces sed -i "/netmask/c\netmask $static_mask" /etc/network/interfaces sed -i "/gateway/c\gateway $static_gateway" /etc/network/interfaces - sed -i "/dns-nameservers/c\dns-nameservers $static_dns" /etc/network/interfaces + if command -v resolvconf &> /dev/null; then + + sed -i "/dns-nameservers/c\dns-nameservers $static_dns" /etc/network/interfaces + + else + + > /etc/resolv.conf + for i in $static_dns; do echo "nameserver $i" >> /etc/resolv.conf; done + + fi fi