diff --git a/.conf/desktop/apps/opentyrian.desktop b/.conf/desktop/apps/opentyrian.desktop index c09b7d95fc..4d2d0efa7a 100644 --- a/.conf/desktop/apps/opentyrian.desktop +++ b/.conf/desktop/apps/opentyrian.desktop @@ -2,7 +2,7 @@ Type=Application Name=OpenTyrian Comment=An arcade-style shoot 'em up -Icon=/usr/local/games/opentyrian/linux/icons/tyrian-48.png +Icon=/usr/games/opentyrian/linux/icons/tyrian-48.png Categories=Game;ArcadeGame; -Exec=/usr/local/games/opentyrian/run +Exec=/usr/games/opentyrian/run Terminal=false diff --git a/.conf/desktop/lxqt/lxqt-buster.7z b/.conf/desktop/lxqt/lxqt-buster.7z new file mode 100644 index 0000000000..2c55cd37a7 Binary files /dev/null and b/.conf/desktop/lxqt/lxqt-buster.7z differ diff --git a/.conf/desktop/lxqt/lxqt-stretch.7z b/.conf/desktop/lxqt/lxqt-stretch.7z new file mode 100644 index 0000000000..119d1045a9 Binary files /dev/null and b/.conf/desktop/lxqt/lxqt-stretch.7z differ diff --git a/.conf/dps_114/apache.nextcloud.conf b/.conf/dps_114/apache.nextcloud.conf index 6d6e8e33fe..2f6d842044 100644 --- a/.conf/dps_114/apache.nextcloud.conf +++ b/.conf/dps_114/apache.nextcloud.conf @@ -15,7 +15,4 @@ Redirect permanent /ocs-provider /nextcloud/ocs-provider SetEnv HOME /var/www/nextcloud SetEnv HTTP_HOME /var/www/nextcloud - # Hard coding 128M OPCache size, only for /nextcloud, to suppress warning on nextcloud admin panel. - php_admin_value opcache.memory_consumption 128 - diff --git a/.conf/dps_114/lighttpd.nextcloud.conf b/.conf/dps_114/lighttpd.nextcloud.conf index 489d1862a5..d7337c9267 100644 --- a/.conf/dps_114/lighttpd.nextcloud.conf +++ b/.conf/dps_114/lighttpd.nextcloud.conf @@ -16,7 +16,7 @@ $HTTP["url"] =~ "^/nextcloud($|/)" { # - Files $HTTP["url"] =~ "^/nextcloud/(\.|autotest|occ|issue|indie|db_|console)" { url.access-deny = ("") } # - Directory listing - dir-listing.active = "disable" + dir-listing.activate = "disable" # - Cache control and security headers for static resources $HTTP["url"] =~ "^/nextcloud/.*\.(css|js|woff2?|svg|gif)$" { setenv.add-response-header += ( @@ -30,7 +30,4 @@ $HTTP["url"] =~ "^/nextcloud($|/)" { ) } - # Solve OPcache settings warning on Nextcloud admin panel - setenv.add-environment += ( "PHP_ADMIN_VALUE" => "opcache.memory_consumption=128" ) - } diff --git a/.conf/dps_114/nginx.nextcloud.conf b/.conf/dps_114/nginx.nextcloud.conf index 057e9f4742..b9081fac72 100644 --- a/.conf/dps_114/nginx.nextcloud.conf +++ b/.conf/dps_114/nginx.nextcloud.conf @@ -60,8 +60,6 @@ location ^~ /nextcloud { fastcgi_intercept_errors on; # Disable on Jessie, because Jessie Nginx does not support this directive #fastcgi_request_buffering off; - # Hard coding 128M OPCache size to suppress warning on Nextcloud admin panel. - fastcgi_param PHP_ADMIN_VALUE "opcache.memory_consumption=128"; } location ~ ^\/nextcloud\/(?:updater|ocs-provider|ocm-provider)(?:$|\/) { diff --git a/.conf/dps_121/roonbridge.service b/.conf/dps_121/roonbridge.service index 531b1091a9..111937a921 100644 --- a/.conf/dps_121/roonbridge.service +++ b/.conf/dps_121/roonbridge.service @@ -1,10 +1,8 @@ [Unit] -Description=Roon Bridge +Description=Roon Bridge (DietPi) After=network.target sound.target [Service] -Type=simple -User=root Group=dietpi Environment=ROON_DATAROOT=/mnt/dietpi_userdata/roon Environment=ROON_ID_DIR=/mnt/dietpi_userdata/roon diff --git a/.conf/dps_36/squeezelite.service b/.conf/dps_36/squeezelite.service index e4fc683d62..9971e7a702 100644 --- a/.conf/dps_36/squeezelite.service +++ b/.conf/dps_36/squeezelite.service @@ -1,8 +1,7 @@ [Unit] -Description=squeezelite +Description=SqueezeLite (DietPi) [Service] -Type=simple ExecStart=/usr/bin/squeezelite -a 4096:1024:16:0 -C 5 -n 'DietPi-Squeezelite' -f /var/log/squeezelite.log [Install] diff --git a/.conf/dps_47/lighttpd.owncloud.conf b/.conf/dps_47/lighttpd.owncloud.conf index 0f6211d132..d225c7ff3b 100644 --- a/.conf/dps_47/lighttpd.owncloud.conf +++ b/.conf/dps_47/lighttpd.owncloud.conf @@ -10,7 +10,7 @@ $HTTP["url"] =~ "^/owncloud($|/)" { # - Files $HTTP["url"] =~ "^/owncloud/(\.|autotest|occ|issue|indie|db_|console)" { url.access-deny = ("") } # - Directory listing - dir-listing.active = "disable" + dir-listing.activate = "disable" # - Cache control and security headers for static resources $HTTP["url"] =~ "^/owncloud/.+\.(css|js)" { setenv.add-response-header += ( diff --git a/.conf/dps_51/run b/.conf/dps_51/run index 9f439918ae..3a6f1533f1 100644 --- a/.conf/dps_51/run +++ b/.conf/dps_51/run @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/dash #//////////////////////////////////// # DietPi OpenTyrian Run Script # @@ -12,15 +12,16 @@ # Usage: # run #//////////////////////////////////// +FP_DIR='/usr/games/opentyrian' -#Xserver already running -if (($(pidof X) >= 0)); then +# Xserver already running +if pgrep Xorg &> /dev/null; then - /usr/local/games/opentyrian/opentyrian -t /usr/local/games/opentyrian/data + $FP_DIR/opentyrian -t $FP_DIR/data -#No X (init X server) +# No X (init X server) else - xinit /usr/local/games/opentyrian/opentyrian -t /usr/local/games/opentyrian/data + xinit $FP_DIR/opentyrian -t $FP_DIR/data fi diff --git a/.conf/dps_85/nginx.conf b/.conf/dps_85/nginx.conf index 863d8e8b48..b6cabc61f7 100644 --- a/.conf/dps_85/nginx.conf +++ b/.conf/dps_85/nginx.conf @@ -30,7 +30,7 @@ http { # Upstream to abstract back-end connection(s) for PHP upstream php { - server unix:/run/php/php7.0-fpm.sock; + server unix:/run/php/php7.3-fpm.sock; } # Set the mime-types via the mime.types external file @@ -42,7 +42,7 @@ http { # Click tracking! access_log off; - # Hide nginx version + # Hide Nginx version server_tokens off; # ~2 seconds is often enough for HTML/CSS, but connections in diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index ddec9ccc0b..e7af2f218e 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -18,7 +18,8 @@ about: Create a report to help us improve - Software title | (EG: Nextcloud) - Was the software title installed freshly or updated/migrated? - Can this issue be replicated on a fresh installation of DietPi? -- `dietpi-bugreport` ID | `sed -n 5p /DietPi/dietpi/.hw_model` + +- Bug report ID | `sed -n 5p /DietPi/dietpi/.hw_model` #### Steps to reproduce diff --git a/.meta/dietpi-cloud-migration b/.meta/dietpi-cloud-migration index 992fe4e9fd..cb07eddffd 100644 --- a/.meta/dietpi-cloud-migration +++ b/.meta/dietpi-cloud-migration @@ -1,17 +1,20 @@ #!/bin/bash -(( $UID )) && echo -e '[\e[31mFAILED\e[0m] Root privileges required. Please run the script with "sudo".\n' && exit 1 +(( $UID )) && echo -e '[\e[31mFAILED\e[0m] Root privileges required. Please run the script with "sudo".' && exit 1 echo -e '[\e[32m OK \e[0m] Root privileges verified.' -! apt-get install -y rsync && echo -e '[\e[31mFAILED\e[0m] "rsync" install failed. Please check your internet connection, proper apt-get function or try to install it manually: "apt-get install -y rsync"\n' && exit 1 +! apt-get install -y rsync && echo -e '[\e[31mFAILED\e[0m] "rsync" install failed. Please check your internet connection, proper apt-get function or try to install it manually: "apt install rsync"' && exit 1 echo -e '[\e[32m OK \e[0m] Successfully installed rsync.' +systemctl start mariadb &> /dev/null || systemctl start mysql &> /dev/null || { echo -e '[\e[31mFAILED\e[0m] Could not start MariaDB server. Aborting...'; exit 1; } +echo -e '[\e[32m OK \e[0m] Successfully started MariaDB.' + run_backup(){ fp_config="/var/www/$1/config/config.php" echo '[ INFO ] Enabling maintenance mode...' - ! sudo -u www-data php /var/www/$1/occ maintenance:mode --on && echo -e '[\e[31mFAILED\e[0m] Could not enable maintenance mode, please check running state of your instance and PHP functionality.\n' && exit 1 + ! sudo -u www-data php /var/www/$1/occ maintenance:mode --on && echo -e '[\e[31mFAILED\e[0m] Could not enable maintenance mode, please check running state of your instance and PHP functionality.' && exit 1 echo "[ INFO ] Scanning $fp_config for necessary information..." local fp_datadir=$(grep -m1 "^[[:blank:]]*'datadirectory'" $fp_config | cut -d \' -f 4) @@ -26,19 +29,19 @@ run_backup(){ - database password: $dbpass" echo '[ INFO ] Backup database to data directory...' - ! mysqldump -u"$dbuser" -h"$dbhost" -p"$dbpass" "$dbname" > "$fp_datadir"/dietpi-$1-database-backup.sql && echo -e '[\e[31mFAILED\e[0m] Database backup failed, please check state of your database server, check logs and in case repair table corruptions.\n' && exit 1 + ! mysqldump -u"$dbuser" -h"$dbhost" -p"$dbpass" "$dbname" > "$fp_datadir"/dietpi-$1-database-backup.sql && echo -e '[\e[31mFAILED\e[0m] Database backup failed, please check state of your database server, check logs and in case repair table corruptions.' && exit 1 echo -e "[\e[32m OK \e[0m] Successfully finished database backup to: $fp_datadir/dietpi-$1-database-backup.sql" echo '[ INFO ] Backup installation folder to data directory...' - ! rsync -aHp --delete /var/www/$1/ "$fp_datadir"/dietpi-$1-installation-backup && echo -e '[\e[31mFAILED\e[0m] "rsync" failed, please check for error reasons and try again.\n' && exit 1 + ! rsync -aHp --delete /var/www/$1/ "$fp_datadir"/dietpi-$1-installation-backup && echo -e '[\e[31mFAILED\e[0m] "rsync" failed, please check for error reasons and try again.' && exit 1 echo -e "[\e[32m OK \e[0m] Successfully finished installation backup to: $fp_datadir/dietpi-$1-installation-backup/" if [[ $2 ]]; then echo '[ INFO ] You provided an additional backup location. Moving data directory...' - [[ ! -d $2 ]] && echo -e "[\e[31mFAILED\e[0m] $2 is no existing directory, please check spelling and mount status of your desired backup drive.\n" && exit 1 + [[ ! -d $2 ]] && echo -e "[\e[31mFAILED\e[0m] $2 is no existing directory, please check spelling and mount status of your desired backup drive." && exit 1 - ! rsync -aHp --delete "$fp_datadir"/ "$2" && echo -e '[\e[31mFAILED\e[0m] "rsync" failed, please check for error reasons and try again.\n' && exit 1 + ! rsync -aHp --delete "$fp_datadir"/ "$2" && echo -e '[\e[31mFAILED\e[0m] "rsync" failed, please check for error reasons and try again.' && exit 1 echo -e "[\e[32m OK \e[0m] Successfully synced data directory to: $2" else @@ -53,18 +56,20 @@ run_backup(){ ### MAIN ### -if [[ -f /var/www/owncloud/config/config.php ]]; then +if [[ -f '/var/www/owncloud/config/config.php' ]]; then echo '[ INFO ] ownCloud installation found, preparing backup...' run_backup owncloud "$1" fi -if [[ -f /var/www/nextcloud/config/config.php ]]; then +if [[ -f '/var/www/nextcloud/config/config.php' ]]; then echo '[ INFO ] Nextcloud installation found, preparing backup...' run_backup nextcloud "$1" fi -[[ ! $fp_config ]] && echo -e '[\e[31mFAILED\e[0m] No ownCloud or Nextcloud instance found at /var/www/owncloud|nextcloud. Aborting...\n' && exit 1 +[[ ! $fp_config ]] && echo -e '[\e[31mFAILED\e[0m] No ownCloud or Nextcloud instance found at /var/www/owncloud|nextcloud. Aborting...' && exit 1 + +exit 0 diff --git a/.meta/dietpi-survey_report b/.meta/dietpi-survey_report index 52a1862581..68a81f61cb 100644 --- a/.meta/dietpi-survey_report +++ b/.meta/dietpi-survey_report @@ -18,6 +18,7 @@ aHW_NAME[12]='Odroid C2' aHW_NAME[13]='Odroid U3' aHW_NAME[14]='Odroid N1' + aHW_NAME[15]='Odroid N2' aHW_NAME[20]='VM x64 (VMware VirtualBox)' aHW_NAME[21]='x86_64 native (PC)' aHW_NAME[22]='Generic device (eg: unknown to DietPi)' @@ -53,13 +54,15 @@ aHW_NAME[70]='Sparky SBC' aHW_NAME[71]='Beagle Bone Black' - aBENCH_COMMON_INDEX=() - + # - Core Benchmarks + aBENCH_CPU_INDEX=() + aBENCH_RAM_INDEX=() + aBENCH_ROOTFS_INDEX=() # - Optional benchmarks aBENCH_LAN_INDEX=() aBENCH_CUSTOMFS_INDEX=() - #[$HW_MODEL,${aBENCH_COMMON_INDEX[$HW_MODEL]}] + #[$HW_MODEL,${aBENCH_XX_INDEX[$HW_MODEL]}] declare -A aBENCH_CPU declare -A aBENCH_ROOTFS_WRITE declare -A aBENCH_ROOTFS_READ @@ -74,7 +77,7 @@ declare -A aBENCH_NET_LAN_SPEED #Results - BENCH_RESULTS_CPU_SCALE=2 + BENCH_RESULTS_CPU_SCALE=1 aBENCH_RESULT_CPU_MIN=() aBENCH_RESULT_CPU_MAX=() aBENCH_RESULT_CPU_AVG=() @@ -376,14 +379,21 @@ aSOFTWARE_NAME6_20[171]='DietPi-NordVPN' aSOFTWARE_NAME6_20[172]='WireGuard' - # - v6.21 + v6.22 + # - v6.21 + v6.22 + v6.23 + aSOFTWARE_NAME6_21=() + aSOFTWARE_NAME6_22=() + aSOFTWARE_NAME6_23=() for i in ${!aSOFTWARE_NAME6_20[@]} do aSOFTWARE_NAME6_21[$i]=${aSOFTWARE_NAME6_20[$i]} aSOFTWARE_NAME6_22[$i]=${aSOFTWARE_NAME6_21[$i]} + aSOFTWARE_NAME6_23[$i]=${aSOFTWARE_NAME6_22[$i]} done + aSOFTWARE_NAME6_23[173]='LXQt' + aSOFTWARE_NAME6_23[174]='GIMP' + aSOFTWARE_NAME6_23[175]='XFCE Power Manager' Main(){ @@ -416,36 +426,56 @@ if [[ $G_DEBUG == 1 ]]; then - echo "DEBUG Benchmark: $file" - echo "BENCH_VERSION=$BENCH_VERSION | BENCH_HW_MODEL=$BENCH_HW_MODEL BENCH_CPU=$BENCH_CPU | BENCH_ROOTFS_WRITE=$BENCH_ROOTFS_WRITE | BENCH_ROOTFS_READ=$BENCH_ROOTFS_READ | BENCH_RAM_WRITE=$BENCH_RAM_WRITE | BENCH_RAM_READ=$BENCH_RAM_READ | BENCH_CPU_TEMP_START=$BENCH_CPU_TEMP_START | BENCH_CPU_TEMP_END=$BENCH_CPU_TEMP_END | BENCH_CUSTOMFS_WRITE=$BENCH_CUSTOMFS_WRITE | BENCH_CUSTOMFS_READ=$BENCH_CUSTOMFS_READ | BENCH_NET_LAN_SPEED=$BENCH_NET_LAN_SPEED" + echo "DEBUG $file: BENCH_VERSION=$BENCH_VERSION | BENCH_HW_MODEL=$BENCH_HW_MODEL BENCH_CPU=$BENCH_CPU | BENCH_ROOTFS_WRITE=$BENCH_ROOTFS_WRITE | BENCH_ROOTFS_READ=$BENCH_ROOTFS_READ | BENCH_RAM_WRITE=$BENCH_RAM_WRITE | BENCH_RAM_READ=$BENCH_RAM_READ | BENCH_CPU_TEMP_START=$BENCH_CPU_TEMP_START | BENCH_CPU_TEMP_END=$BENCH_CPU_TEMP_END | BENCH_CUSTOMFS_WRITE=$BENCH_CUSTOMFS_WRITE | BENCH_CUSTOMFS_READ=$BENCH_CUSTOMFS_READ | BENCH_NET_LAN_SPEED=$BENCH_NET_LAN_SPEED" fi - #Common benchmarks - # - Check for all expected values based on how we handle them, only add entry if valid for all. + # - CPU if [[ ${BENCH_CPU//.*} =~ ^-?[0-9]+$ && - ${BENCH_ROOTFS_WRITE//.*} =~ ^-?[0-9]+$ && ${BENCH_ROOTFS_READ//.*} =~ ^-?[0-9]+$ && - ${BENCH_RAM_WRITE//.*} =~ ^-?[0-9]+$ && ${BENCH_RAM_READ//.*} =~ ^-?[0-9]+$ && - $BENCH_CPU_TEMP_START && $BENCH_CPU_TEMP_END ]]; then + $BENCH_CPU_TEMP_START =~ ^-?[0-9]+$ && $BENCH_CPU_TEMP_END =~ ^-?[0-9]+$ ]]; then + + aBENCH_CPU[$BENCH_HW_MODEL,${aBENCH_CPU_INDEX[$BENCH_HW_MODEL]:=0}]=$BENCH_CPU + + # - Patch for 5 digit CPU temp's: 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 )) + # ------------------------------------------------------------------------------ + + 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]++)) + + fi + + # - RootFS + if [[ ${BENCH_ROOTFS_WRITE//.*} =~ ^-?[0-9]+$ && ${BENCH_ROOTFS_READ//.*} =~ ^-?[0-9]+$ ]]; then + + aBENCH_ROOTFS_WRITE[$BENCH_HW_MODEL,${aBENCH_ROOTFS_INDEX[$BENCH_HW_MODEL]:=0}]=${BENCH_ROOTFS_WRITE//.*} + aBENCH_ROOTFS_READ[$BENCH_HW_MODEL,${aBENCH_ROOTFS_INDEX[$BENCH_HW_MODEL]}]=${BENCH_ROOTFS_READ//.*} + + ((aBENCH_ROOTFS_INDEX[$BENCH_HW_MODEL]++)) + + fi - aBENCH_CPU[$BENCH_HW_MODEL,${aBENCH_COMMON_INDEX[$BENCH_HW_MODEL]:=0}]=$BENCH_CPU - aBENCH_ROOTFS_WRITE[$BENCH_HW_MODEL,${aBENCH_COMMON_INDEX[$BENCH_HW_MODEL]}]=${BENCH_ROOTFS_WRITE//.*} - aBENCH_ROOTFS_READ[$BENCH_HW_MODEL,${aBENCH_COMMON_INDEX[$BENCH_HW_MODEL]}]=${BENCH_ROOTFS_READ//.*} - aBENCH_RAM_WRITE[$BENCH_HW_MODEL,${aBENCH_COMMON_INDEX[$BENCH_HW_MODEL]}]=${BENCH_RAM_WRITE//.*} - aBENCH_RAM_READ[$BENCH_HW_MODEL,${aBENCH_COMMON_INDEX[$BENCH_HW_MODEL]}]=${BENCH_RAM_READ//.*} - aBENCH_CPU_TEMP_START[$BENCH_HW_MODEL,${aBENCH_COMMON_INDEX[$BENCH_HW_MODEL]}]=${BENCH_CPU_TEMP_START//.*} - aBENCH_CPU_TEMP_END[$BENCH_HW_MODEL,${aBENCH_COMMON_INDEX[$BENCH_HW_MODEL]}]=${BENCH_CPU_TEMP_END//.*} + # - RAM + # - https://github.com/MichaIng/DietPi/issues/2715 | nullify this score and ignore it in min/max/avg processing. + if (( $BENCH_VERSION >= 2 )) && + [[ ${BENCH_RAM_WRITE//.*} =~ ^-?[0-9]+$ && ${BENCH_RAM_READ//.*} =~ ^-?[0-9]+$ ]]; then - ((aBENCH_COMMON_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 - #Optional benchmarks, handle them in a seperate index array # - Custom FS if [[ ${BENCH_CUSTOMFS_WRITE//.*} =~ ^-?[0-9]+$ && ${BENCH_CUSTOMFS_READ//.*} =~ ^-?[0-9]+$ ]]; then aBENCH_CUSTOMFS_WRITE[$BENCH_HW_MODEL,${aBENCH_CUSTOMFS_INDEX[$BENCH_HW_MODEL]:=0}]=${BENCH_CUSTOMFS_WRITE//.*} - aBENCH_CUSTOMFS_READ[$BENCH_HW_MODEL,${aBENCH_CUSTOMFS_INDEX[$BENCH_HW_MODEL]}]=${BENCH_CUSTOMFS_READ//.*} + aBENCH_CUSTOMFS_READ[$BENCH_HW_MODEL,${aBENCH_CUSTOMFS_INDEX[$BENCH_HW_MODEL]:=0}]=${BENCH_CUSTOMFS_READ//.*} + ((aBENCH_CUSTOMFS_INDEX[$BENCH_HW_MODEL]++)) fi @@ -454,6 +484,7 @@ if [[ ${BENCH_NET_LAN_SPEED//.*} =~ ^-?[0-9]+$ ]]; then aBENCH_NET_LAN_SPEED[$BENCH_HW_MODEL,${aBENCH_LAN_INDEX[$BENCH_HW_MODEL]:=0}]=${BENCH_NET_LAN_SPEED//.*} + ((aBENCH_LAN_INDEX[$BENCH_HW_MODEL]++)) fi @@ -484,34 +515,18 @@ # Clean up reports dir rm -R /tmp/dietpi-survey_report - #Bench Results, HW_MODEL array: + #Process all results, for later use in HTML printout + # - NB: HW_MODEL array based local default_min_value=100000 - for i in ${!aBENCH_COMMON_INDEX[@]} - do - local hw_model_supports_cpu_temps=1 + # - CPU + for i in ${!aBENCH_CPU_INDEX[@]} + do - #init results aBENCH_RESULT_CPU_MIN[$i]=$default_min_value aBENCH_RESULT_CPU_MAX[$i]=0 aBENCH_RESULT_CPU_AVG[$i]=0 - aBENCH_RESULT_ROOTFS_WRITE_MIN[$i]=$default_min_value - aBENCH_RESULT_ROOTFS_WRITE_MAX[$i]=0 - aBENCH_RESULT_ROOTFS_WRITE_AVG[$i]=0 - - aBENCH_RESULT_ROOTFS_READ_MIN[$i]=$default_min_value - aBENCH_RESULT_ROOTFS_READ_MAX[$i]=0 - aBENCH_RESULT_ROOTFS_READ_AVG[$i]=0 - - aBENCH_RESULT_RAM_WRITE_MIN[$i]=$default_min_value - aBENCH_RESULT_RAM_WRITE_MAX[$i]=0 - aBENCH_RESULT_RAM_WRITE_AVG[$i]=0 - - aBENCH_RESULT_RAM_READ_MIN[$i]=$default_min_value - aBENCH_RESULT_RAM_READ_MAX[$i]=0 - aBENCH_RESULT_RAM_READ_AVG[$i]=0 - aBENCH_RESULT_CPU_TEMP_START_MIN[$i]=$default_min_value aBENCH_RESULT_CPU_TEMP_START_MAX[$i]=0 aBENCH_RESULT_CPU_TEMP_START_AVG[$i]=0 @@ -520,162 +535,176 @@ aBENCH_RESULT_CPU_TEMP_END_MAX[$i]=0 aBENCH_RESULT_CPU_TEMP_END_AVG[$i]=0 - for (( j=0; j<${aBENCH_COMMON_INDEX[$i]}; j++ )) + for (( j=0; j<${aBENCH_CPU_INDEX[$i]}; j++ )) do - #CPU # echo "aBENCH_CPU[$i,$j] ${aBENCH_CPU[$i,$j]}" if (( $(bc -l <<< "${aBENCH_CPU[$i,$j]} < ${aBENCH_RESULT_CPU_MIN[$i]}") )); then - aBENCH_RESULT_CPU_MIN[$i]=$(bc -l <<< "scale=$BENCH_RESULTS_CPU_SCALE; ${aBENCH_CPU[$i,$j]} * 1") + aBENCH_RESULT_CPU_MIN[$i]=$(bc -l <<< "scale=$BENCH_RESULTS_CPU_SCALE; ${aBENCH_CPU[$i,$j]} / 1") fi if (( $(bc -l <<< "${aBENCH_CPU[$i,$j]} > ${aBENCH_RESULT_CPU_MAX[$i]}") )); then - aBENCH_RESULT_CPU_MAX[$i]=$(bc -l <<< "scale=$BENCH_RESULTS_CPU_SCALE; ${aBENCH_CPU[$i,$j]} * 1") + aBENCH_RESULT_CPU_MAX[$i]=$(bc -l <<< "scale=$BENCH_RESULTS_CPU_SCALE; ${aBENCH_CPU[$i,$j]} / 1") fi aBENCH_RESULT_CPU_AVG[$i]=$(bc -l <<< "${aBENCH_CPU[$i,$j]} + ${aBENCH_RESULT_CPU_AVG[$i]}") - #RootFS - # echo "aBENCH_ROOTFS_WRITE[$i,$j] ${aBENCH_ROOTFS_WRITE[$i,$j]}" - if (( ${aBENCH_ROOTFS_WRITE[$i,$j]} < ${aBENCH_RESULT_ROOTFS_WRITE_MIN[$i]} )); then + if (( ${aBENCH_CPU_TEMP_START[$i,$j]} < ${aBENCH_RESULT_CPU_TEMP_START_MIN[$i]} )); then - aBENCH_RESULT_ROOTFS_WRITE_MIN[$i]=${aBENCH_ROOTFS_WRITE[$i,$j]} + aBENCH_RESULT_CPU_TEMP_START_MIN[$i]=${aBENCH_CPU_TEMP_START[$i,$j]} fi - if (( ${aBENCH_ROOTFS_WRITE[$i,$j]} > ${aBENCH_RESULT_ROOTFS_WRITE_MAX[$i]} )); then + if (( ${aBENCH_CPU_TEMP_START[$i,$j]} > ${aBENCH_RESULT_CPU_TEMP_START_MAX[$i]} )); then - aBENCH_RESULT_ROOTFS_WRITE_MAX[$i]=${aBENCH_ROOTFS_WRITE[$i,$j]} + aBENCH_RESULT_CPU_TEMP_START_MAX[$i]=${aBENCH_CPU_TEMP_START[$i,$j]} fi - (( aBENCH_RESULT_ROOTFS_WRITE_AVG[$i] += ${aBENCH_ROOTFS_WRITE[$i,$j]} )) + (( aBENCH_RESULT_CPU_TEMP_START_AVG[$i] += ${aBENCH_CPU_TEMP_START[$i,$j]} )) - # echo "aBENCH_ROOTFS_READ[$i,$j] ${aBENCH_ROOTFS_READ[$i,$j]}" - if (( ${aBENCH_ROOTFS_READ[$i,$j]} < ${aBENCH_RESULT_ROOTFS_READ_MIN[$i]} )); then + # echo "aBENCH_CPU_TEMP_END[$i,$j] ${aBENCH_CPU_TEMP_END[$i,$j]}" + if (( ${aBENCH_CPU_TEMP_END[$i,$j]} < ${aBENCH_RESULT_CPU_TEMP_END_MIN[$i]} )); then - aBENCH_RESULT_ROOTFS_READ_MIN[$i]=${aBENCH_ROOTFS_READ[$i,$j]} + aBENCH_RESULT_CPU_TEMP_END_MIN[$i]=${aBENCH_CPU_TEMP_END[$i,$j]} fi - if (( ${aBENCH_ROOTFS_READ[$i,$j]} > ${aBENCH_RESULT_ROOTFS_READ_MAX[$i]} )); then + if (( ${aBENCH_CPU_TEMP_END[$i,$j]} > ${aBENCH_RESULT_CPU_TEMP_END_MAX[$i]} )); then - aBENCH_RESULT_ROOTFS_READ_MAX[$i]=${aBENCH_ROOTFS_READ[$i,$j]} + aBENCH_RESULT_CPU_TEMP_END_MAX[$i]=${aBENCH_CPU_TEMP_END[$i,$j]} fi - (( aBENCH_RESULT_ROOTFS_READ_AVG[$i] += ${aBENCH_ROOTFS_READ[$i,$j]} )) + (( aBENCH_RESULT_CPU_TEMP_END_AVG[$i] += ${aBENCH_CPU_TEMP_END[$i,$j]} )) - #RAM - # echo "aBENCH_RAM_WRITE[$i,$j] ${aBENCH_RAM_WRITE[$i,$j]}" - if (( ${aBENCH_RAM_WRITE[$i,$j]} < ${aBENCH_RESULT_RAM_WRITE_MIN[$i]} )); then + #Last item in current array. Work out averages + if (( $j == ${aBENCH_CPU_INDEX[$i]} - 1 )); then - aBENCH_RESULT_RAM_WRITE_MIN[$i]=${aBENCH_RAM_WRITE[$i,$j]} + 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 - if (( ${aBENCH_RAM_WRITE[$i,$j]} > ${aBENCH_RESULT_RAM_WRITE_MAX[$i]} )); then + if [[ $G_DEBUG == 1 ]]; then - aBENCH_RESULT_RAM_WRITE_MAX[$i]=${aBENCH_RAM_WRITE[$i,$j]} + echo "aBENCH_RESULT_CPU_AVG $i = ${aBENCH_RESULT_CPU_AVG[$i]}" + echo "aBENCH_RESULT_CPU_TEMP_START_AVG $i = ${aBENCH_RESULT_CPU_TEMP_START_AVG[$i]}" + echo "aBENCH_RESULT_CPU_TEMP_END_AVG $i = ${aBENCH_RESULT_CPU_TEMP_END_AVG[$i]}" + + fi fi - (( aBENCH_RESULT_RAM_WRITE_AVG[$i] += ${aBENCH_RAM_WRITE[$i,$j]} )) - # echo "aBENCH_RAM_READ[$i,$j] ${aBENCH_RAM_READ[$i,$j]}" - if (( ${aBENCH_RAM_READ[$i,$j]} < ${aBENCH_RESULT_RAM_READ_MIN[$i]} )); then + done - aBENCH_RESULT_RAM_READ_MIN[$i]=${aBENCH_RAM_READ[$i,$j]} + done + + # - RootFS + for i in ${!aBENCH_ROOTFS_INDEX[@]} + do + + aBENCH_RESULT_ROOTFS_WRITE_MIN[$i]=$default_min_value + aBENCH_RESULT_ROOTFS_WRITE_MAX[$i]=0 + aBENCH_RESULT_ROOTFS_WRITE_AVG[$i]=0 + aBENCH_RESULT_ROOTFS_READ_MIN[$i]=$default_min_value + aBENCH_RESULT_ROOTFS_READ_MAX[$i]=0 + aBENCH_RESULT_ROOTFS_READ_AVG[$i]=0 + + 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_RAM_READ[$i,$j]} > ${aBENCH_RESULT_RAM_READ_MAX[$i]} )); then + if (( ${aBENCH_ROOTFS_WRITE[$i,$j]} > ${aBENCH_RESULT_ROOTFS_WRITE_MAX[$i]} )); then - aBENCH_RESULT_RAM_READ_MAX[$i]=${aBENCH_RAM_READ[$i,$j]} + aBENCH_RESULT_ROOTFS_WRITE_MAX[$i]=${aBENCH_ROOTFS_WRITE[$i,$j]} fi - (( aBENCH_RESULT_RAM_READ_AVG[$i] += ${aBENCH_RAM_READ[$i,$j]} )) + (( aBENCH_RESULT_ROOTFS_WRITE_AVG[$i] += ${aBENCH_ROOTFS_WRITE[$i,$j]} )) - #CPU temp - # echo "aBENCH_CPU_TEMP_START[$i,$j] ${aBENCH_CPU_TEMP_START[$i,$j]}" - if (( $hw_model_supports_cpu_temps )); then + # echo "aBENCH_ROOTFS_READ[$i,$j] ${aBENCH_ROOTFS_READ[$i,$j]}" + if (( ${aBENCH_ROOTFS_READ[$i,$j]} < ${aBENCH_RESULT_ROOTFS_READ_MIN[$i]} )); then - if [[ ${aBENCH_CPU_TEMP_START[$i,$j]} =~ ^-?[0-9]+$ ]]; then + aBENCH_RESULT_ROOTFS_READ_MIN[$i]=${aBENCH_ROOTFS_READ[$i,$j]} - if (( ${aBENCH_CPU_TEMP_START[$i,$j]} < ${aBENCH_RESULT_CPU_TEMP_START_MIN[$i]} )); then + fi + if (( ${aBENCH_ROOTFS_READ[$i,$j]} > ${aBENCH_RESULT_ROOTFS_READ_MAX[$i]} )); then - aBENCH_RESULT_CPU_TEMP_START_MIN[$i]=${aBENCH_CPU_TEMP_START[$i,$j]} + aBENCH_RESULT_ROOTFS_READ_MAX[$i]=${aBENCH_ROOTFS_READ[$i,$j]} - fi - if (( ${aBENCH_CPU_TEMP_START[$i,$j]} > ${aBENCH_RESULT_CPU_TEMP_START_MAX[$i]} )); then + fi + (( aBENCH_RESULT_ROOTFS_READ_AVG[$i] += ${aBENCH_ROOTFS_READ[$i,$j]} )) - aBENCH_RESULT_CPU_TEMP_START_MAX[$i]=${aBENCH_CPU_TEMP_START[$i,$j]} + #Last item in current array. Work out averages + if (( $j == ${aBENCH_ROOTFS_INDEX[$i]} - 1 )); then - fi - (( aBENCH_RESULT_CPU_TEMP_START_AVG[$i] += ${aBENCH_CPU_TEMP_START[$i,$j]} )) + 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]} )) - # echo "aBENCH_CPU_TEMP_END[$i,$j] ${aBENCH_CPU_TEMP_END[$i,$j]}" - if (( ${aBENCH_CPU_TEMP_END[$i,$j]} < ${aBENCH_RESULT_CPU_TEMP_END_MIN[$i]} )); then + if [[ $G_DEBUG == 1 ]]; then - aBENCH_RESULT_CPU_TEMP_END_MIN[$i]=${aBENCH_CPU_TEMP_END[$i,$j]} + echo "aBENCH_RESULT_ROOTFS_WRITE_AVG $i = ${aBENCH_RESULT_ROOTFS_WRITE_AVG[$i]}" + echo "aBENCH_RESULT_ROOTFS_READ_AVG $i = ${aBENCH_RESULT_ROOTFS_READ_AVG[$i]}" - fi - if (( ${aBENCH_CPU_TEMP_END[$i,$j]} > ${aBENCH_RESULT_CPU_TEMP_END_MAX[$i]} )); then + fi - aBENCH_RESULT_CPU_TEMP_END_MAX[$i]=${aBENCH_CPU_TEMP_END[$i,$j]} + fi - fi - (( aBENCH_RESULT_CPU_TEMP_END_AVG[$i] += ${aBENCH_CPU_TEMP_END[$i,$j]} )) + done - else + done - hw_model_supports_cpu_temps=0 #Set unavailable for current HW model, do not check again for HW model - aBENCH_RESULT_CPU_TEMP_START_AVG[$i]='N/A' - aBENCH_RESULT_CPU_TEMP_END_AVG[$i]='N/A' + # - RAM + for i in ${!aBENCH_RAM_INDEX[@]} + do - aBENCH_RESULT_CPU_TEMP_START_MIN[$i]='N/A' - aBENCH_RESULT_CPU_TEMP_START_MAX[$i]='N/A' + aBENCH_RESULT_RAM_WRITE_MIN[$i]=$default_min_value + aBENCH_RESULT_RAM_WRITE_MAX[$i]=0 + aBENCH_RESULT_RAM_WRITE_AVG[$i]=0 - aBENCH_RESULT_CPU_TEMP_END_MIN[$i]='N/A' - aBENCH_RESULT_CPU_TEMP_END_MAX[$i]='N/A' + aBENCH_RESULT_RAM_READ_MIN[$i]=$default_min_value + aBENCH_RESULT_RAM_READ_MAX[$i]=0 + aBENCH_RESULT_RAM_READ_AVG[$i]=0 - fi + for (( j=0; j<${aBENCH_RAM_INDEX[$i]}; j++ )) + do - fi + if (( ${aBENCH_RAM_WRITE[$i,$j]} < ${aBENCH_RESULT_RAM_WRITE_MIN[$i]} )); then + + aBENCH_RESULT_RAM_WRITE_MIN[$i]=${aBENCH_RAM_WRITE[$i,$j]} - if [[ $G_DEBUG == 1 ]]; then + fi + if (( ${aBENCH_RAM_WRITE[$i,$j]} > ${aBENCH_RESULT_RAM_WRITE_MAX[$i]} )); then - echo "DEBUG Bench Entry: $i $j" - echo ${aBENCH_ROOTFS_WRITE[$i,$j]} - echo ${aBENCH_ROOTFS_READ[$i,$j]} - echo ${aBENCH_RAM_WRITE[$i,$j]} - echo ${aBENCH_RAM_READ[$i,$j]} - echo ${aBENCH_CPU_TEMP_START[$i,$j]} - echo ${aBENCH_CPU_TEMP_END[$i,$j]} + aBENCH_RESULT_RAM_WRITE_MAX[$i]=${aBENCH_RAM_WRITE[$i,$j]} fi + (( aBENCH_RESULT_RAM_WRITE_AVG[$i] += ${aBENCH_RAM_WRITE[$i,$j]} )) - #Last item in current array. Work out averages - if (( $j == ${aBENCH_COMMON_INDEX[$i]} - 1 )); then + # echo "aBENCH_RAM_READ[$i,$j] ${aBENCH_RAM_READ[$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_CPU_AVG[$i]=$(bc -l <<< "scale=$BENCH_RESULTS_CPU_SCALE; ${aBENCH_RESULT_CPU_AVG[$i]} / ${aBENCH_COMMON_INDEX[$i]}") - aBENCH_RESULT_ROOTFS_WRITE_AVG[$i]=$(( ${aBENCH_RESULT_ROOTFS_WRITE_AVG[$i]} / ${aBENCH_COMMON_INDEX[$i]} )) - aBENCH_RESULT_ROOTFS_READ_AVG[$i]=$(( ${aBENCH_RESULT_ROOTFS_READ_AVG[$i]} / ${aBENCH_COMMON_INDEX[$i]} )) - aBENCH_RESULT_RAM_WRITE_AVG[$i]=$(( ${aBENCH_RESULT_RAM_WRITE_AVG[$i]} / ${aBENCH_COMMON_INDEX[$i]} )) - aBENCH_RESULT_RAM_READ_AVG[$i]=$(( ${aBENCH_RESULT_RAM_READ_AVG[$i]} / ${aBENCH_COMMON_INDEX[$i]} )) + aBENCH_RESULT_RAM_READ_MAX[$i]=${aBENCH_RAM_READ[$i,$j]} - if (( $hw_model_supports_cpu_temps )); then + fi + (( aBENCH_RESULT_RAM_READ_AVG[$i] += ${aBENCH_RAM_READ[$i,$j]} )) - aBENCH_RESULT_CPU_TEMP_START_AVG[$i]=$(( ${aBENCH_RESULT_CPU_TEMP_START_AVG[$i]} / ${aBENCH_COMMON_INDEX[$i]} )) - aBENCH_RESULT_CPU_TEMP_END_AVG[$i]=$(( ${aBENCH_RESULT_CPU_TEMP_END_AVG[$i]} / ${aBENCH_COMMON_INDEX[$i]} )) + #Last item in current array. Work out averages + if (( $j == ${aBENCH_RAM_INDEX[$i]} - 1 )); then - fi + 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]} )) if [[ $G_DEBUG == 1 ]]; then - echo "DEBUG Bench avg: $i" - echo "aBENCH_RESULT_CPU_AVG $i = ${aBENCH_RESULT_CPU_AVG[$i]}" - echo "aBENCH_RESULT_ROOTFS_WRITE_AVG $i = ${aBENCH_RESULT_ROOTFS_WRITE_AVG[$i]}" - echo "aBENCH_RESULT_ROOTFS_READ_AVG $i = ${aBENCH_RESULT_ROOTFS_READ_AVG[$i]}" echo "aBENCH_RESULT_RAM_WRITE_AVG $i = ${aBENCH_RESULT_RAM_WRITE_AVG[$i]}" echo "aBENCH_RESULT_RAM_READ_AVG $i = ${aBENCH_RESULT_RAM_READ_AVG[$i]}" - echo "aBENCH_RESULT_CPU_TEMP_START_AVG $i = ${aBENCH_RESULT_CPU_TEMP_START_AVG[$i]}" - echo "aBENCH_RESULT_CPU_TEMP_END_AVG $i = ${aBENCH_RESULT_CPU_TEMP_END_AVG[$i]}" fi @@ -685,7 +714,7 @@ done - # - Optional benchmarks LAN + # - LAN for i in ${!aBENCH_LAN_INDEX[@]} do @@ -721,14 +750,63 @@ done - # - Optional benchmarks CUSTOMFS - #aBENCH_RESULT_CUSTOMFS_WRITE_MIN[$i]=$default_min_value - #aBENCH_RESULT_CUSTOMFS_WRITE_MAX[$i]=0 - #aBENCH_RESULT_CUSTOMFS_WRITE_AVG[$i]=0 + # - CustomFS + for i in ${!aBENCH_CUSTOMFS_INDEX[@]} + do + + aBENCH_RESULT_CUSTOMFS_WRITE_MIN[$i]=$default_min_value + aBENCH_RESULT_CUSTOMFS_WRITE_MAX[$i]=0 + aBENCH_RESULT_CUSTOMFS_WRITE_AVG[$i]=0 + aBENCH_RESULT_CUSTOMFS_READ_MIN[$i]=$default_min_value + aBENCH_RESULT_CUSTOMFS_READ_MAX[$i]=0 + aBENCH_RESULT_CUSTOMFS_READ_AVG[$i]=0 + + 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]} - #aBENCH_RESULT_CUSTOMFS_READ_MIN[$i]=$default_min_value - #aBENCH_RESULT_CUSTOMFS_READ_MAX[$i]=0 - #aBENCH_RESULT_CUSTOMFS_READ_AVG[$i]=0 + fi + (( aBENCH_RESULT_CUSTOMFS_WRITE_AVG[$i] += ${aBENCH_CUSTOMFS_WRITE[$i,$j]} )) + + # echo "aBENCH_CUSTOMFS_READ[$i,$j] ${aBENCH_CUSTOMFS_READ[$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_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]} )) + + if [[ $G_DEBUG == 1 ]]; then + + echo "aBENCH_RESULT_CUSTOMFS_WRITE_AVG $i = ${aBENCH_RESULT_CUSTOMFS_WRITE_AVG[$i]}" + echo "aBENCH_RESULT_CUSTOMFS_READ_AVG $i = ${aBENCH_RESULT_CUSTOMFS_READ_AVG[$i]}" + + fi + + fi + + done + + done # Create HTML file cat << _EOF_ > index.html @@ -752,7 +830,7 @@

DietPi-Survey report page

- Uploads since: 01.01.2019 00:00:00 UTC
+ Uploads since: 2019-01-01 00:00:00 UTC
Last update: $(TZ=UTC date "+%Y-%m-%d %T UTC")

@@ -761,52 +839,52 @@
Opted out installs$SURVEY_COUNT_EMPTY
-

DietPi versions:

+

DietPi versions:

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

Git branches:

+

Git branches:

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

Devices:

+

Devices:

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

CPU architectures:

+

CPU architectures:

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

CPU core counts:

+

CPU core counts:

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

Distro versions:

+

Distro versions:

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

Autostart options:

+

Autostart options:

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

DietPi-Automation:

+

DietPi-Automation:

Used by${aAUTO_SETUP_AUTOMATED[1]} of $((${aAUTO_SETUP_AUTOMATED[1]} + ${aAUTO_SETUP_AUTOMATED[0]})) installs
-

Network interfaces:

+

Network interfaces:

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

Installed software titles:

+

Installed software titles:

$(for i in "${!aSOFTWARE[@]}"; do echo ""; done | sort -nrk 2 -t ' ')
$i ${aSOFTWARE[$i]}
@@ -821,49 +899,81 @@ Device: - Total benchmarks: - Average: - Fastest: - Slowest: - Average: - Lowest: - Highest: - Average: - Lowest: - Highest: + Count: + Average: + Fastest: + Slowest: + Average: + Lowest: + Highest: + Average: + Lowest: + Highest: - $(for i in "${!aBENCH_COMMON_INDEX[@]}"; do echo "${aHW_NAME[$i]:=$i} ${aBENCH_COMMON_INDEX[$i]} ${aBENCH_RESULT_CPU_AVG[$i]} ${aBENCH_RESULT_CPU_MIN[$i]} ${aBENCH_RESULT_CPU_MAX[$i]} ${aBENCH_RESULT_CPU_TEMP_START_AVG[$i]} ${aBENCH_RESULT_CPU_TEMP_START_MIN[$i]} ${aBENCH_RESULT_CPU_TEMP_START_MAX[$i]} ${aBENCH_RESULT_CPU_TEMP_END_AVG[$i]} ${aBENCH_RESULT_CPU_TEMP_END_MIN[$i]} ${aBENCH_RESULT_CPU_TEMP_END_MAX[$i]} "; done | sort -nk 1 -t ' ') + $(for i in "${!aBENCH_CPU_INDEX[@]}"; do echo "${aHW_NAME[$i]:=$i} ${aBENCH_CPU_INDEX[$i]} ${aBENCH_RESULT_CPU_AVG[$i]} ${aBENCH_RESULT_CPU_MIN[$i]} ${aBENCH_RESULT_CPU_MAX[$i]} ${aBENCH_RESULT_CPU_TEMP_START_AVG[$i]} ${aBENCH_RESULT_CPU_TEMP_START_MIN[$i]} ${aBENCH_RESULT_CPU_TEMP_START_MAX[$i]}${aBENCH_RESULT_CPU_TEMP_END_AVG[$i]} ${aBENCH_RESULT_CPU_TEMP_END_MIN[$i]} ${aBENCH_RESULT_CPU_TEMP_END_MAX[$i]} "; done | sort -nk 1 -t ' ') -

DietPi-Benchmarks | IO (Filesystem & RAM):

+

DietPi-Benchmarks | IO (RAM):

- - - - - - - - - - - - - - + + + + + + + - $(for i in "${!aBENCH_COMMON_INDEX[@]}"; do echo ""; done | sort -nk 1 -t ' ') + $(for i in "${!aBENCH_RAM_INDEX[@]}"; do echo ""; done )
- RootFS write (MB/s):RootFS read (MB/s): RAM write (MB/s): RAM read (MB/s):
Device:Total benchmarks:Average:Fastest:Slowest:Average:Fastest:Slowest:Average:Fastest:Slowest:Average:Fastest:Slowest:Count:Average:Fastest:Slowest:Average:Fastest:Slowest:
${aHW_NAME[$i]:=$i} ${aBENCH_COMMON_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]} ${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 | Network LAN throughput:

+

DietPi-Benchmarks | IO (RootFS):

+ + + + + + + + + + + + + + + + $(for i in "${!aBENCH_ROOTFS_INDEX[@]}"; do echo ""; done ) +
+ RootFS write (MB/s):RootFS read (MB/s):
Device:Count:Average:Fastest:Slowest:Average: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]}
+ +

DietPi-Benchmarks | IO (Custom FS):

+ + + + + + + + + + + + + + + + $(for i in "${!aBENCH_CUSTOMFS_INDEX[@]}"; do echo ""; done ) +
+ Custom FS write (MB/s):Custom FS read (MB/s):
Device:Count:Average:Fastest:Slowest:Average: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]}
+ +

DietPi-Benchmarks | IO (Network LAN):

- - - - + + + + - $(for i in "${!aBENCH_LAN_INDEX[@]}"; do echo ""; done | sort -nk 1 -t ' ') + $(for i in "${!aBENCH_LAN_INDEX[@]}"; do echo ""; done )
@@ -871,19 +981,27 @@
Device:Total benchmarks:Average:Fastest:Slowest:Count:Average: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]}
_EOF_ # Move HTML page in place - mv index.html /var/www/survey/index.html + if [[ $G_DEBUG == 1 ]]; then + + mv index.html /var/www/survey/debug.html + + else + + mv index.html /var/www/survey/index.html + + fi } diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 6cbaf6444b..9a28174f2c 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,4 +1,85 @@ +v6.23 +(12/05/19) + +Jessie support: +- The support for Debian Jessie is fading constantly by software titles and Debian itself, increasing the effort for us to work around the raising issues: https://github.com/MichaIng/DietPi/issues/2332 +- As a result we move Jessie systems to a dedicated "jessie-support" branch. Next DietPi v6.24 will still be merged into this branch as well, but for following updates it depends on how much additional related issues we face. +- We highly recommend to migrate to Stretch as fast as possible. +- Odroid C1: We have updated the image to Stretch based on ARMbian 4.18 kernel. Existing Jessie installations will be moved to the jessie-support branch: https://github.com/MichaIng/DietPi/issues/2561 + +Buster support: +- DietPi-Software | Resolved the last failing installs on Debian Buster systems by either fixing or disabling them: phpMyAdmin and Tomcat8 are currently not available on non-RPi Buster systems. +- DietPi on Debian Buster x86_64 systems can be considered as compatible and stable now. On ARM devices some last software install tests are outstanding, especially on Raspberry Pi with Raspbian particularities. We will ship experimental images for testing purpose soon. + +Changes / Improvements / Optimisations: +- DietPi-Banner | Added support for DietPi message of the day (MOTD). This is enabled by default, however, can be disabled. Checks for latest MOTD once a day. +- DietPi-Banner | Always prints the local IP during boot mode display: https://github.com/MichaIng/DietPi/issues/2681 +- DietPi-Benchmark | Increased default survey RootFS and RAM benchmark sizes. 100MB (from 10MB) for RootFS. RAM is 1/4 of available. This is ensure a more accurate calculation of throughput when we divide bytes against time, to obtain the MB/s result. Benchmarks now also run at Nice -19 and realtime IO with priority 0 (highest). +- DietPi-Cleaner | Added a confirmation prompt, before removal of offline docs and man pages, as this may cause APT issues in some circumstances. Many thanks to @maartenlangeveld for reporting this issue: https://github.com/MichaIng/DietPi/issues/2751 +- DietPi-LetsEncrypt | When applying to Lighttpd, "webroot" authentication is now used instead of "standalone". This allows the auto-renewal service to succeed while Lighttpd is running. Many thanks to @minnux for testing this method: https://github.com/MichaIng/DietPi/issues/2680#issuecomment-480095449 +- DietPi-Arr_to_RAM | With v6.18 we silently added a new script (for Stretch and above) that allows linking Sonarr/Radarr/Lidarr database files to RAM, increasing access performance, reducing disk I/O and avoiding constant external HDD spinning due to the very regular access to these files. This script has gone through some rework and polishing and can now be enabled to automatically link those databases to RAM on boot and store them back to disk on shutdown. For more details read: https://dietpi.com/phpbb/viewtopic.php?f=8&t=5828. Many thanks to @Dr0bac for providing valuable input and testing the development progress constantly: https://github.com/MichaIng/DietPi/issues/2689 +- DietPi-Drive_Manager | encryptfs and vboxsf (VirtualBox shared folder) fstab entries are now preserved. Many thanks to @johnvick and @Phil1988 for suggesting: https://github.com/MichaIng/DietPi/issues/2078, https://github.com/MichaIng/DietPi/issues/2202 +- DietPi-PREP | The script execution can now be fully automated via environment variables. Many thanks to @FredericGuilbault for adding this feature: https://github.com/MichaIng/DietPi/pull/2756 +- DietPi-Config | Added support to toggle Intel CPU turbo/boost mode. Requires Intel CPU that supports the feature. +- DietPi-Config | G_CHECK_URL: Added ability to change the connection attempts and timeout, before DietPi URL checking assumes a dead link and failure: https://github.com/MichaIng/DietPi/issues/2717 +- DietPi-Config | Serial/UART device handling has been reworked. Serial login consoles can now be toggled for every found serial device individually. On RPi the primary UART can be completely disabled and warnings are prompted if Bluetooth and login console are to be enabled both on ttyAMA0. On update existing systems will be patched so that serial-getty masks and enabled instances are removed if the related serial device does not exist. This solves some error messages during boot. +- DietPi-Config | Network Adapter menu has been cleaned up. Proxy variables are now sourced from "/etc/bashrc.d/dietpi-proxy.sh" and proxy setup outside of DietPi scripts is detected. +- DietPi-NordVPN | Added ability to toggle auto start/connect during boot. +- DietPi-Software | Subsonic: Package has been updated to v6.1.5. Many thanks to @spectrumcomputing: https://github.com/MichaIng/DietPi/pull/2702 +- DietPi-Software | PHP: All systems will be upgraded to PHP7.3 for security, performance, compatibility and consistency across distro versions. Ondrejs (official Debian PHP maintainer) PHP repository (sury.org) is used for this on Jessie and Stretch, so general functionality and trustworthiness is assured. ownCloud and phpBB users will stay on PHP7.2 for where PHP7.3 is not yet supported. Your PHP configurations will be backed up and webserver configurations adjusted to match the new version. Nextcloud 13 and earlier, especially Jessie systems, will be upgraded to Nextcloud 14 to allow PHP7.3. A full Nextcloud backup will be done, your data, settings and custom apps will be preserved. We strongly advice to further upgrade to the current Nextcloud major version via its web UI updater. +- DietPi-Software | Subsonic: Runs now as limited user "subsonic". This change is as well applied to existing installs via patch during DietPi-Update: https://github.com/MichaIng/DietPi/pull/2705 +- DietPi-Software | WireGuard APT packages are now upgraded when running "apt-get upgrade". Many thanks to @swrobel for reporting this issue: https://github.com/MichaIng/DietPi/issues/2671 +- DietPi-Software | LXQt, GIMP, XFCE4 Power manager: Now available for installations. +- DietPi-Software | Plex Media Server: All systems are migrated to the new official APT repository. This allows easy and consistent upgrades via APT. On ARM systems the until now used 3rd party dev2day repo receives no further updates and will be shut down soon, which makes the migration mandatory. Many thanks to @WolfganP for keeping us informed with news about Plex v1.15 and the new APT repo: https://github.com/MichaIng/DietPi/issues/2655 +- DietPi-Software | Logitech Media Server: Now installs the latest nightly version, since no public "releases" are done. As well the systemd service has gone through some update and now runs as limited user to align with other media servers, enhance security and follow the defaults of the DPKG package. The update/change is applied to existing installs via DietPi-Update as well. Your settings/date are preserved. +- DietPi-Software | Nextcloud Talk: We do not apply (D)TLS settings to coTURN any more. Since WebRTC is encrypted by itself there is no security benefit. More importantly Nextcloud Talk does not make use of the required TURNS protocol, so there is absolutely no point to apply these settings. The (D)TLS feature is meant to allow passing firewalls that only allow encrypted traffic. WebRTC, although encrypted, might not pass such firewalls since the encryption is not on transport layer. For those how are interested in further details and discussion: https://github.com/coturn/coturn/issues/33, https://github.com/nextcloud/spreed/issues/257 +- DietPi-Software | SABnzbd: Install latest version via GitHub master and skip adjusting existing config file. Systemd unit and dependencies have been adjusted to match minimum requirements and official documentation. The update will be applied via DietPi v6.23 patch as well. Many thanks to @19eighties for reporting the outdated version: https://github.com/MichaIng/DietPi/issues/2762 +- DietPi-Software | Jackett: On non-ARMv6 devices the new (v0.11+) standalone (non-mono) binary is installed now. This is applied on DietPi-Update as well, preserving your settings: https://github.com/MichaIng/DietPi/pull/2773 +- DietPi-Software | Blynk: Enabled support for Debian Buster by using the new Java 11 binary. +- DietPi-Software | UrBackup: New version 2.3.8 is installed now. Many thanks to @DeathIsUnknown for informing us about the update: https://github.com/MichaIng/DietPi/issues/2783 + +Bug Fixes: +- System | Debian has vastly reduced support for Jessie systems from their official APT repository. The limited possible list entries are applied during DietPi-Update. Many thanks to @BerndKohl for reporting this issue: https://github.com/MichaIng/DietPi/issues/2665 +- DietPi-Set_swapfile | Resolved an issue where on first boot (and when calling the script manually) the swapfile creation is attempted on target file systems that do not support it (BTRFS). Many thanks to @mzramna for reporting this issue: https://github.com/MichaIng/DietPi/issues/719#issuecomment-484205696 +- DietPi-Config | Resolved an issue where proxy settings would not be correct after a reboot. Many thanks to @stephantual for reporting this!: https://github.com/MichaIng/DietPi/issues/2704 +- DietPi-Update | Resolved an issue where on older images first run update didn't finalise as intended, leading to several first run setup issues, depending on the image age. The fix has been applied outside of the releases since only the online part of the updater is affected: https://github.com/MichaIng/DietPi/pull/2684 +- DietPi-Login | Resolved an issue where login as non-root user could result in a "sudo" password prompt or endless failure loop due to missing sudo permissions. Many thanks to @xsak for reporting this issue: https://github.com/MichaIng/DietPi/issues/2667 +- DietPi-Software | Emby Server: Resolved an issue where download failed if the latest release does not contain a Debian package. Many thanks to @niblettr for reporting this issue: https://dietpi.com/phpbb/viewtopic.php?f=11&t=5755 +- DietPi-Software | Transmission: Resolved an issue where double quotes in global software password caused a service startup failure. Many thanks to @Drew80 for reporting this issue: https://github.com/MichaIng/DietPi/issues/2484#issuecomment-480675168 +- DietPi-Software | WireGuard: Resolved an issue where IPv6 connections did not work with enabled IPv6 forwarding. Many thats to @schnuckz for reporting this issue: https://github.com/MichaIng/DietPi/issues/2691 +- DietPi-Software | Subsonic: Resolved an issue where FFmpeg transcoder might not have been applied correctly. Many thanks to @spectrumcomputing for reporting this issue: https://github.com/MichaIng/DietPi/issues/2697 +- DietPi-Software | AmiBerry: Resolved an issue where no login prompt was present when exiting AmiBerry from fastboot mode. Many thanks to @Trigger58 for reporting this issue: https://github.com/MichaIng/DietPi/issues/2703#issuecomment-482471440 +- DietPi-Software | Logitech Media Server: Resolved an issue where certain plugins failed due to missing "libio-socket-ssl-perl". Many thanks to @noobian and @Edward for reporting this issue: https://dietpi.com/phpbb/viewtopic.php?f=9&t=5824 +- DietPi-Software | Fail2Ban: Resolved an issue where the service silently failed due to wrong log level settings on Stretch and Buster systems. Many thanks to @joaofl for reporting this issue: https://github.com/MichaIng/DietPi/issues/90#issuecomment-485140236 +- DietPi-Software | Redis: Resolved an issue on Jessie systems where the service fails to start due to wrong shipped permissions from Debian package: https://github.com/MichaIng/DietPi/issues/2736 +- DietPi-Software | Nextcloud: Resolved an issue on Lighttpd with HTTPS enabled where OPcache settings were not applied as desired, leading to a warning on Nextcloud admin panel. Many thanks to @Borotes for reporting this issue: https://github.com/MichaIng/DietPi/issues/2489 +- DietPi-Software | Nextcloud/ownCloud: Fixed a wrong directive in our Lighttpd configs. Many thanks to @WilburWalsh for reporting this issue: https://github.com/MichaIng/DietPi/issues/2775 +- DietPi-Software | Nextcloud Talk: Resolved an issue where coTURN prints two warnings about deprecated settings on Buster systems, due to some changes with latest versions. +- DietPi-Software | Kodi: Resolved an issue on RPi where Kodi (v18) fails to start when a custom screen resolution was chosen. Many thanks to @johnnypea for reporting this issue: https://dietpi.com/phpbb/viewtopic.php?p=17550#p17550 +- DietPi-Software | Java: Resolved an issue where install fails on Jessie systems since the used jessie-backports APT repo does not exist any more: https://github.com/MichaIng/DietPi/issues/2752 +- DietPi-Software | Java: Resolved an issue where install fails on Buster systems since OpenJDK 8 packages are not available any more on Buster repo. OpenJDK 11 is installed instead, testing with Java software titles is outstanding. +- DietPi-Software | Node.js: Resolved an issue where install failed on ARMv6 since Node 12 does not support it any more. Many thanks to @axwax for reporting this issue: https://github.com/MichaIng/DietPi/issues/2755 +- DietPi-Software | Tor/WiFi Hotspot: Resolved an issue where WiFi Hotspot fails to start when Tor Hotspot is installed. Many thanks to @schnuckz for reporting this issue: https://github.com/MichaIng/DietPi/issues/2673#issuecomment-482605700 +- DietPi-Software | Jackett: Resolved an issue where service start fails after using the internal updater. Many thanks to @DeathIsUnknown for reporting this issue and providing a solution: https://github.com/MichaIng/DietPi/issues/2593#issuecomment-490096681 +- DietPi-Software | Blynk: Resolved an issue where logging failed and changed the default log dir to /var/log/blynk. Many thanks to @Phil1988 for reporting this issue: https://github.com/MichaIng/DietPi/issues/2777 + +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/2784 + +Known/Outstanding Issues: +- DietPi-Config | Enabling WiFi + Ethernet adapters, both on different subnets, breaks WiFi connection in some cases: https://github.com/MichaIng/DietPi/issues/2103 +- DietPi-Config | RPi: Enabling OpenGL/VC4 causes sound card selection to be invalid: https://github.com/MichaIng/DietPi/issues/2173 +- RPi | LXAppearance (on LXDE desktop) 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 + +For all additional issues that may appear after release, please see the following link for active tickets: https://github.com/MichaIng/DietPi/issues + +----------------------------------------------------------------------------------------------------------- + v6.22 (23/03/19) @@ -51,19 +132,6 @@ Bug Fixes: As always, many smaller code performance and stability improvements, visual and spelling fixes have been done, too much to list all of them here. Check out all code changes of this release on GitHub: https://github.com/MichaIng/DietPi/pull/2653/files -Known/Outstanding Issues: -- DietPi-Config | Enabling WiFi + Ethernet adapters, both on different subnets, breaks WiFi connection in some cases: https://github.com/MichaIng/DietPi/issues/2103 -- DietPi-Config | RPi: Enabling OpenGL/VC4 causes sound card selection to be invalid: https://github.com/MichaIng/DietPi/issues/2173 -- DietPi-Drive_Manager | encryptfs is currently not supported and will be removed from fstab when executing drive manager: https://github.com/MichaIng/DietPi/issues/2078 -- RPi | LXAppearance (on LXDE desktop) 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 - -For all additional issues that may appear after release, please see the following link for active tickets: https://github.com/MichaIng/DietPi/issues - ----------------------------------------------------------------------------------------------------------- v6.21 (Hotfix) diff --git a/PREP_SYSTEM_FOR_DIETPI.sh b/PREP_SYSTEM_FOR_DIETPI.sh index 15e1c15444..cbc8cac4c5 100644 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -14,12 +14,19 @@ # - G_HW_ARCH # - G_DISTRO # - G_DISTRO_NAME + # + # The following environment variables can be set to automate the this script (adjust example values to your needs): + # - GITOWNER='MichaIng' (optional, defaults to 'MichaIng') + # - GITBRANCH='master' (must be one of 'master', 'beta' or 'dev') + # - IMAGE_CREATOR='Mr. Tux' + # - PREIMAGE_INFO='Some GNU/Linux' + # - HW_MODEL=0 (must match one of the supported IDs below) + # - WIFI_REQUIRED=0 [01] + # - DISTRO_TARGET=4 [45] (Stretch: 4, Buster: 5) #------------------------------------------------------------------------------------------------ - #Core globals + # Core globals G_PROGRAM_NAME='DietPi-PREP' - G_GITOWNER=${GITOWNER:-MichaIng} - unset GITOWNER #------------------------------------------------------------------------------------------------ # Critical checks and pre-reqs, with exit, prior to initial run of script @@ -32,31 +39,19 @@ fi - #Work inside /tmp as usually ramfs to reduce disk I/O and speed up download and unpacking + # Work inside /tmp as usually ramfs to reduce disk I/O and speed up download and unpacking # - Save full script path, beforehand: https://github.com/MichaIng/DietPi/pull/2341#discussion_r241784962 FP_PREP_SCRIPT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/$(basename "${BASH_SOURCE[0]}")" cd /tmp - #Prefer IPv4 by default, to avoid hanging access attempts in some cases + # APT: Prefer IPv4 by default to avoid hanging access attempts in some cases # - NB: This needs to match the method in: /DietPi/dietpi/func/dietpi-set_hardware preferipv4 enable - # - APT echo 'Acquire::ForceIPv4 "true";' > /etc/apt/apt.conf.d/99-dietpi-force-ipv4 - # - Wget - if grep -q '^[[:blank:]]*prefer-family[[:blank:]]*=' /etc/wgetrc; then - sed -i '/^[[:blank:]]*prefer-family[[:blank:]]*=/c\prefer-family = IPv4' /etc/wgetrc - - elif grep -q '^[[:blank:]#;]*prefer-family[[:blank:]]*=' /etc/wgetrc; then + # 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 - sed -i '/^[[:blank:]#;]*prefer-family[[:blank:]]*=/c\prefer-family = IPv4' /etc/wgetrc - - else - - echo 'prefer-family = IPv4' >> /etc/wgetrc - - fi - - #Check/install minimal APT Pre-Reqs + # Check/install minimal APT Pre-Reqs a_MIN_APT_PREREQS=( 'apt-transport-https' # Allows HTTPS sources for APT @@ -69,11 +64,26 @@ ) - #Removing conflicting /etc/apt/sources.list.d entries + # 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 + [[ -f '/etc/apt/sources.list.d/deb-multimedia.list' ]] && rm /etc/apt/sources.list.d/deb-multimedia.list # - OMV: https://dietpi.com/phpbb/viewtopic.php?f=11&t=2772&p=10646#p10594 - [[ -f /etc/apt/sources.list.d/openmediavault.list ]] && rm /etc/apt/sources.list.d/openmediavault.list + [[ -f '/etc/apt/sources.list.d/openmediavault.list' ]] && rm /etc/apt/sources.list.d/openmediavault.list + + # Fixing sources.list due to Debian dropped Jessie support: https://github.com/MichaIng/DietPi/issues/2665 + if grep -qi 'jessie' /etc/os-release && ! grep -qi 'raspbian' /etc/os-release; then + + if [[ $(uname -m) == 'aarch64' ]]; then + + echo 'deb http://archive.debian.org/debian/ main contrib non-free' > /etc/apt/sources.list + + else + + sed -Ei '/jessie-(backports|updates)/d' /etc/apt/sources.list + + fi + + fi apt-get clean apt-get update @@ -88,10 +98,25 @@ fi done - unset a_MIN_APT_PREREQS - #Setup locale + # Wget: Prefer IPv4 by default to avoid hanging access attempts in some cases + # - NB: This needs to match the method in: /DietPi/dietpi/func/dietpi-set_hardware preferipv4 enable + if grep -q '^[[:blank:]]*prefer-family[[:blank:]]*=' /etc/wgetrc; then + + sed -i '/^[[:blank:]]*prefer-family[[:blank:]]*=/c\prefer-family = IPv4' /etc/wgetrc + + elif grep -q '^[[:blank:]#;]*prefer-family[[:blank:]]*=' /etc/wgetrc; then + + sed -i '/^[[:blank:]#;]*prefer-family[[:blank:]]*=/c\prefer-family = IPv4' /etc/wgetrc + + else + + echo 'prefer-family = IPv4' >> /etc/wgetrc + + fi + + # Setup locale # - Remove existing settings that could break dpkg-reconfigure locales > /etc/environment [[ -f /etc/default/locale ]] && rm /etc/default/locale @@ -118,27 +143,37 @@ export LANG=en_GB.UTF8 export LC_ALL=en_GB.UTF8 - #Select gitbranch - aWHIP_BRANCH=( + # Set Git owner + G_GITOWNER=${GITOWNER:-MichaIng} + unset GITOWNER - 'master' ': Stable release (recommended)' - 'beta' ': Public beta testing branch' - 'dev' ': Unstable dev branch' + # Select Git branch + if ! [[ $GITBRANCH =~ ^(master|beta|dev)$ ]]; then - ) + aWHIP_BRANCH=( - if WHIP_RETURN=$(whiptail --title "$G_PROGRAM_NAME" --menu 'Please select a Git branch:' --default-item 'master' --ok-button 'Ok' --cancel-button 'Exit' --backtitle "$G_PROGRAM_NAME" 12 80 3 "${aWHIP_BRANCH[@]}" 3>&1 1>&2 2>&3); then + 'master' ': Stable release (recommended)' + 'beta' ': Public beta testing branch' + 'dev' ': Unstable dev branch' - G_GITBRANCH=$WHIP_RETURN + ) - else + grep -qi 'jessie' /etc/os-release && aWHIP_BRANCH+=( 'jessie-support' 'EOS') #REMOVE v6.24 - echo -e '[ INFO ] No choice detected. Aborting...\n' - exit 0 + if GITBRANCH=$(whiptail --title "$G_PROGRAM_NAME" --menu 'Please select the Git branch the installer should use:' --default-item 'master' --ok-button 'Ok' --cancel-button 'Exit' --backtitle "$G_PROGRAM_NAME" 12 80 3 "${aWHIP_BRANCH[@]}" 3>&1 1>&2 2>&3); then - fi + unset aWHIP_BRANCH + + else + + echo -e '[ INFO ] No choice detected. Aborting...\n' + exit 0 + + fi - unset aWHIP_BRANCH WHIP_RETURN + fi + G_GITBRANCH=$GITBRANCH + unset GITBRANCH echo "[ INFO ] Selected Git branch: $G_GITOWNER/$G_GITBRANCH" @@ -167,8 +202,7 @@ G_PROGRAM_NAME='DietPi-PREP' G_INIT - DISTRO_TARGET=0 - DISTRO_TARGET_NAME='' + # - Detect the the Debian version of this operating system. if grep -q 'jessie' /etc/os-release; then G_DISTRO=3 @@ -191,6 +225,7 @@ fi + # - Detect the the hardware architecture of this operating system. G_HW_ARCH_DESCRIPTION=$(uname -m) if [[ $G_HW_ARCH_DESCRIPTION == 'armv6l' ]]; then @@ -215,21 +250,11 @@ fi - #WiFi install flag - WIFI_REQUIRED=0 - - #Image creator flags - IMAGE_CREATOR='' - PREIMAGE_INFO='' - - #Setup step, current (used in info) - SETUP_STEP=0 - - #URL connection test var holder - INTERNET_ADDRESS='' - Main(){ + # Setup step, current (used in info) + SETUP_STEP=0 + #------------------------------------------------------------------------------------------------ echo '' G_DIETPI-NOTIFY 2 '-----------------------------------------------------------------------------------' @@ -239,26 +264,29 @@ #------------------------------------------------------------------------------------------------ if [[ -d /DietPi/dietpi || -d /boot/dietpi ]]; then - G_DIETPI-NOTIFY 2 'DietPi system found, running pre-prep' + G_DIETPI-NOTIFY 2 'DietPi system found, removing the old files and stopping services. (pre-prep)' - # - Stop services + # - Stop services: RAMdisk includes (Pre|Post)Boot due to dependencies [[ -f /DietPi/dietpi/dietpi-services ]] && /DietPi/dietpi/dietpi-services stop - [[ -f /etc/systemd/system/dietpi-ramdisk.service ]] && systemctl stop dietpi-ramdisk [[ -f /etc/systemd/system/dietpi-ramlog.service ]] && systemctl stop dietpi-ramlog + [[ -f /etc/systemd/system/dietpi-ramdisk.service ]] && systemctl stop dietpi-ramdisk + + # - Disable services + for i in /etc/systemd/system/dietpi-* + do + + [[ -f $i ]] || continue + systemctl disable ${i##*/} + rm $i + + done # - Delete any previous existing data # Failsafe umount /DietPi [[ -d /DietPi ]] && rm -R /DietPi - [[ -d /boot/dietpi ]] && rm -R /boot/dietpi - - [[ -d /mnt/dietpi-backup ]] && rm -R /mnt/dietpi-backup - [[ -d /mnt/dietpi-sync ]] && rm -R /mnt/dietpi-sync - [[ -d /mnt/dietpi_userdata ]] && rm -R /mnt/dietpi_userdata - - [[ -d /etc/dietpi ]] && rm -R /etc/dietpi # Pre v160 - [[ -d /var/lib/dietpi ]] && rm -R /var/lib/dietpi - [[ -d /var/tmp/dietpi ]] && rm -R /var/tmp/dietpi + rm -Rf /{boot,mnt,etc,var/lib,var/tmp}/dietpi* + rm -f /etc/{bashrc,profile,sysctl}.d/dietpi* [[ -f /root/DietPi-Automation.log ]] && rm /root/DietPi-Automation.log [[ -f /boot/Automation_Format_My_Usb_Drive ]] && rm /boot/Automation_Format_My_Usb_Drive @@ -272,19 +300,29 @@ #------------------------------------------------------------------------------------------------ echo '' G_DIETPI-NOTIFY 2 '-----------------------------------------------------------------------------------' - G_DIETPI-NOTIFY 0 "Step $SETUP_STEP (inputs): Image info / Hardware / WiFi / Distro:" + G_DIETPI-NOTIFY 0 "Step $SETUP_STEP Ask user about: Image info / Hardware / WiFi / Distro:" ((SETUP_STEP++)) G_DIETPI-NOTIFY 2 '-----------------------------------------------------------------------------------' #------------------------------------------------------------------------------------------------ - #Image creator + # Image creator while : do + if [[ $IMAGE_CREATOR ]]; then + + G_WHIP_RETURNED_VALUE=$IMAGE_CREATOR + # unset to force interactive input if disallowed name is detected + unset IMAGE_CREATOR + + else + + G_WHIP_INPUTBOX 'Please enter your name. This will be used to identify the image creator within credits banner.\n\nYou can add your contact information as well for end users.\n\nNB: An entry is required.' - G_WHIP_INPUTBOX 'Please enter your name. This will be used to identify the image creator within credits banner.\n\nYou can add your contact information as well for end users.\n\nNB: An entry is required.' - if (( ! $? )) && [[ $G_WHIP_RETURNED_VALUE ]]; then + fi + + if [[ $G_WHIP_RETURNED_VALUE ]]; then - #Disallowed: + # Disallowed: DISALLOWED_NAME=0 aDISALLOWED_NAMES=( @@ -319,7 +357,6 @@ else IMAGE_CREATOR=$G_WHIP_RETURNED_VALUE - G_DIETPI-NOTIFY 2 "Entered image creator: $IMAGE_CREATOR" break fi @@ -328,22 +365,29 @@ done - #Pre-image used/name - while : - do + G_DIETPI-NOTIFY 2 "Entered image creator: $IMAGE_CREATOR" - G_WHIP_INPUTBOX 'Please enter the name or URL of the pre-image you installed on this system, prior to running this script. This will be used to identify the pre-image credits.\n\nEG: Debian, Raspbian Lite, Meveric, FriendlyARM, or "forum.odroid.com/viewtopic.php?f=ABC&t=XYZ" etc.\n\nNB: An entry is required.' - if (( ! $? )) && [[ $G_WHIP_RETURNED_VALUE ]]; then + # Pre-image used/name + if [[ ! $PREIMAGE_INFO ]]; then - PREIMAGE_INFO=$G_WHIP_RETURNED_VALUE - G_DIETPI-NOTIFY 2 "Entered pre-image info: $PREIMAGE_INFO" - break + while : + do - fi + G_WHIP_INPUTBOX 'Please enter the name or URL of the pre-image you installed on this system, prior to running this script. This will be used to identify the pre-image credits.\n\nEG: Debian, Raspbian Lite, Meveric, FriendlyARM, or "forum.odroid.com/viewtopic.php?f=ABC&t=XYZ" etc.\n\nNB: An entry is required.' + if [[ $G_WHIP_RETURNED_VALUE ]]; then - done + PREIMAGE_INFO=$G_WHIP_RETURNED_VALUE + break - #Hardware selection + fi + + done + + fi + + G_DIETPI-NOTIFY 2 "Entered pre-image info: $PREIMAGE_INFO" + + # Hardware selection # NB: PLEASE ENSURE HW_MODEL INDEX ENTRIES MATCH : PREP, dietpi-obtain_hw_model, dietpi-survey_results, # NBB: DO NOT REORDER INDEX's. These are now fixed and will never change (due to survey results etc) G_WHIP_DEFAULT_ITEM=22 @@ -382,6 +426,7 @@ '68' ': NanoPC T4' '67' ': NanoPi K1 Plus' '14' ': Odroid N1' + '15' ': Odroid N2' '13' ': Odroid U3' '38' ': OrangePi PC 2' '37' ': OrangePi Prime' @@ -400,45 +445,76 @@ ) - G_WHIP_MENU 'Please select the current device this is being installed on:\n - NB: Select "Generic device" if not listed.\n - "Core devices": Are fully supported by DietPi, offering full GPU + Kodi support.\n - "Limited support devices": No GPU support, supported limited to DietPi specific issues only (eg: excludes Kernel/GPU/VPU related items).' - if (( $? )) || [[ -z $G_WHIP_RETURNED_VALUE ]]; then + while : + do - G_DIETPI-NOTIFY 1 'No choice detected. Aborting...\n' - exit 0 + # Check for valid entry, e.g. when set via environment variabe + if disable_error=1 G_CHECK_VALIDINT "$HW_MODEL" 0; then - fi + for i in "${G_WHIP_MENU_ARRAY[@]}" + do + + [[ $HW_MODEL == $i ]] && break 2 + + done + + fi + + G_WHIP_MENU 'Please select the current device this is being installed on:\n - NB: Select "Generic device" if not listed.\n - "Core devices": Are fully supported by DietPi, offering full GPU + Kodi support.\n - "Limited support devices": No GPU support, supported limited to DietPi specific issues only (eg: excludes Kernel/GPU/VPU related items).' + if (( $? )); then + + G_DIETPI-NOTIFY 1 'No choice detected. Aborting...\n' + exit 0 + + elif [[ $G_WHIP_RETURNED_VALUE ]]; then + + HW_MODEL=$G_WHIP_RETURNED_VALUE + break + + fi + + done + G_HW_MODEL=$HW_MODEL + unset HW_MODEL # + Set for future scripts - G_HW_MODEL=$G_WHIP_RETURNED_VALUE echo $G_HW_MODEL > /etc/.dietpi_hw_model_identifier G_DIETPI-NOTIFY 2 "Selected hardware model ID: $G_HW_MODEL" G_DIETPI-NOTIFY 2 "Detected CPU architecture: $G_HW_ARCH_DESCRIPTION (ID: $G_HW_ARCH)" - G_WHIP_MENU_ARRAY=( + # WiFi selection + if [[ $WIFI_REQUIRED != [01] ]]; then - '0' ': I do not require WiFi functionality, skip related package install.' - '1' ': I require WiFi functionality, install related packages.' + G_WHIP_MENU_ARRAY=( - ) + '0' ': I do not require WiFi functionality, skip related package install.' + '1' ': I require WiFi functionality, install related packages.' - G_WHIP_DEFAULT_ITEM=1 - (( $G_HW_MODEL == 20 )) && G_WHIP_DEFAULT_ITEM=0 + ) - if G_WHIP_MENU 'Please select an option:' && (( $G_WHIP_RETURNED_VALUE )); then + G_WHIP_DEFAULT_ITEM=1 + (( $G_HW_MODEL == 20 )) && G_WHIP_DEFAULT_ITEM=0 + if G_WHIP_MENU 'Please select an option:'; then - G_DIETPI-NOTIFY 2 'Marking WiFi as required' - WIFI_REQUIRED=1 - else + WIFI_REQUIRED=$G_WHIP_RETURNED_VALUE + + else + + G_DIETPI-NOTIFY 1 'No choice detected. Aborting...\n' + exit 0 - G_DIETPI-NOTIFY 2 'Marking WiFi as NOT required' + fi fi - #Distro Selection + (( $WIFI_REQUIRED )) && G_DIETPI-NOTIFY 2 'Marking WiFi as required' || G_DIETPI-NOTIFY 2 'Marking WiFi as NOT required' + + # Distro Selection DISTRO_LIST_ARRAY=( + '3' ': jessie-support' #REMOVE v6.24 '4' ': Stretch (current stable release, recommended)' '5' ': Buster (testing only, not officially supported)' @@ -466,25 +542,49 @@ unset DISTRO_LIST_ARRAY - if [[ -z ${G_WHIP_MENU_ARRAY+x} ]]; then + if (( ! ${#G_WHIP_MENU_ARRAY[@]} )); then G_DIETPI-NOTIFY 1 'No available distro versions for this system. Aborting...\n' exit 1 fi - G_WHIP_DEFAULT_ITEM=${G_WHIP_MENU_ARRAY[0]} # Downgrades disabled, so first item matches current/lowest supported distro version - G_WHIP_BUTTON_CANCEL_TEXT='Exit' - G_WHIP_MENU "Please select a distro version to install on this system. Selecting a distro that is older than the current installed on system, is not supported.\n\nCurrently installed:\n - $G_DISTRO $G_DISTRO_NAME" - if (( $? )) || [[ -z $G_WHIP_RETURNED_VALUE ]]; then + while : + do - G_DIETPI-NOTIFY 1 'No choice detected. Aborting...\n' - exit 0 + if disable_error=1 G_CHECK_VALIDINT "$DISTRO_TARGET" 0; then - fi + for i in "${G_WHIP_MENU_ARRAY[@]}" + do - DISTRO_TARGET=$G_WHIP_RETURNED_VALUE - if (( $DISTRO_TARGET == 4 )); then + [[ $DISTRO_TARGET == $i ]] && break 2 + + done + + fi + + G_WHIP_DEFAULT_ITEM=${G_WHIP_MENU_ARRAY[0]} # Downgrades disabled, so first item matches current/lowest supported distro version + G_WHIP_BUTTON_CANCEL_TEXT='Exit' + G_WHIP_MENU "Please select a distro version to install on this system. Selecting a distro that is older than the current installed on system, is not supported.\n\nCurrently installed:\n - $G_DISTRO $G_DISTRO_NAME" + if (( $? )); then + + G_DIETPI-NOTIFY 1 'No choice detected. Aborting...\n' + exit 0 + + else + + DISTRO_TARGET=$G_WHIP_RETURNED_VALUE + break + + fi + + done + + if (( $DISTRO_TARGET == 3 )); then #REMOVE v6.24 + + DISTRO_TARGET_NAME='jessie' + + elif (( $DISTRO_TARGET == 4 )); then DISTRO_TARGET_NAME='stretch' @@ -509,9 +609,9 @@ G_DIETPI-NOTIFY 2 '-----------------------------------------------------------------------------------' #------------------------------------------------------------------------------------------------ - INTERNET_ADDRESS="https://github.com/$G_GITOWNER/DietPi/archive/$G_GITBRANCH.zip" - G_CHECK_URL "$INTERNET_ADDRESS" - G_RUN_CMD wget "$INTERNET_ADDRESS" -O package.zip + local url="https://github.com/$G_GITOWNER/DietPi/archive/$G_GITBRANCH.zip" + G_CHECK_URL "$url" + G_RUN_CMD wget "$url" -O package.zip [[ -d DietPi-$G_GITBRANCH ]] && l_message='Cleaning previously extracted files' G_RUN_CMD rm -R "DietPi-$G_GITBRANCH" l_message='Extracting DietPi sourcecode' G_RUN_CMD unzip package.zip @@ -526,10 +626,6 @@ G_RUN_CMD mv "DietPi-$G_GITBRANCH/config.txt" /boot/ - elif (( $G_HW_MODEL == 10 )); then - - G_RUN_CMD mv "DietPi-$G_GITBRANCH/boot_c1.ini" /boot/boot.ini - elif (( $G_HW_MODEL == 11 )); then G_RUN_CMD mv "DietPi-$G_GITBRANCH/boot_xu4.ini" /boot/boot.ini @@ -581,7 +677,7 @@ G_DISTRO=$DISTRO_TARGET G_DISTRO_NAME=$DISTRO_TARGET_NAME G_HW_MODEL=$G_HW_MODEL G_RUN_CMD /DietPi/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 -i 's@https://oph.mdrjr.net/meveric@http://fuzon.co.uk/meveric@' /etc/apt/sources.list.d/meveric* &> /dev/null + sed -Ei 's@https?://oph\.mdrjr\.net@http://fuzon.co.uk@' /etc/apt/sources.list.d/meveric* &> /dev/null # - (Re)create DietPi logs dir, used by G_AGx G_RUN_CMD mkdir -p /var/tmp/dietpi/logs @@ -635,6 +731,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 + 'dropbear-run' # DietPi default SSH-Client, excluding initramfs integration 'ethtool' # Ethernet link checking 'fake-hwclock' # Hardware clock emulation, to allow correct timestamps during boot before network time sync 'gnupg' # apt-key add @@ -661,7 +758,7 @@ _EOF_ ) # - G_HW_MODEL specific required repo key packages: https://github.com/MichaIng/DietPi/issues/1285#issuecomment-358301273 - if (( $G_HW_MODEL >= 10 )); then + if (( $G_HW_MODEL > 9 )); then G_AGI debian-archive-keyring aPACKAGES_REQUIRED_INSTALL+=('initramfs-tools') # RAM file system initialization, required for generic boot loader, but not required/used by RPi bootloader @@ -683,17 +780,6 @@ _EOF_ fi - # - G_DISTRO specific required packages: - if (( $G_DISTRO < 4 )); then - - aPACKAGES_REQUIRED_INSTALL+=('dropbear') # DietPi default SSH-Client - - else - - aPACKAGES_REQUIRED_INSTALL+=('dropbear-run') # DietPi default SSH-Client (excluding initramfs integration, available since Stretch) - - fi - # - G_HW_MODEL specific required packages: if (( $G_HW_MODEL != 20 )); then @@ -706,6 +792,7 @@ _EOF_ # - G_HW_ARCH specific required Kernel packages # As these are kernel, or bootloader packages, we need to install them directly to allow autoremove of in case older kernel packages: # https://github.com/MichaIng/DietPi/issues/1285#issuecomment-354602594 + # x86_64 if (( $G_HW_ARCH == 10 )); then @@ -770,11 +857,16 @@ _EOF_ # Buster systemd-udevd doesn't support the current raspi-copies-and-fills: https://github.com/MichaIng/DietPi/issues/1286 (( $DISTRO_TARGET < 5 )) && G_AGI raspi-copies-and-fills + # Odroid N2 + elif (( $G_HW_MODEL == 15 )); then + + G_AGI linux-image-arm64-odroid-n2 + # Odroid N1 elif (( $G_HW_MODEL == 14 )); then G_AGI linux-image-arm64-odroid-n1 - #G_AGI libdrm-rockchip1 #Not currently on meveric's repo + #G_AGI libdrm-rockchip1 # Not currently on meveric's repo # Odroid C2 elif (( $G_HW_MODEL == 12 )); then @@ -784,24 +876,17 @@ _EOF_ # Odroid XU3/4/HC1/HC2 elif (( $G_HW_MODEL == 11 )); then - #G_AGI linux-image-4.9-armhf-odroid-xu3 - G_AGI $(dpkg --get-selections | mawk '/^linux-image/ {print $1}') - dpkg --get-selections | grep -q '^linux-image' || G_AGI linux-image-4.14-armhf-odroid-xu4 - - # Odroid C1 - elif (( $G_HW_MODEL == 10 )); then - - G_AGI linux-image-armhf-odroid-c1 + G_AGI linux-image-4.14-armhf-odroid-xu4 # BBB elif (( $G_HW_MODEL == 71 )); then - G_AGI device-tree-compiler #Kern + G_AGI device-tree-compiler # dtoverlay compiler # - Auto detect kernel package incl. ARMbian/others DTB else - AUTO_DETECT_KERN_PKG=$(dpkg --get-selections | grep -E '^linux-(image|dtb)' | awk '{print $1}') + AUTO_DETECT_KERN_PKG=$(dpkg --get-selections | grep -E '^linux-(image|dtb)' | mawk '{print $1}') if [[ $AUTO_DETECT_KERN_PKG ]]; then G_AGI $AUTO_DETECT_KERN_PKG @@ -825,7 +910,7 @@ _EOF_ if (( $G_HW_MODEL != 20 )); then aPACKAGES_REQUIRED_INSTALL+=('firmware-realtek') # Eth/WiFi/BT dongle firmware - aPACKAGES_REQUIRED_INSTALL+=('firmware-linux-nonfree') + aPACKAGES_REQUIRED_INSTALL+=('firmware-linux-nonfree') # Various drivers for generic devices fi @@ -834,18 +919,7 @@ _EOF_ aPACKAGES_REQUIRED_INSTALL+=('firmware-atheros') # WiFi dongle firmware aPACKAGES_REQUIRED_INSTALL+=('firmware-brcm80211') # WiFi dongle firmware aPACKAGES_REQUIRED_INSTALL+=('firmware-iwlwifi') # Intel WiFi dongle/PCI-e firwmare - - # Intel/Nvidia/WiFi (ralink) dongle firmware: https://github.com/MichaIng/DietPi/issues/1675#issuecomment-377806609 - # On Jessie, firmware-misc-nonfree is not available, firmware-ralink instead as dedicated package. - if (( $G_DISTRO < 4 )); then - - aPACKAGES_REQUIRED_INSTALL+=('firmware-ralink') - - else - - aPACKAGES_REQUIRED_INSTALL+=('firmware-misc-nonfree') - - fi + aPACKAGES_REQUIRED_INSTALL+=('firmware-misc-nonfree') # Intel/Nvidia/WiFi (Ralink) dongle firmware fi @@ -999,11 +1073,11 @@ _EOF_ [[ -f /etc/cron.d/make_nas_processes_faster ]] && rm /etc/cron.d/make_nas_processes_faster #----------------------------------------------------------------------------------- - #Boot Logo + # Boot Logo [[ -f /boot/boot.bmp ]] && G_RUN_CMD wget https://github.com/$G_GITOWNER/DietPi/raw/$G_GITBRANCH/.meta/images/dietpi-logo_boot.bmp -O /boot/boot.bmp #----------------------------------------------------------------------------------- - #Bash Profiles + # Bash Profiles # - Pre v6.9 cleaning: sed -i '/\/DietPi/d' /root/.bashrc @@ -1031,7 +1105,7 @@ _EOF_ chmod 4755 $(which sudo) #----------------------------------------------------------------------------------- - #Dir's + # Dirs G_DIETPI-NOTIFY 2 'Configuring DietPi Directories' @@ -1068,7 +1142,7 @@ _EOF_ mkdir -p /mnt/nfs_client #----------------------------------------------------------------------------------- - #Services + # Services G_DIETPI-NOTIFY 2 'Configuring DietPi Services:' @@ -1079,7 +1153,7 @@ _EOF_ G_RUN_CMD systemctl enable dietpi-kill_ssh #----------------------------------------------------------------------------------- - #Cron Jobs + # Cron Jobs G_DIETPI-NOTIFY 2 'Configuring Cron:' @@ -1100,7 +1174,7 @@ _EOF_ G_ERROR_HANDLER #----------------------------------------------------------------------------------- - #Network + # Network G_DIETPI-NOTIFY 2 'Configuring wlan/eth naming to be preferred for networked devices:' ln -sfv /dev/null /etc/systemd/network/99-default.link @@ -1118,7 +1192,7 @@ _EOF_ systemctl disable wpa_supplicant 2> /dev/null && G_DIETPI-NOTIFY 2 'Disabled non-required wpa_supplicant systemd unit' #----------------------------------------------------------------------------------- - #MISC + # MISC G_DIETPI-NOTIFY 2 'Disabling apt-daily services to prevent random APT cache lock' @@ -1155,12 +1229,16 @@ _EOF_ G_DIETPI-NOTIFY 2 'Configuring network interfaces:' - [[ -f /etc/network/interfaces ]] && rm -R /etc/network/interfaces # ARMbian symlink for bulky network-manager + [[ -f '/etc/network/interfaces' ]] && rm -R /etc/network/interfaces # ARMbian symlink for bulky network-manager G_ERROR_HANDLER_COMMAND='/etc/network/interfaces' cat << _EOF_ > $G_ERROR_HANDLER_COMMAND -#/etc/network/interfaces -#Please use DietPi-Config to modify network settings. +# Location: /etc/network/interfaces +# Please modify network settings via: dietpi-config +# Or create your own drop-ins in: /etc/network/interfaces.d/ + +# Drop-in configs +source interfaces.d/* # Local auto lo @@ -1174,7 +1252,7 @@ netmask 255.255.255.0 gateway 192.168.0.1 #dns-nameservers 8.8.8.8 8.8.4.4 -# Wifi +# WiFi #allow-hotplug wlan0 iface wlan0 inet dhcp address 192.168.0.100 @@ -1203,7 +1281,7 @@ _EOF_ fi # Fix rare WiFi interface start issue: https://github.com/MichaIng/DietPi/issues/2074 - [[ -f /etc/network/if-pre-up.d/wireless-tools ]] && sed -i '\|^[[:blank:]]ifconfig "$IFACE" up$|c\\t/sbin/ip link set dev "$IFACE" up' /etc/network/if-pre-up.d/wireless-tools + [[ -f '/etc/network/if-pre-up.d/wireless-tools' ]] && sed -i '\|^[[:blank:]]ifconfig "$IFACE" up$|c\\t/sbin/ip link set dev "$IFACE" up' /etc/network/if-pre-up.d/wireless-tools G_DIETPI-NOTIFY 2 'Tweaking DHCP timeout:' @@ -1284,8 +1362,8 @@ _EOF_ G_DIETPI-NOTIFY 2 'Configuring regional settings (TZdata):' - [[ -f /etc/timezone ]] && rm /etc/timezone - [[ -f /etc/localtime ]] && rm /etc/localtime + [[ -f '/etc/timezone' ]] && rm /etc/timezone + [[ -f '/etc/localtime' ]] && rm /etc/localtime ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime G_RUN_CMD dpkg-reconfigure -f noninteractive tzdata @@ -1295,9 +1373,9 @@ _EOF_ #G_DIETPI-NOTIFY 2 "Configuring regional settings (Locale):" - #Runs at start of script + # Runs at start of script - #G_HW_ARCH specific + # G_HW_ARCH specific G_DIETPI-NOTIFY 2 'Applying G_HW_ARCH specific tweaks:' if (( $G_HW_ARCH == 10 )); then @@ -1319,7 +1397,7 @@ _EOF_ fi - #G_HW_MODEL specific + # G_HW_MODEL specific G_DIETPI-NOTIFY 2 'Appling G_HW_MODEL specific tweaks:' if (( $G_HW_MODEL != 20 )); then @@ -1332,7 +1410,7 @@ _EOF_ #DietPi external USB drive. Power management settings. /dev/sda { - #10 mins + # 10 mins spindown_time = 120 # @@ -1424,7 +1502,7 @@ _EOF_ # - Ensure WiFi module pre-exists G_CONFIG_INJECT '8723bs' '8723bs' /etc/modules - #Rock64, remove HW accell config, as its not currently functional: https://github.com/MichaIng/DietPi/issues/2086 + # Rock64, remove HW accell config, as its not currently functional: https://github.com/MichaIng/DietPi/issues/2086 elif (( $G_HW_MODEL == 43 )); then [[ -f /etc/X11/xorg.conf.d/20-armsoc.conf ]] && rm /etc/X11/xorg.conf.d/20-armsoc.conf @@ -1473,17 +1551,17 @@ _EOF_ G_DIETPI-NOTIFY 2 'Running general cleanup of misc files' # - Remove Bash history file - [[ -f ~/.bash_history ]] && rm ~/.bash_history + [[ -f '/root/.bash_history' ]] && rm /root/.bash_history rm -f /home/*/.bash_history # - Remove Nano history file - [[ -f ~/.nano_history ]] && rm ~/.nano_history + [[ -f '/root/.nano_history' ]] && rm /root/.nano_history rm -f /home/*/.nano_history G_DIETPI-NOTIFY 2 'Removing swapfile from image' - /DietPi/dietpi/func/dietpi-set_dphys-swapfile 0 /var/swap - [[ -e /var/swap ]] && rm /var/swap # still exists on some images... + /DietPi/dietpi/func/dietpi-set_swapfile 0 /var/swap + [[ -e '/var/swap' ]] && rm /var/swap # still exists on some images... # - re-enable for next run G_CONFIG_INJECT 'AUTO_SETUP_SWAPFILE_SIZE=' 'AUTO_SETUP_SWAPFILE_SIZE=1' /DietPi/dietpi.txt @@ -1494,7 +1572,7 @@ _EOF_ (( $G_HW_MODEL == 40 )) && [[ -f /boot/uEnv.txt ]] && sed -i '/^ethaddr/ d' /boot/uEnv.txt # - Set Pi cmdline.txt back to normal - [[ -f /boot/cmdline.txt ]] && sed -i 's/ rootdelay=10//g' /boot/cmdline.txt + [[ -f '/boot/cmdline.txt' ]] && sed -i 's/ rootdelay=10//g' /boot/cmdline.txt G_DIETPI-NOTIFY 2 'Generating default wpa_supplicant.conf' @@ -1528,8 +1606,7 @@ _EOF_ l_message='Detecting additional OS installed on system' G_RUN_CMD os-prober # - Native PC/EFI (assume x86_64 only possible) - if dpkg-query -s 'grub-efi-amd64' &> /dev/null && - [[ -d '/boot/efi' ]]; then + if dpkg-query -s 'grub-efi-amd64' &> /dev/null && [[ -d '/boot/efi' ]]; then l_message='Recreating GRUB-EFI' G_RUN_CMD grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch_grub --recheck @@ -1540,8 +1617,8 @@ _EOF_ G_CONFIG_INJECT 'GRUB_CMDLINE_LINUX_DEFAULT=' 'GRUB_CMDLINE_LINUX_DEFAULT="consoleblank=0 quiet"' /etc/default/grub G_CONFIG_INJECT 'GRUB_CMDLINE_LINUX=' 'GRUB_CMDLINE_LINUX="net.ifnames=0"' /etc/default/grub - G_CONFIG_INJECT 'GRUB_TIMEOUT=' 'GRUB_TIMEOUT=3' /etc/default/grub - l_message='Finalizing GRUB' G_RUN_CMD update-grub + G_CONFIG_INJECT 'GRUB_TIMEOUT=' 'GRUB_TIMEOUT=0' /etc/default/grub + l_message='Finalising GRUB' G_RUN_CMD update-grub fi @@ -1615,7 +1692,7 @@ _EOF_ else - l_message='Enabling dietpi-fs_partition_resize for first boot' G_RUN_CMD systemctl enable dietpi-fs_partition_resize + l_message='Enabling automated partition and file system resize for first boot' G_RUN_CMD systemctl enable dietpi-fs_partition_resize fi @@ -1646,7 +1723,7 @@ _EOF_ rm -Rf /var/log/{,.??,.[^.]}* mount /var/log # Prevent new log files from being written to disk by background processes - cd ~ + cd /root umount /tmp rm -Rf /tmp/{,.??,.[^.]}* mount /tmp # Prevent new tmp files from being written to disk by background processes @@ -1673,16 +1750,15 @@ _EOF_ G_DIETPI-NOTIFY 0 'Completed, disk can now be saved to .img for later use, or, reboot system to start first run of DietPi.' - #Power off system + # Power off system - #Read image + # Read image - #Resize rootfs partition to minimum size +50MB + # Resize rootfs partition to minimum size +50MB } #------------------------------------------------------------------------------------------------ - #Run Main #------------------------------------------------------------------------------------------------ diff --git a/README.md b/README.md index b25f6d8abc..b62e5e7db2 100644 --- a/README.md +++ b/README.md @@ -144,7 +144,7 @@ We are always looking for talented people who believe in the DietPi project, and Vote for new suggestions, feature-, software- or image requests, or add your own to our new FeatHub page: -[![Feature Requests](http://feathub.com/MichaIng/DietPi?format=svg)](http://feathub.com/MichaIng/DietPi) +[![Feature Requests](https://feathub.com/MichaIng/DietPi?format=svg)](https://feathub.com/MichaIng/DietPi) ## License @@ -190,10 +190,11 @@ along with this program. If not, see https://www.gnu.org/licenses/ Links to additional software used in DietPi and their source and build instructions where applicable: - [Linux kernel](https://github.com/torvalds/linux) -- [GNU operating sytem](https://www.gnu.org/) +- [GNU operating system](https://www.gnu.org/) - [Debian distribution](https://salsa.debian.org/) - [Raspberry](https://github.com/raspberrypi) [Pi](https://github.com/RPi-Distro) - [Odroid](https://github.com/hardkernel?tab=repositories) +- [Sparky](https://github.com/sparkysbc?tab=repositories) [SBC](https://github.com/sparky-sbc/sparky-test) - [FriendlyARM](https://github.com/friendlyarm?tab=repositories) - [X.Org-X-Server](https://www.x.org/archive//individual/) - [LXDE desktop](https://github.com/LXDE) diff --git a/boot_c1.ini b/boot_c1.ini deleted file mode 100644 index e36cda9466..0000000000 --- a/boot_c1.ini +++ /dev/null @@ -1,68 +0,0 @@ -# IMPORTANT: -# - Modifications to /boot/boot.ini will not be preserved on reboot. -# - Please ensure you edit from the DietPi-RAMdisk location: /DietPi/boot.ini - -ODROIDC-UBOOT-CONFIG - -setenv m "720p" - -# HDMI DVI Mode Configuration -setenv vout_mode "hdmi" -# setenv vout_mode "dvi" -# setenv vout_mode "vga" - -# HDMI BPP Mode -setenv m_bpp "16" - -# HDMI Hotplug Force (HPD) -# 1 = Enables HOTPlug Detection -# 0 = Disables HOTPlug Detection and force the connected status -setenv hpd "0" - -# CEC Enable/Disable (Requires Hardware Modification) -# 1 = Enables HDMI CEC -# 0 = Disables HDMI CEC -setenv cec "0" - -# PCM5102 I2S Audio DAC -# PCM5102 is an I2S Audio Dac Addon board for ODROID-C1+ -# Uncomment the line below to __ENABLE__ support for this Addon board. -# setenv enabledac "enabledac" - -# UHS Card Configuration -# Uncomment the line below to __DISABLE__ UHS-1 MicroSD support -# This might break boot for some brand models of cards. -setenv disableuhs "disableuhs" - -# Disable VPU (Video decoding engine, Saves RAM!!!) -# 0 = disabled -# 1 = enabled -setenv vpu "0" - -# Disable HDMI Output (Again, saves ram!) -# 0 = disabled -# 1 = enabled -setenv hdmioutput "1" - -# Default Console Device Setting -setenv condev "console=tty0 console=ttyS0,115200n8" - -########################################### - -if test "${hpd}" = "0"; then setenv hdmi_hpd "disablehpd=true"; fi -if test "${cec}" = "1"; then setenv hdmi_cec "hdmitx=cecf"; fi - -# Boot Arguments -setenv bootargs "root=/dev/mmcblk0p2 rootwait ro ${condev} no_console_suspend vdaccfg=0xa000 logo=osd1,loaded,0x7900000,720p,full dmfc=3 cvbsmode=576cvbs hdmimode=${m} m_bpp=${m_bpp} vout=${vout_mode} ${disableuhs} ${hdmi_hpd} ${hdmi_cec} ${enabledac}" - -# Booting -fatload mmc 0:1 0x21000000 uImage -fatload mmc 0:1 0x22000000 uInitrd -fatload mmc 0:1 0x21800000 meson8b_odroidc.dtb -fdt addr 21800000 - -if test "${vpu}" = "0"; then fdt rm /mesonstream; fdt rm /vdec; fdt rm /ppmgr; fi - -if test "${hdmioutput}" = "0"; then fdt rm /mesonfb; fi - -bootm 0x21000000 0x22000000 0x21800000" diff --git a/dietpi.txt b/dietpi.txt index 9d4d78b3f6..444e381da5 100644 --- a/dietpi.txt +++ b/dietpi.txt @@ -7,17 +7,17 @@ #------------------------------------------------------------------------------------------------------ # D I E T - P I -# DietPi-Automation settings, applied on the 1st boot of DietPi, ONCE +# DietPi-Automation settings, applied on 1st boot of DietPi only, ONCE! #------------------------------------------------------------------------------------------------------ ##### Networking Options ##### -# If both Ethernet and Wifi are enabled, Wifi will take priority and Ethernet will be disabled. +# If both Ethernet and WiFi are enabled, WiFi will take priority and Ethernet will be disabled. # 1=enabled AUTO_SETUP_NET_ETHERNET_ENABLED=1 AUTO_SETUP_NET_WIFI_ENABLED=0 -# If using WiFi, please edit the following to pre-enter creds /boot/dietpi-wifi.txt +# If using WiFi, please edit dietpi-wifi.txt to pre-enter credentials. # Enter your Static Network details below, if applicable. AUTO_SETUP_NET_USESTATIC=0 @@ -153,9 +153,8 @@ CONFIG_CPU_ONDEMAND_SAMPLE_RATE=25000 #sampling rate * down factor / 1000 = Milliseconds (40 = 1000ms when sampling rate is 25000) CONFIG_CPU_ONDEMAND_SAMPLE_DOWNFACTOR=80 -#Proxy settings | System-wide proxy settings. Use dietpi-config > networking options to apply. -# NB: Do not modify, you must use dietpi-config to configure/set options -CONFIG_PROXY_ENABLED=0 +#Proxy settings | System-wide proxy settings +# NB: Do not modify, you must use dietpi-config > "Network Options: Adapters" to apply CONFIG_PROXY_ADDRESS=MyProxyServer.com CONFIG_PROXY_PORT=8080 CONFIG_PROXY_USERNAME= @@ -164,9 +163,16 @@ CONFIG_PROXY_PASSWORD= #Delay boot until network is established: 0=disabled | 1=10 second wait max (default) | 2=infinite wait CONFIG_BOOT_WAIT_FOR_NETWORK=1 +#Connection timeout, before DietPi G_CHECK_URL assumes the URL is dead. Increase if you have a "flaky" connection or slow DNS resolver. +# NB: Set this to "0" to allow unlimited time, however this is not recommended to avoid unlimited hanging background scripts, e.g. daily DietPi update check. +CONFIG_G_CHECK_URL_TIMEOUT=5 +#Connection attempts with above timeout each, before DietPi G_CHECK_URL is giving up and prompts an error. +# NB: Set this to "0" to disable URL checking completely, however this is not recommended to avoid harder to debug follow-up errors during APT and download attempts. +CONFIG_G_CHECK_URL_ATTEMPTS=3 + #DietPi checks for updates (allows dietpi to check for updates on a daily basis and boot using a <1kb file download.) CONFIG_CHECK_DIETPI_UPDATES=1 -# Optional: Automatically update DietPi when updates are available. | requires CONFIG_CHECK_DIETPI_UPDATES=1 +# Optional: Automatically update DietPi when updates are available. | requires CONFIG_CHECK_DIETPI_UPDATES=1 CONFIG_AUTO_DIETPI_UPDATES=0 #NTPD Update Mode: 0=disabled | 1=boot only | 2=boot + daily | 3=boot + hourly | 4=Daemon + Drift diff --git a/dietpi/boot b/dietpi/boot index d2ddd649dc..09a1dd27ff 100644 --- a/dietpi/boot +++ b/dietpi/boot @@ -109,7 +109,7 @@ if (( $G_DIETPI_INSTALL_STAGE == 10 )); then # - Set swap - /DietPi/dietpi/func/dietpi-set_dphys-swapfile $(grep -m1 '^[[:blank:]]*AUTO_SETUP_SWAPFILE_SIZE=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') "$(grep -m1 '^[[:blank:]]*AUTO_SETUP_SWAPFILE_LOCATION=' /DietPi/dietpi.txt | sed 's/^[^=]*=//')" + /DietPi/dietpi/func/dietpi-set_swapfile $(grep -m1 '^[[:blank:]]*AUTO_SETUP_SWAPFILE_SIZE=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') "$(grep -m1 '^[[:blank:]]*AUTO_SETUP_SWAPFILE_LOCATION=' /DietPi/dietpi.txt | sed 's/^[^=]*=//')" # - Run survey [[ -f /DietPi/dietpi/.dietpi-survey ]] && rm /DietPi/dietpi/.dietpi-survey diff --git a/dietpi/dietpi-autostart b/dietpi/dietpi-autostart index fa97aa9b36..58c02ca4c8 100644 --- a/dietpi/dietpi-autostart +++ b/dietpi/dietpi-autostart @@ -16,16 +16,15 @@ # - dietpi-autostart int (set value only) #//////////////////////////////////// - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals -------------------------------------------------------------- . /DietPi/dietpi/func/dietpi-globals G_PROGRAM_NAME='DietPi-Autostart' G_CHECK_ROOT_USER G_INIT - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals -------------------------------------------------------------- - #Grab Input (valid integer) - INPUT=-1 - disable_error=1 G_CHECK_VALIDINT "$1" && INPUT=$1 + # Grab Input (valid integer) + disable_error=1 G_CHECK_VALIDINT "$1" && INPUT=$1 || INPUT=-1 #///////////////////////////////////////////////////////////////////////////////////// # MENUS @@ -36,12 +35,12 @@ Apply_Boot_Index(){ - # - Always disable LightDM + # Disable all autostart options first + # - LightDM systemctl disable lightdm &> /dev/null - # - Amiberry | always disable services, service launched by DietPi/login if non fastboot mode + # - Amiberry systemctl disable amiberry &> /dev/null - if (( $G_HW_MODEL < 10 )); then sed -i '/^[[:blank:]]*boot_delay=0/d' /DietPi/config.txt @@ -51,49 +50,54 @@ fi - # - Disable custom launch service + # - Custom script + systemctl disable dietpi-autostart_custom &> /dev/null [[ -f /etc/systemd/system/dietpi-autostart_custom.service ]] && rm /etc/systemd/system/dietpi-autostart_custom.service - # - Disable auto login + # - Auto login local fp_svc='/etc/systemd/system/getty@tty1.service.d' if [[ -d $fp_svc ]]; then [[ -f $fp_svc/dietpi-autologin.conf ]] && rm $fp_svc/dietpi-autologin.conf - [[ $(ls -A $fp_svc) ]] || rmdir $fp_svc + rmdir --ignore-fail-on-non-empty $fp_svc fi #---------------------------------------------------------------------- - #Enable autoboot options - # Custom script, service without auto login: https://github.com/MichaIng/DietPi/issues/1024 + # Enable selected autostart option + # - Custom script, service without auto login: https://github.com/MichaIng/DietPi/issues/1024 if (( $AUTO_START_INDEX == 14 )); then cat << _EOF_ > /etc/systemd/system/dietpi-autostart_custom.service [Unit] Description=DietPi-Autostart (Custom /var/lib/dietpi/dietpi-autostart/custom.sh) -After=dietpi-boot.service dietpi-ramdisk.service dietpi-ramlog.service dietpi-postboot.service rc-local.service -Requires=dietpi-boot.service dietpi-ramdisk.service +Requisite=dietpi-boot.service +After=dietpi-boot.service dietpi-postboot.service rc-local.service +ConditionPathExists=/var/lib/dietpi/dietpi-autostart/custom.sh [Service] Type=idle -ExecStartPre=$(command -v echo) 'Starting DietPi-Autostart (Custom) script' +RemainAfterExit=yes +StandardOutput=tty ExecStartPre=$(command -v chmod) +x /var/lib/dietpi/dietpi-autostart/custom.sh +ExecStartPre=$(which echo) 'Starting DietPi-Autostart (Custom) script...' ExecStart=/var/lib/dietpi/dietpi-autostart/custom.sh -StandardOutput=tty -RemainAfterExit=yes [Install] WantedBy=multi-user.target _EOF_ - systemctl enable dietpi-autostart_custom - # Uae4arm special | fast boot via enabled service + # - Uae4arm special | fast boot via enabled service elif (( $AUTO_START_INDEX == 6 )); then systemctl enable amiberry - # - apply tweaks + # - Enable systemd-logind to have a login console ready after exiting AmiBerry from fastboot + systemctl unmask systemd-logind + systemctl enable systemd-logind &> /dev/null + + # - Apply tweaks if (( $G_HW_MODEL < 10 )); then G_CONFIG_INJECT 'boot_delay=' 'boot_delay=0' /DietPi/config.txt @@ -103,7 +107,7 @@ _EOF_ fi - # Enable auto login + # - Enable auto login elif (( $AUTO_START_INDEX > 0 )); then mkdir -p /etc/systemd/system/getty@tty1.service.d @@ -120,17 +124,17 @@ _EOF_ fi - #Save boot index, if not default 0 + # Save boot index, if not default 0 (( $AUTO_START_INDEX )) && echo $AUTO_START_INDEX > /DietPi/dietpi/.dietpi-autostart_index systemctl daemon-reload } - #TARGETMENUID=0 + # TARGETMENUID=0 Menu_Main(){ - #existing boot flag + # Existing boot flag [[ -f /DietPi/dietpi/.dietpi-autostart_index ]] && AUTO_START_INDEX=$( -1 )); do @@ -240,7 +242,7 @@ _EOF_ done - #Apply boot index + # Apply boot index elif (( $INPUT >= 0 )); then AUTO_START_INDEX=$INPUT diff --git a/dietpi/dietpi-bugreport b/dietpi/dietpi-bugreport index 9843a95405..45453a0e10 100644 --- a/dietpi/dietpi-bugreport +++ b/dietpi/dietpi-bugreport @@ -9,25 +9,26 @@ #//////////////////////////////////// # # Info: + # - Location: /DietPi/dietpi/dietpi-bugreport # - Called from G_ERROR_HANDLER - # - filename /DietPi/dietpi/dietpi-bugreport # - Generates $UNIQUE_ID.7z and uploads to dietpi.com - # Usage: - # - /DietPi/dietpi/dietpi-bugreport Interactively let user send or remove already uploaded bug report - # - /DietPi/dietpi/dietpi-bugreport 1 Automated send of bug report - # - /DietPi/dietpi/dietpi-bugreport -1 Automated remove of already uploaded bug report - #//////////////////////////////////// - - #Import DietPi-Globals --------------------------------------------------------------- + USAGE=' +Usage: dietpi-bugreport +Available commands: + 0, Interactive menu to send or remove bug reports and review upload content + 1 Non-interactively send a bug report + -1 Non-interactively remove an already uploaded bug report +' #//////////////////////////////////// + + # Import DietPi-Globals -------------------------------------------------------------- . /DietPi/dietpi/func/dietpi-globals G_PROGRAM_NAME='DietPi-Bugreport' G_CHECK_ROOT_USER G_CHECK_ROOTFS_RW G_INIT - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals -------------------------------------------------------------- - INPUT=0 - disable_error=1 G_CHECK_VALIDINT "$1" && INPUT=$1 + disable_error=1 G_CHECK_VALIDINT "$1" && INPUT=$1 || INPUT=0 UNIQUE_ID=$(sed -n 5p /DietPi/dietpi/.hw_model) UPLOAD_FILENAME="$UNIQUE_ID.7z" @@ -85,6 +86,7 @@ '/boot/config.txt' '/boot/cmdline.txt' '/boot/boot.ini' + '/boot/uenv.ini' '/boot/uEnv.ini' '/boot/armbianEnv.ini' @@ -113,6 +115,7 @@ '/etc/X11/xorg.conf' '/etc/asound.conf' '/etc/network/interfaces' + '/etc/network/interfaces.d' '/etc/wpa_supplicant/wpa_supplicant.conf' '/etc/fstab' '/etc/sysctl.conf' @@ -132,17 +135,17 @@ Generate_Upload_File(){ # Generate command output file - for ((i=0; i<${#aCOMMAND_LIST[@]}; i++)) + for i in "${aCOMMAND_LIST[@]}" do - echo -e "\n----------\n${aCOMMAND_LIST[$i]}:\n----------" >> CMD_OUT.txt - ${aCOMMAND_LIST[$i]} &>> CMD_OUT.txt + echo -e "\n----------\n$i\n----------" >> CMD_OUT.txt + $i &>> CMD_OUT.txt done unset aCOMMAND_LIST - # - Have the git error in 1st directory. - [[ -f /tmp/.G_ERROR_HANDLER_GITREPORT ]] && cp /tmp/.G_ERROR_HANDLER_GITREPORT ./G_ERROR_HANDLER_GITREPORT + # Have the Git error in 1st directory + [[ -f '/tmp/.G_ERROR_HANDLER_GITREPORT' ]] && cp /tmp/.G_ERROR_HANDLER_GITREPORT ./G_ERROR_HANDLER_GITREPORT G_DIETPI-NOTIFY 2 'Packing upload archive, please wait...' 7zr a -spf "$UPLOAD_FILENAME" ${aFILE_LIST[@]} &> dietpi-bugreport_compress.log @@ -162,12 +165,12 @@ fi - [[ -f dietpi-bugreport_compress.log ]] && rm dietpi-bugreport_compress.log + [[ -f 'dietpi-bugreport_compress.log' ]] && rm dietpi-bugreport_compress.log # Limit filesize UPLOAD_FILESIZE=$(stat -c%s "$UPLOAD_FILENAME") - # - Upload + # Upload if (( $UPLOAD_FILESIZE <= $UPLOAD_FILESIZE_LIMIT )); then G_DIETPI-NOTIFY -2 'Running cURL' @@ -187,6 +190,7 @@ else G_DIETPI-NOTIFY 1 'Failed to connect to SFTP server. Please try again later or report this to DietPi forum or GitHub repo in the first place.' + exit 1 fi @@ -194,12 +198,14 @@ G_DIETPI-NOTIFY 1 'The bug report upload archive appears to be unexpected large. Please inspect and in case clean up the locations to be uploaded, as their size should never be that large:' printf "%s\n" "${aFILE_LIST[@]}" + exit 1 fi else G_DIETPI-NOTIFY 1 'Failed to connect to "dietpi.com". Please try again later or report this to DietPi forum or GitHub repo in the first place.' + exit 1 fi @@ -222,11 +228,10 @@ ) - if G_WHIP_MENU "By sending a bug report file, you can help the developers to investigate your issue, in relation to your report on GitHub or the DietPi forum. + if G_WHIP_MENU 'By sending a bug report file, you can help the developers to investigate your issue, in relation to your report on GitHub or the DietPi forum. The file is sent via secured connection to our SFTP server and is stored there unreadable to the public upload user. -The file will be removed after your issue is solved and you can remove it by yourself as well by running \"dietpi-bugreport -1\" or via this menu. - -Would you like to send a bug report archive or remove an already uploaded one?"; then +The file will be removed after your issue is solved and you can remove it by yourself as well by running "dietpi-bugreport -1" or via this menu.\n +Would you like to send a bug report archive or remove an already uploaded one?'; then if (( $G_WHIP_RETURNED_VALUE == 1 )); then @@ -238,43 +243,42 @@ Would you like to send a bug report archive or remove an already uploaded one?"; elif (( $G_WHIP_RETURNED_VALUE == 3 )); then - G_WHIP_SCROLLBOX "The upload will contain the following command outputs: - -$(printf "\t- %s\n" "${aCOMMAND_LIST[@]}") - -It will contain as well the following files and directories: - + G_WHIP_SCROLLBOX "The upload will contain the following command outputs:\n +$(printf "\t- %s\n" "${aCOMMAND_LIST[@]}")\n +It will contain as well the following files and directories:\n $(printf "\t- %s\n" "${aFILE_LIST[@]}")" fi else - break + exit 0 fi done - if (( $INPUT == 1 || $INPUT == -1 )); then + if (( $INPUT == 1 )); then - if (( $INPUT == 1 )); then + # Generate 7z bug report file + Generate_Upload_File - # Generate 7z bug report file - Generate_Upload_File + elif (( $INPUT == -1 )); then - else + # Send empty file to clear already uploaded bug report + > "$UPLOAD_FILENAME" - # Send empty file to clear already uploaded bug report - > "$UPLOAD_FILENAME" + else - fi - - # Upload bug report file - Upload_Bug_Report + G_DIETPI-NOTIFY 1 "Invalid input command ($INPUT). Aborting... +$USAGE" + exit 1 fi + # Upload bug report file + Upload_Bug_Report + #----------------------------------------------------------------------------------- exit 0 #----------------------------------------------------------------------------------- diff --git a/dietpi/dietpi-cleaner b/dietpi/dietpi-cleaner index 07ed115228..df6f629529 100644 --- a/dietpi/dietpi-cleaner +++ b/dietpi/dietpi-cleaner @@ -8,6 +8,7 @@ #//////////////////////////////////// # # Info: + # - Location: /DietPi/dietpi/dietpi-cleaner # - Cleans "crap" on users system :) # # - Usage @@ -16,17 +17,16 @@ # /DietPi/dietpi/dietpi-cleaner 2 = Run All cleaners (no menu). #//////////////////////////////////// - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals -------------------------------------------------------------- . /DietPi/dietpi/func/dietpi-globals G_PROGRAM_NAME='DietPi-Cleaner' G_CHECK_ROOT_USER G_CHECK_ROOTFS_RW G_INIT - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals -------------------------------------------------------------- - #Grab Input (valid interger) - INPUT=0 - disable_error=1 G_CHECK_VALIDINT "$1" && INPUT=$1 + # Grab Input (valid interger) + disable_error=1 G_CHECK_VALIDINT "$1" && INPUT=$1 || INPUT=0 #///////////////////////////////////////////////////////////////////////////////////// # Globals @@ -48,7 +48,7 @@ #///////////////////////////////////////////////////////////////////////////////////// # Menu #///////////////////////////////////////////////////////////////////////////////////// - #Whippy Whoopy Whiptail! + # Whippy Whoopy Whiptail! TARGETMENUID=0 Menu_Exit(){ @@ -56,22 +56,20 @@ G_WHIP_SIZE_X_MAX=50 if G_WHIP_YESNO "Exit $G_PROGRAM_NAME?"; then - #exit - TARGETMENUID=-1 + TARGETMENUID=-1 # Exit else - #Return to Main Menu - TARGETMENUID=0 + TARGETMENUID=0 # Main menu fi } - #TARGETMENUID=0 + # TARGETMENUID=0 Menu_Main(){ - #Get current RootFS usage + # Get current RootFS usage Update_Space_Used TARGETMENUID=0 @@ -114,10 +112,10 @@ Further information:\n - https://dietpi.com/phpbb/viewtopic.php?f=8&t=5&p=623#p6 Test) - #Enable test + # Enable test DRY_RUN=1 - #check for at least 1 enabled. + # Check for at least 1 enabled. local at_least_one_cleaner_is_enabled=0 for ((i=0; i<$MAX_CLEANERS; i++)) do @@ -133,8 +131,8 @@ Further information:\n - https://dietpi.com/phpbb/viewtopic.php?f=8&t=5&p=623#p6 if (( $at_least_one_cleaner_is_enabled )); then - G_WHIP_YESNO "$G_PROGRAM_NAME will now simulate your enabled cleaners.\n\n(Notice): No data will be modified.\n\nContinue with test run?" - (( $? == 0 )) && Run_Cleaners + G_WHIP_YESNO "$G_PROGRAM_NAME will now simulate your enabled cleaners.\n +(Notice): No data will be modified.\n\nContinue with test run?" && Run_Cleaners else @@ -146,10 +144,10 @@ Further information:\n - https://dietpi.com/phpbb/viewtopic.php?f=8&t=5&p=623#p6 Run) - #Disable test + # Disable test DRY_RUN=0 - #check for at least 1 enabled. + # Check for at least 1 enabled. local at_least_one_cleaner_is_enabled=0 for ((i=0; i<$MAX_CLEANERS; i++)) do @@ -187,23 +185,21 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners } - #TARGETMENUID=1 + # TARGETMENUID=1 Menu_Cleaners(){ - #Return to main menu - TARGETMENUID=0 + TARGETMENUID=0 # Main menu - #Get on/off whilptail status + # Get on/off whilptail status G_WHIP_CHECKLIST_ARRAY=() local OnOff_Status='on' for ((i=0; i<$MAX_CLEANERS; i++)) do - #On/Off status - OnOff_Status='on' - (( ${aEnabledCleaners[$i]} )) || OnOff_Status='off' + # On/Off status + (( ${aEnabledCleaners[$i]} )) && OnOff_Status='on' || OnOff_Status='off' - #Define options + # Define options if (( $i == 0 )); then G_WHIP_CHECKLIST_ARRAY+=("$i " ': Dev - Uninstalls all dev packages (eg: git, lib123-dev).' "$OnOff_Status") @@ -222,7 +218,7 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners elif (( $i == 4 )); then - G_WHIP_CHECKLIST_ARRAY+=("$i " ': Apt - Clears the apt cache and runs a fresh update.' "$OnOff_Status") + G_WHIP_CHECKLIST_ARRAY+=("$i " ': APT - Clears the APT cache and runs a fresh update.' "$OnOff_Status") else @@ -252,11 +248,10 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners } - #TARGETMENUID=2 + # TARGETMENUID=2 Menu_Options_Files(){ - #Return to main menu - TARGETMENUID=0 + TARGETMENUID=0 # Main menu local option_1_text='Include mount directory (/mnt/*) during file scan' local include_mnt_status='Disabled' @@ -277,24 +272,15 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners "$option_1_text") - if (( $INCLUDE_MNT )); then - - INCLUDE_MNT=0 - - else - - INCLUDE_MNT=1 - - fi - - TARGETMENUID=2 + (( $INCLUDE_MNT )) && INCLUDE_MNT=0 || INCLUDE_MNT=1 + TARGETMENUID=2 # Files menu ;; "$option_2_text") nano $FILEPATH_CUSTOMFILES - TARGETMENUID=2 + TARGETMENUID=2 # Files menu ;; @@ -339,13 +325,13 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners Run_Cleaners(){ - #stop services - /DietPi/dietpi/dietpi-services stop + # Stop services + (( $DRY_RUN )) || /DietPi/dietpi/dietpi-services stop Update_Space_Used ROOT_SPACE_USED_BEFORE=$ROOT_SPACE_USED_CURRENT - #Run enabled cleaners + # Run enabled cleaners for ((i=0; i<$MAX_CLEANERS; i++)) do @@ -356,17 +342,18 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners Update_Space_Used ROOT_SPACE_USED_AFTER=$ROOT_SPACE_USED_CURRENT - #start services - /DietPi/dietpi/dietpi-services start + # Start services + (( $DRY_RUN )) || /DietPi/dietpi/dietpi-services start #inform user of space cleared. ROOT_SPACE_FREE_DELTA=$(( $ROOT_SPACE_USED_BEFORE - $ROOT_SPACE_USED_AFTER )) - if (( $INPUT == 0 )); then + if (( $DRY_RUN )); then - G_WHIP_MSG "$G_PROGRAM_NAME completed." + read -p " +$G_PROGRAM_NAME simulation has finished: Press any key to continue..." - elif (( $INPUT == 1 )); then + else G_WHIP_MSG "$G_PROGRAM_NAME has finished cleaning RootFS:\n - $ROOT_SPACE_FREE_DELTA MB of space has been cleared." @@ -380,26 +367,24 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners INFO_CLEAN_NAME='Dev packages' Banner_Cleaning + # Find packages and convert into 1 line string local string_package_names='' while read line do - #Convert lined list into a 1 line string. - string_package_names+="$line " - - done <<< "$(dpkg --get-selections | mawk '/-dev/ {print $1}')" + [[ $line ]] && string_package_names+="$line " - #add other dev packages - string_package_names+='build-essential git' + done <<< "$(dpkg --get-selections *-dev build-essential git make automake autoconf 2> /dev/null | mawk '{print $1}')" - #Purge + # Mark for autoremoval if (( $DRY_RUN )); then - apt-get remove -ys $string_package_names + G_DIETPI-NOTIFY 0 "The following dev packages have been found: ${string_package_names:-}" + G_DIETPI-NOTIFY 2 "$G_PROGRAM_NAME only purges the ones that are not required for any other installed APT package." else - G_AGP $string_package_names + apt-mark auto $string_package_names G_AGA sed -i '/^aSOFTWARE_INSTALL_STATE\[16\]=/c\aSOFTWARE_INSTALL_STATE\[16\]=0' /DietPi/dietpi/.installed &> /dev/null sed -i '/^aSOFTWARE_INSTALL_STATE\[17\]=/c\aSOFTWARE_INSTALL_STATE\[17\]=0' /DietPi/dietpi/.installed &> /dev/null @@ -414,18 +399,32 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners INFO_CLEAN_NAME='Man pages and docs' Banner_Cleaning - local Yes_or_Simulate='-y' - (( $DRY_RUN )) && Yes_or_Simulate='-s' + # Find packages and convert into 1 line string + local string_package_names='' + while read line + do - G_AGP man manpages $Yes_or_Simulate - G_AGA $Yes_or_Simulate + [[ $line ]] && string_package_names+="$line " - #Remove files - if (( ! $DRY_RUN )); then + done <<< "$(dpkg --get-selections man-db manpages 2> /dev/null | mawk '{print $1}')" + + # Mark for autoremoval + if (( $DRY_RUN )); then + + G_DIETPI-NOTIFY 0 "The following man page/docs packages have been found: ${string_package_names:-}" + G_DIETPI-NOTIFY 2 "$G_PROGRAM_NAME only purges the ones that are not required for any other installed APT package." + G_DIETPI-NOTIFY 2 'Installed man/doc disk usage:' + du -sh /usr/share/{man,doc,doc-base} 2> /dev/null - rm -R /usr/share/man - rm -R /usr/share/doc - rm -R /usr/share/doc-base + 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 fi @@ -437,25 +436,25 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners INFO_CLEAN_NAME='Files' Banner_Cleaning - #Generate list of files to include. Remove lines with (#) or (space) or (empty) from list + # Generate list of files to include. Remove lines with (#) or (space) or (empty) from list sed -E '/([#[:blank:]]|^$)/d' $FILEPATH_CUSTOMFILES > $FP_TEMP - #Check include file has at least one value/line to process. + # Check include file has at least one value/line to process. local line_count=$(wc -l < $FP_TEMP) - if (( $line_count == 0 )); then + if (( ! $line_count )); 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 filename entries to match?\n' else - #Create array to hold user includes + # Create array to hold user includes local aCustomFiles=() readarray aCustomFiles < $FP_TEMP - #Generate the find string + # Generate the find string local find_string='' echo -e '\nSearching for filenames matching:' - for ((i=0; i<${#aCustomFiles[@]}; i++)) + for i in ${!aCustomFiles[@]} do echo -e "- ${aCustomFiles[$i]}" @@ -474,10 +473,10 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners echo 'Please wait...' - #Find all matching filenames. + # Find all matching filenames. find / -type f $find_string > $FP_TEMP - #Remove /mnt from find list + # Remove /mnt from find list (( $INCLUDE_MNT )) || sed -i '/\/mnt/d' $FP_TEMP line_count=$(wc -l < $FP_TEMP) @@ -491,7 +490,7 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners fi - #Remove files + # Remove files while read line do @@ -505,9 +504,6 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners done < $FP_TEMP - #delete[] - unset aCustomFiles - fi rm $FP_TEMP @@ -529,7 +525,7 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners } - # Apt caches + # APT caches Run_Cleaner_4(){ INFO_CLEAN_NAME='APT cache and update' @@ -548,7 +544,7 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners #///////////////////////////////////////////////////////////////////////////////////// # Settings File #///////////////////////////////////////////////////////////////////////////////////// - #Define Location + # Define Location FILEPATH_SETTINGS='/DietPi/dietpi/.dietpi-cleaner' FILEPATH_CUSTOMFILES='/DietPi/dietpi/.dietpi-cleaner_custom_files' @@ -556,10 +552,10 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners if [[ -f $FILEPATH_SETTINGS ]]; then - #Get line count - local line_count=$(cat $FILEPATH_SETTINGS | wc -l) + # Get line count + local line_count=$(wc -l < $FILEPATH_SETTINGS) - #Load settings + # Load settings for ((i=0; i<$line_count; i++)) do @@ -569,7 +565,7 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners fi - #Custom filescan options + # Custom filescan options if [[ ! -f $FILEPATH_CUSTOMFILES ]]; then cat << _EOF_ > $FILEPATH_CUSTOMFILES @@ -600,26 +596,26 @@ _EOF_ Write_Settings_File(){ - #Enabled/Disabled Cleaner Settings - rm $FILEPATH_SETTINGS &> /dev/null + # Enabled/Disabled Cleaner Settings + [[ -f $FILEPATH_SETTINGS ]] && rm $FILEPATH_SETTINGS for ((i=0; i<$MAX_CLEANERS; i++)) do - echo -e "${aEnabledCleaners[$i]}" >> $FILEPATH_SETTINGS + echo "${aEnabledCleaners[$i]}" >> $FILEPATH_SETTINGS done } #///////////////////////////////////////////////////////////////////////////////////// - #Main + # Main #///////////////////////////////////////////////////////////////////////////////////// Read_Settings_File #----------------------------------------------------------------------------------- - #Run Menu + # Run Menu if (( $INPUT == 0 )); then - #Start DietPi Menu + # Start DietPi Menu while (( $TARGETMENUID > -1 )); do if (( $TARGETMENUID == 0 )); then @@ -641,13 +637,13 @@ _EOF_ Write_Settings_File #----------------------------------------------------------------------------------- - #Run Enabled cleaners (no menu) + # Run Enabled cleaners (no menu) elif (( $INPUT == 1 )); then Run_Cleaners #----------------------------------------------------------------------------------- - #Run ALL cleaners (no menu) + # Run ALL cleaners (no menu) elif (( $INPUT == 2 )); then for ((i=0; i<$MAX_CLEANERS; i++)) diff --git a/dietpi/dietpi-config b/dietpi/dietpi-config index 7305c4a64c..90d98a20d6 100644 --- a/dietpi/dietpi-config +++ b/dietpi/dietpi-config @@ -17,15 +17,15 @@ # - iEXITONBACK - 1=Exit DietPi-Config when going back to previous menu (applied to TARGETMENUINDEX 8 only!!) #//////////////////////////////////// - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals -------------------------------------------------------------- . /DietPi/dietpi/func/dietpi-globals G_PROGRAM_NAME='DietPi-Config' G_CHECK_ROOT_USER G_CHECK_ROOTFS_RW G_INIT - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals -------------------------------------------------------------- - #Grab Inputs + # Grab Inputs # - target MENU INDEX (valid interger) disable_error=1 G_CHECK_VALIDINT "$1" && TARGETMENUID=$1 @@ -38,29 +38,20 @@ fi #///////////////////////////////////////////////////////////////////////////////////// - #Obtain Hardware Details + # Obtain Hardware Details #///////////////////////////////////////////////////////////////////////////////////// HW_ONBOARD_WIFI=$(sed -n 10p /DietPi/dietpi/.hw_model) FP_CPU_SCALING_GOV='/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors' #///////////////////////////////////////////////////////////////////////////////////// - #Obtain Installed software + # Obtain Installed software #///////////////////////////////////////////////////////////////////////////////////// - Load_Installed_Software(){ - - [[ -f /DietPi/dietpi/.installed ]] && . /DietPi/dietpi/.installed - - } + Load_Installed_Software(){ [[ -f '/DietPi/dietpi/.installed' ]] && . /DietPi/dietpi/.installed; } #///////////////////////////////////////////////////////////////////////////////////// - #Whiltail Info + # Whiltail Info #///////////////////////////////////////////////////////////////////////////////////// - HW_MSG_NOTSUPPORTED='Not Supported' - Info_HW_OptionNotSupported(){ - - G_WHIP_MSG "This option is not available for $G_HW_MODEL_DESCRIPTION" - - } + Info_HW_OptionNotSupported(){ G_WHIP_MSG "This option is not available for $G_HW_MODEL_DESCRIPTION"; } #///////////////////////////////////////////////////////////////////////////////////// # MENUS @@ -73,11 +64,11 @@ REBOOT_REQUIRED=0 - #Interger min/max value holders + # Interger min/max value holders MIN_VALUE=0 MAX_VALUE=0 - #TARGETMENUID=0 + # TARGETMENUID=0 Menu_Main(){ G_WHIP_MENU_ARRAY=('1' ': Display Options') @@ -159,7 +150,7 @@ Menu_Exit(){ - # TARGETMENUID = -1 , if we are to exit the menu + # TARGETMENUID=-1, if we are to exit DietPi-Config G_WHIP_SIZE_X_MAX=50 if G_WHIP_YESNO "Exit $G_PROGRAM_NAME?"; then @@ -212,7 +203,7 @@ } - #TARGETMENUID=1 + # TARGETMENUID=1 Menu_DisplayOptions(){ TARGETMENUID=0 @@ -238,7 +229,7 @@ fi - #Display brightness + # Display brightness G_WHIP_MENU_ARRAY+=('16' ': Display Brightness') local xorg_dpi_current=$(grep -m1 '^[[:blank:]]*SOFTWARE_XORG_DPI=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') @@ -246,7 +237,7 @@ (( $G_HW_MODEL != 20 )) && G_WHIP_MENU_ARRAY+=('14' ': LED Control') - #RPi only + # RPi only if (( $G_HW_MODEL < 10 )); then # HDMI rotation @@ -262,7 +253,7 @@ local overscan_text='[On]' (( $overscan_disabled )) && overscan_text='[Off]' G_WHIP_MENU_ARRAY+=('6' ": Overscan : $overscan_text") - # - Overscan sizes + # - Overscan sizes if (( ! $overscan_disabled )); then local overscan_options=( @@ -319,8 +310,8 @@ fi - #Odroid Remote - if (( $G_HW_MODEL >= 10 && $G_HW_MODEL <= 12 )); then + # Odroid Remote + if (( $G_HW_MODEL > 9 && $G_HW_MODEL < 13 )); then local odroid_remote_text='[Off]' local odroid_remote_enabled=0 @@ -339,8 +330,7 @@ if G_WHIP_MENU 'Please select an option:'; then - #Return to this menu - TARGETMENUID=1 + TARGETMENUID=1 # Return to this menu WHIP_SELECTION_PREVIOUS=$G_WHIP_RETURNED_VALUE @@ -372,9 +362,7 @@ # RPi and Odroids only if (( $G_HW_MODEL < 20 )); then - G_WHIP_MENU_ARRAY=() - - G_WHIP_MENU_ARRAY+=('none' ': Uninstall all panels') + G_WHIP_MENU_ARRAY=('none' ': Uninstall all panels') G_WHIP_MENU_ARRAY+=('waveshare32' ': 320x240 panel with touch input') if (( $G_HW_MODEL < 10 )); then @@ -404,9 +392,10 @@ elif (( $G_WHIP_RETURNED_VALUE == 2 )); then - if (( $G_HW_MODEL < 10 || $G_HW_MODEL == 10 || $G_HW_MODEL == 12 )); then + if (( $G_HW_MODEL < 10 || $G_HW_MODEL == 12 || + ( $G_HW_MODEL == 10 && $G_DISTRO == 3 ) )); then #REMOVE v6.24 - G_WHIP_MSG 'GPU/RAM Memory splits are pre-configured and applied during DietPi-Software setup. \n \nThe split value is optimized based on your software installs, however, feel free to tweak them.' + G_WHIP_MSG 'GPU/RAM Memory splits are pre-configured and applied during DietPi-Software setup.\n\nThe split value is optimized based on your software installs, however, feel free to tweak them.' TARGETMENUID=6 else @@ -417,7 +406,7 @@ elif (( $G_WHIP_RETURNED_VALUE == 6 )); then - #RPI only + # RPi only if (( $G_HW_MODEL < 10 )); then if (( $overscan_disabled )); then @@ -445,7 +434,7 @@ elif (( $G_WHIP_RETURNED_VALUE == 7 )); then - #RPI only + # RPi only if (( $G_HW_MODEL < 10 )); then G_WHIP_MENU_ARRAY=( @@ -479,7 +468,7 @@ elif (( $G_WHIP_RETURNED_VALUE == 8 )); then - #RPI only + # RPi only if (( $G_HW_MODEL < 10 )); then if (( $rpi_camera_module_enabled )); then @@ -501,17 +490,15 @@ elif (( $G_WHIP_RETURNED_VALUE == 9 )); then - #RPI only + # RPi only if (( $G_HW_MODEL < 10 )); then if (( $rpi_camera_led_disabled )); then - #disable G_CONFIG_INJECT 'disable_camera_led=' 'disable_camera_led=0' /DietPi/config.txt else - #enable G_CONFIG_INJECT 'disable_camera_led=' 'disable_camera_led=1' /DietPi/config.txt fi @@ -525,7 +512,6 @@ elif (( $G_WHIP_RETURNED_VALUE == 10 )); then - # - Enable if (( $odroid_remote_enabled )); then /DietPi/dietpi/func/dietpi-set_hardware remoteir none @@ -540,12 +526,10 @@ fi fi - REBOOT_REQUIRED=1 elif (( $G_WHIP_RETURNED_VALUE == 11 )); then - # - Enable if (( $justboom_ir_remote_enabled )); then /DietPi/dietpi/func/dietpi-set_hardware remoteir none @@ -560,7 +544,6 @@ fi fi - REBOOT_REQUIRED=1 elif (( $G_WHIP_RETURNED_VALUE == 12 )); then @@ -570,7 +553,7 @@ G_CONFIG_INJECT 'decode_WVC1=' "decode_WVC1=$G_WHIP_RETURNED_VALUE" /DietPi/config.txt - #https://github.com/MichaIng/DietPi/issues/1487 + # https://github.com/MichaIng/DietPi/issues/1487 local current_gpu_mem=$(grep -m1 '^[[:blank:]]*gpu_mem_1024' /DietPi/config.txt | sed 's/^[^=]*=//g') (( $current_gpu_mem < 128 )) && /DietPi/dietpi/func/dietpi-set_hardware gpumemsplit 128 @@ -585,7 +568,7 @@ G_CONFIG_INJECT 'decode_MPG2=' "decode_MPG2=$G_WHIP_RETURNED_VALUE" /DietPi/config.txt - #https://github.com/MichaIng/DietPi/issues/1487 + # https://github.com/MichaIng/DietPi/issues/1487 local current_gpu_mem=$(grep -m1 '^[[:blank:]]*gpu_mem_1024' /DietPi/config.txt | sed 's/^[^=]*=//g') (( $current_gpu_mem < 128 )) && /DietPi/dietpi/func/dietpi-set_hardware gpumemsplit 128 @@ -612,18 +595,17 @@ G_CONFIG_INJECT 'display_hdmi_rotate=' "display_hdmi_rotate=$G_WHIP_RETURNED_VALUE" /DietPi/config.txt - # rotation 90/270 | invert x/y on FB (Y > X) + # rotation 90/270 | invert x/y on FB (Y > X) if [[ $G_WHIP_RETURNED_VALUE == '1' || $G_WHIP_RETURNED_VALUE == '3' ]]; then Display_Rotation_Calc_XY_Invert 1 - # X > Y + # X > Y else Display_Rotation_Calc_XY_Invert 0 fi - REBOOT_REQUIRED=1 fi @@ -683,14 +665,10 @@ G_WHIP_DEFAULT_ITEM=$current_brightness G_WHIP_INPUTBOX "Please enter a brightness value:\n - Min = $MIN_VALUE | Max = $MAX_VALUE" - if (( $? == 0 )) && [[ $G_WHIP_RETURNED_VALUE ]]; then + if (( $? == 0 )) && G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" $MIN_VALUE $MAX_VALUE; then - if G_CHECK_VALIDINT $G_WHIP_RETURNED_VALUE $MIN_VALUE $MAX_VALUE; then - - # - apply - echo $G_WHIP_RETURNED_VALUE > $fp_brightness/brightness - - fi + # - apply + echo $G_WHIP_RETURNED_VALUE > $fp_brightness/brightness fi @@ -700,8 +678,6 @@ fi - unset afp_current_set_brightness - elif (( $G_WHIP_RETURNED_VALUE == 17 )); then G_WHIP_MENU_ARRAY=( @@ -731,8 +707,6 @@ fi - unset overscan_options - } Xorg_Configure(){ @@ -743,19 +717,18 @@ \nWould you like to continue?"; then G_RUN_CMD Xorg -configure - mv $HOME/xorg.conf.new /etc/X11/xorg.conf + mv /root/xorg.conf.new /etc/X11/xorg.conf fi } - #TARGETMENUID=2 + # TARGETMENUID=2 Menu_DisplayOptions_Driver_Resolution(){ - #Return to Display Options Menu - TARGETMENUID=1 + TARGETMENUID=1 # Return to Display Options menu - #VM + # VM if (( $G_HW_MODEL == 20 )); then local current=$(grep -m1 '^[[:blank:]]*GRUB_GFXMODE=' /etc/default/grub | sed 's/^[^=]*=//') @@ -793,7 +766,7 @@ fi - #Native PC + # Native PC elif (( $G_HW_MODEL == 21 )); then local nvidia_installed=0 @@ -836,18 +809,17 @@ /DietPi/dietpi/dietpi-software install 151 fi - REBOOT_REQUIRED=1 elif [[ $G_WHIP_RETURNED_VALUE == 'Intel' ]]; then if (( $intel_installed )); then - G_AGP xserver-xorg-video-intel #Must test removal deps... + G_AGP i965-va-driver xserver-xorg-video-intel else - G_AG_CHECK_INSTALL_PREREQ xserver-xorg-video-intel libgl1-mesa-dri + G_AG_CHECK_INSTALL_PREREQ i965-va-driver xserver-xorg-video-intel libgl1-mesa-dri Xorg_Configure fi @@ -856,7 +828,7 @@ fi - #RPI + # RPi elif (( $G_HW_MODEL < 10 )); then local framebuffer_x=$(grep -m1 '^[[:blank:]]*framebuffer_width=' /DietPi/config.txt || vcgencmd get_config framebuffer_width) @@ -900,8 +872,7 @@ REBOOT_REQUIRED=1 - #Return to This Menu - TARGETMENUID=2 + TARGETMENUID=2 # Return to this menu if [[ $G_WHIP_RETURNED_VALUE == 'Headless' ]]; then @@ -1015,10 +986,10 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 fi - #Odroid C1 - elif (( $G_HW_MODEL == 10 )); then + # Odroid C1: REMOVE v6.24 + elif (( $G_HW_MODEL == 10 && $G_DISTRO == 3 )); then - #Get Current Values + # Get Current Values local current_resolution=$(mawk -F '"' '/setenv m "/ {print $2;exit}' /DietPi/boot.ini) G_WHIP_MENU_ARRAY=( @@ -1036,8 +1007,7 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 REBOOT_REQUIRED=1 - #Return to This Menu - TARGETMENUID=2 + TARGETMENUID=2 # Return to this menu # - Always reset to HDMI sed -i '/setenv vout_mode /c\setenv vout_mode "hdmi"' /DietPi/boot.ini @@ -1079,10 +1049,10 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 fi - #Odroid xu3/4 + # Odroid XU3/4 elif (( $G_HW_MODEL == 11 )); then - #Get Current Values + # Get Current Values local current_resolution=$(grep -m1 'setenv videoconfig \"' /DietPi/boot.ini) if [[ $current_resolution == *'1920x1080'* ]]; then @@ -1112,8 +1082,7 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 REBOOT_REQUIRED=1 - #Return to This Menu - TARGETMENUID=2 + TARGETMENUID=2 # Return to this menu # - Always reset to hdmi sed -i '/setenv vout /c\setenv vout "hdmi"' /DietPi/boot.ini @@ -1127,10 +1096,10 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 fi - #Odroid C2 + # Odroid C2 elif (( $G_HW_MODEL == 12 )); then - #Get Current Values + # Get Current Values local current_resolution=$(mawk -F '"' '/setenv m "/ {print $2;exit}' /DietPi/boot.ini | sed 's/p/p /') # - NB: also added space after xxxp, so its easier to read, and selects default item. @@ -1158,11 +1127,11 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 [[ $current_resolution != $G_WHIP_RETURNED_VALUE ]] && REBOOT_REQUIRED=1 - # - Always reset vga/dvi options + # Always reset vga/dvi options sed -i '/setenv vout "dvi"/c\# setenv vout "dvi"' /DietPi/boot.ini sed -i '/setenv vout "vga"/c\# setenv vout "vga"' /DietPi/boot.ini - #DVI / VU7+ + # DVI / VU7+ if [[ $G_WHIP_RETURNED_VALUE == '1024x600p 60hz' ]]; then # + DVI mode @@ -1170,20 +1139,19 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 fi - #Remove the space from option - local temp_string=$(echo "$G_WHIP_RETURNED_VALUE" | tr -d '[:blank:]') + # Remove the space from option + local temp_string=${G_WHIP_RETURNED_VALUE//[[:blank:]]/} sed -i "/setenv m /c\setenv m \"$temp_string\"" /DietPi/boot.ini - #Return to This Menu - TARGETMENUID=2 + TARGETMENUID=2 # Return to this menu fi - #Pine a64 + # Pine A64 elif (( $G_HW_MODEL == 40 )); then - #Get Current Values + # Get Current Values local current_resolution=$(grep -m1 '^[[:blank:]]*hdmi_mode=' /DietPi/uEnv.txt | sed 's/^[^=]*=//') [[ $current_resolution ]] || current_resolution='Not set' @@ -1212,8 +1180,7 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 fi - #Return to This Menu - TARGETMENUID=2 + TARGETMENUID=2 # Return to this menu fi @@ -1225,21 +1192,93 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 } - #TARGETMENUID=3 - Menu_AdvancedOptions(){ + # TARGETMENUID=18 + Menu_AdvancedOptions_Serial_UART(){ - TARGETMENUID=0 + TARGETMENUID=18 # Return to this menu + declare -A aSTATE=() G_WHIP_MENU_ARRAY=() - #Swap file + (( $G_HW_MODEL < 10 )) && G_WHIP_MENU_ARRAY+=('' '●─ Toggle console ') + for i in /dev/tty{S,AMA,SAC}[0-9] + do + + [[ -e $i ]] || continue + i=${i#/dev/} + aSTATE[$i]='[Off]' + systemctl -q is-active serial-getty@$i && aSTATE[$i]='[On]' + G_WHIP_MENU_ARRAY+=("$i console" ": ${aSTATE[$i]}") + + done + + # RPi special + local rpi_text='' + if (( $G_HW_MODEL < 10 )); then + + local rpi_text='\n\nOn Raspberry Pi you can additionally enable or disable the primary UART device completely (requires reboot).' + G_WHIP_MENU_ARRAY+=('' '●─ Toggle device ') + + # Onboard WiFi/BT: "enable_uart" toggles ttyS0 (mini UART), disabled by default + if (( $(sed -n 9p /DietPi/dietpi/.hw_model) )); then + + local rpi_uart='ttyS0 (mini UART)' + local rpi_uart_state='[Off]' + grep -q '^[[:blank:]]*enable_uart=1' /DietPi/config.txt && rpi_uart_state='[On]' + + # Nonboard WiFi/BT: "enable_uart" toggles ttyAMA0 (full UART). enabled by default + else + + local rpi_uart='ttyAMA0 (full UART)' + local rpi_uart_state='[On]' + grep -q '^[[:blank:]]*enable_uart=0' /DietPi/config.txt && rpi_uart_state='[Off]' + + fi + G_WHIP_MENU_ARRAY+=("$rpi_uart device" ': $rpi_uart_state') + + fi + + (( ${#G_WHIP_MENU_ARRAY[@]} > 2 )) || { G_WHIP_MSG 'No serial/UART devices have been found on your system.'; TARGETMENUID=3; return; } + + G_WHIP_BUTTON_CANCEL_TEXT='Back' + if G_WHIP_MENU "Select an available serial/UART device to toggle a login console on it.$rpi_text"; then + + if [[ $G_WHIP_RETURNED_VALUE == *'device' ]]; then + + local toggle=1 + [[ $rpi_uart_state == '[On]' ]] && toggle=0 && /DietPi/dietpi/func/dietpi-set_hardware serialconsole disable ${G_WHIP_RETURNED_VALUE%% *} + G_CONFIG_INJECT 'enable_uart=' "enable_uart=$toggle" /DietPi/config.txt + REBOOT_REQUIRED=1 + + elif [[ $G_WHIP_RETURNED_VALUE == *'console' ]]; then + + local toggle='enable' + [[ ${aSTATE[${G_WHIP_RETURNED_VALUE%% *}]} == '[On]' ]] && toggle='disable' + /DietPi/dietpi/func/dietpi-set_hardware serialconsole $toggle ${G_WHIP_RETURNED_VALUE%% *} + + fi + + else + + TARGETMENUID=3 # Return to Advanced Options + + fi + + } + + # TARGETMENUID=3 + Menu_AdvancedOptions(){ + + TARGETMENUID=0 + + # Swap file local swap_size=$(free -m | mawk '/Swap:/ {print $2;exit}') local swap_location=$(grep -m1 '^[[:blank:]]*AUTO_SETUP_SWAPFILE_LOCATION=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') local swap_size_text="$swap_size MB" - (( ! $swap_size )) && swap_size_text='[Off]' - G_WHIP_MENU_ARRAY+=('Swapfile' ": [$swap_size_text | $swap_location]") + (( $swap_size )) || swap_size_text='[Off]' + G_WHIP_MENU_ARRAY=('Swapfile' ": [$swap_size_text | $swap_location]") - #Time sync + # Time sync local ntpd_mode_current=$(grep -m1 '^[[:blank:]]*CONFIG_NTP_MODE=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') local ntpd_mode_text='' if (( $ntpd_mode_current == 0 )); then @@ -1265,29 +1304,26 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 fi G_WHIP_MENU_ARRAY+=('Time sync mode' ": [$ntpd_mode_text]") - local rtc_enabled=0 - local rtc_text='Emulated' - if ! command -v fake-hwclock &> /dev/null; then + # RTC clock + local rtc_enabled=1 + local rtc_text='Hardware' + if command -v fake-hwclock &> /dev/null; then - rtc_enabled=1 - rtc_text='Hardware' + rtc_enabled=0 + rtc_text='Emulated' fi - G_WHIP_MENU_ARRAY+=('RTC mode' ": [$rtc_text]") - G_WHIP_MENU_ARRAY+=('Update firmware' '') + # Hide firmware update on RPi. This is done automatically with simple apt upgrade since raspberrypi-kernel it is no meta-package. + (( $G_HW_MODEL > 9 )) && G_WHIP_MENU_ARRAY+=('Update firmware' '') - #No bluetooth and serial console for VM - if (( $G_HW_MODEL != 20 )); then + # Serial/UART devices + G_WHIP_MENU_ARRAY+=('Serial/UART' ': Manage available devices') - #Serial console - local serialconsole_state=$(grep -m1 '^[[:blank:]]*CONFIG_SERIAL_CONSOLE_ENABLE=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') - local serialconsole_text='[Off]' - (( $serialconsole_state )) && serialconsole_text='[On]' - G_WHIP_MENU_ARRAY+=('Serial console' ": $serialconsole_text") + # Bluetooth: Not for VM + if (( $G_HW_MODEL != 20 )); then - #Bluetooth local bluetooth_state_text='[On]' local bluetooth_state=1 if [[ -f /etc/modprobe.d/disable_bt.conf ]]; then @@ -1300,40 +1336,42 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 fi - #RPi Specific + # RPi specific if (( $G_HW_MODEL < 10 )); then + # I2C state local rpi_i2c_enabled=$(grep -ci -m1 '^[[:blank:]]*dtparam=i2c_arm=on' /DietPi/config.txt) local rpi_i2c_text='[Off]' (( $rpi_i2c_enabled )) && rpi_i2c_text='[On]' + G_WHIP_MENU_ARRAY+=('I2C state' ": $rpi_i2c_text") + # I2C baudrate local rpi_i2cbaudrate_hz=$(grep -m1 '^[[:blank:]]*i2c_arm_baudrate=' /DietPi/config.txt | sed 's/^[^=]*=//') - # Allow commented/non-existent entry, using default value: https://github.com/raspberrypi/firmware/blob/d69aadedb7c146ba5d3b0b45a661e5669a9141c4/boot/overlays/README#L115-L116 + # - Allow commented/non-existent entry, using default value: https://github.com/raspberrypi/firmware/blob/d69aadedb7c146ba5d3b0b45a661e5669a9141c4/boot/overlays/README#L115-L116 rpi_i2cbaudrate_hz="$(( ${rpi_i2cbaudrate_hz:-100000} / 1000 )) kHz" + G_WHIP_MENU_ARRAY+=('I2C frequency' ": [$rpi_i2cbaudrate_hz]") + + # USB max current local usb_max_current_enabled=$(grep -ci -m1 '^[[:blank:]]*max_usb_current=1' /DietPi/config.txt) local rpi_usbmaxcurrent_text='[Off]' (( $usb_max_current_enabled )) && rpi_usbmaxcurrent_text='[On]' + G_WHIP_MENU_ARRAY+=('Max USB current' ": $rpi_usbmaxcurrent_text") - if (( $G_HW_MODEL == 3 )); then + # USB boot option: RPi3 only and not required for RPi3+: https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/msd.md + if (( $G_HW_MODEL == 3 )) && [[ $G_HW_MODEL_DESCRIPTION == *'3 Model '[AB]'+' ]]; then local rpi3_usb_boot_bit_enabled=$(vcgencmd otp_dump | grep -m1 '17:' | grep -ci -m1 '3020000a') local rpi3_usb_boot_bit_enabled_text='[Off]' (( $rpi3_usb_boot_bit_enabled )) && rpi3_usb_boot_bit_enabled_text='[On]' - G_WHIP_MENU_ARRAY+=('USB boot support' ": $rpi3_usb_boot_bit_enabled_text") fi - G_WHIP_MENU_ARRAY+=('Max USB current' ": $rpi_usbmaxcurrent_text") - G_WHIP_MENU_ARRAY+=('I2c state' ": $rpi_i2c_text") - G_WHIP_MENU_ARRAY+=('I2c frequency' ": [$rpi_i2cbaudrate_hz]") - fi if G_WHIP_MENU 'Please select an option:'; then - #Return to This Menu - TARGETMENUID=3 + TARGETMENUID=3 # Return to this menu if [[ $G_WHIP_RETURNED_VALUE == 'Swapfile' ]]; then @@ -1356,7 +1394,7 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 systemctl stop fake-hwclock - # - allow times in the past + # - Allow times in the past G_CONFIG_INJECT 'FORCE=' 'FORCE=force' /etc/default/fake-hwclock systemctl restart fake-hwclock @@ -1391,8 +1429,8 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 local old_firmware=$(ls /lib/modules/) - #PineA64 - if (( $G_HW_MODEL == 40 )); then + # Pine A64: Non-ARMbian only + if [[ $G_HW_MODEL == 40 && -f '/usr/local/sbin/pine64_update_uboot.sh' && -f '/usr/local/sbin/pine64_update_kernel.sh' ]]; then if G_WHIP_YESNO "Would you like to update the firmware/kernel for $G_HW_MODEL_DESCRIPTION? - This will run longsleep's update scripts to update the U-Boot and kernel."; then @@ -1402,7 +1440,7 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 fi - #G_AGDUG based (not all devices support this) + # G_AGDUG based (not all devices support this) elif G_WHIP_YESNO "Would you like to update the firmware/kernel for $G_HW_MODEL_DESCRIPTION? - This will run G_AGDUG, a wrapper for 'apt-get dist-upgrade'\n - Most (but not all) devices allow APT based firmware updates \nNB: If requested to overwrite the current kernel, press TAB and then ENTER (to confirm)."; then @@ -1412,12 +1450,12 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 fi - #Reboot required only, if firmware got actually updated + # Reboot required only, if firmware got actually updated [[ $old_firmware != $(ls /lib/modules/) ]] && REBOOT_REQUIRED=1 elif [[ $G_WHIP_RETURNED_VALUE == 'Max USB current' ]]; then - #Enabled + # Enabled if (( $usb_max_current_enabled == 1 )); then if G_WHIP_YESNO "Current setting: $rpi_usbmaxcurrent_text (1.2AMP)\nWould you like to disable this setting? @@ -1428,7 +1466,7 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 fi - #Disabled + # Disabled elif (( $usb_max_current_enabled == 0 )); then if G_WHIP_YESNO "Current setting: $rpi_usbmaxcurrent_text (0.6AMP)\nWould you like to enable this setting? @@ -1441,7 +1479,7 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 fi - elif [[ $G_WHIP_RETURNED_VALUE == 'I2c state' ]]; then + elif [[ $G_WHIP_RETURNED_VALUE == 'I2C state' ]]; then if (( $rpi_i2c_enabled )); then @@ -1454,14 +1492,14 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 fi REBOOT_REQUIRED=1 - elif [[ $G_WHIP_RETURNED_VALUE == 'I2c frequency' ]]; then + elif [[ $G_WHIP_RETURNED_VALUE == 'I2C frequency' ]]; then - #remove kHz from current - G_WHIP_DEFAULT_ITEM=$(echo -e "$rpi_i2cbaudrate_hz" | tr -d ' kHz') - if G_WHIP_INPUTBOX 'Please enter the required i2c baudrate frequency (kHz).'; then + # Remove kHz from current + G_WHIP_DEFAULT_ITEM=${rpi_i2cbaudrate_hz% kHz} + if G_WHIP_INPUTBOX 'Please enter the required I2C baudrate frequency (kHz).'; then - #check valid int - if G_CHECK_VALIDINT $G_WHIP_RETURNED_VALUE; then + # Check valid int + if G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE"; then /DietPi/dietpi/func/dietpi-set_hardware i2c "$G_WHIP_RETURNED_VALUE" REBOOT_REQUIRED=1 @@ -1470,18 +1508,9 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 fi - elif [[ $G_WHIP_RETURNED_VALUE == 'Serial console' ]]; then - - if (( $serialconsole_state )); then - - /DietPi/dietpi/func/dietpi-set_hardware serialconsole disable - - else - - /DietPi/dietpi/func/dietpi-set_hardware serialconsole enable + elif [[ $G_WHIP_RETURNED_VALUE == 'Serial/UART' ]]; then - fi - REBOOT_REQUIRED=1 + TARGETMENUID=18 elif [[ $G_WHIP_RETURNED_VALUE == 'Bluetooth' ]]; then @@ -1520,35 +1549,27 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 } - #TARGETMENUID=4 + # TARGETMENUID=4 Menu_PerformanceOptions(){ TARGETMENUID=0 - #All devices + # All devices local current_cpu_governor=$(grep -m1 '^[[:blank:]]*CONFIG_CPU_GOVERNOR=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') local frequency_min_cpu_governor=1 local fp_frequency_min_cpu_governor='/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq' - if [[ -f $fp_frequency_min_cpu_governor ]]; then - - frequency_min_cpu_governor=$(( $(<$fp_frequency_min_cpu_governor) / 1000 )) - - fi + [[ -f $fp_frequency_min_cpu_governor ]] && frequency_min_cpu_governor=$(( $(<$fp_frequency_min_cpu_governor) / 1000 )) local frequency_max_cpu_governor=2 local fp_frequency_max_cpu_governor='/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq' - if [[ -f $fp_frequency_max_cpu_governor ]]; then - - frequency_max_cpu_governor=$(( $(<$fp_frequency_max_cpu_governor) / 1000 )) - - fi + [[ -f $fp_frequency_max_cpu_governor ]] && frequency_max_cpu_governor=$(( $(<$fp_frequency_max_cpu_governor) / 1000 )) local cpu_temp=$(G_OBTAIN_CPU_TEMP) local cpu_temp_f='Unknown' if disable_error=1 G_CHECK_VALIDINT "$cpu_temp"; then - cpu_temp_f="$(( ( $cpu_temp * 9 / 5 ) + 32 ))'f" + cpu_temp_f="$(( $cpu_temp * 9/5 + 32 ))'f" cpu_temp+="'c" fi @@ -1557,17 +1578,17 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 local memory_free=$(( $(mawk '/MemFree:/ {print $2;exit}' /proc/meminfo) / 1000 )) local memory_usage=$(( $memory_total - $memory_free )) - #Create Menu List for Whiptail + # Create Menu List for Whiptail # - this will list the menu options available for each device. G_WHIP_MENU_ARRAY=() - #RPi: Overclocking + # RPi: Overclocking (( $G_HW_MODEL < 10 )) && G_WHIP_MENU_ARRAY+=('Overclocking' ': Set Profile') - #CPU GOV + # CPU GOV G_WHIP_MENU_ARRAY+=('CPU Governor' ": [$current_cpu_governor]") - #Ondemand/Interactive Throttle up menu + # Ondemand/Interactive Throttle up menu if [[ $current_cpu_governor == 'ondemand' || $current_cpu_governor == 'conservative' || $current_cpu_governor == 'interactive' ]]; then @@ -1577,7 +1598,7 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 fi - #Ondemand extras + # Ondemand extras if [[ $current_cpu_governor == 'ondemand' ]]; then local current_cpu_sample_rate=$(( $(grep -m1 '^[[:blank:]]*CONFIG_CPU_ONDEMAND_SAMPLE_RATE=' /DietPi/dietpi.txt | sed 's/[^=]*=//') / 1000 )) #convert to ms @@ -1589,7 +1610,18 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 fi - #Define CPU scaling frequency or percent + # Intel boost option (eg: i5-6200U, disables 2.9GHz mode, limits to 2.3GHz) + local intel_boost_disabled=0 + local intel_boost_text='Enabled' + if grep -qi 'genuineintel' /proc/cpuinfo; then + + intel_boost_disabled=$(grep -m1 '^[[:blank:]]*CONFIG_CPU_DISABLE_TURBO=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') + (( $intel_boost_disabled )) && intel_boost_text='Disabled' + G_WHIP_MENU_ARRAY+=('Intel Turbo/Boost' ": [$intel_boost_text]") + + fi + + # Define CPU scaling frequency or percent local type_cpu_freq_info='MHz' # - Intel [[ -f /sys/devices/system/cpu/intel_pstate/max_perf_pct ]] && type_cpu_freq_info='%' @@ -1606,7 +1638,7 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 G_WHIP_MENU_ARRAY+=('CPU Frequency Limits' ": Max = [$user_frequency_max_text] | Min = [$user_frequency_min_text]") - #RPi extras + # RPi extras if (( $G_HW_MODEL < 10 )); then local current_cpu_temp_limit=$(grep -m1 'temp_limit' /DietPi/config.txt | sed 's/^[^=]*=//') @@ -1622,11 +1654,19 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 G_WHIP_MENU "Hardware : $G_HW_MODEL_DESCRIPTION \nCPU Temp: $cpu_temp : $cpu_temp_f\nRAM: $memory_total MB | Used: $memory_usage MB | Free: $memory_free MB" if (( $? == 0 )); then - #Return to this menu - TARGETMENUID=4 + TARGETMENUID=4 # Return to this menu case "$G_WHIP_RETURNED_VALUE" in + 'Intel Turbo/Boost'*) + + (( intel_boost_disabled++ )) + (( $intel_boost_disabled > 1 )) && intel_boost_disabled=0 + G_CONFIG_INJECT 'CONFIG_CPU_DISABLE_TURBO=' "CONFIG_CPU_DISABLE_TURBO=$intel_boost_disabled" /DietPi/dietpi.txt + /DietPi/dietpi/func/dietpi-set_cpu + + ;; + 'Ondemand Down Factor'*) MIN_VALUE=1 @@ -1635,9 +1675,9 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 G_WHIP_INPUTBOX "After Ondemand throttles up, how long before the next sample to check if CPU clocks can be reduced.\n\n - This value * 'Ondemand Sample Rate' = total miliseconds\n - Lower values may help reduce power consumption, however, a 500-1000ms value is recommended to prevent excessive sampling.\n - Valid range: $MIN_VALUE - $MAX_VALUE\n\nIf unsure, set any value, 'Ondemand Down Factor' option on the next screen will list the calculated miliseconds." if (( $? == 0 )); then - if G_CHECK_VALIDINT $G_WHIP_RETURNED_VALUE $MIN_VALUE $MAX_VALUE; then + if G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" $MIN_VALUE $MAX_VALUE; then - sed -i "/CONFIG_CPU_ONDEMAND_SAMPLE_DOWNFACTOR=/c\CONFIG_CPU_ONDEMAND_SAMPLE_DOWNFACTOR=$G_WHIP_RETURNED_VALUE" /DietPi/dietpi.txt + G_CONFIG_INJECT 'CONFIG_CPU_ONDEMAND_SAMPLE_DOWNFACTOR=' "CONFIG_CPU_ONDEMAND_SAMPLE_DOWNFACTOR=$G_WHIP_RETURNED_VALUE" /DietPi/dietpi.txt /DietPi/dietpi/func/dietpi-set_cpu fi @@ -1648,8 +1688,8 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 'Ondemand Sample Rate'*) - local index=-1 - local input_fp=( + local file='' + local afile=( '/sys/devices/system/cpu/cpufreq/ondemand/sampling_rate_min' '/sys/devices/system/cpu/cpufreq/ondemand/min_sampling_rate' @@ -1658,46 +1698,38 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 ) - for ((i=0; i<${#input_fp[@]}; i++)) + for i in ${afile[@]} do - if [[ -f ${input_fp[$i]} ]]; then - - index=$i - break - - fi + [[ -f $i ]] && file=$i && break done - # - Unable to find min value, hard set it - if (( $index <= -1 )); then + if [[ $file ]]; then - MIN_VALUE=20 # RPi is min 20ms, however, no way to currently detect min available values... + MIN_VALUE=$(( $(<$file) / 1000 )) + # - Unable to find min value, hard set it else - MIN_VALUE=$(( $(<${input_fp[$index]}) / 1000 )) + MIN_VALUE=20 # RPi is min 20ms, however, no way to currently detect min available values... fi MAX_VALUE=300 G_WHIP_DEFAULT_ITEM=$current_cpu_sample_rate - G_WHIP_INPUTBOX "Please enter a sample rate in miliseconds, for Ondemand to check if it needs to increase CPU clocks.\nA lower value will make the system more responsive.\n - valid range: $MIN_VALUE - $MAX_VALUE" + G_WHIP_INPUTBOX "Please enter a sample rate in milliseconds, for Ondemand to check if it needs to increase CPU clocks.\nA lower value will make the system more responsive.\n - valid range: $MIN_VALUE - $MAX_VALUE" if (( $? == 0 )); then - if G_CHECK_VALIDINT $G_WHIP_RETURNED_VALUE $MIN_VALUE $MAX_VALUE; then + if G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" $MIN_VALUE $MAX_VALUE; then - sed -i "/CONFIG_CPU_ONDEMAND_SAMPLE_RATE=/c\CONFIG_CPU_ONDEMAND_SAMPLE_RATE=$(( $G_WHIP_RETURNED_VALUE * 1000 ))" /DietPi/dietpi.txt - #Apply changes + G_CONFIG_INJECT 'CONFIG_CPU_ONDEMAND_SAMPLE_RATE=' "CONFIG_CPU_ONDEMAND_SAMPLE_RATE=$(( $G_WHIP_RETURNED_VALUE * 1000 ))" /DietPi/dietpi.txt /DietPi/dietpi/func/dietpi-set_cpu fi fi - unset input_fp - ;; 'CPU Frequency Limits'*) @@ -1714,13 +1746,9 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 readarray available_frequency_array < /tmp/dietpi-available_cpu_freqs local division_factor=1000 #display MHz for user menu # - Intel (disable conversion) - if [[ -f /sys/devices/system/cpu/intel_pstate/max_perf_pct ]]; then + [[ -f /sys/devices/system/cpu/intel_pstate/max_perf_pct ]] && division_factor=1 - division_factor=1 - - fi - - local index=0 #0=max | 1=min + local index=0 # 0=max | 1=min while (( $index < 2 )) do @@ -1844,10 +1872,9 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 G_WHIP_INPUTBOX "When the CPU usage (%) is greater than this value, the CPU frequency will increase from $frequency_min_cpu_governor MHz to $frequency_max_cpu_governor MHz.\n - Valid range $MIN_VALUE - $MAX_VALUE\n - Recommended settings: Desktop = 50%, Server = 85%" if (( $? == 0 )); then - if G_CHECK_VALIDINT $G_WHIP_RETURNED_VALUE $MIN_VALUE $MAX_VALUE; then + if G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" $MIN_VALUE $MAX_VALUE; then G_CONFIG_INJECT 'CONFIG_CPU_USAGE_THROTTLE_UP=' "CONFIG_CPU_USAGE_THROTTLE_UP=$G_WHIP_RETURNED_VALUE" /DietPi/dietpi.txt - #Apply changes /DietPi/dietpi/func/dietpi-set_cpu fi @@ -1864,7 +1891,7 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 G_WHIP_INPUTBOX "When the ARM temperature ('c) reaches this value, the ARM will underclock to reduce heat. \n - Recommended value is 65 \n - Valid range $MIN_VALUE - $MAX_VALUE" if (( $? == 0 )); then - if G_CHECK_VALIDINT $G_WHIP_RETURNED_VALUE $MIN_VALUE $MAX_VALUE; then + if G_CHECK_VALIDINT "$G_WHIP_RETURNED_VALUE" $MIN_VALUE $MAX_VALUE; then if (( $G_WHIP_RETURNED_VALUE > 65 )); then @@ -1889,7 +1916,7 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 Change_Hostname(){ - #Get existing Hostname + # Get existing Hostname local hostname_existing=$( /tmp/available_locale + mawk '/UTF-8/ {print $1}' /usr/share/i18n/SUPPORTED | sed 's/#//g' > /tmp/available_locale G_WHIP_MENU_ARRAY=() local index=0 - # convert for whiptail 0-1=1st option 2-3=2nd + # convert for whiptail 0-1=1st option 2-3=2nd while read line do @@ -2154,8 +2172,7 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 rm /tmp/available_locale G_WHIP_DEFAULT_ITEM=$locale_current - G_WHIP_MENU 'Please select a system locale. DietPi will automatically apply this as the default locale:' - if (( $? == 0 )); then + if G_WHIP_MENU 'Please select a system locale. DietPi will automatically apply this as the default locale:'; then /DietPi/dietpi/func/dietpi-set_software locale "$G_WHIP_RETURNED_VALUE" @@ -2191,7 +2208,7 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 NET_RX_MB='Unknown' NET_TX_MB='Unknown' - #$1 = device+index + # $1 = device+index Net_Update_UsageStats(){ local input=$1 @@ -2206,14 +2223,14 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 NET_RX_BYTE=$( 0 )); then + if disable_error=1 G_CHECK_VALIDINT "$NET_RX_BYTE" 1; then NET_RX_MB="$(( $NET_RX_BYTE / 1024 / 1024 ))MB" fi NET_TX_MB='Unknown' - if disable_error=1 G_CHECK_VALIDINT $NET_TX_BYTE && (( $NET_TX_BYTE > 0 )); then + if disable_error=1 G_CHECK_VALIDINT "$NET_TX_BYTE" 1; then NET_TX_MB="$(( $NET_TX_BYTE / 1024 / 1024 ))MB" @@ -2265,7 +2282,7 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 Network_ETH_CopyCurrentToStatic(){ - #Apply, Only if we have a connection + # Apply, Only if we have a connection if (( $ETH_CONNECTED == 1 )); then ETH_IP_STATIC=$ETH_IP @@ -2279,7 +2296,7 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 Network_WIFI_CopyCurrentToStatic(){ - #Apply, Only if we have a connection + # Apply, Only if we have a connection if (( $WIFI_CONNECTED == 1 )); then WIFI_IP_STATIC=$WIFI_IP @@ -2293,10 +2310,10 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 Network_Restart(){ - #Stop all services (required for hotspot) + # Stop all services (required for hotspot) /DietPi/dietpi/dietpi-services stop - # Enable/Disable wifi modules + # Enable/Disable WiFi modules if (( $WIFI_DISABLED )); then /DietPi/dietpi/func/dietpi-set_hardware wifimodules disable @@ -2307,34 +2324,34 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 fi - #Drop Connections + # Drop Connections G_DIETPI-NOTIFY 0 'Dropping connections, please wait...' ifdown eth$ETH_DEV_INDEX --force &> /dev/null ifdown wlan$WIFI_DEV_INDEX --force &> /dev/null - #Kill dhclient + # Kill dhclient killall dhclient &> /dev/null - #Flush, not viable to handle this if change of IP, requires a detect of SSH loss/ip change, then exit script. - # ip addr flush dev eth$ETH_DEV_INDEX &> /dev/null - # ip addr flush dev wlan$WIFI_DEV_INDEX &> /dev/null + # Flush, not viable to handle this if change of IP, requires a detect of SSH loss/ip change, then exit script. + # - ip addr flush dev eth$ETH_DEV_INDEX &> /dev/null + # - ip addr flush dev wlan$WIFI_DEV_INDEX &> /dev/null - #Restart Networking + # Restart Networking G_DIETPI-NOTIFY 2 'Restarting network, please wait...' systemctl daemon-reload - #Manually bring up adapters + # Manually bring up adapters (( $ETH_DISABLED == 0 )) && ifup eth$ETH_DEV_INDEX --force (( $WIFI_DISABLED == 0 )) && ifup wlan$WIFI_DEV_INDEX --force - #Restart all services (required for hotspot) + # Restart all services (required for hotspot) /DietPi/dietpi/dietpi-services start # - Add a little delay to ensure all network device data are updated (eg: SSID current takes a little longer) G_DIETPI-NOTIFY 2 'Reloading networking data, please wait...' sleep 2 - #Update network data + # Update network data Network_GetData G_DIETPI-NOTIFY 0 'Network restarted' @@ -2351,7 +2368,7 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 Network_ApplyChanges(){ - #Eth + # Eth local eth_enabled_text='' (( $ETH_DISABLED )) && eth_enabled_text='#' @@ -2368,7 +2385,7 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 fi - #Wlan + # WiFi local wifi_enabled_text='' (( $WIFI_DISABLED )) && wifi_enabled_text='#' @@ -2386,8 +2403,12 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 fi cat << _EOF_ > /etc/network/interfaces -#/etc/network/interfaces -#Please use DietPi-Config to modify network settings. +# Location: /etc/network/interfaces +# Please modify network settings via: dietpi-config +# Or create your own drop-ins in: /etc/network/interfaces.d/ + +# Drop-in configs +source interfaces.d/* # Local auto lo @@ -2401,7 +2422,7 @@ netmask $ETH_MASK gateway $ETH_GATEWAY ${eth_dns_text}dns-nameservers $ETH_DNS -# Wifi +# WiFi ${wifi_enabled_text}allow-hotplug wlan$WIFI_DEV_INDEX iface wlan$WIFI_DEV_INDEX inet $wifi_dhcp_static_text address $WIFI_IP @@ -2438,24 +2459,24 @@ _EOF_ # - Update WiFi db/wpa_supplicant /DietPi/dietpi/func/dietpi-wifidb 1 - #Update Current Mode for network restart + # Update Current Mode for network restart ETH_MODE=$ETH_MODE_TARGET WIFI_MODE=$WIFI_MODE_TARGET - #restart net + # Restart net Network_Restart } Change_StaticIp(){ - #Ethernet + # Ethernet if (( $1 == 0 )); then G_WHIP_DEFAULT_ITEM=$ETH_IP_STATIC G_WHIP_INPUTBOX 'Please enter a new static IP address' && ETH_IP_STATIC=$G_WHIP_RETURNED_VALUE - #wifi + # WiFi elif (( $1 == 1 )); then G_WHIP_DEFAULT_ITEM=$WIFI_IP_STATIC @@ -2467,13 +2488,13 @@ _EOF_ Change_StaticGateway(){ - #Ethernet + # Ethernet if (( $1 == 0 )); then G_WHIP_DEFAULT_ITEM=$ETH_GATEWAY_STATIC G_WHIP_INPUTBOX 'Please enter a new static Gateway address' && ETH_GATEWAY_STATIC=$G_WHIP_RETURNED_VALUE - #wifi + # WiFi elif (( $1 == 1 )); then G_WHIP_DEFAULT_ITEM=$WIFI_GATEWAY_STATIC @@ -2485,13 +2506,13 @@ _EOF_ Change_StaticMask(){ - #Ethernet + # Ethernet if (( $1 == 0 )); then G_WHIP_DEFAULT_ITEM=$ETH_MASK_STATIC G_WHIP_INPUTBOX 'Please enter a new static Mask address' && ETH_MASK_STATIC=$G_WHIP_RETURNED_VALUE - #wifi + # WiFi elif (( $1 == 1 )); then G_WHIP_DEFAULT_ITEM=$WIFI_MASK_STATIC @@ -2503,9 +2524,9 @@ _EOF_ Change_StaticDns(){ - #$1 = Adapater type | 0=Eth, 1=WiFi + # $1 = Adapater type | 0=Eth, 1=WiFi - #Store current into var + # Store current into var local current_value=0 # - Ethernet @@ -2522,7 +2543,7 @@ _EOF_ local return_value=$current_value - #Create Menu List for Whiptail + # Create Menu List for Whiptail G_WHIP_MENU_ARRAY=( 'Custom' 'Manually enter your DNS server' @@ -2560,7 +2581,7 @@ _EOF_ fi - #Apply new value + # Apply new value # - Ethernet if (( $1 == 0 )); then @@ -2590,32 +2611,17 @@ _EOF_ ) G_WHIP_DEFAULT_ITEM=$WIFI_COUNTRYCODE - G_WHIP_MENU 'Please select a country, to enable WiFi channels and power ratings allowed in your country.' - if (( $? == 0 )); then - - case "$G_WHIP_RETURNED_VALUE" in + if G_WHIP_MENU 'Please select a country, to enable WiFi channels and power ratings allowed in your country.'; then - 'Manual') + if [[ $G_WHIP_RETURNED_VALUE == 'Manual' ]]; then - G_WHIP_DEFAULT_ITEM=$WIFI_COUNTRYCODE - G_WHIP_INPUTBOX "Please enter a 2 character country code: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2" - if (( $? == 0 )); then - - wifi_country_code_target=$G_WHIP_RETURNED_VALUE - - fi + G_WHIP_DEFAULT_ITEM=$WIFI_COUNTRYCODE + G_WHIP_INPUTBOX 'Please enter a 2 character country code: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2' || return + [[ $G_WHIP_RETURNED_VALUE == [[:upper:]][[:upper:]] ]] || { G_WHIP_MSG "[ERROR] Invalid country code ($G_WHIP_RETURNED_VALUE). Aborting..."; return; } - ;; - - *) - - wifi_country_code_target=$G_WHIP_RETURNED_VALUE - - ;; - - esac + fi + wifi_country_code_target=$G_WHIP_RETURNED_VALUE - #Apply /DietPi/dietpi/func/dietpi-set_hardware wificountrycode "$wifi_country_code_target" # - Restart networking @@ -2626,6 +2632,8 @@ _EOF_ iw reg set $wifi_country_code_target # - Check if country code was successfully applied + # Wait a bid until setting got applied + sleep 0.1 WIFI_COUNTRYCODE=$(iw reg get | mawk '/country/ {print $2;exit}' | tr -d ':') if [[ $WIFI_COUNTRYCODE != $wifi_country_code_target ]]; then @@ -2639,24 +2647,17 @@ _EOF_ Wifi_Reconnect(){ - G_WHIP_YESNO "WiFi will connect to the strongest configured SSID that is secure, with an open SSID being the last priority.\n\nSave all changes and restart networking?\n\nNB: All WiFi connections will be dropped!" - if (( $? == 0 )); then - - #Apply Changes - Network_ApplyChanges - - fi + G_WHIP_YESNO 'WiFi will connect to the strongest configured SSID that is secure, with an open SSID being the last priority.\n\nSave all changes and restart networking?\n\nNB: All WiFi connections will be dropped!' + (( $? == 0 )) && Network_ApplyChanges } Ethernet_Reconnect(){ - G_WHIP_YESNO 'Do you wish to apply settings and reconnect network now? \n\n(NOTICE) All Ethernet connections will be dropped!' - if (( $? == 0 )); then + if G_WHIP_YESNO 'Do you wish to apply settings and reconnect network now? \n\n(NOTICE) All Ethernet connections will be dropped!'; then - #Apply Changes printf '\ec' # clear current terminal screen - echo -e 'Reconnecting Ethernet , please wait' + echo 'Reconnecting Ethernet , please wait...' Network_ApplyChanges fi @@ -2668,13 +2669,13 @@ _EOF_ Network_GetData(){ - #Update DietPi system network details + # Update DietPi system network details /DietPi/dietpi/func/obtain_network_details - #Copy /etc/network/interfaces to /tmp (tmpfs) and pull data from it. + # Copy /etc/network/interfaces to /tmp (tmpfs) and pull data from it. cp /etc/network/interfaces /tmp/net_interfaces - #Reset + # Reset ETH_IP_STATIC=$(mawk '/address / {print $2;exit}' /tmp/net_interfaces) ETH_GATEWAY_STATIC=$(mawk '/gateway / {print $2;exit}' /tmp/net_interfaces) ETH_MASK_STATIC=$(mawk '/netmask / {print $2;exit}' /tmp/net_interfaces) @@ -2714,7 +2715,7 @@ _EOF_ [[ ! $WIFI_SSID_CURRENT ]] && WIFI_SSID_CURRENT='Disconnected / No SSID' WIFI_CRED_INDEX=0 # Which index of SSID/KEY etc we are editing - #Get extra wifi stats + # Get extra WiFi stats WIFI_BITRATE=0 WIFI_SIGNALSTRENGTH=0 # - Hotspot enabled? @@ -2754,20 +2755,20 @@ _EOF_ } - #eth + # Eth if [[ -d /sys/class/net/eth$ETH_DEV_INDEX ]]; then - #Hardware + # Hardware ETH_HARDWARE=1 - #Static or DHCP? + # Static or DHCP? ETH_MODE=$(grep -ci -m1 "iface eth$ETH_DEV_INDEX inet dhcp" /tmp/net_interfaces) ETH_MODE_TARGET=$ETH_MODE - #Connected and Valid IP? + # Connected and Valid IP? ETH_CONNECTED=$(ip -o r l dev eth$ETH_DEV_INDEX | grep -vcim1 '[[:blank:]]linkdown') - #Enabled and Connected + # Enabled and Connected if (( $ETH_DISABLED == 0 && $ETH_CONNECTED == 1 )); then ETH_IP=$(ip a s eth$ETH_DEV_INDEX | grep -m1 '^[[:blank:]]*inet ' | mawk '{print $2}' | sed 's|/.*$||') @@ -2779,19 +2780,20 @@ _EOF_ fi + # WiFi if [[ -d /sys/class/net/wlan$WIFI_DEV_INDEX ]]; then - #Hardware + # Hardware WIFI_HARDWARE=1 - #Static or DHCP? + # Static or DHCP? WIFI_MODE=$(grep -ci -m1 "iface wlan$WIFI_DEV_INDEX inet dhcp" /tmp/net_interfaces) WIFI_MODE_TARGET=$WIFI_MODE - #Connected and Valid IP? + # Connected and Valid IP? WIFI_CONNECTED=$(ip -o r l dev wlan$ETH_DEV_INDEX | grep -vcim1 '[[:blank:]]linkdown') - #Enabled and Connected + # Enabled and Connected if (( $WIFI_DISABLED == 0 && $WIFI_CONNECTED == 1 )); then WIFI_IP=$(ip a s wlan$WIFI_DEV_INDEX | grep -m1 '^[[:blank:]]*inet ' | mawk '{print $2}' | sed 's|/.*$||') @@ -2799,7 +2801,7 @@ _EOF_ WIFI_MASK=$(cidr2mask $(ip a s wlan$WIFI_DEV_INDEX | grep -m1 '^[[:blank:]]*inet ' | mawk '{print $2}' | sed 's|^.*/||')) WIFI_DNS=$(mawk '/nameserver/ {print $2;exit}' /etc/resolv.conf) - #Get extra wifi stats + # Get extra WiFi stats WIFI_BITRATE=$(iwconfig wlan$WIFI_DEV_INDEX | mawk '/Bit Rate/ {print $2;exit}' | sed 's/Rate[:=]//g') WIFI_SIGNALSTRENGTH=$(iwconfig wlan$WIFI_DEV_INDEX | mawk '/Signal level=/ {print $4;exit}' | sed 's/level=//g' | cut -f1 -d "/") @@ -2818,78 +2820,70 @@ _EOF_ fi - #cleanup tmp + # Cleanup tmp [[ -f /tmp/net_interfaces ]] && rm /tmp/net_interfaces } - #TARGETMENUID=8 + # TARGETMENUID=8 Menu_NetworkAdapters(){ - TARGETMENUID=0 - - #Check Network + # Check Network Network_GetData - G_WHIP_MENU_ARRAY=() - - #Obtain enabled/disabled status + # Obtain enabled/disabled status local eth_disabled_text='[On]' (( $ETH_DISABLED )) && eth_disabled_text='[Off]' local wlan_disabled_text='[On]' (( $WIFI_DISABLED )) && wlan_disabled_text='[Off]' - #Obtain Hardware Status + # Obtain Hardware Status local eth_hardware_text='Available' - (( ! $ETH_HARDWARE )) && eth_hardware_text='Not Found' + (( $ETH_HARDWARE )) || eth_hardware_text='Not Found' local wlan_hardware_text='Available' - (( ! $WIFI_HARDWARE )) && wlan_hardware_text='Not Found' + (( $WIFI_HARDWARE )) || wlan_hardware_text='Not Found' - #Obtain Connected/Carrier Status + # Obtain Connected/Carrier Status local eth_connected_text='Disconnected' (( $ETH_CONNECTED )) && eth_connected_text='Connected' local wlan_connected_text='Disconnected' if (( $WIFI_CONNECTED )); then - wlan_connected_text='Connected' - (( $WIFI_HOTSPOT )) && wlan_connected_text='WiFi Hotspot Mode' + (( $WIFI_HOTSPOT )) && wlan_connected_text='WiFi Hotspot Mode' || wlan_connected_text='Connected' fi - #Internet Connection Status - local Internet_connected_text='Please run Internet Test' + # Internet Connection Status + local Internet_connected_text='Run internet connection test' if (( $INTERNET_TEST_STATE == 2 )); then - Internet_connected_text='[On]' + Internet_connected_text='[Success] | Online' elif (( $INTERNET_TEST_STATE == 1 )); then - Internet_connected_text='[Fail] | Offline' + Internet_connected_text='[Failure] | Offine' fi - #Proxy settings (global vars, force an int to obtain current values stored in dietpi.txt) + # Proxy settings: Scrapes $http_proxy, otherwise obtains current values stored in dietpi.txt Load_Proxy_Vars local proxy_state_text='[Off]' (( $PROXY_ENABLED )) && proxy_state_text="[On] | $PROXY_ADDRESS:$PROXY_PORT" - # - Reset init flag. Ensures Menu_Proxy() reloads current settings. - PROXY_ENABLED=-1 - - G_WHIP_MENU_ARRAY+=('' '●─ Adapter Options ') - G_WHIP_MENU_ARRAY+=('Ethernet' ': Change Wired Network Settings') - G_WHIP_MENU_ARRAY+=('WiFi' ': Change Wireless Network Settings') + G_WHIP_MENU_ARRAY=('' '●─ Adapter Options ') + G_WHIP_MENU_ARRAY+=('Ethernet' ": $eth_hardware_text | $eth_disabled_text | $eth_connected_text") + G_WHIP_MENU_ARRAY+=('WiFi' ": $wlan_hardware_text | $wlan_disabled_text | $wlan_connected_text") # - Onboard WiFi - local onboard_wifi_enabled=1 - # RPi 3/ZeroW + # RPi 3/Zero W if (( $HW_ONBOARD_WIFI )); then - if [[ -f /etc/modprobe.d/disable_wifi_rpi3_onboard.conf ]]; then + local onboard_wifi_enabled=1 + if [[ -f '/etc/modprobe.d/disable_wifi_rpi3_onboard.conf' ]]; then onboard_wifi_enabled=0 G_WHIP_MENU_ARRAY+=('Onboard WiFi' ': [Off]') @@ -2904,9 +2898,9 @@ _EOF_ G_WHIP_MENU_ARRAY+=('' '●─ Additional Options ') - #IPv6 + # IPv6 local ipv6_status_text='[WARNING] Not supported or disabled on kernel level!' - if [[ -d /proc/sys/net/ipv6 ]]; then + if [[ -d '/proc/sys/net/ipv6' ]]; then local ipv6_enabled=0 ipv6_status_text='[Off]' @@ -2922,12 +2916,10 @@ _EOF_ local ipv4_preferred=0 local ipv4_status_text='[Off]' - local ipv4_status_long='\nIPv4 : Not preferred over IPv6 with APT and wget' if [[ -f /etc/apt/apt.conf.d/99-dietpi-force-ipv4 ]]; then ipv4_preferred=1 ipv4_status_text='[On]' - ipv4_status_long='\nIPv4 : Preferred over IPv6 with APT and wget' fi G_WHIP_MENU_ARRAY+=('Prefer IPv4' ": $ipv4_status_text") @@ -2936,14 +2928,10 @@ _EOF_ fi - G_WHIP_MENU_ARRAY+=('Test' ': Run the internet connection test') - G_WHIP_MENU_ARRAY+=('Proxy' ': Configure proxy settings') - - G_WHIP_MENU "Ethernet : $eth_hardware_text | $eth_disabled_text | $eth_connected_text \nWifi : $wlan_hardware_text | $wlan_disabled_text | $wlan_connected_text\nIPv6 : $ipv6_status_text$ipv4_status_long\nInternet : $Internet_connected_text\nProxy : $proxy_state_text" - if (( $? == 0 )); then + G_WHIP_MENU_ARRAY+=('Proxy' ": $proxy_state_text") + G_WHIP_MENU_ARRAY+=('Test' ": $Internet_connected_text") - #Return to this Menu - TARGETMENUID=8 + if G_WHIP_MENU 'Please select an option to change:'; then case "$G_WHIP_RETURNED_VALUE" in @@ -2959,20 +2947,16 @@ _EOF_ fi - REBOOT_REQUIRED=1 - G_WHIP_MSG 'Onboard WiFi modules setting applied\n\nNB: A reboot is required for the changes to take effect.' ;; 'IPv6') - #Disable if (( $ipv6_enabled )); then /DietPi/dietpi/func/dietpi-set_hardware enableipv6 0 - #Enable else /DietPi/dietpi/func/dietpi-set_hardware enableipv6 1 @@ -2983,12 +2967,10 @@ _EOF_ 'Prefer IPv4') - #Don't prefer if (( $ipv4_preferred )); then /DietPi/dietpi/func/dietpi-set_hardware preferipv4 0 - #Prefer else /DietPi/dietpi/func/dietpi-set_hardware preferipv4 1 @@ -2999,16 +2981,16 @@ _EOF_ 'Ethernet') - #No hardware found + # No hardware found if (( ! $ETH_HARDWARE )); then - G_WHIP_MSG 'No Ethernet Hardware was found. You are most likely running a Pi Model A.' + G_WHIP_MSG 'No Ethernet hardware was detected on your device.' - #Disabled + # Disabled elif (( $ETH_DISABLED )); then - G_WHIP_YESNO 'Ethernet must be enabled before settings can be changed.\n\nWould you like to enable Ethernet now?\n - (NOTICE) Connections may drop!' - if (( $? == 0 )); then + if G_WHIP_YESNO 'Ethernet must be enabled before settings can be changed.\n +Would you like to enable Ethernet now?\n - (NOTICE) Connections may drop!'; then ETH_DISABLED=0 Network_ApplyChanges @@ -3026,22 +3008,22 @@ _EOF_ 'WiFi') - #Disabled | Offer chance to enable (also enables wifi modules) + # Disabled | Offer chance to enable (also enables WiFi modules) if (( $WIFI_DISABLED )); then - G_WHIP_YESNO 'WiFi must be enabled before settings can be changed.\n\nWould you like to enable WiFi now? \n - (NOTICE) Connections may drop!' - if (( $? == 0 )); then + if G_WHIP_YESNO 'WiFi must be enabled before settings can be changed.\n +Would you like to enable WiFi now? \n - (NOTICE) Connections may drop!'; then WIFI_DISABLED=0 Network_ApplyChanges fi - # - No hardware found + # No hardware found elif (( ! $WIFI_HARDWARE )); then - G_WHIP_YESNO 'No supported Wifi Hardware was found.\n\nWould you like to disable WiFi? \n - (NOTICE) Connections may drop!' - if (( $? == 0 )); then + if G_WHIP_YESNO 'No supported WiFi hardware was found.\n +Would you like to disable WiFi? \n - (NOTICE) Connections may drop!'; then WIFI_DISABLED=1 Network_ApplyChanges @@ -3059,20 +3041,19 @@ _EOF_ 'Test') G_WHIP_DEFAULT_ITEM=$INTERNET_TEST_URL - G_WHIP_INPUTBOX 'Press enter a URL address to test (eg: http://google.com)' - if (( $? == 0 )); then + if G_WHIP_INPUTBOX 'Please enter a URL address to test (eg: https://dietpi.com)'; then INTERNET_TEST_URL=$G_WHIP_RETURNED_VALUE - INTERNET_TEST_STATE=0 #Not tested - G_ERROR_HANDLER_INFO_ONLY=1 retry_max=2 G_CHECK_URL "$INTERNET_TEST_URL" + INTERNET_TEST_STATE=0 # Not tested + G_ERROR_HANDLER_INFO_ONLY=1 G_CHECK_URL "$INTERNET_TEST_URL" if (( $G_ERROR_HANDLER_EXITCODE_RETURN == 0 )); then - INTERNET_TEST_STATE=2 #Online + INTERNET_TEST_STATE=2 # Online else - INTERNET_TEST_STATE=1 #Failed + INTERNET_TEST_STATE=1 # Failed fi @@ -3088,14 +3069,15 @@ _EOF_ esac - #Cancel + # Cancel else - #Exit DietPi-Config on back to previous menu? + TARGETMENUID=0 # Return to main menu + + # Exit DietPi-Config on back to previous menu? if (( $EXITONBACK == 1 )); then - #Return to this menu - TARGETMENUID=8 + TARGETMENUID=8 # Return to this menu Menu_Exit fi @@ -3104,7 +3086,7 @@ _EOF_ } - #TARGETMENUID=9 + # TARGETMENUID=9 Menu_NetworkAdapters_Ethernet(){ TARGETMENUID=8 @@ -3143,8 +3125,7 @@ _EOF_ 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 - #Return to this menu - TARGETMENUID=9 + TARGETMENUID=9 # Return to this menu WHIP_SELECTION_PREVIOUS=$G_WHIP_RETURNED_VALUE @@ -3230,7 +3211,7 @@ _EOF_ } - #TARGETMENUID=10 + # TARGETMENUID=10 Menu_NetworkAdapters_Wifi(){ TARGETMENUID=8 @@ -3242,7 +3223,7 @@ _EOF_ G_WHIP_MENU_ARRAY=('' '●─ Basic Options ') - #WiFi Hotspot Menu + # WiFi Hotspot Menu if (( $WIFI_HOTSPOT )); then # - Load current details into global vars, once. @@ -3254,7 +3235,7 @@ _EOF_ fi - # N enabled? + # - N enabled? local hotspot_n_enabled=0 local hotspot_n_text='Disabled' if grep -q '^ieee80211n=1' /etc/hostapd/hostapd.conf; then @@ -3264,18 +3245,14 @@ _EOF_ fi - # toggle + # - Toggle local hotspot_active_state=$(systemctl is-active hostapd | grep -ci -m1 '^active' ) - local hotspot_status_text='Status : ' - local hotspot_active_state_text='[Enabled] | Select to turn off hotspot' - if (( ! $hotspot_active_state )); then + local hotspot_status_text='Status : Offline' + local hotspot_active_state_text='[Disabled] | Select to turn on hotspot' + if (( $hotspot_active_state )); then - hotspot_active_state_text='[Disabled] | Select to turn on hotspot' - hotspot_status_text+='Offline' - - else - - hotspot_status_text+='Online' + hotspot_status_text+='Status : Online' + hotspot_active_state_text='[Enabled] | Select to turn off hotspot' fi @@ -3286,16 +3263,16 @@ _EOF_ description_text+=$hotspot_status_text - #WiFi Menu + # WiFi Menu else # - Get current Mode details local mode_current='DHCP' - (( $WIFI_MODE == 0 )) && mode_current='STATIC' + (( $WIFI_MODE )) || mode_current='STATIC' # - Target Details local mode_target='DHCP' - (( $WIFI_MODE_TARGET == 0 )) && mode_target='STATIC' + (( $WIFI_MODE_TARGET )) || mode_target='STATIC' G_WHIP_MENU_ARRAY+=('Scan' ': Scan and configure SSID') @@ -3332,7 +3309,6 @@ _EOF_ fi - G_WHIP_MENU_ARRAY+=('' '●─ Additional Options ') # - Unset country code? if [[ $WIFI_COUNTRYCODE == '00' ]]; then @@ -3361,8 +3337,7 @@ _EOF_ G_WHIP_DEFAULT_ITEM=$WHIP_SELECTION_PREVIOUS if G_WHIP_MENU "$description_text"; then - #Return to this menu - TARGETMENUID=10 + TARGETMENUID=10 # Return to this menu WHIP_SELECTION_PREVIOUS=$G_WHIP_RETURNED_VALUE @@ -3545,7 +3520,7 @@ _EOF_ } - #TARGETMENUID=11 + # TARGETMENUID=11 Menu_Tools(){ TARGETMENUID=0 @@ -3579,13 +3554,13 @@ _EOF_ } - #TARGETMENUID=12 + # TARGETMENUID=12 Menu_FilesystemBenchmark(){ TARGETMENUID=11 # - Init/load previous bench results - [[ -f /var/lib/dietpi/dietpi-benchmark/results ]] || /DietPi/dietpi/func/dietpi-benchmark 0 + [[ -f '/var/lib/dietpi/dietpi-benchmark/results' ]] || /DietPi/dietpi/func/dietpi-benchmark 0 . /var/lib/dietpi/dietpi-benchmark/results # - Sanity for beta testing. As this value won't exist until re-save of /var/lib/dietpi/dietpi-benchmark/results @@ -3602,7 +3577,7 @@ _EOF_ ) G_WHIP_DEFAULT_ITEM='DietPi-Benchmark' - G_WHIP_MENU "\ + if G_WHIP_MENU "\ DietPi-Benchmark | https://dietpi.com/survey#benchmark : - CPU Performance : Duration = $BENCH_CPU seconds (lower is faster) - CPU Temp : Idle = ${BENCH_CPU_TEMP_START}'c | Full load = ${BENCH_CPU_TEMP_END}'c @@ -3611,11 +3586,9 @@ DietPi-Benchmark | https://dietpi.com/survey#benchmark : Additional benchmarks: - Custom Filesystem : Write = $BENCH_CUSTOMFS_WRITE MB/s | Read = $BENCH_CUSTOMFS_READ MB/s - - Network LAN : Transfer rate = $BENCH_NET_LAN_SPEED MB/s" - if (( $? == 0 )); then + - Network LAN : Transfer rate = $BENCH_NET_LAN_SPEED MB/s"; then - #Return to this menu - TARGETMENUID=12 + TARGETMENUID=12 # Return to this menu case "$G_WHIP_RETURNED_VALUE" in @@ -3696,13 +3669,13 @@ Additional benchmarks: sed -i '/core_freq=/c\#core_freq=250' /DietPi/config.txt sed -i '/sdram_freq=/c\#sdram_freq=450' /DietPi/config.txt - elif (( $G_HW_MODEL <= 1 )); then + elif (( $G_HW_MODEL < 2 )); then sed -i '/arm_freq=/c\#arm_freq=700' /DietPi/config.txt sed -i '/core_freq=/c\#core_freq=250' /DietPi/config.txt sed -i '/sdram_freq=/c\#sdram_freq=400' /DietPi/config.txt - #Zero , via name id + # Zero , via name id if grep -qi 'rpi zero' /DietPi/dietpi/.hw_model; then sed -i '/arm_freq=/c\#arm_freq=1000' /DietPi/config.txt @@ -3723,32 +3696,27 @@ Additional benchmarks: } - #TARGETMENUID=13 + # TARGETMENUID=13 Menu_Overclock(){ TARGETMENUID=4 - #Get Current Overclocking Settings + # Get Current Overclocking Settings local over_voltage_value=$(grep -m1 'over_voltage=' /DietPi/config.txt | tr -d '#over_voltage=') local arm_freq_value=$(grep -m1 'arm_freq=' /DietPi/config.txt | tr -d '#arm_freq=') local core_freq_value=$(grep -m1 'core_freq=' /DietPi/config.txt | tr -d '#core_freq=') local sdram_freq_value=$(grep -m1 'sdram_freq=' /DietPi/config.txt | tr -d '#sdram_freq=') - #Overclocking Pi1 + # Overclocking RPi1 # - Zero if grep -qi 'rpi zero' /DietPi/dietpi/.hw_model; then - G_WHIP_MENU_ARRAY=( - - 'none' ': 1000 MHz ARM | 400 MHz core | 450 MHz SDRAM | 0 overvolt' - - ) + G_WHIP_MENU_ARRAY=('none' ': 1000 MHz ARM | 400 MHz core | 450 MHz SDRAM | 0 overvolt') G_WHIP_MENU "Hardware : $G_HW_MODEL_DESCRIPTION\nCurrent: $arm_freq_value MHz ARM | $core_freq_value MHz core | $sdram_freq_value MHz SDRAM | $over_voltage_value overvolt" if (( $? == 0 )); then - #Return to this menu - TARGETMENUID=13 + TARGETMENUID=13 # Return to this menu case "$G_WHIP_RETURNED_VALUE" in @@ -3776,10 +3744,10 @@ Additional benchmarks: G_WHIP_MENU "Hardware : $G_HW_MODEL_DESCRIPTION\nCurrent: $arm_freq_value MHz ARM | $core_freq_value MHz core | $sdram_freq_value MHz SDRAM | $over_voltage_value overvolt" if (( $? == 0 )); then - #Return to this menu - TARGETMENUID=13 + TARGETMENUID=13 # Return to this menu case "$G_WHIP_RETURNED_VALUE" in + 'none') Reset_Overclocking @@ -3824,7 +3792,7 @@ Additional benchmarks: fi - #Overclocking Pi2 + # Overclocking Pi2 elif (( $G_HW_MODEL == 2 )); then G_WHIP_MENU_ARRAY=( @@ -3839,8 +3807,7 @@ Additional benchmarks: G_WHIP_MENU "Hardware : $G_HW_MODEL_DESCRIPTION\nCurrent: $arm_freq_value MHz ARM | $core_freq_value MHz core | $sdram_freq_value MHz SDRAM | $over_voltage_value overvolt" if (( $? == 0 )); then - #Return to this menu - TARGETMENUID=13 + TARGETMENUID=13 # Return to this menu case "$G_WHIP_RETURNED_VALUE" in @@ -3892,16 +3859,12 @@ Additional benchmarks: fi - #Overclocking Pi3 + # Overclocking Pi3 elif (( $G_HW_MODEL == 3 )); then if grep -qi 'RPi 3 Model B+' /DietPi/dietpi/.hw_model; then - G_WHIP_MENU_ARRAY=( - - 'none' ': 1400 MHz ARM | 400 MHz core | 500 MHz SDRAM | 0 overvolt' - - ) + G_WHIP_MENU_ARRAY=('none' ': 1400 MHz ARM | 400 MHz core | 500 MHz SDRAM | 0 overvolt') else @@ -3919,8 +3882,7 @@ Additional benchmarks: G_WHIP_MENU "Hardware : $G_HW_MODEL_DESCRIPTION \nCurrent: $arm_freq_value MHz ARM | $core_freq_value MHz core | $sdram_freq_value MHz SDRAM | $over_voltage_value overvolt" if (( $? == 0 )); then - #Return to this menu - TARGETMENUID=13 + TARGETMENUID=13 # Return to this menu case "$G_WHIP_RETURNED_VALUE" in @@ -3977,7 +3939,7 @@ Additional benchmarks: } - #TARGETMENUID=14 + # TARGETMENUID=14 Menu_AudioOptions(){ TARGETMENUID=0 @@ -4017,8 +3979,7 @@ Additional benchmarks: if G_WHIP_MENU 'Please select an option:'; then - #Return to This Menu - TARGETMENUID=14 + TARGETMENUID=14 # Return to this menu if [[ $G_WHIP_RETURNED_VALUE == 'PSU noise reduction' ]]; then @@ -4047,7 +4008,7 @@ Additional benchmarks: G_WHIP_MENU_ARRAY=() # - Global: - # RPI, none disables HDMI aswell. + # RPi, none disables HDMI as well. if (( $G_HW_MODEL < 10 )); then G_WHIP_MENU_ARRAY+=('none' ': Disables HDMI + 3.5mm Analogue') @@ -4058,18 +4019,15 @@ Additional benchmarks: G_WHIP_MENU_ARRAY+=('default' ': 3.5mm Analogue') # Native PC/MISC devices | Detect and list available - elif (( $G_HW_MODEL == 21 || + elif (( $G_HW_MODEL == 15 || + $G_HW_MODEL == 21 || $G_HW_MODEL == 40 || $G_HW_MODEL == 42 || $G_HW_MODEL == 43 || $G_HW_MODEL == 44 || $G_HW_MODEL == 67 )); then G_WHIP_MENU_ARRAY+=('default' ': HW:0,0') # Install prereqs to allow for detection - if dpkg-query -s alsa-utils &> /dev/null; then - - /DietPi/dietpi/func/dietpi-set_hardware soundcard default - - fi + dpkg-query -s alsa-utils &> /dev/null || /DietPi/dietpi/func/dietpi-set_hardware soundcard default for i in {0..9} do @@ -4133,8 +4091,9 @@ Additional benchmarks: G_WHIP_MENU_ARRAY+=('justboom-digi' ': JustBoom: Digi HAT and Digi Zero') G_WHIP_MENU_ARRAY+=('rpi-dac' ': Soekris DAM1021 (pcm1794a)') - # - C1/C2 - elif (( $G_HW_MODEL == 10 || $G_HW_MODEL == 12 )); then + # - C2 + elif (( $G_HW_MODEL == 12 || + ( $G_HW_MODEL == 10 && $G_DISTRO == 3 ) )); then #REMOVE v6.24 G_WHIP_MENU_ARRAY+=('odroid-hifishield-plus' ': Odroid HiFi Shield 1/Plus') G_WHIP_MENU_ARRAY+=('odroid-hifishield-2' ': Odroid HiFi Shield 2') @@ -4155,9 +4114,9 @@ Additional benchmarks: G_WHIP_MENU_ARRAY+=('H3-analogue' ': 3.5mm analogue') # - H5 - # elif (( $G_HW_CPUID == 2 )); then + #elif (( $G_HW_CPUID == 2 )); then - # G_WHIP_MENU_ARRAY+=('H5-analogue' '3.5mm analogue') + #G_WHIP_MENU_ARRAY+=('H5-analogue' '3.5mm analogue') # - Sparky elif (( $G_HW_MODEL == 70 )); then @@ -4196,8 +4155,8 @@ Additional benchmarks: } - #TARGETMENUID=15 - STRESS_TEST_MODE=0 #0=CPU only | 1=CPU/RAM 2=CPU/RAM/IO + # TARGETMENUID=15 + STRESS_TEST_MODE=0 # 0=CPU only | 1=CPU/RAM 2=CPU/RAM/IO STRESS_TEST_DURATION=60 STRESS_TEST_RESULTS_TEMP_MIN=0 STRESS_TEST_RESULTS_TEMP_MAX=0 @@ -4227,8 +4186,7 @@ Additional benchmarks: if G_WHIP_MENU 'Please select an option:'; then - #Return to this menu - TARGETMENUID=15 + TARGETMENUID=15 # Return to this menu if [[ $G_WHIP_RETURNED_VALUE == 'Duration' ]]; then @@ -4243,11 +4201,7 @@ Additional benchmarks: ) G_WHIP_DEFAULT_ITEM=$STRESS_TEST_DURATION - if G_WHIP_MENU 'Please select a duration for the test'; then - - STRESS_TEST_DURATION=$G_WHIP_RETURNED_VALUE - - fi + G_WHIP_MENU 'Please select a duration for the test' && STRESS_TEST_DURATION=$G_WHIP_RETURNED_VALUE elif [[ $G_WHIP_RETURNED_VALUE == 'Mode' ]]; then @@ -4260,11 +4214,7 @@ Additional benchmarks: ) G_WHIP_DEFAULT_ITEM=$STRESS_TEST_MODE - if G_WHIP_MENU 'Please select a stress test type'; then - - STRESS_TEST_MODE=$G_WHIP_RETURNED_VALUE - - fi + G_WHIP_MENU 'Please select a stress test type' && STRESS_TEST_MODE=$G_WHIP_RETURNED_VALUE elif [[ $G_WHIP_RETURNED_VALUE == 'Start' ]]; then @@ -4276,7 +4226,7 @@ Additional benchmarks: local start_time=$(date) local start_time_epoch=$(date +%s) local memory_per_thread=$(( $(free -m | mawk '/^Mem:/ {print $2;exit}') / ( $G_HW_CPU_CORES * 2 ) )) - local fp_log="$HOME/dietpi-config_stress.log" + local fp_log='/root/dietpi-config_stress.log' rm $fp_log &> /dev/null if (( $STRESS_TEST_MODE == 0 )); then @@ -4356,15 +4306,15 @@ Additional benchmarks: } - #TARGETMENUID=16 + # TARGETMENUID=16 Menu_Network_Nas_Misc(){ TARGETMENUID=0 - #Update installed software + # Update installed software Load_Installed_Software - #No-IP Client + # No-IP Client local noip_installed=0 local noip_status='Not Installed' local noip_menutext='Install No-IP now' @@ -4374,7 +4324,7 @@ Additional benchmarks: noip_status='Offline - Please enter No-IP details' noip_menutext='Enter/Setup No-IP details' - #Check if No-IP is running (indicates login details are valid) + # Check if No-IP is running (indicates login details are valid) if pgrep '/usr/local/bin/noip2' &> /dev/null; then noip_status='Online / Active' @@ -4384,15 +4334,15 @@ Additional benchmarks: fi - #APT mirror + # APT mirror local apt_mirror_current=$(grep -m1 '^[[:blank:]]*deb[[:blank:]]' /etc/apt/sources.list | mawk '{print $2}') [[ $apt_mirror_current ]] || apt_mirror_current='Unknown, no string from scrape' - #NTP mirror + # NTP mirror local ntp_mirror_current=$(grep -m1 '^[[:blank:]]*CONFIG_NTP_MIRROR=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') [[ $ntp_mirror_current ]] || ntp_mirror_current='Unknown, no string from scrape' - #Network boot wait + # Network boot wait local boot_wait_for_network=$(grep -m1 '^[[:blank:]]*CONFIG_BOOT_WAIT_FOR_NETWORK=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') local boot_wait_for_network_text='' if (( $boot_wait_for_network == 0 )); then @@ -4409,13 +4359,19 @@ Additional benchmarks: fi + local check_url_timeout=$(grep -m1 '^[[:blank:]]*CONFIG_G_CHECK_URL_TIMEOUT=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') + local check_url_attempts=$(grep -m1 '^[[:blank:]]*CONFIG_G_CHECK_URL_ATTEMPTS=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') + G_WHIP_MENU_ARRAY=( '' '●─ Mirror Options ' 'APT Mirror' ": [$apt_mirror_current]" 'NTP Mirror' ": [$ntp_mirror_current]" - '' '●─ Additional Options ' + '' '●─ Connection Test Options ' 'Boot Net Wait' ": [$boot_wait_for_network_text]" + 'G_CHECK_URL Timeout' ": [$check_url_timeout Seconds]" + 'G_CHECK_URL Attempts' ": [$check_url_attempts Tries]" + '' '●─ Additional Options ' 'Network Drives' ': Mount/control networked storage' 'No-IP' ": [$noip_menutext]" @@ -4423,11 +4379,36 @@ Additional benchmarks: if G_WHIP_MENU ''; then - #Return to this Menu - TARGETMENUID=16 + TARGETMENUID=16 # Return to this menu case "$G_WHIP_RETURNED_VALUE" in + 'G_CHECK_URL Timeout') + + local min=5 max=60 + G_WHIP_DEFAULT_ITEM=$check_url_timeout + 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\nPlease enter a value between $min and $max." + if (( $? == 0 )) && 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" /DietPi/dietpi.txt + + fi + + ;; + + 'G_CHECK_URL Attempts') + + local min=2 max=10 + G_WHIP_DEFAULT_ITEM=$check_url_attempts + 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\nPlease enter a value between $min and $max." + if (( $? == 0 )) && 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" /DietPi/dietpi.txt + + fi + + ;; + '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?' @@ -4453,12 +4434,19 @@ Additional benchmarks: 'APT Mirror') - #Create Menu List for Whiptail - G_WHIP_MENU_ARRAY=( + # Jessie ARMv8: https://github.com/MichaIng/DietPi/issues/2665#issuecomment-477348864 + if (( $G_HW_ARCH == 3 && $G_DISTRO < 4 )); then - 'Custom' ': Manually enter APT mirror' + G_WHIP_MSG '[INFO] Debian has dropped the Jessie ARMv8 branch from the official APT repository.\n +Related packages are now available only from the archive: http://archive.debian.org/debian/\n +This has been applied to your APT sources.list during DietPi update to v6.23 and it cannot be changed.\n +Aborting...' + return - ) + fi + + # Create Menu List for Whiptail + G_WHIP_MENU_ARRAY=('Custom' ': Manually enter APT mirror') # - Raspbian if (( $G_HW_MODEL < 10 )); then @@ -4510,7 +4498,7 @@ Additional benchmarks: 'NTP Mirror') - #Create Menu List for Whiptail + # Create Menu List for Whiptail G_WHIP_MENU_ARRAY=( 'Gateway' ': Use local router as NTP server (Recommended)' @@ -4584,7 +4572,7 @@ NB: If you need to use *.pool.ntp.org servers, enter the base domain only. The s 'No-IP') - #Installed? + # Installed? if (( ! $noip_installed )); then G_WHIP_YESNO 'No-IP Client is not installed, would you like to install it now?\n @@ -4595,7 +4583,7 @@ NB: If you need to use *.pool.ntp.org servers, enter the base domain only. The s printf '\ec' # clear current terminal screen G_RUN_CMD systemctl stop noip2 - #Failsafe: Directory required for "noip2 -C" to create the config file there + # Failsafe: Directory required for "noip2 -C" to create the config file there mkdir -p /usr/local/etc noip2 -C read -p 'Press any key to continue...' @@ -4607,14 +4595,13 @@ NB: If you need to use *.pool.ntp.org servers, enter the base domain only. The s esac - #Cancel + # Cancel else - #Exit DietPi-Config on back to previous menu? + # Exit DietPi-Config on back to previous menu? if (( $EXITONBACK == 1 )); then - #Return to this menu - TARGETMENUID=16 + TARGETMENUID=16 # Return to this menu Menu_Exit fi @@ -4623,147 +4610,142 @@ NB: If you need to use *.pool.ntp.org servers, enter the base domain only. The s } - PROXY_ENABLED=-1 + PROXY_ENABLED=0 PROXY_ADDRESS='' PROXY_PORT='' PROXY_USERNAME='' PROXY_PASSWORD='' - #So we can call this in other menus (eg: submenu of this) + # So we can call this in other menus (eg: submenu of this) Load_Proxy_Vars(){ - PROXY_ENABLED=$(grep -m1 '^[[:blank:]]*CONFIG_PROXY_ENABLED=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') - PROXY_ADDRESS=$(grep -m1 '^[[:blank:]]*CONFIG_PROXY_ADDRESS=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') - PROXY_PORT=$(grep -m1 '^[[:blank:]]*CONFIG_PROXY_PORT=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') - PROXY_USERNAME=$(grep -m1 '^[[:blank:]]*CONFIG_PROXY_USERNAME=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') - PROXY_PASSWORD=$(grep -m1 '^[[:blank:]]*CONFIG_PROXY_PASSWORD=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') + if [[ -f '/etc/bashrc.d/dietpi-proxy.sh' ]]; then - } + PROXY_ENABLED=1 + . /etc/bashrc.d/dietpi-proxy.sh - #TARGETMENUID=17 - Menu_NetworkAdapters_Proxy(){ + else - TARGETMENUID=8 + PROXY_ENABLED=0 + # Inform user if DietPi proxy state does not match variable existence + # - This occurs either because of missing reboot/login after exiting script before, or, proxy was set up outside of DietPi scripts + # - Prompt only when inside/entering proxy settings + [[ $http_proxy && $TARGETMENUID == 17 ]] && G_WHIP_MSG 'Either a proxy was set up outside of DietPi scripts or you need to reload you current login session (logout+login or reboot) for changes to take effect.' + + fi - #Get current details on first menu init (PROXY_ENABLED=-1) - if (( $PROXY_ENABLED == -1 )); then + if [[ $http_proxy ]]; then - Load_Proxy_Vars + PROXY_ADDRESS=${http_proxy#*//}; PROXY_ADDRESS=${PROXY_ADDRESS%:*} + PROXY_PORT=${http_proxy##*:} + if [[ $http_proxy == *@* ]]; then - proxy_state_text='[Off]' - (( $PROXY_ENABLED )) && proxy_state_text='[On]' + PROXY_ADDRESS=${PROXY_ADDRESS#*@} + PROXY_USERNAME=${http_proxy#*//}; PROXY_USERNAME=${PROXY_USERNAME%%:*} + PROXY_PASSWORD=${http_proxy%%@*}; PROXY_PASSWORD=${PROXY_PASSWORD##*:} + + fi + + else + + [[ $PROXY_ADDRESS ]] || PROXY_ADDRESS=$(grep -m1 '^[[:blank:]]*CONFIG_PROXY_ADDRESS=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') + [[ $PROXY_PORT ]] || PROXY_PORT=$(grep -m1 '^[[:blank:]]*CONFIG_PROXY_PORT=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') + [[ $PROXY_USERNAME ]] || PROXY_USERNAME=$(grep -m1 '^[[:blank:]]*CONFIG_PROXY_USERNAME=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') + [[ $PROXY_PASSWORD ]] || PROXY_PASSWORD=$(grep -m1 '^[[:blank:]]*CONFIG_PROXY_PASSWORD=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') fi - proxy_state_text_new='No' - (( $PROXY_ENABLED )) && proxy_state_text_new='Yes' + } + + # TARGETMENUID=17 + Menu_NetworkAdapters_Proxy(){ + + Load_Proxy_Vars + + local proxy_state_text='[Off]' + (( $PROXY_ENABLED )) && proxy_state_text='[On]' G_WHIP_MENU_ARRAY=( - 'Toggle' ": Use Proxy?: $proxy_state_text_new" - 'Address' ': Enter Proxy server IP/URL' - 'Port' ': Enter Proxy server port' - 'Username' ': Enter Proxy server username' - 'Password' ': Enter Proxy server password' - 'Apply' ': Save Changes' + 'State' ": $proxy_state_text" + 'Address' ": $PROXY_ADDRESS" + 'Port' ": $PROXY_PORT" + 'Username' ": $PROXY_USERNAME" + 'Password' ": $PROXY_PASSWORD" ) - G_WHIP_MENU "Current Details:\n - Status: $proxy_state_text\n - Address: $PROXY_ADDRESS\n - Port: $PROXY_PORT\n - Username: $PROXY_USERNAME\n - Password: $PROXY_PASSWORD" - if (( $? == 0 )); then - - #Return to this menu - TARGETMENUID=17 + if G_WHIP_MENU 'Please select an option to change:'; then case "$G_WHIP_RETURNED_VALUE" in - 'Toggle') + 'State') - ((PROXY_ENABLED++)) - (( $PROXY_ENABLED > 1 )) && PROXY_ENABLED=0 + (( $PROXY_ENABLED )) && PROXY_ENABLED=0 || PROXY_ENABLED=1 ;; 'Address') G_WHIP_DEFAULT_ITEM=$PROXY_ADDRESS - G_WHIP_INPUTBOX 'Please enter the proxy URL or IP address\n - eg: MyProxy.com' - (( $? == 0 )) && PROXY_ADDRESS=$G_WHIP_RETURNED_VALUE + G_WHIP_INPUTBOX 'Please enter the proxy URL or IP address\n - eg: MyProxy.com' && PROXY_ADDRESS=$G_WHIP_RETURNED_VALUE + G_CONFIG_INJECT 'CONFIG_PROXY_ADDRESS=' "CONFIG_PROXY_ADDRESS=$PROXY_ADDRESS" /DietPi/dietpi.txt ;; 'Port') G_WHIP_DEFAULT_ITEM=$PROXY_PORT - G_WHIP_INPUTBOX 'Please enter the proxy port number\n - eg: 1234' - (( $? == 0 )) && PROXY_PORT=$G_WHIP_RETURNED_VALUE + G_WHIP_INPUTBOX 'Please enter the proxy port number\n - eg: 1234' && PROXY_PORT=$G_WHIP_RETURNED_VALUE + G_CONFIG_INJECT 'CONFIG_PROXY_PORT=' "CONFIG_PROXY_PORT=$PROXY_PORT" /DietPi/dietpi.txt ;; 'Username') G_WHIP_DEFAULT_ITEM=$PROXY_USERNAME - G_WHIP_INPUTBOX 'Please enter the proxy username\n - eg: JoeBloggs\n - Leave blank if not required' - (( $? == 0 )) && PROXY_USERNAME=$G_WHIP_RETURNED_VALUE + G_WHIP_INPUTBOX 'Please enter the proxy username\n - eg: JoeBloggs\n - Leave blank if not required' && PROXY_USERNAME=$G_WHIP_RETURNED_VALUE + G_CONFIG_INJECT 'CONFIG_PROXY_USERNAME=' "CONFIG_PROXY_USERNAME=$PROXY_USERNAME" /DietPi/dietpi.txt ;; 'Password') G_WHIP_DEFAULT_ITEM=$PROXY_PASSWORD - G_WHIP_INPUTBOX 'Please enter the proxy password\n - eg: LetMeIn\n - Leave blank if not required' - (( $? == 0 )) && PROXY_PASSWORD=$G_WHIP_RETURNED_VALUE + G_WHIP_INPUTBOX 'Please enter the proxy password\n - eg: LetMeIn\n - Leave blank if not required' && PROXY_PASSWORD=$G_WHIP_RETURNED_VALUE + G_CONFIG_INJECT 'CONFIG_PROXY_PASSWORD=' "CONFIG_PROXY_PASSWORD=$PROXY_PASSWORD" /DietPi/dietpi.txt ;; - 'Apply') - - # - Save settings to dietpi.txt - G_CONFIG_INJECT 'CONFIG_PROXY_ENABLED=' "CONFIG_PROXY_ENABLED=$PROXY_ENABLED" /DietPi/dietpi.txt - G_CONFIG_INJECT 'CONFIG_PROXY_ADDRESS=' "CONFIG_PROXY_ADDRESS=$PROXY_ADDRESS" /DietPi/dietpi.txt - G_CONFIG_INJECT 'CONFIG_PROXY_PORT=' "CONFIG_PROXY_PORT=$PROXY_PORT" /DietPi/dietpi.txt - G_CONFIG_INJECT 'CONFIG_PROXY_USERNAME=' "CONFIG_PROXY_USERNAME=$PROXY_USERNAME" /DietPi/dietpi.txt - G_CONFIG_INJECT 'CONFIG_PROXY_PASSWORD=' "CONFIG_PROXY_PASSWORD=$PROXY_PASSWORD" /DietPi/dietpi.txt - - # - Delete active export vars - #unset {http,https,ftp}_proxy #Does not apply to system when running from a bash script. + esac - # - Delete any existing export settings from /etc/bash.bashrc - sed -i '/^[[:blank:]]*{http,https,ftp}_proxy=/d' /etc/bash.bashrc + # - Add export settings + if (( $PROXY_ENABLED )); then - # - Add export settings - if (( $PROXY_ENABLED )); then + if [[ $PROXY_USERNAME && $PROXY_PASSWORD ]]; then - if [[ $PROXY_USERNAME && $PROXY_PASSWORD ]]; then - cat << _EOF_ >> /etc/bash.bashrc + cat << _EOF_ > /etc/bashrc.d/dietpi-proxy.sh export {http,https,ftp}_proxy="http://$PROXY_USERNAME:$PROXY_PASSWORD@$PROXY_ADDRESS:$PROXY_PORT" _EOF_ - else - cat << _EOF_ >> /etc/bash.bashrc + else + + cat << _EOF_ > /etc/bashrc.d/dietpi-proxy.sh export {http,https,ftp}_proxy="http://$PROXY_ADDRESS:$PROXY_PORT" _EOF_ - fi - - - fi - - # - Ask user for reboot now to activate/disable proxy - REBOOT_REQUIRED=1 + fi - G_WHIP_YESNO 'The updated proxy settings have been saved.\n\nNB: You must reboot your system, before the new proxy settings will take effect.\n\nReboot system now?' - (( $? == 0 )) && reboot + else - # - Reset init flag to force a reload of setings next time this menu is run. - PROXY_ENABLED=-1 + [[ -f '/etc/bashrc.d/dietpi-proxy.sh' ]] && rm /etc/bashrc.d/dietpi-proxy.sh + unset {http,https,ftp}_proxy # Has no effect on current login session but for this script, e.g. connection test - ;; + fi - esac + REBOOT_REQUIRED=1 - #Reset init flag to force a reload of setings next time this menu is run. else - PROXY_ENABLED=-1 + TARGETMENUID=8 # Return to Network Adapters menu fi @@ -4774,7 +4756,7 @@ _EOF_ #///////////////////////////////////////////////////////////////////////////////////// if (( $G_DIETPI_INSTALL_STAGE >= 0 )); then - #Start DietPi-Config + # Start DietPi-Config while (( $TARGETMENUID >= 0 )); do printf '\ec' # clear current terminal screen @@ -4853,6 +4835,10 @@ _EOF_ Menu_NetworkAdapters_Proxy + elif (( $TARGETMENUID == 18 )); then + + Menu_AdvancedOptions_Serial_UART + else G_WHIP_MSG "[FAILED] Unknown menu ID $TARGETMENUID, reverting to DietPi-Config main menu\n @@ -4866,7 +4852,7 @@ Please report it to: https://github.com/MichaIng/DietPi/issues" else - echo -e ' >> Filesystem prep has not yet completed:\n Please wait for the system to reboot' + G_WHIP_MSG '[INFO] First run setup has not reached sufficient state.\n\nPlease reboot before using DietPi-Config. If the issue persists, please report this as bug.' fi diff --git a/dietpi/dietpi-cpuinfo b/dietpi/dietpi-cpuinfo index 5d297bdcf9..c49969c1b2 100644 --- a/dietpi/dietpi-cpuinfo +++ b/dietpi/dietpi-cpuinfo @@ -12,23 +12,19 @@ # - Prints CPU information # # Usage: - # - /DietPi/dietpi/dietpi-cpuinfo Obtain stats and print + # - /DietPi/dietpi/dietpi-cpuinfo Obtain stats and print # - /DietPi/dietpi/dietpi-cpuinfo 2 Generates file of available, ordered scaling freq's $FP_CPU_SCALINGAVAILABLE_FREQ #//////////////////////////////////// - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals -------------------------------------------------------------- . /DietPi/dietpi/func/dietpi-globals G_PROGRAM_NAME='DietPi-CPU_info' G_CHECK_ROOT_USER G_INIT - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals -------------------------------------------------------------- - #DietPi-Globals exit trap addition - G_EXIT_CUSTOM(){ unset aCPU_CURRENT_FREQ aCPU_MIN_FREQ aCPU_MAX_FREQ aCPU_SCALINGAVAILABLE_FREQ; } - - #Grab Input - INPUT=0 - disable_error=1 G_CHECK_VALIDINT "$1" && INPUT=$1 + # Grab input + disable_error=1 G_CHECK_VALIDINT "$1" && INPUT=$1 || INPUT=0 aCPU_CURRENT_FREQ=() aCPU_MIN_FREQ=() @@ -66,21 +62,18 @@ Obtain_Cpu_Scaling_Freq(){ # - Intel - if [[ -f /sys/devices/system/cpu/intel_pstate/max_perf_pct ]]; then + if [[ -f '/sys/devices/system/cpu/intel_pstate/max_perf_pct' ]]; then - local index=0 - local value=10 - while (( $value <= 100 )) + local i + for ((i=10; i<=100; i+=5)) do - aCPU_SCALINGAVAILABLE_FREQ[$index]=$value - ((index++)) - value=$(( $value + 5 )) + aCPU_SCALINGAVAILABLE_FREQ+=($i) done # - Standard - elif [[ -f /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies ]]; then + elif [[ -f '/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies' ]]; then for ((i=0; i<$(nproc --all); i++)) do @@ -90,7 +83,7 @@ done # - XU4 3.x - elif [[ -f /sys/devices/system/cpu/cpufreq/mp-cpufreq/cpu_freq_table ]]; then + elif [[ -f '/sys/devices/system/cpu/cpufreq/mp-cpufreq/cpu_freq_table' ]]; then aCPU_SCALINGAVAILABLE_FREQ[0]=$(tr ' ' '\n' < /sys/devices/system/cpu/cpufreq/mp-cpufreq/cpu_freq_table | sed 's/[^0-9]//g' | sed '/^$/d') @@ -112,7 +105,7 @@ CPU_GOV_CURRENT='N/A' Obtain_Cpu_Gov(){ - if [[ -f /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ]]; then + if [[ -f '/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor' ]]; then CPU_GOV_CURRENT=$( $FP_CPU_SCALINGAVAILABLE_FREQ if (( $CPU_SCALINGSUPPORTED )); then @@ -176,16 +167,16 @@ for i in ${aCPU_SCALINGAVAILABLE_FREQ[@]} do - echo -e "$i" >> $FP_CPU_SCALINGAVAILABLE_FREQ + echo $i >> $FP_CPU_SCALINGAVAILABLE_FREQ done - # Order, remove dupes + # - Order, remove dupes sort -u -n $FP_CPU_SCALINGAVAILABLE_FREQ -o $FP_CPU_SCALINGAVAILABLE_FREQ fi - #Print all stats + # Print all stats else Obtain_Cpu_Freq diff --git a/dietpi/dietpi-drive_manager b/dietpi/dietpi-drive_manager index 50a7ee7a5c..6c8898c045 100644 --- a/dietpi/dietpi-drive_manager +++ b/dietpi/dietpi-drive_manager @@ -17,16 +17,15 @@ # #//////////////////////////////////// - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals -------------------------------------------------------------- . /DietPi/dietpi/func/dietpi-globals G_PROGRAM_NAME='DietPi-Drive_Manager' G_CHECK_ROOT_USER G_INIT - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals -------------------------------------------------------------- #Grab Input (valid interger) - INPUT=0 - disable_error=1 G_CHECK_VALIDINT "$1" && INPUT=$1 + disable_error=1 G_CHECK_VALIDINT "$1" && INPUT=$1 || INPUT=0 EXIT_CODE=0 @@ -127,7 +126,7 @@ # Mounts local swap_mount='' local tmpfs_mounts='' - local bind_mounts='' + local misc_mounts='' local net_mounts='' # Mode 4: Force reset/clean fstab (PREP) @@ -141,58 +140,59 @@ tmpfs /DietPi tmpfs defaults,size=10m,noatime,nodev,nosuid,mode=1777 0 0" # Else: Grab current mounts else - swap_mount=$(grep -m1 '[[:blank:]]swap[[:blank:]]' $FP_TEMP_FSTAB) + swap_mount=$(grep -m1 '^[[:blank:]]*[^#].*[[:blank:]]swap[[:blank:]]' $FP_TEMP_FSTAB) tmpfs_mounts=$(grep '^tmpfs[[:blank:]]' $FP_TEMP_FSTAB) - bind_mounts=$(grep '[[:blank:],]bind[[:blank:],]' $FP_TEMP_FSTAB) + # encryptfs, vboxsf, bind mounts + misc_mounts=$(grep -E '^[[:blank:]]*[^#].*([[:blank:],]bind[[:blank:],]|[[:blank:]](encryptfs|vboxsf)[[:blank:]])' $FP_TEMP_FSTAB) # CurlFtpFS, CIFS/SMB/Samba, NFS - net_mounts=$(grep -E '(^curlftpfs|[[:blank:]]cifs[[:blank:]]|[[:blank:]]nfs[4]?[[:blank:]])' $FP_TEMP_FSTAB) + net_mounts=$(grep -E '(^curlftpfs|[[:blank:]](cifs|nfs4?)[[:blank:]])' $FP_TEMP_FSTAB) fi - echo "#----------------------------------------------------------- -#NETWORK -#----------------------------------------------------------- -#Please use DietPi-Drive_Manager to setup network mounts + echo "# Please use \"dietpi-drive_manager\" to setup mounts +#---------------------------------------------------------------- +# NETWORK +#---------------------------------------------------------------- $net_mounts -#----------------------------------------------------------- -#TMPFS -#----------------------------------------------------------- +#---------------------------------------------------------------- +# TMPFS +#---------------------------------------------------------------- $tmpfs_mounts -#----------------------------------------------------------- -#MISC (bind) -#----------------------------------------------------------- -$bind_mounts +#---------------------------------------------------------------- +# MISC: encryptfs, vboxsf (VirtualBox shared folder), bind mounts +#---------------------------------------------------------------- +$misc_mounts -#----------------------------------------------------------- -#SWAPFILE -#----------------------------------------------------------- +#---------------------------------------------------------------- +# SWAPFILE +#---------------------------------------------------------------- $swap_mount -#----------------------------------------------------------- -#PHYSICAL DRIVES -#-----------------------------------------------------------" > $FP_TEMP_FSTAB +#---------------------------------------------------------------- +# PHYSICAL DRIVES +#----------------------------------------------------------------" > $FP_TEMP_FSTAB # Detect mounted drives and add them to fstab G_DIETPI-NOTIFY 2 'Detecting drives, please wait...' df -Pha | tail -n +2 > .dietpi-drive_manager_df_tmp - # - Remove items from list - # Bind: https://github.com/MichaIng/DietPi/issues/2013#issuecomment-416394374 + # - Remove misc items from list + # bind: https://github.com/MichaIng/DietPi/issues/2013#issuecomment-416394374 while read line do [[ $line ]] || continue - # - Bind - local input_bind_mount_source=$(mawk '{print $1}' <<< $line) - local input_bind_mount_target=$(mawk '{print $2}' <<< $line) - sed -i "\#[[:blank:]]$input_bind_mount_target#d" .dietpi-drive_manager_df_tmp - sed -i "\#[[:blank:]]$input_bind_mount_source#d" .dietpi-drive_manager_df_tmp - [[ $G_DEBUG == 1 ]] && G_DIETPI-NOTIFY 0 " - Detected bind mount and removed from df scrape: $input_bind_mount_source > $input_bind_mount_target" + local input_mount_target=$(mawk '{print $2}' <<< $line) + sed -i "\#[[:blank:]]$input_mount_target$#d" .dietpi-drive_manager_df_tmp + # - target + source removal via $6 required for bind mounts: https://github.com/MichaIng/DietPi/issues/2013#issuecomment-417413867 + local input_mount_source=$(mawk '{print $1}' <<< $line) + sed -i "\#[[:blank:]]$input_mount_source$#d" .dietpi-drive_manager_df_tmp + [[ $G_DEBUG == 1 ]] && G_DIETPI-NOTIFY 0 " - Detected misc mount and removed from df scrape: $input_mount_source > $input_mount_target" - done <<< "$bind_mounts" + done <<< "$misc_mounts" # - Process final DF result while read line @@ -782,7 +782,7 @@ aDRIVE_ISPARTITIONTABLE ${aDRIVE_ISPARTITIONTABLE[$i]} sed -i "\@[[:space:]]/[[:space:]][[:space:]]*auto@c $dev_entry / auto defaults,noatime,rw 0 1" /etc/fstab # - Disable Swap - /DietPi/dietpi/func/dietpi-set_dphys-swapfile 0 + /DietPi/dietpi/func/dietpi-set_swapfile 0 rsync -aHv --delete --exclude '/boot/*' --exclude '/lost+found/' --exclude '/mnt/*' --exclude ${aDRIVE_MOUNT_TARGET[$INDEX_DRIVE_BEING_EDITED]}/ --exclude '/sys/*' --exclude '/proc/*' / "${aDRIVE_MOUNT_TARGET[$INDEX_DRIVE_BEING_EDITED]}"/ if (( $? )); then @@ -796,7 +796,7 @@ aDRIVE_ISPARTITIONTABLE ${aDRIVE_ISPARTITIONTABLE[$i]} fi # - Recreate swap - # /DietPi/dietpi/func/dietpi-set_dphys-swapfile 1 ${aDRIVE_MOUNT_TARGET[$INDEX_DRIVE_BEING_EDITED]}/var/swap/.swap + # /DietPi/dietpi/func/dietpi-set_swapfile 1 ${aDRIVE_MOUNT_TARGET[$INDEX_DRIVE_BEING_EDITED]}/var/swap/.swap # Manually update location # sed -i "/^[[:blank:]]*AUTO_SETUP_SWAPFILE_LOCATION=/c\AUTO_SETUP_SWAPFILE_LOCATION=/var/swap" /DietPi/dietpi.txt @@ -814,8 +814,9 @@ aDRIVE_ISPARTITIONTABLE ${aDRIVE_ISPARTITIONTABLE[$i]} 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[$INDEX_DRIVE_BEING_EDITED]}#g" /boot/cmdline.txt - #C1/C2/XU4 | /DietPi/boot.ini - elif (( $G_HW_MODEL == 10 || $G_HW_MODEL == 11 || $G_HW_MODEL == 12 )); then + #C2/XU4 | /DietPi/boot.ini + elif (( $G_HW_MODEL == 11 || $G_HW_MODEL == 12 || + ( $G_HW_MODEL == 10 && $G_DISTRO == 3 ) )); then #REMOVE v6.24 # find current root= to replace local rootfs_current=$(mawk '{for(i=1;i<=NF;i++) {print $i} }' /DietPi/boot.ini | grep -m1 'root=' | sed 's/\"//') @@ -1318,7 +1319,7 @@ aDRIVE_ISPARTITIONTABLE ${aDRIVE_ISPARTITIONTABLE[$i]} local fp_target_swapfile="${aDRIVE_MOUNT_TARGET[$INDEX_DRIVE_BEING_EDITED]}/.swapfile" [[ ${aDRIVE_MOUNT_TARGET[$INDEX_DRIVE_BEING_EDITED]} == '/' ]] && fp_target_swapfile='/var/swap' - /DietPi/dietpi/func/dietpi-set_dphys-swapfile $G_WHIP_RETURNED_VALUE "$fp_target_swapfile" + /DietPi/dietpi/func/dietpi-set_swapfile $G_WHIP_RETURNED_VALUE "$fp_target_swapfile" fi diff --git a/dietpi/dietpi-explorer b/dietpi/dietpi-explorer index 25c7bdb730..a119e3e656 100644 --- a/dietpi/dietpi-explorer +++ b/dietpi/dietpi-explorer @@ -9,28 +9,27 @@ #//////////////////////////////////// # # Info: - # - filename /DietPi/dietpi/dietpi-explorer + # - Location: /DietPi/dietpi/dietpi-explorer # # Usage: # - dietpi-explorer (menu system) - # - dietpi-explorer 1 | Select a folder mode, return result for other applications to /tmp/.dietpi-explorer_selected_location + # - dietpi-explorer 1 Select a folder mode, return result for other applications to /tmp/.dietpi-explorer_selected_location #//////////////////////////////////// - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals -------------------------------------------------------------- . /DietPi/dietpi/func/dietpi-globals G_PROGRAM_NAME='DietPi-Explorer' G_CHECK_ROOT_USER G_INIT - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals -------------------------------------------------------------- - INPUT=0 - disable_error=1 G_CHECK_VALIDINT "$1" && INPUT=$1 + disable_error=1 G_CHECK_VALIDINT "$1" && INPUT=$1 || INPUT=0 CURRENT_DIRECTORY='' TARGET_FP='/home' - [[ $2 ]] && TARGET_FP="$2" + [[ $2 ]] && TARGET_FP=$2 - CP_MODE=0 #0=CP 1=MV + CP_MODE=0 # 0=CP 1=MV CP_SOURCE='' CP_TARGET='' @@ -40,7 +39,7 @@ if (( $CP_MODE == 0 )); then - G_ERROR_HANDLER_INFO_ONLY=1 G_RUN_CMD cp -R "$CP_SOURCE" "$CP_TARGET"/ + G_ERROR_HANDLER_INFO_ONLY=1 G_RUN_CMD cp -a "$CP_SOURCE" "$CP_TARGET"/ elif (( $CP_MODE == 1 )); then @@ -51,9 +50,9 @@ fi # - Reset for next run + CP_MODE=0 CP_SOURCE='' CP_TARGET='' - CP_MODE=0 } @@ -153,7 +152,7 @@ elif [[ $G_WHIP_RETURNED_VALUE == 'Select' ]]; then - echo -e "$CURRENT_DIRECTORY/$TARGET_FP" > /tmp/.dietpi-explorer_selected_location + echo "$CURRENT_DIRECTORY/$TARGET_FP" > /tmp/.dietpi-explorer_selected_location exit 0 elif [[ $G_WHIP_RETURNED_VALUE == 'Copy' ]]; then @@ -173,7 +172,7 @@ elif [[ $G_WHIP_RETURNED_VALUE == 'Rename' ]]; then - G_WHIP_DEFAULT_ITEM="$TARGET_FP" + G_WHIP_DEFAULT_ITEM=$TARGET_FP if G_WHIP_INPUTBOX "Please enter a new name for '$TARGET_FP'"; then G_ERROR_HANDLER_INFO_ONLY=1 G_RUN_CMD mv "$TARGET_FP" "$G_WHIP_RETURNED_VALUE" @@ -199,10 +198,10 @@ done <<< "$(getent passwd | cut -d: -f1 | sort)" - G_WHIP_DEFAULT_ITEM="$permission_current_user" + G_WHIP_DEFAULT_ITEM=$permission_current_user if G_WHIP_MENU 'Chown permissions:\n - Please select a User'; then - local chown_user="$G_WHIP_RETURNED_VALUE" + local chown_user=$G_WHIP_RETURNED_VALUE G_WHIP_MENU_ARRAY=() @@ -213,10 +212,10 @@ done <<< "$(getent group | cut -d: -f1 | sort)" - G_WHIP_DEFAULT_ITEM="$permission_current_group" + G_WHIP_DEFAULT_ITEM=$permission_current_group if G_WHIP_MENU 'Chown permissions:\n - Please select a Group'; then - local chown_group="$G_WHIP_RETURNED_VALUE" + local chown_group=$G_WHIP_RETURNED_VALUE G_ERROR_HANDLER_INFO_ONLY=1 G_RUN_CMD chown -R $chown_user:$chown_group "$CURRENT_DIRECTORY/$TARGET_FP" fi @@ -225,7 +224,7 @@ elif [[ $G_WHIP_RETURNED_VALUE == 'Chmod' ]]; then - G_WHIP_DEFAULT_ITEM="$chmod_current" + G_WHIP_DEFAULT_ITEM=$chmod_current if G_WHIP_INPUTBOX 'Chmod permissions:\n - Please enter a value'; then G_ERROR_HANDLER_INFO_ONLY=1 G_RUN_CMD chmod -R $G_WHIP_RETURNED_VALUE "$CURRENT_DIRECTORY/$TARGET_FP" @@ -245,10 +244,10 @@ #///////////////////////////////////////////////////////////////////////////////////// TARGETMENUID=0 - #TARGETMENUID=0 + # TARGETMENUID=0 Menu_Main(){ - CURRENT_DIRECTORY="$PWD" + CURRENT_DIRECTORY=$PWD G_WHIP_MENU_ARRAY=() if [[ $CURRENT_DIRECTORY == '/' ]]; then @@ -282,10 +281,10 @@ done G_WHIP_BUTTON_CANCEL_TEXT='Exit' - G_WHIP_DEFAULT_ITEM="$TARGET_FP" + G_WHIP_DEFAULT_ITEM=$TARGET_FP if G_WHIP_MENU "$CURRENT_DIRECTORY"; then - TARGET_FP="$G_WHIP_RETURNED_VALUE" + TARGET_FP=$G_WHIP_RETURNED_VALUE Select_Menu @@ -302,13 +301,11 @@ G_WHIP_SIZE_X_MAX=50 if G_WHIP_YESNO "Exit $G_PROGRAM_NAME?"; then - #exit - TARGETMENUID=-1 + TARGETMENUID=-1 # Exit else - #Return to Main Menu - TARGETMENUID=0 + TARGETMENUID=0 # Main menu fi @@ -317,11 +314,10 @@ #///////////////////////////////////////////////////////////////////////////////////// # Main Loop #///////////////////////////////////////////////////////////////////////////////////// - - #Default to users home dir + # Default to users home dir cd "$TARGET_FP" - #Start Menu + # Start Menu while (( $TARGETMENUID > -1 )) do diff --git a/dietpi/dietpi-letsencrypt b/dietpi/dietpi-letsencrypt index e8238fd4c7..52d7f6dbf9 100644 --- a/dietpi/dietpi-letsencrypt +++ b/dietpi/dietpi-letsencrypt @@ -17,33 +17,31 @@ # - /DietPi/dietpi/dietpi-letsencrypt 1 = Create/Renew/Apply cert #//////////////////////////////////// - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals -------------------------------------------------------------- . /DietPi/dietpi/func/dietpi-globals G_PROGRAM_NAME='DietPi-LetsEncrypt' G_CHECK_ROOT_USER G_CHECK_ROOTFS_RW G_INIT - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals -------------------------------------------------------------- - #Grab Input - INPUT=0 - disable_error=1 G_CHECK_VALIDINT "$1" && INPUT=$1 + # Grab Input + disable_error=1 G_CHECK_VALIDINT "$1" && INPUT=$1 || INPUT=0 #///////////////////////////////////////////////////////////////////////////////////// - #Globals + # Globals #///////////////////////////////////////////////////////////////////////////////////// FP_LOGFILE='/var/log/dietpi-letsencrypt.log' - # On Stretch+ the APT package installs a systemd unit for cert renewal, - # on Jessie-, we install the CertBot from github directly and add a cron job for renewal: + # On Stretch+ the APT package installs a systemd unit for cert renewal. FP_RENEWAL='/etc/systemd/system/certbot.service.d' + # On Jessie- we install the CertBot from GitHub directly and add a cron job for renewal. (( $G_DISTRO < 4 )) && FP_RENEWAL='/etc/cron.weekly/dietpi-letsencrypt' FP_BINARY='/usr/bin/certbot' (( $G_DISTRO < 4 )) && FP_BINARY='/etc/certbot_scripts/certbot-auto' - LETSENCRYPT_INSTALLED=0 - [[ -f $FP_BINARY ]] && LETSENCRYPT_INSTALLED=1 + [[ -f $FP_BINARY ]] && LETSENCRYPT_INSTALLED=1 || LETSENCRYPT_INSTALLED=0 LETSENCRYPT_DOMAIN='mydomain.com' LETSENCRYPT_EMAIL='myemail@email.com' @@ -58,26 +56,24 @@ local fp_cert_dir="/etc/letsencrypt/live/$LETSENCRYPT_DOMAIN" #------------------------------------------------------------------------------------------------------ - #Apache2 + # Apache2 if pgrep '[a]pache' &> /dev/null; then G_DIETPI-NOTIFY 0 'Apache2 webserver detected' local fp_defaultsite='/etc/apache2/sites-available/000-default.conf' - #Add ServerName if it doesnt exist. This is required to prevent CertBot compaining about vhost with no domain. + # - Add ServerName if it doesnt exist. This is required to prevent CertBot complaining about vhost with no domain. G_CONFIG_INJECT 'ServerName[[:blank:]]' "ServerName $LETSENCRYPT_DOMAIN" "$fp_defaultsite" ' 3 )) && options='-a webroot -w /var/www/ -i apache' (( $LETSENCRYPT_REDIRECT )) && options+=' --redirect' || options+=' --no-redirect' (( $LETSENCRYPT_HSTS )) && options+=' --hsts' - #Cert me up Apache2 - # - When cert exists already, attempt renewal. This allows easy configuration update via "dietpi-letsencrypt 1" without using up limited certs per week. + # - Cert me up Apache2 + # If cert exists already, attempt renewal. This allows easy configuration update via "dietpi-letsencrypt 1" without using up limited certs per week. if [[ -f $fp_cert_dir/cert.pem ]]; then $FP_BINARY renew @@ -85,7 +81,7 @@ else - $FP_BINARY $options --agree-tos --rsa-key-size "$LETSENCRYPT_KEYSIZE" -m "$LETSENCRYPT_EMAIL" -d "$LETSENCRYPT_DOMAIN" + $FP_BINARY $options --agree-tos --no-eff-email --rsa-key-size "$LETSENCRYPT_KEYSIZE" -m "$LETSENCRYPT_EMAIL" -d "$LETSENCRYPT_DOMAIN" local exit_code=$? fi @@ -98,13 +94,12 @@ fi #------------------------------------------------------------------------------------------------------ - #Lighttpd + # Lighttpd elif pgrep '[l]ighttpd' &> /dev/null; then G_DIETPI-NOTIFY 0 'Lighttpd webserver detected' # - Cert me up - /DietPi/dietpi/dietpi-services stop if [[ -f $fp_cert_dir/cert.pem ]]; then $FP_BINARY renew @@ -112,7 +107,7 @@ else - $FP_BINARY certonly --standalone --agree-tos --rsa-key-size "$LETSENCRYPT_KEYSIZE" -m "$LETSENCRYPT_EMAIL" -d "$LETSENCRYPT_DOMAIN" + $FP_BINARY certonly --webroot -w /var/www --agree-tos --no-eff-email --rsa-key-size "$LETSENCRYPT_KEYSIZE" -m "$LETSENCRYPT_EMAIL" -d "$LETSENCRYPT_DOMAIN" local exit_code=$? fi @@ -134,18 +129,18 @@ fi - # Add Lighttpd renewal to certbot system service: + # - Add Lighttpd renewal to certbot systemd service if (( $G_DISTRO > 3 )); then [[ -d $FP_RENEWAL ]] || mkdir "$FP_RENEWAL" cat << _EOF_ > "$FP_RENEWAL"/dietpi-lighttpd.conf [Service] -ExecStartPost=/bin/bash -c '/bin/cat $fp_cert_dir/privkey.pem $fp_cert_dir/cert.pem > $fp_cert_dir/combined.pem' +ExecStartPost=/bin/dash -c 'cat "$fp_cert_dir/privkey.pem" "$fp_cert_dir/cert.pem" > "$fp_cert_dir/combined.pem"' _EOF_ fi - # Allow adding environment variables via: setenv.add-environment + # - Allow adding environment variables via: setenv.add-environment G_CONFIG_INJECT '"mod_setenv"' ' "mod_setenv",' /etc/lighttpd/lighttpd.conf '"mod_.+",' cat << _EOF_ > /etc/lighttpd/conf-enabled/letsencrypt.conf @@ -156,13 +151,13 @@ _EOF_ ssl.disable-client-renegotiation = "enable" # pemfile is cert+privkey, ca-file is the intermediate chain in one file - ssl.pemfile = "$fp_cert_dir/combined.pem" - ssl.ca-file = "$fp_cert_dir/fullchain.pem" + ssl.pemfile = "$fp_cert_dir/combined.pem" + ssl.ca-file = "$fp_cert_dir/fullchain.pem" # for DH/DHE ciphers, dhparam should be >= 2048-bit - #ssl.dh-file = "/path/to/dhparam.pem" + #ssl.dh-file = "/path/to/dhparam.pem" # ECDH/ECDHE ciphers curve strength (see 'openssl ecparam -list_curves') - ssl.ec-curve = "secp384r1" + ssl.ec-curve = "secp384r1" # Compression is by default off at compile-time, but use if needed #ssl.use-compression = "disable" @@ -173,15 +168,15 @@ _EOF_ ssl.use-sslv2 = "disable" ssl.use-sslv3 = "disable" ssl.honor-cipher-order = "enable" - ssl.cipher-list = "ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS" + ssl.cipher-list = "ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS" } _EOF_ - # Enable new "mod_openssl" on Buster + # - Enable new "mod_openssl" on Buster (( $G_DISTRO > 4 )) && sed -i '1i\server.modules += ( "mod_openssl" )\n' /etc/lighttpd/conf-enabled/letsencrypt.conf - # Redirect - rm /etc/lighttpd/conf-enabled/redirect.conf &> /dev/null + # - Redirect + [[ -f /etc/lighttpd/conf-enabled/redirect.conf ]] && rm /etc/lighttpd/conf-enabled/redirect.conf if (( $LETSENCRYPT_REDIRECT )); then cat << _EOF_ > /etc/lighttpd/conf-enabled/redirect.conf @@ -196,7 +191,7 @@ _EOF_ fi - # HSTS + # - HSTS if (( $LETSENCRYPT_HSTS )); then cat << _EOF_ > /etc/lighttpd/conf-available/99-dietpi-hsts.conf @@ -220,19 +215,17 @@ _EOF_ G_DIETPI-NOTIFY 0 'Nginx webserver detected' local fp_defaultsite='/etc/nginx/sites-available/default' - # Apply domain name + # - Apply domain name G_CONFIG_INJECT 'server_name[[:blank:]]' " server_name $LETSENCRYPT_DOMAIN;" "$fp_defaultsite" 'listen[[:blank:]]' - #Restart Nginx to apply server_name change: + # - Restart Nginx to apply server_name change systemctl restart nginx local options='--nginx' - #Use webroot authentication on Stretch+ for now: https://github.com/MichaIng/DietPi/issues/734#issuecomment-361774084 - (( $G_DISTRO > 3 )) && options='-a webroot -w /var/www/ -i nginx' (( $LETSENCRYPT_REDIRECT )) && options+=' --redirect' || options+=' --no-redirect' (( $LETSENCRYPT_HSTS )) && options+=' --hsts' - #Cert me up Nginx + # - Cert me up Nginx if [[ -f $fp_cert_dir/cert.pem ]]; then $FP_BINARY renew @@ -240,7 +233,7 @@ _EOF_ else - $FP_BINARY $options --agree-tos --rsa-key-size "$LETSENCRYPT_KEYSIZE" -m "$LETSENCRYPT_EMAIL" -d "$LETSENCRYPT_DOMAIN" + $FP_BINARY $options --agree-tos --no-eff-email --rsa-key-size "$LETSENCRYPT_KEYSIZE" -m "$LETSENCRYPT_EMAIL" -d "$LETSENCRYPT_DOMAIN" local exit_code=$? fi @@ -252,7 +245,7 @@ _EOF_ fi - #Apply HSTS header to ownCloud/Nextcloud config + # - Apply HSTS header to ownCloud/Nextcloud config if (( $LETSENCRYPT_HSTS )); then [[ -f /etc/nginx/sites-dietpi/dietpi-owncloud.conf ]] && sed -i 's/#add_header Strict-Transport-Security/add_header Strict-Transport-Security/g' /etc/nginx/sites-dietpi/dietpi-owncloud.conf @@ -261,7 +254,7 @@ _EOF_ fi #------------------------------------------------------------------------------------------------------ - #Minio + # Minio elif pgrep '[m]inio' &> /dev/null; then G_DIETPI-NOTIFY 0 'Minio S3 server detected' @@ -275,7 +268,7 @@ _EOF_ else - $FP_BINARY certonly --standalone --staple-ocsp --agree-tos --rsa-key-size "$LETSENCRYPT_KEYSIZE" -m "$LETSENCRYPT_EMAIL" -d "$LETSENCRYPT_DOMAIN" + $FP_BINARY certonly --standalone --staple-ocsp --agree-tos --no-eff-email --rsa-key-size "$LETSENCRYPT_KEYSIZE" -m "$LETSENCRYPT_EMAIL" -d "$LETSENCRYPT_DOMAIN" local exit_code=$? fi @@ -287,29 +280,29 @@ _EOF_ fi - # Ensure strict permissions while copying: + # - Ensure strict permissions while copying: umask 077 - # Locate them correctly (THIS didn't work as symlinks) - G_RUN_CMD cp "$fp_cert_dir"/fullchain.pem /home/minio-user/.minio/certs/public.crt - G_RUN_CMD cp "$fp_cert_dir"/privkey.pem /home/minio-user/.minio/certs/private.key + # - Locate them correctly (THIS didn't work as symlinks) + G_RUN_CMD cp "$fp_cert_dir/fullchain.pem" /home/minio-user/.minio/certs/public.crt + G_RUN_CMD cp "$fp_cert_dir/privkey.pem" /home/minio-user/.minio/certs/private.key - # Own those certs! + # - Own those certs! G_RUN_CMD chown minio-user:minio-user /home/minio-user/.minio/certs/public.crt /home/minio-user/.minio/certs/private.key G_RUN_CMD chmod 400 /home/minio-user/.minio/certs/public.crt /home/minio-user/.minio/certs/private.key - # Creation permissions back to default: + # - Creation permissions back to default: umask 022 - # Add SSL to config file + # - Add SSL to config file G_CONFIG_INJECT 'MINIO_OPTS="' 'MINIO_OPTS="--address :443"' /etc/default/minio - # Allow SSL binding for non root user - # - Install libcap2-bin, which provides setcap command, not installed by default on DietPi: + # - Allow SSL binding for non root user + # Install libcap2-bin, which provides setcap command, not installed by default on DietPi: G_AGI libcap2-bin G_RUN_CMD setcap CAP_NET_BIND_SERVICE=+eip /usr/local/bin/minio - # Create renewl script + # - Create renewl script cat << _EOF_ > /home/minio-user/.minio/dietpi-cert-renewl.sh #!/bin/bash # Minio only works with copied and owned certs. Upon renewal the new certs needs to be copied and re-owned @@ -319,8 +312,8 @@ systemctl stop minio umask 077 # Copy to correct Location -cp $fp_cert_dir/fullchain.pem /home/minio-user/.minio/certs/public.crt -cp $fp_cert_dir/privkey.pem /home/minio-user/.minio/certs/private.key +cp "$fp_cert_dir/fullchain.pem" /home/minio-user/.minio/certs/public.crt +cp "$fp_cert_dir/privkey.pem" /home/minio-user/.minio/certs/private.key # Re-Own those certs! chown minio-user:minio-user /home/minio-user/.minio/certs/public.crt /home/minio-user/.minio/certs/private.key @@ -329,10 +322,10 @@ chmod 400 /home/minio-user/.minio/certs/public.crt /home/minio-user/.minio/certs systemctl start minio _EOF_ - # Change permissions on renewal script + # - Change permissions on renewal script G_RUN_CMD chmod +x /home/minio-user/.minio/dietpi-cert-renewl.sh - # Add Minio renewal to certbot system service: + # Add Minio renewal to certbot system service if (( $G_DISTRO > 3 )); then [[ -d $FP_RENEWAL ]] || mkdir "$FP_RENEWAL" @@ -359,35 +352,7 @@ Would you like to switch to DietPi-Software, to install one of the above?' && /D fi - if [[ -f /etc/turnserver.conf ]]; then - - G_DIETPI-NOTIFY 2 'coturn TURN server detected' - - # - Get TURN port - local turn_port=5349 - if grep -q '^[[:blank:]]*tls-listening-port=' /etc/turnserver.conf; then - - turn_port=$(grep -m1 '^[[:blank:]]*tls-listening-port=' /etc/turnserver.conf) - turn_port=${turn_port#*tls-listening-port=} - - elif grep -q '^[[:blank:]]*listening-port=' /etc/turnserver.conf; then - - turn_port=$(grep -m1 '^[[:blank:]]*listening-port=' /etc/turnserver.conf) - turn_port=${turn_port#*listening-port=} - # - Comment non-TLS port setting to avoid doubled port use - G_CONFIG_INJECT 'listening-port=' "#listening-port=$turn_port" /etc/turnserver.conf - - fi - - # - Set TURN TLS settings - G_CONFIG_INJECT 'tls-listening-port=' "tls-listening-port=$turn_port" /etc/turnserver.conf - G_CONFIG_INJECT 'cert=' "cert=$fp_cert_dir/cert.pem" /etc/turnserver.conf - G_CONFIG_INJECT 'pkey=' "pkey=$fp_cert_dir/privkey.pem" /etc/turnserver.conf - G_CONFIG_INJECT 'cipher-list=' 'cipher-list="ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AES:RSA+3DES:!ADH:!AECDH:!MD5"' /etc/turnserver.conf - - fi - - #ALL | Create cert renewal cron job on Jessie-: + # ALL | Create cert renewal cron job on Jessie-: if (( $G_DISTRO < 4 )); then cat << _EOF_ > "$FP_RENEWAL" @@ -409,7 +374,7 @@ Would you like to switch to DietPi-Software, to install one of the above?' && /D $FP_BINARY -q renew &>> $FP_LOGFILE [[ -f /home/minio-user/.minio/dietpi-cert-renewl.sh ]] && /home/minio-user/.minio/dietpi-cert-renewl.sh &>> $FP_LOGFILE - [[ -f $fp_cert_dir/combined.pem ]] && cat $fp_cert_dir/privkey.pem $fp_cert_dir/cert.pem > $fp_cert_dir/combined.pem 2>> $FP_LOGFILE + [[ -f $fp_cert_dir/combined.pem ]] && cat "$fp_cert_dir/privkey.pem" "$fp_cert_dir/cert.pem" > "$fp_cert_dir/combined.pem" 2>> $FP_LOGFILE #---------------------------------------------------------------- exit @@ -443,19 +408,17 @@ _EOF_ Read_Settings_File(){ - local sed_index=1 - - LETSENCRYPT_DOMAIN=$(sed -n "$sed_index"p "$FP_SETTINGS");((sed_index++)) - LETSENCRYPT_EMAIL=$(sed -n "$sed_index"p "$FP_SETTINGS");((sed_index++)) - LETSENCRYPT_REDIRECT=$(sed -n "$sed_index"p "$FP_SETTINGS");((sed_index++)) - LETSENCRYPT_HSTS=$(sed -n "$sed_index"p "$FP_SETTINGS");((sed_index++)) - LETSENCRYPT_KEYSIZE=$(sed -n "$sed_index"p "$FP_SETTINGS");((sed_index++)) + LETSENCRYPT_DOMAIN=$(sed -n 1p $FP_SETTINGS) + LETSENCRYPT_EMAIL=$(sed -n 2p $FP_SETTINGS) + LETSENCRYPT_REDIRECT=$(sed -n 3p $FP_SETTINGS) + LETSENCRYPT_HSTS=$(sed -n 4p $FP_SETTINGS) + LETSENCRYPT_KEYSIZE=$(sed -n 5p $FP_SETTINGS) } Write_Settings_File(){ - cat << _EOF_ > "$FP_SETTINGS" + cat << _EOF_ > $FP_SETTINGS $LETSENCRYPT_DOMAIN $LETSENCRYPT_EMAIL $LETSENCRYPT_REDIRECT @@ -476,18 +439,37 @@ _EOF_ G_WHIP_SIZE_X_MAX=50 if G_WHIP_YESNO "Exit $G_PROGRAM_NAME?"; then - #exit + # Exit TARGETMENUID=-1 else - #Return to Main Menu + # Return to Main Menu TARGETMENUID=0 fi } + Input_Box(){ + + local input_value=$1 + local input_desc=$2 + + G_WHIP_DEFAULT_ITEM=$input_value + if G_WHIP_INPUTBOX "Please enter a value for $input_desc"; then + + input_value=$G_WHIP_RETURNED_VALUE + + # Prevent null values + [[ $input_value ]] || input_value='NULL' + + fi + + echo "$input_value" + + } + #TARGETMENUID=0 Menu_Main(){ @@ -521,8 +503,8 @@ _EOF_ while : do - LETSENCRYPT_DOMAIN=$(Input_Box $LETSENCRYPT_DOMAIN Website-Domain) - [[ $LETSENCRYPT_DOMAIN == *?.?* && ! $(sed 's/\.//g' <<< $LETSENCRYPT_DOMAIN) =~ ^[0-9]*$ ]] && break + LETSENCRYPT_DOMAIN=$(Input_Box "$LETSENCRYPT_DOMAIN" Website-Domain) + [[ $LETSENCRYPT_DOMAIN == *?.?* && ! $(sed 's/\.//g' <<< "$LETSENCRYPT_DOMAIN") =~ ^[0-9]*$ ]] && break G_WHIP_MSG "[FAILED] \"$LETSENCRYPT_DOMAIN\" is no valid domain name.\n\nNote that raw IP addresses are not allowed by LetsEncrypt, thus a domain is required.\nYou can install No-IP with DietPi-Software to aquire one.\n\nPlease try again..." @@ -532,13 +514,13 @@ _EOF_ 'Email') - LETSENCRYPT_EMAIL=$(Input_Box $LETSENCRYPT_EMAIL Email-Address) + LETSENCRYPT_EMAIL=$(Input_Box "$LETSENCRYPT_EMAIL" Email-Address) ;; 'Key Size') - (( $LETSENCRYPT_KEYSIZE == 2048 )) && LETSENCRYPT_KEYSIZE=4096 || LETSENCRYPT_KEYSIZE=2048 + (( $LETSENCRYPT_KEYSIZE == 4096 )) && LETSENCRYPT_KEYSIZE=2048 || LETSENCRYPT_KEYSIZE=4096 ;; @@ -578,8 +560,13 @@ Are you sure that you want to enable HTTP Strict Transport Security?' && LETSENC 'Apply') - G_WHIP_YESNO "LetsEncrypt will now be run. This will:\n- Create your free SSL cert.\n- Automatically apply and enable your SSL cert\n- NB: This process can take a long time, please be patient.\n- NB: HTTPS will automatically be applied to the webserver and applications which use '/var/www/*'. Applications which use their own webserver (these usually have their own :port number), will not be available under HTTPS, and, these will need to be configured manually.\n\nWould you like to continue?" - if (( ! $? )); then + if G_WHIP_YESNO 'LetsEncrypt will now be run. This will: +- Create your free SSL cert. +- Automatically apply and enable your SSL cert +- NB: This process can take a long time, please be patient. +- NB: HTTPS will automatically be applied to the webserver and applications which use "/var/www/*". + Applications which use their own webserver (these usually have their own :port number), will not be available under HTTPS, and, these will need to be configured manually.\n +Would you like to continue?'; then Write_Settings_File Run_Lets_Encrypt @@ -593,36 +580,17 @@ Are you sure that you want to enable HTTP Strict Transport Security?' && LETSENC else - #Exit + # Exit Menu_Exit fi } - Input_Box(){ - - local input_value=$1 - local input_desc=$2 - - G_WHIP_DEFAULT_ITEM=$input_value - if G_WHIP_INPUTBOX "Please enter a value for $input_desc"; then - - input_value=$G_WHIP_RETURNED_VALUE - - # - Prevent null values - [[ $input_value ]] || input_value='NULL' - - fi - - echo "$input_value" - - } - #///////////////////////////////////////////////////////////////////////////////////// # Main Loop #///////////////////////////////////////////////////////////////////////////////////// - #Load Settings file. Generate if required. + # Load Settings file. Generate if required. if [[ -f $FP_SETTINGS ]]; then Read_Settings_File @@ -634,10 +602,10 @@ Are you sure that you want to enable HTTP Strict Transport Security?' && LETSENC fi #----------------------------------------------------------------------------------- - #Check installed + # Check installed if (( ! $LETSENCRYPT_INSTALLED )); then - #Menu + # Menu if (( ! $INPUT )); then G_DIETPI-NOTIFY 1 "CertBot binary not found ( $FP_BINARY )" @@ -651,7 +619,7 @@ Are you sure that you want to enable HTTP Strict Transport Security?' && LETSENC fi #----------------------------------------------------------------------------------- - #Menu + # Menu elif (( ! $INPUT )); then while (( $TARGETMENUID > -1 )); do @@ -663,7 +631,7 @@ Are you sure that you want to enable HTTP Strict Transport Security?' && LETSENC done #----------------------------------------------------------------------------------- - #Run + # Run elif (( $INPUT == 1 )); then Run_Lets_Encrypt @@ -673,7 +641,7 @@ Are you sure that you want to enable HTTP Strict Transport Security?' && LETSENC G_DIETPI-NOTIFY 2 'DietPi-LetsEncrypt usage:' G_DIETPI-NOTIFY 2 ' dietpi-letsencrypt => Open whiptail menu' - G_DIETPI-NOTIFY 2 ' dietpi-letsencrypt 1 => Create/Renew/Apply certs without user input' + G_DIETPI-NOTIFY 2 ' dietpi-letsencrypt 1 => Create/Renew/Apply certs non-interactively' fi diff --git a/dietpi/dietpi-login b/dietpi/dietpi-login index 1030319b6f..4e2301e64d 100644 --- a/dietpi/dietpi-login +++ b/dietpi/dietpi-login @@ -177,7 +177,7 @@ Please login again as user "root" with password "dietpi", respectively the one y # Wait for full system boot local i=0 - until sudo systemctl -ln 0 --no-pager status dietpi-postboot | grep -qi 'exited' # "sudo" required for non-root logins + while pgrep -f '/DietPi/dietpi/postboot' &> /dev/null do echo -ne "\e[90m[\e[0m INFO \e[90m]\e[0m Waiting for DietPi-Postboot to finish... (Press CTRL+C to abort) ($((i++)))\r" @@ -192,6 +192,8 @@ Please login again as user "root" with password "dietpi", respectively the one y . /DietPi/dietpi/func/dietpi-globals G_PROGRAM_NAME='DietPi-Login' #G_INIT # To allow concurrent logins + # - Always remove PID file when script is killed + trap '[[ -f $FP_DIETPI_FIRSTRUNSETUP_PID ]] && rm $FP_DIETPI_FIRSTRUNSETUP_PID' EXIT # Import DietPi-Globals -------------------------------------------------------------- /DietPi/dietpi/func/obtain_network_details diff --git a/dietpi/dietpi-morsecode b/dietpi/dietpi-morsecode index 80574db918..eed1fd491d 100644 --- a/dietpi/dietpi-morsecode +++ b/dietpi/dietpi-morsecode @@ -9,66 +9,57 @@ #//////////////////////////////////// # # Info: + # - Location: /DietPi/dietpi/dietpi-morsecode # - Converts and renders a text file into morse code # # Usage: - # - dietpi-morsecode 0/noinput = Output to Term - # - dietpi-morsecode 1 = Output to both RPi status LED's + # - dietpi-morsecode 0/noinput = Output to console/screen + # - dietpi-morsecode 1 = Output to both RPi status LEDs # - dietpi-morsecode 2 = Output to ALSA (sound) #//////////////////////////////////// - #At the end of the day, if your using this, your probably in a life threating situation. - #I doubt your Transmission downloads, or webserver is going to be more important. - #So, Lets change the nice to -10 (High priority) ;) + # At the end of the day, if your using this, your probably in a life threating situation. + # I doubt your Transmission downloads, or webserver is going to be more important. + # So, Lets change the nice to -10 (High priority) ;) renice -n -10 $$ &> /dev/null - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals -------------------------------------------------------------- . /DietPi/dietpi/func/dietpi-globals G_PROGRAM_NAME='DietPi-Morsecode' G_CHECK_ROOT_USER G_INIT - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals -------------------------------------------------------------- - G_EXIT_CUSTOM(){ [[ -f $FP_TEXTFILE_LOWERCASE ]] && rm $FP_TEXTFILE_LOWERCASE; } - - INPUT=0 - disable_error=1 G_CHECK_VALIDINT "$1" && INPUT=$1 + # Grab input + disable_error=1 G_CHECK_VALIDINT "$1" && INPUT=$1 || INPUT=0 #///////////////////////////////////////////////////////////////////////////////////// # Output Data #///////////////////////////////////////////////////////////////////////////////////// OUTPUT_MODE=$INPUT - - #OUTPUT_MODE_0 (TERM/SCREEN) - TERM_X=$(tput cols) - TERM_Y=$(tput lines) - TERM_TOTAL_CHARS=$(( $TERM_X * $TERM_Y - 1)) #How many printed chars are required to fill screen? - TERM_COLOUR='\e[48;5;15m' - - #OUTPUT_MODE_1 (RPI status LEDs) - - #OUTPUT_MODE_2 (Sound) + SOUND_PID=-1 Output_On(){ - #TERM/SCREEN Output + # console/screen if (( $OUTPUT_MODE == 0 )); then - #Set color - echo -e "$TERM_COLOUR" - printf '\ec' # clear current terminal screen + # Fill terminal with colour + # - 8bit colour code (light gray) for max terminal support + echo -ne '\e[H\e[47m\e[J' - #RPi status LEDs + # RPi status LEDs elif (( $OUTPUT_MODE == 1 )); then echo 1 > /sys/class/leds/led0/brightness echo 1 > /sys/class/leds/led1/brightness + # ALSA (sound) elif (( $OUTPUT_MODE == 2 )); then - #Isnt quick enough in bash. cant get buffer/latency low enough to make it usable. + # Isnt quick enough in bash. cant get buffer/latency low enough to make it usable. speaker-test -b 40000 -t sine -f 800 -l 1 -p 1 &> /dev/null & - pid=$! + SOUND_PID=$! fi @@ -76,22 +67,22 @@ Output_Off(){ - #TERM/SCREEN Output + # console/screen if (( $OUTPUT_MODE == 0 )); then - #reset colour - echo -e '\e[0m' - printf '\ec' # clear current terminal screen + # Reset colour + echo -ne '\e[H\e[0m\e[J' - #RPi status LEDs + # RPi status LEDs elif (( $OUTPUT_MODE == 1 )); then echo 0 > /sys/class/leds/led0/brightness echo 0 > /sys/class/leds/led1/brightness + # ALSA (sound) elif (( $OUTPUT_MODE == 2 )); then - kill -9 $pid + kill -9 $SOUND_PID #killall speaker-test &> /dev/null fi @@ -103,22 +94,22 @@ #///////////////////////////////////////////////////////////////////////////////////// CHAR_CURRENT=0 - #Filepaths - FP_TEXTFILE_INPUT="$HOME/dietpi-morsecode" - FP_TEXTFILE_LOWERCASE='/tmp/.dietpi-morsecode_lowercase' + # Filepaths + FP_TEXTFILE_INPUT='/root/dietpi-morsecode' + FP_TEXTFILE_LOWERCASE='.dietpi-morsecode_lowercase' - #Define single unit duration (essentially the speed at which the morse code is outputted) + # Define single unit duration (essentially the speed at which the morse code is outputted) MC_DURATION_UNIT=0.15 - #Dash and next char duration ( MC_DURATION_UNIT * 3 ) - MC_DURATION_DASH=$(echo - | mawk "{print $MC_DURATION_UNIT * 3}") - #New word duration ( MC_DURATION_UNIT * 7 ) - MC_DURATION_WORD=$(echo - | mawk "{print $MC_DURATION_UNIT * 7}") + # Dash and next char duration ( MC_DURATION_UNIT * 3 ) + MC_DURATION_DASH=$(mawk "{print $MC_DURATION_UNIT * 3}" <<< '') + # New word duration ( MC_DURATION_UNIT * 7 ) + MC_DURATION_WORD=$(mawk "{print $MC_DURATION_UNIT * 7}" <<< '') Mc_Convert_Input_Textfile_Lowercase(){ - echo -e 'DietPi-Morsecode\n\nConverting input file to lowercase......\n' + G_DIETPI-NOTIFY 1 'DietPi-Morsecode\n\nConverting input file to lowercase......\n' dd if="$FP_TEXTFILE_INPUT" of="$FP_TEXTFILE_LOWERCASE" conv=lcase &> /dev/null - echo -e "Completed\nRendering to Output_Mode $OUTPUT_MODE" + G_DIETPI-NOTIFY 1 "Completed\nRendering to Output_Mode $OUTPUT_MODE" } @@ -152,7 +143,7 @@ } - #AR + # AR Mc_End_of_Message(){ Mc_Next_Word @@ -441,26 +432,29 @@ #///////////////////////////////////////////////////////////////////////////////////// # Main Loop #///////////////////////////////////////////////////////////////////////////////////// - #Check for input file + # Check for input file if [[ ! -f $FP_TEXTFILE_INPUT ]]; then - printf '\ec' # clear current terminal screen - echo -e "\nNo textfile was found. Please create a file at:\n$FP_TEXTFILE_INPUT\nThis file will then be converted to Morse Code." - exit + + G_DIETPI-NOTIFY 1 "No textfile was found. Please create a file at:\n$FP_TEXTFILE_INPUT\nThis file will then be converted to Morse Code." + exit 1 + fi #----------------------------------------------------------------------------------- - #Convert input textfile file to lowercase + # Convert input textfile file to lowercase Mc_Convert_Input_Textfile_Lowercase #----------------------------------------------------------------------------------- - #Process file (read char one at a time, convert to morse code and render) + # Process file (read char one at a time, convert to morse code and render) + # - Clear screen in case of console/screen output mode + (( $OUTPUT_MODE == 0 )) && printf '\ec' while read -r -n1 CHAR_CURRENT do - #Space (new word) - if [[ $CHAR_CURRENT = ' ' ]]; then + # Space (new word) + if [[ $CHAR_CURRENT == [[:space:]] ]]; then Mc_Next_Word - #Next char + # Next char else Mc_Next_Char @@ -470,7 +464,7 @@ done < $FP_TEXTFILE_LOWERCASE - #Send end of message (AR) + # Send end of message (AR) Mc_End_of_Message #----------------------------------------------------------------------------------- exit diff --git a/dietpi/dietpi-process_tool b/dietpi/dietpi-process_tool index d49012ad0a..27cff3f857 100644 --- a/dietpi/dietpi-process_tool +++ b/dietpi/dietpi-process_tool @@ -277,7 +277,7 @@ aNAME[$index]='Sonarr';aPROCESS_NAME[$index]='NzbDrone.exe';((index++)) aNAME[$index]='Spotify Connect Web';aPROCESS_NAME[$index]='spotify-connect-web';((index++)) aNAME[$index]='Supervisor';aPROCESS_NAME[$index]='supervisor';((index++)) - aNAME[$index]='Squeezebox Server (LMS)';aPROCESS_NAME[$index]='squeezeboxserver';((index++)) + aNAME[$index]='Logitech Media Server';aPROCESS_NAME[$index]='squeezeboxserver';((index++)) aNAME[$index]='Squeezelite';aPROCESS_NAME[$index]='squeezelite';((index++)) aNAME[$index]='Syncthing';aPROCESS_NAME[$index]='syncthing';((index++)) aNAME[$index]='Syncthing-inotify';aPROCESS_NAME[$index]='syncthing-inotify';((index++)) @@ -437,7 +437,7 @@ Write_Settings_File(){ - rm $FP_SETTINGS &> /dev/null + [[ -f $FP_SETTINGS ]] && rm $FP_SETTINGS local save_index=0 for i in ${!aNAME[@]} diff --git a/dietpi/dietpi-services b/dietpi/dietpi-services index 0bbc035aa1..bb37abe636 100644 --- a/dietpi/dietpi-services +++ b/dietpi/dietpi-services @@ -65,7 +65,9 @@ # - PHP 'php5-fpm' 'php7.0-fpm' + 'php7.1-fpm' 'php7.2-fpm' + 'php7.3-fpm' # - Webservers 'apache2' @@ -102,7 +104,7 @@ # - Media 'ympd' 'mympd' - 'squeezeboxserver' + 'logitechmediaserver' 'subsonic' 'airsonic' 'mopidy' @@ -199,7 +201,7 @@ # - SSH aSERVICE_NAME+=('dropbear') - aSERVICE_NAME+=('ssh') #: OpenSSH-server + aSERVICE_NAME+=('ssh') #: OpenSSH Server # - Misc #aSERVICE_NAME+=('systemd-timesyncd') #: Timesync. DietPi stops this by default after success, may confuse user/prompt questions. @@ -208,7 +210,7 @@ aSERVICE_NAME+=('openvpn') #: https://github.com/MichaIng/DietPi/issues/1501 aSERVICE_NAME+=('vncserver') #: DietPi vnc server service/script aSERVICE_NAME+=('nxserver') #: Nomachine - aSERVICE_NAME+=('xrdp') #: XRDP server + aSERVICE_NAME+=('xrdp') #: XRDP Server aSERVICE_NAME+=('amiberry') #: DietPi AmiBerry run service # - DietPi @@ -219,6 +221,7 @@ aSERVICE_NAME+=('dietpi-postboot') aSERVICE_NAME+=('dietpi-wifi-monitor') #: https://github.com/MichaIng/DietPi/issues/1288#issuecomment-350653480 aSERVICE_NAME+=('dietpi-nordvpn') #: NordVPN install + client + aSERVICE_NAME+=('dietpi-arr_to_RAM') #: Sonarr/Radarr/Lidarr database to RAM link service #aSERVICE_NAME+=('wg-quick@wg0') #: WireGuard fi @@ -412,7 +415,7 @@ if (( ${aSERVICE_AVAILABLE[$i]} )); then - G_DIETPI-NOTIFY -2 "${aSERVICE_NAME[$i]}" + G_DIETPI-NOTIFY -2 ${aSERVICE_NAME[$i]} systemctl $target_state ${aSERVICE_NAME[$i]} &> /dev/null @@ -430,7 +433,7 @@ if (( ${aSERVICE_AVAILABLE[$i]} )); then - G_DIETPI-NOTIFY -2 "${aSERVICE_NAME[$i]}" + G_DIETPI-NOTIFY -2 ${aSERVICE_NAME[$i]} systemctl $target_state ${aSERVICE_NAME[$i]} &> /dev/null @@ -499,7 +502,7 @@ _EOF_ #Apply if (( ${aSERVICE_AVAILABLE[$i]} )); then - G_DIETPI-NOTIFY -2 "${aSERVICE_NAME[$i]}" + G_DIETPI-NOTIFY -2 ${aSERVICE_NAME[$i]} systemctl $SYSTEMD_CMD ${aSERVICE_NAME[$i]} &> /dev/null @@ -568,7 +571,7 @@ _EOF_ #Apply if (( ${aSERVICE_AVAILABLE[$i]} )); then - STATUS=${aSERVICE_NAME[$i]}\t$(systemctl status ${aSERVICE_NAME[$i]} | grep -m1 'Active' | cut -c12-) + STATUS="${aSERVICE_NAME[$i]}\t$(systemctl status ${aSERVICE_NAME[$i]} | grep -m1 'Active' | cut -c12-)" if [[ $STATUS =~ 'failed' ]]; then diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index 68c0204fbf..fdf2957459 100644 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -9,36 +9,37 @@ #//////////////////////////////////// # # Info: - # - filename /DietPi/dietpi/dietpi-software - # - Installs "ready to run" software with optimizations unique to the device. + # - Location: /DietPi/dietpi/dietpi-software + # - Installs "ready to run" software with optimisations unique to the device. # - Generates and uses /DietPi/dietpi/.installed (software list) # -1=selected for uninstall, 0=not installed, 1=selected for install, 2=installed # # Usage: - # - dietpi-software - # - /DietPi/dietpi/dietpi-software install iUNIQUEID (OR) sINDEX_{SSHSERVER,FILESERVER,LOGGING,WEBSERVER}_TARGET=-int - # - /DietPi/dietpi/dietpi-software reinstall #Same as installed, however, only reinstalls if state =2. Does not uninstall due to package removal danger (eg: xserver removes kodi), simply flags to be installed (=1). - # - /DietPi/dietpi/dietpi-software uninstall iUNIQUEID - # - /DietPi/dietpi/dietpi-software list #Lists UNIQUEIDs for software. + # - dietpi-software # Menu to select software for (un)install + # - dietpi-software install $software_id (OR) $INDEX_{SSHSERVER,FILESERVER,LOGGING,WEBSERVER}_TARGET=-int + # - dietpi-software reinstall # Same as installed, however, only reinstalls if state =2. Does not uninstall due to package removal danger (eg: Xserver removes Kodi), simply flags to be installed (=1). + # - dietpi-software uninstall $software_id + # - dietpi-software list # Lists all available software titles with ID and info + # - dietpi-software free # List currently unused software IDs to be used for new software implementations #//////////////////////////////////// - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals --------------------------------------------------------------- . /DietPi/dietpi/func/dietpi-globals G_PROGRAM_NAME='DietPi-Software' G_CHECK_ROOT_USER G_CHECK_ROOTFS_RW G_INIT - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals --------------------------------------------------------------- #///////////////////////////////////////////////////////////////////////////////////// - #Filepath + # Filepath #///////////////////////////////////////////////////////////////////////////////////// FP_INSTALLED_FILE='/DietPi/dietpi/.installed' FP_INSTALLED_FILE_TEMP='.installed' - #Used to set user/personal data directories (eg: usbdrive) + # Used to set user/personal data directories (eg: usbdrive) FP_DIETPI_DEDICATED_USBDRIVE='' - #Default user content folders used in DietPi. + # Default user content folders used in DietPi. FOLDER_MUSIC='Music' FOLDER_PICTURES='Pictures' FOLDER_VIDEO='Video' @@ -58,7 +59,7 @@ > $fp_target - #Save installed states + # Save installed states for i in ${!aSOFTWARE_INSTALL_STATE[@]} do @@ -75,22 +76,22 @@ done - #Misc + # Misc cat << _EOF_ >> $fp_target -#DietPi Choice System: SSH Server +# DietPi Choice System: SSH Server INDEX_SSHSERVER_CURRENT=$INDEX_SSHSERVER_CURRENT INDEX_SSHSERVER_TARGET=$INDEX_SSHSERVER_TARGET -#DietPi Choice System: File Server +# DietPi Choice System: File Server INDEX_FILESERVER_CURRENT=$INDEX_FILESERVER_CURRENT INDEX_FILESERVER_TARGET=$INDEX_FILESERVER_TARGET -#DietPi Choice System: Logging +# DietPi Choice System: Logging INDEX_LOGGING_CURRENT=$INDEX_LOGGING_CURRENT INDEX_LOGGING_TARGET=$INDEX_LOGGING_TARGET -#DietPi Preference System: Webserver base +# DietPi Preference System: Webserver base INDEX_WEBSERVER_CURRENT=$INDEX_WEBSERVER_CURRENT INDEX_WEBSERVER_TARGET=$INDEX_WEBSERVER_TARGET _EOF_ @@ -99,16 +100,16 @@ _EOF_ Read_InstallFileList(){ - #Load Software states + # Load Software states G_DIETPI-NOTIFY -2 'Reading database' local fp_target=$FP_INSTALLED_FILE [[ $1 == 'temp' ]] && fp_target=$FP_INSTALLED_FILE_TEMP - #Load + # Load [[ -f $fp_target ]] && . $fp_target - #Always reset choice system during first run to defaults: https://github.com/MichaIng/DietPi/issues/1122 + # Always reset choice system during first run to defaults: https://github.com/MichaIng/DietPi/issues/1122 if (( $G_DIETPI_INSTALL_STAGE == 1 )); then INDEX_SSHSERVER_CURRENT=-1 @@ -135,6 +136,7 @@ _EOF_ # - Use /etc/apt/sources.list for connection test optional_cmd_inputs='--no-check-certificate' G_CHECK_URL "$(grep -m1 '^[[:blank:]]*deb ' /etc/apt/sources.list | mawk '{print $2}')" # Will exit on failure here then prompt user to configure network + # Time sync /DietPi/dietpi/func/run_ntpd } @@ -142,29 +144,37 @@ _EOF_ #///////////////////////////////////////////////////////////////////////////////////// # Installation System #///////////////////////////////////////////////////////////////////////////////////// - #Reboot after installation has finished. + # Reboot after installation has finished DISABLE_REBOOT=0 - #uninstall flag, used in software installations + removals, runs Uninstall_Software() + # Uninstall flag, used in software installations + removals, runs Uninstall_Software() UNINSTALL_REQUIRED=0 - #Global Password for software installs + # Global password for software installs GLOBAL_PW='' Update_Global_Pw(){ GLOBAL_PW='' + + # - Use new "pbkdf2" function on Buster to resolve warning about deprecated key derivation used: https://github.com/MichaIng/DietPi/issues/2213 + local pbkdf2='' + (( $G_DISTRO > 4 )) && pbkdf2='-iter 10000' + # - Encrypted - if [[ -r '/var/lib/dietpi/dietpi-software/.GLOBAL_PW.bin' ]]; then + if [[ -f '/var/lib/dietpi/dietpi-software/.GLOBAL_PW.bin' ]]; then - # - Use new "pbkdf2" function on Buster to resolve warning about deprecated key derivation used: https://github.com/MichaIng/DietPi/issues/2213 - local pbkdf2='' - (( $G_DISTRO > 4 )) && pbkdf2='-iter 10000' GLOBAL_PW=$(openssl enc -d -a -md sha256 -aes-256-cbc $pbkdf2 -salt -pass pass:'DietPiRocks!' -in /var/lib/dietpi/dietpi-software/.GLOBAL_PW.bin) - # - 1st run automated setup only - else + # - 1st run automated setup or user cancelled manual password choice + elif GLOBAL_PW=$(grep -m1 '^[[:blank:]]*AUTO_SETUP_GLOBAL_PASSWORD=' /DietPi/dietpi.txt | sed 's/^[^=]*=//'); then - GLOBAL_PW=$(grep -m1 '^[[:blank:]]*AUTO_SETUP_GLOBAL_PASSWORD=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') + G_CONFIG_INJECT 'AUTO_SETUP_GLOBAL_PASSWORD=' 'AUTO_SETUP_GLOBAL_PASSWORD=Password has been encrypted and secured on rootFS' /DietPi/dietpi.txt + openssl enc -e -a -md sha256 -aes-256-cbc $pbkdf2 -salt -pass pass:'DietPiRocks!' -out /var/lib/dietpi/dietpi-software/.GLOBAL_PW.bin <<< $GLOBAL_PW + chmod 600 /var/lib/dietpi/dietpi-software/.GLOBAL_PW.bin + [[ $GLOBAL_PW != 'dietpi' ]] && G_WHIP_MSG '[INFO] For security reasons your global software password has been removed from dietpi.txt and instead saved and ecrypted within: + - /var/lib/dietpi/dietpi-software/.GLOBAL_PW.bin\n +DietPi-Software will decrypt and use it for software installs. You can change it via: + - dietpi-config > Security Options > Change Passwords' fi @@ -172,16 +182,16 @@ _EOF_ if [[ ! $GLOBAL_PW ]]; then GLOBAL_PW='dietpi' - G_DIETPI-NOTIFY 1 "Unable to obtain GLOBAL_PW from dietpi.txt (1st run automation only), and, /var/lib/dietpi/dietpi-software/.GLOBAL_PW.bin\n\nThe following fallback GLOBAL_PW will be used:\n - $GLOBAL_PW" + G_WHIP_MSG "[ERROR] Unable to obtain your global software password\n\nThe following fallback password will be used:\n - $GLOBAL_PW" fi } - #Total system RAM (used to calculate percentage based value for software cache levels, eg: opcache/apcu max sizes) + # Total system RAM: Used to calculate percentage based value for software cache levels, eg: OPcache/APCu max sizes RAM_TOTAL=$(free -m | mawk '/Mem:/ {print $2;exit}') - #Run Installation Flag (1 = run installs) + # Run Installation Flag (1 = run installs) GOSTARTINSTALL=0 # Install variables @@ -189,143 +199,69 @@ _EOF_ UNINSTALL_URL_ADDRESS='' DEPS_LIST='' - #Special installation Vars + # Special installation Vars USER_EMONHUB_APIKEY_COMPLETED=0 USER_EMONHUB_APIKEY_CURRENT=0 WIFIHOTSPOT_RTL8188C_DEVICE=0 USER_LINUX_AUTOINSTALL_PROMPT_DISPLAYED=0 - #PHP5/7 specific directories, apt package-, module- and command names - # - and Distro specific MariaDB service name - FP_PHP_BASE_DIR='/etc/php/7.0' - PHP_APT_PACKAGE_NAME='php7.0' - PHP_BINARY='php' + # PHP version specific directories, APT package-, module- and command names + # - and distro specific MariaDB service name + FP_PHP_BASE_DIR='/etc/php/7.3' + PHP_NAME='php7.3' + # MariaDB: On Jessie it is still shipped with /etc/init.d/mysql only MARIADB_SERVICE='mariadb' - if (( $G_DISTRO < 4 )); then - - FP_PHP_BASE_DIR='/etc/php5' - PHP_APT_PACKAGE_NAME='php5' - PHP_BINARY='php5' - MARIADB_SERVICE='mysql' - - elif (( $G_DISTRO > 4 )); then - - FP_PHP_BASE_DIR='/etc/php/7.3' - PHP_APT_PACKAGE_NAME='php7.3' - - fi + (( $G_DISTRO < 4 )) && MARIADB_SERVICE='mysql' USBDRIVE=0 - #Choices Made? + # Choices Made? INSTALL_SOFTWARE_CHOICESMADE=0 - #DietPi Choice System: SSH Server - #NB: Update Read_InstallFileList with defaults + # DietPi Choice System: SSH Server + # NB: Update Read_InstallFileList with defaults INSTALL_SSHSERVER_CHOICESMADE=0 INDEX_SSHSERVER_CURRENT=-1 INDEX_SSHSERVER_TARGET=-1 - #DietPi Choice System: Fileserver - #NB: Update Read_InstallFileList with defaults + # DietPi Choice System: Fileserver + # NB: Update Read_InstallFileList with defaults INSTALL_FILESERVER_CHOICESMADE=0 INDEX_FILESERVER_CURRENT=0 INDEX_FILESERVER_TARGET=0 - #DietPi Choice System: Logging - #NB: Update Read_InstallFileList with defaults + # DietPi Choice System: Logging + # NB: Update Read_InstallFileList with defaults INSTALL_LOGGING_CHOICESMADE=0 INDEX_LOGGING_CURRENT=-1 INDEX_LOGGING_TARGET=-1 - #DietPi Preference System: Webserver base - #NB: Update Read_InstallFileList with defaults + # DietPi Preference System: Webserver base + # NB: Update Read_InstallFileList with defaults INDEX_WEBSERVER_CURRENT=-2 INDEX_WEBSERVER_TARGET=-2 FP_ONLINEDOC_URL='https://dietpi.com/phpbb/viewtopic.php?' - # - Available for - MAX_G_HW_MODEL=71 #This needs to match highest G_HW_MODEL value in dietpi-obtain_hw_model - MAX_G_HW_ARCH=10 #This needs to match highest G_HW_ARCH value in dietpi-obtain_hw_model - MAX_G_DISTRO=5 #This needs to match highest G_DISTRO value in dietpi-obtain_hw_model - # 2D array (well, bash style) + # Available for + MAX_G_HW_MODEL=71 # This needs to match highest G_HW_MODEL value in dietpi-obtain_hw_model + MAX_G_HW_ARCH=10 # This needs to match highest G_HW_ARCH value in dietpi-obtain_hw_model + MAX_G_DISTRO=5 # This needs to match highest G_DISTRO value in dietpi-obtain_hw_model + # - 2D array (well, bash style) declare -A aSOFTWARE_AVAIL_G_HW_MODEL declare -A aSOFTWARE_AVAIL_G_HW_ARCH declare -A aSOFTWARE_AVAIL_G_DISTRO - #///////////////////////////////////////////////////////////////////////////////////// - # This function generates the array for all the software available for installation. - # - # Reference: - # - Adding new software to DietPi-Software: - # https://github.com/MichaIng/DietPi/issues/490#issuecomment-244416570 - # - # Adding software to the install list: - # ------------------------------------ - # - software_id: - # This is the next number in the sequence. Each software install has a unique number, - # so it can be referenced in all arrays. This has to be the same for install, uninstall - # and setting up the service. Run "dietpi-software list | grep ''" to - # get the next number in the sequence. Ensure that you are running a testing build, as - # release may be behind the testing branch and available software packages. - # - # - aSOFTWARE_WHIP_NAME[$software_id]: - # This is the name to display in the UI. - # - # - aSOFTWARE_WHIP_DESC[$software_id]: - # This is the description to place next to the name in the UI. - # - # - aSOFTWARE_CATEGORY_INDEX[$software_id]: - # If you are adding a new piece of software, first choose the category it belongs to - # (see aSOFTWARE_CATEGORIES_DIETPI and aSOFTWARE_CATEGORIES_LINUX below), which will - # give you the aSOFTWARE_CATEGORY_INDEX to set. In the example below this is 0. - # - # - aSOFTWARE_TYPE[$software_id]: - # If this is aSOFTWARE_CATEGORIES_DIETPI then aSOFTWARE_TYPE=0, if it is - # aSOFTWARE_CATEGORIES_LINUX then it is 1. In the example it is 0. - # - # - aSOFTWARE_ONLINEDOC_URL[$software_id]: - # This is appended to FP_ONLINEDOC_URL to make a URL for help on this software. - # - # Specifying other software as dependencies: - # If your software needs other software to be available, look under the 'Requires software - # to be installed' heading and then add that to the section you create. In the example - # below ALSA and XSERVERXORG are needed. The system will check their presence - # and install as needed. - # - # Dealing with Hardware types: - # If you have hardware requirements, like must not/only be installed on a Pi, then you need - # to add something like below. Look for other examples in the existing software - # installations. Full list of models can be found in 'dietpi-obtain_hw_model'. - # - # # - Disable for All non-RPi - # for ((i=10; i<=$MAX_G_HW_MODEL; i++)) - # do - # aSOFTWARE_AVAIL_G_HW_MODEL[$software_id,$i]=0 - # done - # - # Example: - # #------------------ Desktops: LXDE ------------------ - # software_id=23 - # aSOFTWARE_WHIP_NAME[$software_id]='LXDE' - # aSOFTWARE_WHIP_DESC[$software_id]='ultra lightweight desktop' - # aSOFTWARE_CATEGORY_INDEX[$software_id]=0 - # aSOFTWARE_TYPE[$software_id]=0 - # aSOFTWARE_REQUIRES_ALSA[$software_id]=1 - # aSOFTWARE_REQUIRES_XSERVERXORG[$software_id]=1 - # aSOFTWARE_ONLINEDOC_URL[$software_id]='f=8&t=5#p42' - # - #///////////////////////////////////////////////////////////////////////////////////// + # Generate arrays for all available software titles Software_Arrays_Init(){ - G_DIETPI-NOTIFY -2 'Initializing database' + G_DIETPI-NOTIFY -2 'Initialising database' #-------------------------------------------------------------------------------- - #Categories - #NB: Unique IDs, do not re-arrange or re-order. + # Categories + # NB: Unique IDs, do not re-arrange or re-order! #-------------------------------------------------------------------------------- - #DietPi software + # DietPi optimised software aSOFTWARE_CATEGORIES_DIETPI=( '●─ Desktops ' #0 @@ -352,7 +288,7 @@ _EOF_ ) - #Linux software + # Linux additional software aSOFTWARE_CATEGORIES_LINUX=( '●─ SSH Clients ' #0 @@ -368,87 +304,118 @@ _EOF_ ) #-------------------------------------------------------------------------------- - #DietPi software items + # DietPi software items #-------------------------------------------------------------------------------- - #Before adding, please check 'dietpi-software list | grep null' to list NULL (available) IDs for use. + # Before adding, please check 'dietpi-software free' to list free IDs for use. - #Assign UNIQUE ID to each item + # Assign unique ID to each item local software_id=-1 - #Desktops + # Desktops #-------------------------------------------------------------------------------- software_id=23 - aSOFTWARE_WHIP_NAME[$software_id]='LXDE' - aSOFTWARE_WHIP_DESC[$software_id]='ultra lightweight desktop' - aSOFTWARE_CATEGORY_INDEX[$software_id]=0 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_ALSA[$software_id]=1 - aSOFTWARE_REQUIRES_XSERVERXORG[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=42#p42' + aSOFTWARE_WHIP_NAME[$software_id]='LXDE' + aSOFTWARE_WHIP_DESC[$software_id]='ultra lightweight desktop' + aSOFTWARE_CATEGORY_INDEX[$software_id]=0 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_ALSA[$software_id]=1 + aSOFTWARE_REQUIRES_XSERVERXORG[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=42#p42' + + #------------------ + software_id=173 + + aSOFTWARE_WHIP_NAME[$software_id]='LXQt' + aSOFTWARE_WHIP_DESC[$software_id]='Lightweight desktop' + aSOFTWARE_CATEGORY_INDEX[$software_id]=0 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_ALSA[$software_id]=1 + aSOFTWARE_REQUIRES_XSERVERXORG[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=17712#p17712' #------------------ software_id=24 - aSOFTWARE_WHIP_NAME[$software_id]='MATE' - aSOFTWARE_WHIP_DESC[$software_id]='desktop enviroment' - aSOFTWARE_CATEGORY_INDEX[$software_id]=0 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_ALSA[$software_id]=1 - aSOFTWARE_REQUIRES_XSERVERXORG[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=2073#p2073' + aSOFTWARE_WHIP_NAME[$software_id]='MATE' + aSOFTWARE_WHIP_DESC[$software_id]='desktop enviroment' + aSOFTWARE_CATEGORY_INDEX[$software_id]=0 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_ALSA[$software_id]=1 + aSOFTWARE_REQUIRES_XSERVERXORG[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=2073#p2073' #------------------ software_id=25 - aSOFTWARE_WHIP_NAME[$software_id]='XFCE' - aSOFTWARE_WHIP_DESC[$software_id]='lightweight desktop environment' - aSOFTWARE_CATEGORY_INDEX[$software_id]=0 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_ALSA[$software_id]=1 - aSOFTWARE_REQUIRES_XSERVERXORG[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=2203#p2203' + aSOFTWARE_WHIP_NAME[$software_id]='XFCE' + aSOFTWARE_WHIP_DESC[$software_id]='lightweight desktop environment' + aSOFTWARE_CATEGORY_INDEX[$software_id]=0 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_ALSA[$software_id]=1 + aSOFTWARE_REQUIRES_XSERVERXORG[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=2203#p2203' #------------------ software_id=26 - aSOFTWARE_WHIP_NAME[$software_id]='GNUStep' - aSOFTWARE_WHIP_DESC[$software_id]='lightweight based on OpenStep' - aSOFTWARE_CATEGORY_INDEX[$software_id]=0 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_ALSA[$software_id]=1 - aSOFTWARE_REQUIRES_XSERVERXORG[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=2072#p2072' + aSOFTWARE_WHIP_NAME[$software_id]='GNUStep' + aSOFTWARE_WHIP_DESC[$software_id]='lightweight based on OpenStep' + aSOFTWARE_CATEGORY_INDEX[$software_id]=0 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_ALSA[$software_id]=1 + aSOFTWARE_REQUIRES_XSERVERXORG[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=2072#p2072' #------------------ software_id=113 - aSOFTWARE_WHIP_NAME[$software_id]='Chromium' - aSOFTWARE_WHIP_DESC[$software_id]='web browser for desktop or autostart' - aSOFTWARE_CATEGORY_INDEX[$software_id]=0 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_ALSA[$software_id]=1 - aSOFTWARE_REQUIRES_XSERVERXORG[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=3011#p3011' + aSOFTWARE_WHIP_NAME[$software_id]='Chromium' + aSOFTWARE_WHIP_DESC[$software_id]='web browser for desktop or autostart' + aSOFTWARE_CATEGORY_INDEX[$software_id]=0 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_ALSA[$software_id]=1 + aSOFTWARE_REQUIRES_XSERVERXORG[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=3011#p3011' # - ARMv6 aSOFTWARE_AVAIL_G_HW_ARCH[$software_id,1]=0 - #Remote Desktops + #------------------ + software_id=174 + + aSOFTWARE_WHIP_NAME[$software_id]='GIMP' + aSOFTWARE_WHIP_DESC[$software_id]='mspaint on steroids' + aSOFTWARE_CATEGORY_INDEX[$software_id]=0 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_XSERVERXORG[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=17713#p17713' + + #------------------ + software_id=175 + + aSOFTWARE_WHIP_NAME[$software_id]='XFCE4 Power' + aSOFTWARE_WHIP_DESC[$software_id]='power manager with brightness (recommended for LXDE/LXQt)' + aSOFTWARE_CATEGORY_INDEX[$software_id]=0 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_XSERVERXORG[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='' + + # Remote Desktops #-------------------------------------------------------------------------------- software_id=27 - aSOFTWARE_WHIP_NAME[$software_id]='TightVNC Server' - aSOFTWARE_WHIP_DESC[$software_id]='desktop for remote connection' - aSOFTWARE_CATEGORY_INDEX[$software_id]=1 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_DESKTOP[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=408#p408' + aSOFTWARE_WHIP_NAME[$software_id]='TightVNC Server' + aSOFTWARE_WHIP_DESC[$software_id]='desktop for remote connection' + aSOFTWARE_CATEGORY_INDEX[$software_id]=1 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_DESKTOP[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=408#p408' # - ARMv8 aSOFTWARE_AVAIL_G_HW_ARCH[$software_id,3]=0 - # - Stretch+: replaced by tigervnc (vnc4) + # - Stretch+: Replaced by TigerVNC (VNC4) for ((i=4; i<=$MAX_G_DISTRO; i++)) do @@ -459,42 +426,42 @@ _EOF_ #------------------ software_id=28 - aSOFTWARE_WHIP_NAME[$software_id]='VNC4 Server' - aSOFTWARE_WHIP_DESC[$software_id]='desktop for remote connection' - aSOFTWARE_CATEGORY_INDEX[$software_id]=1 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_DESKTOP[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=408#p408' + aSOFTWARE_WHIP_NAME[$software_id]='VNC4 Server' + aSOFTWARE_WHIP_DESC[$software_id]='desktop for remote connection' + aSOFTWARE_CATEGORY_INDEX[$software_id]=1 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_DESKTOP[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=408#p408' #------------------ software_id=29 - aSOFTWARE_WHIP_NAME[$software_id]='XRDP' - aSOFTWARE_WHIP_DESC[$software_id]='remote desktop protocol (rdp) server' - aSOFTWARE_CATEGORY_INDEX[$software_id]=1 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_DESKTOP[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=2074#p2074' + aSOFTWARE_WHIP_NAME[$software_id]='XRDP' + aSOFTWARE_WHIP_DESC[$software_id]='remote desktop protocol (rdp) server' + aSOFTWARE_CATEGORY_INDEX[$software_id]=1 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_DESKTOP[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=2074#p2074' #------------------ software_id=30 - aSOFTWARE_WHIP_NAME[$software_id]='NoMachine' - aSOFTWARE_WHIP_DESC[$software_id]='multi-platform server and client access' - aSOFTWARE_CATEGORY_INDEX[$software_id]=1 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_DESKTOP[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=2071#p2071' + aSOFTWARE_WHIP_NAME[$software_id]='NoMachine' + aSOFTWARE_WHIP_DESC[$software_id]='multi-platform server and client access' + aSOFTWARE_CATEGORY_INDEX[$software_id]=1 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_DESKTOP[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=2071#p2071' #------------------ software_id=120 - aSOFTWARE_WHIP_NAME[$software_id]='RealVNC Server' - aSOFTWARE_WHIP_DESC[$software_id]='desktop for remote connection' - aSOFTWARE_CATEGORY_INDEX[$software_id]=1 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_DESKTOP[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=4149#p4149' + aSOFTWARE_WHIP_NAME[$software_id]='RealVNC Server' + aSOFTWARE_WHIP_DESC[$software_id]='desktop for remote connection' + aSOFTWARE_CATEGORY_INDEX[$software_id]=1 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_DESKTOP[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=4149#p4149' # - License RPi only for ((i=10; i<=$MAX_G_HW_MODEL; i++)) @@ -508,243 +475,237 @@ _EOF_ #-------------------------------------------------------------------------------- software_id=31 - aSOFTWARE_WHIP_NAME[$software_id]='Kodi' - aSOFTWARE_WHIP_DESC[$software_id]='the media centre for linux' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_ALSA[$software_id]=1 - aSOFTWARE_REQUIRES_XSERVERXORG[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=43#p43' + aSOFTWARE_WHIP_NAME[$software_id]='Kodi' + aSOFTWARE_WHIP_DESC[$software_id]='the media centre for linux' + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_ALSA[$software_id]=1 + aSOFTWARE_REQUIRES_XSERVERXORG[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=43#p43' - # - Only RPi + Odroid - for ((i=20; i<=$MAX_G_HW_MODEL; i++)) + # - Only RPi + Odroid + x86_64 + for ((i=22; i<=$MAX_G_HW_MODEL; i++)) do aSOFTWARE_AVAIL_G_HW_MODEL[$software_id,$i]=0 done - # - Re-enable Native PC - aSOFTWARE_AVAIL_G_HW_MODEL[$software_id,21]=1 - # + ASUS TB aSOFTWARE_AVAIL_G_HW_MODEL[$software_id,52]=1 - # + NanoPC T4 - # aSOFTWARE_AVAIL_G_HW_MODEL[$software_id,68]=1 + # - C1 + (( $G_DISTRO > 3 )) & aSOFTWARE_AVAIL_G_HW_MODEL[$software_id,10]=0 #------------------ software_id=32 - aSOFTWARE_WHIP_NAME[$software_id]='YMPD' - aSOFTWARE_WHIP_DESC[$software_id]='lightweight web interface music player for mpd' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_ALSA[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=50#p50' + aSOFTWARE_WHIP_NAME[$software_id]='YMPD' + aSOFTWARE_WHIP_DESC[$software_id]='lightweight web interface music player for mpd' + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_ALSA[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=50#p50' #------------------ software_id=148 - aSOFTWARE_WHIP_NAME[$software_id]='myMPD' - aSOFTWARE_WHIP_DESC[$software_id]='fork of ympd with improved features' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_ALSA[$software_id]=1 - aSOFTWARE_REQUIRES_BUILDESSENTIAL[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=13978#p13978' + aSOFTWARE_WHIP_NAME[$software_id]='myMPD' + aSOFTWARE_WHIP_DESC[$software_id]='fork of ympd with improved features' + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_ALSA[$software_id]=1 + aSOFTWARE_REQUIRES_BUILDESSENTIAL[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=13978#p13978' #------------------ software_id=119 - aSOFTWARE_WHIP_NAME[$software_id]='CAVA' - aSOFTWARE_WHIP_DESC[$software_id]='optional: console audio vis for mpd' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_ALSA[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=3928#p3928' + aSOFTWARE_WHIP_NAME[$software_id]='CAVA' + aSOFTWARE_WHIP_DESC[$software_id]='optional: console audio vis for mpd' + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_ALSA[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=3928#p3928' #------------------ software_id=33 - aSOFTWARE_WHIP_NAME[$software_id]='Airsonic' - aSOFTWARE_WHIP_DESC[$software_id]='web interface media streaming server' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_ALSA[$software_id]=1 - aSOFTWARE_REQUIRES_JAVA_JRE_JDK[$software_id]=1 - aSOFTWARE_REQUIRES_FFMPEG[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=11280#p11280' + aSOFTWARE_WHIP_NAME[$software_id]='Airsonic' + aSOFTWARE_WHIP_DESC[$software_id]='web interface media streaming server' + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_ALSA[$software_id]=1 + aSOFTWARE_REQUIRES_JAVA_JRE_JDK[$software_id]=1 + aSOFTWARE_REQUIRES_FFMPEG[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=11280#p11280' #------------------ software_id=34 - aSOFTWARE_WHIP_NAME[$software_id]='Subsonic' - aSOFTWARE_WHIP_DESC[$software_id]='web interface media streaming server' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_ALSA[$software_id]=1 - aSOFTWARE_REQUIRES_FFMPEG[$software_id]=1 - aSOFTWARE_REQUIRES_JAVA_JRE_JDK[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=213#p213' + aSOFTWARE_WHIP_NAME[$software_id]='Subsonic' + aSOFTWARE_WHIP_DESC[$software_id]='web interface media streaming server' + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_ALSA[$software_id]=1 + aSOFTWARE_REQUIRES_FFMPEG[$software_id]=1 + aSOFTWARE_REQUIRES_JAVA_JRE_JDK[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=213#p213' #------------------ software_id=35 - aSOFTWARE_WHIP_NAME[$software_id]='SqueezeBox' - aSOFTWARE_WHIP_DESC[$software_id]='logitech media server (lms)' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1009#p1009' + aSOFTWARE_WHIP_NAME[$software_id]='Logitech Media Server' + aSOFTWARE_WHIP_DESC[$software_id]='aka LMS, Squeezebox Server' + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1009#p1009' #------------------ software_id=36 - aSOFTWARE_WHIP_NAME[$software_id]='SqueezeLite' - aSOFTWARE_WHIP_DESC[$software_id]='audio player for lms & squeezebox' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_ALSA[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1009#p1009' + aSOFTWARE_WHIP_NAME[$software_id]='SqueezeLite' + aSOFTWARE_WHIP_DESC[$software_id]='audio player for lms & squeezebox' + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_ALSA[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1009#p1009' #------------------ software_id=37 - aSOFTWARE_WHIP_NAME[$software_id]='Shairport Sync' - aSOFTWARE_WHIP_DESC[$software_id]='airplay audio player with multiroom sync' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_ALSA[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1221#p1221' + aSOFTWARE_WHIP_NAME[$software_id]='Shairport Sync' + aSOFTWARE_WHIP_DESC[$software_id]='airplay audio player with multiroom sync' + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_ALSA[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1221#p1221' #------------------ software_id=39 - aSOFTWARE_WHIP_NAME[$software_id]='ReadyMedia' - aSOFTWARE_WHIP_DESC[$software_id]='(MiniDLNA) media streaming server (dlna, upnp)' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=49#p49' + aSOFTWARE_WHIP_NAME[$software_id]='ReadyMedia' + aSOFTWARE_WHIP_DESC[$software_id]='(MiniDLNA) media streaming server (dlna, upnp)' + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=49#p49' #------------------ software_id=40 - aSOFTWARE_WHIP_NAME[$software_id]='Ampache' - aSOFTWARE_WHIP_DESC[$software_id]='web interface media streaming server' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_ALSA[$software_id]=1 - aSOFTWARE_REQUIRES_GIT[$software_id]=1 - aSOFTWARE_REQUIRES_FFMPEG[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='Ampache' + aSOFTWARE_WHIP_DESC[$software_id]='web interface media streaming server' + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_ALSA[$software_id]=1 + aSOFTWARE_REQUIRES_GIT[$software_id]=1 + aSOFTWARE_REQUIRES_FFMPEG[$software_id]=1 aSOFTWARE_REQUIRES_WEBSERVER[$software_id]=1 - aSOFTWARE_REQUIRES_PHP[$software_id]=1 - aSOFTWARE_REQUIRES_MYSQL[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=554#p554' + aSOFTWARE_REQUIRES_PHP[$software_id]=1 + aSOFTWARE_REQUIRES_MYSQL[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=554#p554' #------------------ software_id=41 - aSOFTWARE_WHIP_NAME[$software_id]='Emby Server' - aSOFTWARE_WHIP_DESC[$software_id]='web interface media streaming server' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1789#p1789' + aSOFTWARE_WHIP_NAME[$software_id]='Emby Server' + aSOFTWARE_WHIP_DESC[$software_id]='web interface media streaming server' + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1789#p1789' - # - Disable for ARMv6: https://github.com/MichaIng/DietPi/issues/534#issuecomment-416405968 + # - ARMv6: https://github.com/MichaIng/DietPi/issues/534#issuecomment-416405968 aSOFTWARE_AVAIL_G_HW_ARCH[$software_id,1]=0 - # - Disable for all ARM on Jessie: https://github.com/MichaIng/DietPi/issues/2521 + # - ARM on Jessie: https://github.com/MichaIng/DietPi/issues/2521 (( $G_DISTRO < 4 )) && aSOFTWARE_AVAIL_G_HW_ARCH[$software_id,2]=0 && aSOFTWARE_AVAIL_G_HW_ARCH[$software_id,3]=0 #------------------ software_id=42 - aSOFTWARE_WHIP_NAME[$software_id]='Plex Media Server' - aSOFTWARE_WHIP_DESC[$software_id]='web interface media streaming server' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1949#p1949' + aSOFTWARE_WHIP_NAME[$software_id]='Plex Media Server' + aSOFTWARE_WHIP_DESC[$software_id]='web interface media streaming server' + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1949#p1949' - # - Disable for ARMv6: https://github.com/MichaIng/DietPi/issues/648 + # - ARMv6: https://github.com/MichaIng/DietPi/issues/648 aSOFTWARE_AVAIL_G_HW_ARCH[$software_id,1]=0 #------------------ software_id=43 - aSOFTWARE_WHIP_NAME[$software_id]='Murmur' - aSOFTWARE_WHIP_DESC[$software_id]='mumble voip server' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1691#p1691' + aSOFTWARE_WHIP_NAME[$software_id]='Murmur' + aSOFTWARE_WHIP_DESC[$software_id]='mumble voip server' + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1691#p1691' #------------------ software_id=118 - aSOFTWARE_WHIP_NAME[$software_id]='Mopidy' - aSOFTWARE_WHIP_DESC[$software_id]='web interface music & radio player' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=3611#p3611' - aSOFTWARE_REQUIRES_ALSA[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='Mopidy' + aSOFTWARE_WHIP_DESC[$software_id]='web interface music & radio player' + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=3611#p3611' + aSOFTWARE_REQUIRES_ALSA[$software_id]=1 #------------------ software_id=121 - aSOFTWARE_WHIP_NAME[$software_id]='Roon Bridge' - aSOFTWARE_WHIP_DESC[$software_id]='Turns device into Roon capable audio player' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=4153#p4153' - aSOFTWARE_REQUIRES_ALSA[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='Roon Bridge' + aSOFTWARE_WHIP_DESC[$software_id]='Turns device into Roon capable audio player' + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=4153#p4153' + aSOFTWARE_REQUIRES_ALSA[$software_id]=1 - # - Disable for ARMv6 + # - ARMv6 aSOFTWARE_AVAIL_G_HW_ARCH[$software_id,1]=0 #------------------ software_id=124 - aSOFTWARE_WHIP_NAME[$software_id]='NAA daemon' - aSOFTWARE_WHIP_DESC[$software_id]='signalyst network audio adaptor (naa)' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=4294#p4294' - aSOFTWARE_REQUIRES_ALSA[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='NAA daemon' + aSOFTWARE_WHIP_DESC[$software_id]='signalyst network audio adaptor (naa)' + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=4294#p4294' + aSOFTWARE_REQUIRES_ALSA[$software_id]=1 #------------------ software_id=128 - aSOFTWARE_WHIP_NAME[$software_id]='MPD' - aSOFTWARE_WHIP_DESC[$software_id]='music player daemon' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_ALSA[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='' + aSOFTWARE_WHIP_NAME[$software_id]='MPD' + aSOFTWARE_WHIP_DESC[$software_id]='music player daemon' + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_ALSA[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='' #------------------ software_id=129 - aSOFTWARE_WHIP_NAME[$software_id]='O!MPD' - aSOFTWARE_WHIP_DESC[$software_id]='feature-rich, web interface audio player for mpd' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=5171#p5171' - aSOFTWARE_REQUIRES_ALSA[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='O!MPD' + aSOFTWARE_WHIP_DESC[$software_id]='feature-rich, web interface audio player for mpd' + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=5171#p5171' + aSOFTWARE_REQUIRES_ALSA[$software_id]=1 aSOFTWARE_REQUIRES_WEBSERVER[$software_id]=1 - aSOFTWARE_REQUIRES_PHP[$software_id]=1 - aSOFTWARE_REQUIRES_MYSQL[$software_id]=1 - - # - VM - aSOFTWARE_AVAIL_G_HW_MODEL[$software_id,20]=0 + aSOFTWARE_REQUIRES_PHP[$software_id]=1 + aSOFTWARE_REQUIRES_MYSQL[$software_id]=1 #------------------ software_id=135 - aSOFTWARE_WHIP_NAME[$software_id]='IceCast' - aSOFTWARE_WHIP_DESC[$software_id]='Shoutcast streaming server (+DarkIce)' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_ALSA[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=6526#p6526' + aSOFTWARE_WHIP_NAME[$software_id]='IceCast' + aSOFTWARE_WHIP_DESC[$software_id]='Shoutcast streaming server (+DarkIce)' + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_ALSA[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=6526#p6526' # - VM aSOFTWARE_AVAIL_G_HW_MODEL[$software_id,20]=0 @@ -752,12 +713,12 @@ _EOF_ #------------------ software_id=141 - aSOFTWARE_WHIP_NAME[$software_id]='Spotify Connect Web' - aSOFTWARE_WHIP_DESC[$software_id]='web interface for spotify premium' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=7013#p7013' - aSOFTWARE_REQUIRES_ALSA[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='Spotify Connect Web' + aSOFTWARE_WHIP_DESC[$software_id]='web interface for spotify premium' + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=7013#p7013' + aSOFTWARE_REQUIRES_ALSA[$software_id]=1 # - Currently ARMv7+ only, so disable all archs, then re-enable armv7+ for ((i=1; i<=$MAX_G_HW_ARCH; i++)) @@ -771,39 +732,39 @@ _EOF_ #------------------ software_id=143 - aSOFTWARE_WHIP_NAME[$software_id]='Koel' - aSOFTWARE_WHIP_DESC[$software_id]='web interface audio streamer' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=7305#p7305' + aSOFTWARE_WHIP_NAME[$software_id]='Koel' + aSOFTWARE_WHIP_DESC[$software_id]='web interface audio streamer' + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=7305#p7305' aSOFTWARE_REQUIRES_PHP[$software_id]=1 - aSOFTWARE_REQUIRES_MYSQL[$software_id]=1 - aSOFTWARE_REQUIRES_NODEJS[$software_id]=1 - aSOFTWARE_REQUIRES_BUILDESSENTIAL[$software_id]=1 - aSOFTWARE_REQUIRES_FFMPEG[$software_id]=1 + aSOFTWARE_REQUIRES_MYSQL[$software_id]=1 + aSOFTWARE_REQUIRES_NODEJS[$software_id]=1 + aSOFTWARE_REQUIRES_BUILDESSENTIAL[$software_id]=1 + aSOFTWARE_REQUIRES_FFMPEG[$software_id]=1 # Currently user prompt asks for admin user credentials: aSOFTWARE_REQUIRES_USERINPUT[$software_id]=1 #------------------ software_id=146 - aSOFTWARE_WHIP_NAME[$software_id]='Tautulli' - aSOFTWARE_WHIP_DESC[$software_id]='monitoring and tracking tool for Plex' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=7463#p7463' - aSOFTWARE_REQUIRES_GIT[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='Tautulli' + aSOFTWARE_WHIP_DESC[$software_id]='monitoring and tracking tool for Plex' + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=7463#p7463' + aSOFTWARE_REQUIRES_GIT[$software_id]=1 #------------------ software_id=154 - aSOFTWARE_WHIP_NAME[$software_id]='Roon Server' - aSOFTWARE_WHIP_DESC[$software_id]='Roon capable audio player and core' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=7966#p7966' - aSOFTWARE_REQUIRES_ALSA[$software_id]=1 - aSOFTWARE_REQUIRES_FFMPEG[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='Roon Server' + aSOFTWARE_WHIP_DESC[$software_id]='Roon capable audio player and core' + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=7966#p7966' + aSOFTWARE_REQUIRES_ALSA[$software_id]=1 + aSOFTWARE_REQUIRES_FFMPEG[$software_id]=1 # - x86_64 only for ((i=1; i<=$MAX_G_HW_ARCH; i++)) @@ -817,282 +778,285 @@ _EOF_ #------------------ software_id=159 - aSOFTWARE_WHIP_NAME[$software_id]='Allo' - aSOFTWARE_WHIP_DESC[$software_id]='web interface' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 - aSOFTWARE_TYPE[$software_id]=-1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='' - aSOFTWARE_REQUIRES_ALSA[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='Allo' + aSOFTWARE_WHIP_DESC[$software_id]='web interface' + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 + aSOFTWARE_TYPE[$software_id]=-1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='' + aSOFTWARE_REQUIRES_ALSA[$software_id]=1 aSOFTWARE_REQUIRES_WEBSERVER[$software_id]=1 - aSOFTWARE_REQUIRES_PHP[$software_id]=1 - aSOFTWARE_REQUIRES_MYSQL[$software_id]=1 + aSOFTWARE_REQUIRES_PHP[$software_id]=1 + aSOFTWARE_REQUIRES_MYSQL[$software_id]=1 #------------------ software_id=160 - aSOFTWARE_WHIP_NAME[$software_id]='Allo_update' - aSOFTWARE_WHIP_DESC[$software_id]='quick reinstall/update web only' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 - aSOFTWARE_TYPE[$software_id]=-1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='' + aSOFTWARE_WHIP_NAME[$software_id]='Allo_update' + aSOFTWARE_WHIP_DESC[$software_id]='quick reinstall/update web only' + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 + aSOFTWARE_TYPE[$software_id]=-1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='' #------------------ software_id=163 - aSOFTWARE_WHIP_NAME[$software_id]='GMediaRender' - aSOFTWARE_WHIP_DESC[$software_id]='DLNA audio render/endpoint' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_ALSA[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=9012#p9012' + aSOFTWARE_WHIP_NAME[$software_id]='GMediaRender' + aSOFTWARE_WHIP_DESC[$software_id]='DLNA audio render/endpoint' + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_ALSA[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=9012#p9012' #------------------ software_id=167 - aSOFTWARE_WHIP_NAME[$software_id]='Raspotify' - aSOFTWARE_WHIP_DESC[$software_id]='spotify connect client' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_ALSA[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=9368#p9368' + aSOFTWARE_WHIP_NAME[$software_id]='Raspotify' + aSOFTWARE_WHIP_DESC[$software_id]='spotify connect client' + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_ALSA[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=9368#p9368' - # Disable for ARMv8 + x86_64: + # - ARMv8 - x86_64 aSOFTWARE_AVAIL_G_HW_ARCH[$software_id,3]=0 aSOFTWARE_AVAIL_G_HW_ARCH[$software_id,10]=0 #------------------ software_id=80 - aSOFTWARE_WHIP_NAME[$software_id]='Ubooquity' - aSOFTWARE_WHIP_DESC[$software_id]='a free home server for your comics and ebooks library' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_JAVA_JRE_JDK[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=12969#p12969' + aSOFTWARE_WHIP_NAME[$software_id]='Ubooquity' + aSOFTWARE_WHIP_DESC[$software_id]='a free home server for your comics and ebooks library' + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_JAVA_JRE_JDK[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=12969#p12969' #------------------ software_id=86 - aSOFTWARE_WHIP_NAME[$software_id]='Roon Extension Manager' - aSOFTWARE_WHIP_DESC[$software_id]='Manage extensions from within Roon' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_GIT[$software_id]=1 - aSOFTWARE_REQUIRES_NODEJS[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=13160#p13160' + aSOFTWARE_WHIP_NAME[$software_id]='Roon Extension Manager' + aSOFTWARE_WHIP_DESC[$software_id]='Manage extensions from within Roon' + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_GIT[$software_id]=1 + aSOFTWARE_REQUIRES_NODEJS[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=13160#p13160' #BitTorrent #-------------------------------------------------------------------------------- software_id=44 - aSOFTWARE_WHIP_NAME[$software_id]='Transmission' - aSOFTWARE_WHIP_DESC[$software_id]='bittorrent server with web interface (c)' - aSOFTWARE_CATEGORY_INDEX[$software_id]=3 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=46#p46' + aSOFTWARE_WHIP_NAME[$software_id]='Transmission' + aSOFTWARE_WHIP_DESC[$software_id]='bittorrent server with web interface (c)' + aSOFTWARE_CATEGORY_INDEX[$software_id]=3 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=46#p46' #------------------ software_id=45 - aSOFTWARE_WHIP_NAME[$software_id]='Deluge' - aSOFTWARE_WHIP_DESC[$software_id]='bittorrent server with web interface (python)' - aSOFTWARE_CATEGORY_INDEX[$software_id]=3 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=61#p61' + aSOFTWARE_WHIP_NAME[$software_id]='Deluge' + aSOFTWARE_WHIP_DESC[$software_id]='bittorrent server with web interface (python)' + aSOFTWARE_CATEGORY_INDEX[$software_id]=3 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=61#p61' #------------------ software_id=46 - aSOFTWARE_WHIP_NAME[$software_id]='qBitTorrent' - aSOFTWARE_WHIP_DESC[$software_id]='bittorrent server with web interface (c++)' - aSOFTWARE_CATEGORY_INDEX[$software_id]=3 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=2272#p2272' + aSOFTWARE_WHIP_NAME[$software_id]='qBitTorrent' + aSOFTWARE_WHIP_DESC[$software_id]='bittorrent server with web interface (c++)' + aSOFTWARE_CATEGORY_INDEX[$software_id]=3 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=2272#p2272' #------------------ software_id=107 - aSOFTWARE_WHIP_NAME[$software_id]='rTorrent' - aSOFTWARE_WHIP_DESC[$software_id]='bittorrent server with rutorrent web interface' - aSOFTWARE_CATEGORY_INDEX[$software_id]=3 - aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_WHIP_NAME[$software_id]='rTorrent' + aSOFTWARE_WHIP_DESC[$software_id]='bittorrent server with rutorrent web interface' + aSOFTWARE_CATEGORY_INDEX[$software_id]=3 + aSOFTWARE_TYPE[$software_id]=0 aSOFTWARE_REQUIRES_WEBSERVER[$software_id]=1 - aSOFTWARE_REQUIRES_PHP[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=2603#p2603' + aSOFTWARE_REQUIRES_PHP[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=2603#p2603' #------------------ software_id=116 - aSOFTWARE_WHIP_NAME[$software_id]='Medusa' - aSOFTWARE_WHIP_DESC[$software_id]='Automatic Video Library Manager for TV Shows' - aSOFTWARE_CATEGORY_INDEX[$software_id]=3 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=3327#p3327' + aSOFTWARE_WHIP_NAME[$software_id]='Medusa' + aSOFTWARE_WHIP_DESC[$software_id]='Automatic Video Library Manager for TV Shows' + aSOFTWARE_CATEGORY_INDEX[$software_id]=3 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=3327#p3327' #------------------ software_id=132 - aSOFTWARE_WHIP_NAME[$software_id]='Aria2' - aSOFTWARE_WHIP_DESC[$software_id]='download manager with web interface' - aSOFTWARE_CATEGORY_INDEX[$software_id]=3 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=6177#p6177' + aSOFTWARE_WHIP_NAME[$software_id]='Aria2' + aSOFTWARE_WHIP_DESC[$software_id]='download manager with web interface' + aSOFTWARE_CATEGORY_INDEX[$software_id]=3 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=6177#p6177' aSOFTWARE_REQUIRES_WEBSERVER[$software_id]=1 - aSOFTWARE_REQUIRES_PHP[$software_id]=1 - aSOFTWARE_REQUIRES_SQLITE[$software_id]=1 + aSOFTWARE_REQUIRES_PHP[$software_id]=1 + aSOFTWARE_REQUIRES_SQLITE[$software_id]=1 #------------------ software_id=139 - aSOFTWARE_WHIP_NAME[$software_id]='SABnzbd' - aSOFTWARE_WHIP_DESC[$software_id]='nzb download manager' - aSOFTWARE_CATEGORY_INDEX[$software_id]=3 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=6747#p6747' - aSOFTWARE_REQUIRES_BUILDESSENTIAL[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='SABnzbd' + aSOFTWARE_WHIP_DESC[$software_id]='nzb download manager' + aSOFTWARE_CATEGORY_INDEX[$software_id]=3 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=6747#p6747' + # Pre-compiling required on ARM + (( $G_HW_ARCH < 10 )) && aSOFTWARE_REQUIRES_BUILDESSENTIAL[$software_id]=1 #------------------ software_id=142 - aSOFTWARE_WHIP_NAME[$software_id]='CouchPotato' - aSOFTWARE_WHIP_DESC[$software_id]='automatically download movies' - aSOFTWARE_CATEGORY_INDEX[$software_id]=3 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=6747#p6747' - aSOFTWARE_REQUIRES_BUILDESSENTIAL[$software_id]=1 - aSOFTWARE_REQUIRES_GIT[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='CouchPotato' + aSOFTWARE_WHIP_DESC[$software_id]='automatically download movies' + aSOFTWARE_CATEGORY_INDEX[$software_id]=3 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=6747#p6747' + aSOFTWARE_REQUIRES_BUILDESSENTIAL[$software_id]=1 + aSOFTWARE_REQUIRES_GIT[$software_id]=1 #------------------ software_id=144 - aSOFTWARE_WHIP_NAME[$software_id]='Sonarr' - aSOFTWARE_WHIP_DESC[$software_id]='automatically download TV shows' - aSOFTWARE_CATEGORY_INDEX[$software_id]=3 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=7455#p7455' - aSOFTWARE_REQUIRES_SQLITE[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='Sonarr' + aSOFTWARE_WHIP_DESC[$software_id]='automatically download TV shows' + aSOFTWARE_CATEGORY_INDEX[$software_id]=3 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=7455#p7455' + aSOFTWARE_REQUIRES_SQLITE[$software_id]=1 #------------------ software_id=145 - aSOFTWARE_WHIP_NAME[$software_id]='Radarr' - aSOFTWARE_WHIP_DESC[$software_id]='automatically download movies' - aSOFTWARE_CATEGORY_INDEX[$software_id]=3 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=7457#p7457' - aSOFTWARE_REQUIRES_SQLITE[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='Radarr' + aSOFTWARE_WHIP_DESC[$software_id]='automatically download movies' + aSOFTWARE_CATEGORY_INDEX[$software_id]=3 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=7457#p7457' + aSOFTWARE_REQUIRES_SQLITE[$software_id]=1 #------------------ software_id=106 - aSOFTWARE_WHIP_NAME[$software_id]='Lidarr' - aSOFTWARE_WHIP_DESC[$software_id]='automatically download music' - aSOFTWARE_CATEGORY_INDEX[$software_id]=3 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=13580#p13580' - aSOFTWARE_REQUIRES_SQLITE[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='Lidarr' + aSOFTWARE_WHIP_DESC[$software_id]='automatically download music' + aSOFTWARE_CATEGORY_INDEX[$software_id]=3 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=13580#p13580' + aSOFTWARE_REQUIRES_SQLITE[$software_id]=1 #------------------ software_id=147 - aSOFTWARE_WHIP_NAME[$software_id]='Jackett' - aSOFTWARE_WHIP_DESC[$software_id]='API support for your torrent trackers' - aSOFTWARE_CATEGORY_INDEX[$software_id]=3 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=7503#p7503' + aSOFTWARE_WHIP_NAME[$software_id]='Jackett' + aSOFTWARE_WHIP_DESC[$software_id]='API support for your torrent trackers' + aSOFTWARE_CATEGORY_INDEX[$software_id]=3 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=7503#p7503' #------------------ software_id=149 - aSOFTWARE_WHIP_NAME[$software_id]='NZBget' - aSOFTWARE_WHIP_DESC[$software_id]='nzb download manager' - aSOFTWARE_CATEGORY_INDEX[$software_id]=3 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=7575#p7575' + aSOFTWARE_WHIP_NAME[$software_id]='NZBget' + aSOFTWARE_WHIP_DESC[$software_id]='nzb download manager' + aSOFTWARE_CATEGORY_INDEX[$software_id]=3 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=7575#p7575' #------------------ BitTorrent: HTPC Manager ------------------ software_id=155 - aSOFTWARE_WHIP_NAME[$software_id]='HTPC Manager' - aSOFTWARE_WHIP_DESC[$software_id]='manage your HTPC from anywhere' - aSOFTWARE_REQUIRES_GIT[$software_id]=1 - aSOFTWARE_CATEGORY_INDEX[$software_id]=3 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=8043#p8043' + aSOFTWARE_WHIP_NAME[$software_id]='HTPC Manager' + aSOFTWARE_WHIP_DESC[$software_id]='manage your HTPC from anywhere' + aSOFTWARE_REQUIRES_GIT[$software_id]=1 + aSOFTWARE_CATEGORY_INDEX[$software_id]=3 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=8043#p8043' #Cloud / Backups #-------------------------------------------------------------------------------- software_id=47 - aSOFTWARE_WHIP_NAME[$software_id]='ownCloud' - aSOFTWARE_WHIP_DESC[$software_id]='File sync, sharing and collaboration platform' - aSOFTWARE_CATEGORY_INDEX[$software_id]=4 - aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_WHIP_NAME[$software_id]='ownCloud' + aSOFTWARE_WHIP_DESC[$software_id]='File sync, sharing and collaboration platform' + aSOFTWARE_CATEGORY_INDEX[$software_id]=4 + aSOFTWARE_TYPE[$software_id]=0 aSOFTWARE_REQUIRES_WEBSERVER[$software_id]=1 - aSOFTWARE_REQUIRES_PHP[$software_id]=1 - aSOFTWARE_REQUIRES_MYSQL[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=47#p47' - # Current ownCloud 10.0.10 does not support PHP7.3 (Buster): https://doc.owncloud.org/server/administration_manual/installation/system_requirements.html - aSOFTWARE_AVAIL_G_DISTRO[$software_id,5]=0 + aSOFTWARE_REQUIRES_PHP[$software_id]=1 + aSOFTWARE_REQUIRES_MYSQL[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=47#p47' + # ownCloud up to 10.2 does not support PHP7.3 (Buster): https://doc.owncloud.org/server/administration_manual/installation/system_requirements.html + aSOFTWARE_AVAIL_G_DISTRO[$software_id,5]=0 + # Disable if PHP7.3 is already installed + command -v php7.3 &> /dev/null && aSOFTWARE_AVAIL_G_DISTRO[$software_id,$G_DISTRO]=0 #------------------ software_id=114 - aSOFTWARE_WHIP_NAME[$software_id]='Nextcloud' - aSOFTWARE_WHIP_DESC[$software_id]='File sync, sharing and collaboration platform' - aSOFTWARE_CATEGORY_INDEX[$software_id]=4 - aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_WHIP_NAME[$software_id]='Nextcloud' + aSOFTWARE_WHIP_DESC[$software_id]='File sync, sharing and collaboration platform' + aSOFTWARE_CATEGORY_INDEX[$software_id]=4 + aSOFTWARE_TYPE[$software_id]=0 aSOFTWARE_REQUIRES_WEBSERVER[$software_id]=1 - aSOFTWARE_REQUIRES_PHP[$software_id]=1 - aSOFTWARE_REQUIRES_MYSQL[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=3026#p3026' + aSOFTWARE_REQUIRES_PHP[$software_id]=1 + aSOFTWARE_REQUIRES_MYSQL[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=3026#p3026' #------------------ software_id=168 - aSOFTWARE_WHIP_NAME[$software_id]='Nextcloud Talk' - aSOFTWARE_WHIP_DESC[$software_id]='Video calls with configured TURN server' - aSOFTWARE_CATEGORY_INDEX[$software_id]=4 - aSOFTWARE_TYPE[$software_id]=0 - #Currently requires manual domain and TURN server port input. + aSOFTWARE_WHIP_NAME[$software_id]='Nextcloud Talk' + aSOFTWARE_WHIP_DESC[$software_id]='Video calls with configured coTURN server' + aSOFTWARE_CATEGORY_INDEX[$software_id]=4 + aSOFTWARE_TYPE[$software_id]=0 + # Currently requires manual domain and coTURN server port input. # - To resolve: Default port 5349 could be used, but reliable method to get external domain/static IP is required. aSOFTWARE_REQUIRES_USERINPUT[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=15227#p15227' + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=15227#p15227' #------------------ software_id=48 - aSOFTWARE_WHIP_NAME[$software_id]='Pydio' - aSOFTWARE_WHIP_DESC[$software_id]='feature-rich backup and sync server' - aSOFTWARE_CATEGORY_INDEX[$software_id]=4 - aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_WHIP_NAME[$software_id]='Pydio' + aSOFTWARE_WHIP_DESC[$software_id]='feature-rich backup and sync server' + aSOFTWARE_CATEGORY_INDEX[$software_id]=4 + aSOFTWARE_TYPE[$software_id]=0 aSOFTWARE_REQUIRES_WEBSERVER[$software_id]=1 - aSOFTWARE_REQUIRES_PHP[$software_id]=1 - aSOFTWARE_REQUIRES_MYSQL[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1064#p1064' + aSOFTWARE_REQUIRES_PHP[$software_id]=1 + aSOFTWARE_REQUIRES_MYSQL[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1064#p1064' #------------------ software_id=111 - aSOFTWARE_WHIP_NAME[$software_id]='UrBackup server' - aSOFTWARE_WHIP_DESC[$software_id]='full system backup server' - aSOFTWARE_CATEGORY_INDEX[$software_id]=4 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=65#p65' + aSOFTWARE_WHIP_NAME[$software_id]='UrBackup server' + aSOFTWARE_WHIP_DESC[$software_id]='full system backup server' + aSOFTWARE_CATEGORY_INDEX[$software_id]=4 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=65#p65' - # No deb packages for ARMv6: + # - ARMv6: aSOFTWARE_AVAIL_G_HW_ARCH[$software_id,1]=0 #------------------ software_id=49 - aSOFTWARE_WHIP_NAME[$software_id]='Gogs' - aSOFTWARE_WHIP_DESC[$software_id]='personal github server with web interface' - aSOFTWARE_CATEGORY_INDEX[$software_id]=4 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_GIT[$software_id]=1 - aSOFTWARE_REQUIRES_MYSQL[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=2187#p2187' + aSOFTWARE_WHIP_NAME[$software_id]='Gogs' + aSOFTWARE_WHIP_DESC[$software_id]='personal github server with web interface' + aSOFTWARE_CATEGORY_INDEX[$software_id]=4 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_GIT[$software_id]=1 + aSOFTWARE_REQUIRES_MYSQL[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=2187#p2187' # - ARMv8 aSOFTWARE_AVAIL_G_HW_ARCH[$software_id,3]=0 @@ -1100,20 +1064,20 @@ _EOF_ #------------------ software_id=50 - aSOFTWARE_WHIP_NAME[$software_id]='Syncthing' - aSOFTWARE_WHIP_DESC[$software_id]='backup and sync server with web interface' - aSOFTWARE_CATEGORY_INDEX[$software_id]=4 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=2363#p2363' + aSOFTWARE_WHIP_NAME[$software_id]='Syncthing' + aSOFTWARE_WHIP_DESC[$software_id]='backup and sync server with web interface' + aSOFTWARE_CATEGORY_INDEX[$software_id]=4 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=2363#p2363' #------------------ software_id=134 - aSOFTWARE_WHIP_NAME[$software_id]='Tonido' - aSOFTWARE_WHIP_DESC[$software_id]='lightweight cloud based backup system' - aSOFTWARE_CATEGORY_INDEX[$software_id]=4 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=6476#p6476' + aSOFTWARE_WHIP_NAME[$software_id]='Tonido' + aSOFTWARE_WHIP_DESC[$software_id]='lightweight cloud based backup system' + aSOFTWARE_CATEGORY_INDEX[$software_id]=4 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=6476#p6476' # - ARMv6 aSOFTWARE_AVAIL_G_HW_ARCH[$software_id,1]=0 @@ -1123,17 +1087,19 @@ _EOF_ #------------------ software_id=158 - aSOFTWARE_WHIP_NAME[$software_id]='Minio' - aSOFTWARE_WHIP_DESC[$software_id]='S3 compatible distributed object server' - aSOFTWARE_CATEGORY_INDEX[$software_id]=4 - aSOFTWARE_TYPE[$software_id]=0 + + aSOFTWARE_WHIP_NAME[$software_id]='Minio' + aSOFTWARE_WHIP_DESC[$software_id]='S3 compatible distributed object server' + aSOFTWARE_CATEGORY_INDEX[$software_id]=4 + aSOFTWARE_TYPE[$software_id]=0 #------------------ software_id=161 - aSOFTWARE_WHIP_NAME[$software_id]='FuguHub' - aSOFTWARE_WHIP_DESC[$software_id]='Lightweight WebDAV cloud (eg: dropbox) with a CMS' - aSOFTWARE_CATEGORY_INDEX[$software_id]=4 - aSOFTWARE_TYPE[$software_id]=0 + + aSOFTWARE_WHIP_NAME[$software_id]='FuguHub' + aSOFTWARE_WHIP_DESC[$software_id]='Lightweight WebDAV cloud (eg: dropbox) with a CMS' + aSOFTWARE_CATEGORY_INDEX[$software_id]=4 + aSOFTWARE_TYPE[$software_id]=0 # - ARMv8 aSOFTWARE_AVAIL_G_HW_ARCH[$software_id,3]=0 @@ -1141,35 +1107,34 @@ _EOF_ #------------------ software_id=165 - aSOFTWARE_WHIP_NAME[$software_id]='Gitea' - aSOFTWARE_WHIP_DESC[$software_id]='Git with a cup of tea' - aSOFTWARE_CATEGORY_INDEX[$software_id]=4 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_GIT[$software_id]=1 - aSOFTWARE_REQUIRES_MYSQL[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=9863#p9863' - + aSOFTWARE_WHIP_NAME[$software_id]='Gitea' + aSOFTWARE_WHIP_DESC[$software_id]='Git with a cup of tea' + aSOFTWARE_CATEGORY_INDEX[$software_id]=4 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_GIT[$software_id]=1 + aSOFTWARE_REQUIRES_MYSQL[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=9863#p9863' #Emulation / Gaming #-------------------------------------------------------------------------------- software_id=108 - aSOFTWARE_WHIP_NAME[$software_id]='AmiBerry' - aSOFTWARE_WHIP_DESC[$software_id]='amiga emulator' - aSOFTWARE_CATEGORY_INDEX[$software_id]=5 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_ALSA[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=64#p64' - aSOFTWARE_REQUIRES_XSERVERXORG[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='AmiBerry' + aSOFTWARE_WHIP_DESC[$software_id]='amiga emulator' + aSOFTWARE_CATEGORY_INDEX[$software_id]=5 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_ALSA[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=64#p64' + aSOFTWARE_REQUIRES_XSERVERXORG[$software_id]=1 - # - Disable for All non-RPi + # - RPi only for ((i=10; i<=$MAX_G_HW_MODEL; i++)) do aSOFTWARE_AVAIL_G_HW_MODEL[$software_id,$i]=0 done - aSOFTWARE_AVAIL_G_HW_MODEL[$software_id,52]=1 # ASUS TB + aSOFTWARE_AVAIL_G_HW_MODEL[$software_id,52]=1 # + ASUS TB # - XU4 test #aSOFTWARE_AVAIL_G_HW_MODEL[$software_id,11]=1 #Requires Stretch due to libc requirements @@ -1177,15 +1142,15 @@ _EOF_ #------------------ software_id=51 - aSOFTWARE_WHIP_NAME[$software_id]='OpenTyrian' - aSOFTWARE_WHIP_DESC[$software_id]='a classic retro game, addictive' - aSOFTWARE_CATEGORY_INDEX[$software_id]=5 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_ALSA[$software_id]=1 - aSOFTWARE_REQUIRES_XSERVERXORG[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=45#p45' + aSOFTWARE_WHIP_NAME[$software_id]='OpenTyrian' + aSOFTWARE_WHIP_DESC[$software_id]='a classic retro game, addictive' + aSOFTWARE_CATEGORY_INDEX[$software_id]=5 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_ALSA[$software_id]=1 + aSOFTWARE_REQUIRES_XSERVERXORG[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=45#p45' - # - Disable for All non-RPi + # - RPi only for ((i=10; i<=$MAX_G_HW_MODEL; i++)) do @@ -1193,17 +1158,21 @@ _EOF_ done + # - enable x86_64 + aSOFTWARE_AVAIL_G_HW_MODEL[$software_id,21]=1 + + #------------------ software_id=112 - aSOFTWARE_WHIP_NAME[$software_id]='DXX-Rebirth' - aSOFTWARE_WHIP_DESC[$software_id]='Descent 1/2' - aSOFTWARE_CATEGORY_INDEX[$software_id]=5 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_ALSA[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=2963#p2963' + aSOFTWARE_WHIP_NAME[$software_id]='DXX-Rebirth' + aSOFTWARE_WHIP_DESC[$software_id]='Descent 1/2' + aSOFTWARE_CATEGORY_INDEX[$software_id]=5 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_ALSA[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=2963#p2963' - # - Disable for All non-RPi + # - RPi only for ((i=10; i<=$MAX_G_HW_MODEL; i++)) do @@ -1214,11 +1183,11 @@ _EOF_ #------------------ software_id=52 - aSOFTWARE_WHIP_NAME[$software_id]='Cuberite' - aSOFTWARE_WHIP_DESC[$software_id]='minecraft server with web interface (c++)' - aSOFTWARE_CATEGORY_INDEX[$software_id]=5 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=2068#p2068' + aSOFTWARE_WHIP_NAME[$software_id]='Cuberite' + aSOFTWARE_WHIP_DESC[$software_id]='minecraft server with web interface (c++)' + aSOFTWARE_CATEGORY_INDEX[$software_id]=5 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=2068#p2068' # - ARMv8 aSOFTWARE_AVAIL_G_HW_ARCH[$software_id,3]=0 @@ -1226,29 +1195,29 @@ _EOF_ #------------------ software_id=53 - aSOFTWARE_WHIP_NAME[$software_id]='MineOS' - aSOFTWARE_WHIP_DESC[$software_id]='minecraft servers with web interface (java)' - aSOFTWARE_CATEGORY_INDEX[$software_id]=5 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_BUILDESSENTIAL[$software_id]=1 - aSOFTWARE_REQUIRES_GIT[$software_id]=1 - aSOFTWARE_REQUIRES_JAVA_JRE_JDK[$software_id]=1 - aSOFTWARE_REQUIRES_NODEJS[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=2069#p2069' + aSOFTWARE_WHIP_NAME[$software_id]='MineOS' + aSOFTWARE_WHIP_DESC[$software_id]='minecraft servers with web interface (java)' + aSOFTWARE_CATEGORY_INDEX[$software_id]=5 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_BUILDESSENTIAL[$software_id]=1 + aSOFTWARE_REQUIRES_GIT[$software_id]=1 + aSOFTWARE_REQUIRES_JAVA_JRE_JDK[$software_id]=1 + aSOFTWARE_REQUIRES_NODEJS[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=2069#p2069' #------------------ software_id=156 - aSOFTWARE_WHIP_NAME[$software_id]='Steam' - aSOFTWARE_WHIP_DESC[$software_id]='client' - aSOFTWARE_CATEGORY_INDEX[$software_id]=5 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=8016#p8016' - aSOFTWARE_REQUIRES_ALSA[$software_id]=1 - aSOFTWARE_REQUIRES_XSERVERXORG[$software_id]=1 - aSOFTWARE_REQUIRES_DESKTOP[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='Steam' + aSOFTWARE_WHIP_DESC[$software_id]='client' + aSOFTWARE_CATEGORY_INDEX[$software_id]=5 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=8016#p8016' + aSOFTWARE_REQUIRES_ALSA[$software_id]=1 + aSOFTWARE_REQUIRES_XSERVERXORG[$software_id]=1 + aSOFTWARE_REQUIRES_DESKTOP[$software_id]=1 - #Native PC only + # Native PC only for ((i=0; i<=$MAX_G_HW_MODEL; i++)) do @@ -1259,94 +1228,95 @@ _EOF_ #------------------ software_id=164 - aSOFTWARE_WHIP_NAME[$software_id]='Nukkit' - aSOFTWARE_WHIP_DESC[$software_id]='A nuclear-powered server for Minecraft Pocket Edition' - aSOFTWARE_CATEGORY_INDEX[$software_id]=5 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_JAVA_JRE_JDK[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=10675#p10675' + + aSOFTWARE_WHIP_NAME[$software_id]='Nukkit' + aSOFTWARE_WHIP_DESC[$software_id]='A nuclear-powered server for Minecraft Pocket Edition' + aSOFTWARE_CATEGORY_INDEX[$software_id]=5 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_JAVA_JRE_JDK[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=10675#p10675' #Social Media #-------------------------------------------------------------------------------- software_id=54 - aSOFTWARE_WHIP_NAME[$software_id]='Forums' - aSOFTWARE_WHIP_DESC[$software_id]='phpbb forums' - aSOFTWARE_CATEGORY_INDEX[$software_id]=6 - aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_WHIP_NAME[$software_id]='phpBB' + aSOFTWARE_WHIP_DESC[$software_id]='bulletin board forum software' + aSOFTWARE_CATEGORY_INDEX[$software_id]=6 + aSOFTWARE_TYPE[$software_id]=0 aSOFTWARE_REQUIRES_WEBSERVER[$software_id]=1 - aSOFTWARE_REQUIRES_PHP[$software_id]=1 - aSOFTWARE_REQUIRES_MYSQL[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=51#p51' + aSOFTWARE_REQUIRES_PHP[$software_id]=1 + aSOFTWARE_REQUIRES_MYSQL[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=51#p51' #------------------ software_id=55 - aSOFTWARE_WHIP_NAME[$software_id]='Wordpress' - aSOFTWARE_WHIP_DESC[$software_id]='website blog and publishing platform' - aSOFTWARE_CATEGORY_INDEX[$software_id]=6 - aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_WHIP_NAME[$software_id]='Wordpress' + aSOFTWARE_WHIP_DESC[$software_id]='website blog and publishing platform' + aSOFTWARE_CATEGORY_INDEX[$software_id]=6 + aSOFTWARE_TYPE[$software_id]=0 aSOFTWARE_REQUIRES_WEBSERVER[$software_id]=1 - aSOFTWARE_REQUIRES_PHP[$software_id]=1 - aSOFTWARE_REQUIRES_MYSQL[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=395#p395' + aSOFTWARE_REQUIRES_PHP[$software_id]=1 + aSOFTWARE_REQUIRES_MYSQL[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=395#p395' #------------------ software_id=38 - aSOFTWARE_WHIP_NAME[$software_id]='FreshRSS' - aSOFTWARE_WHIP_DESC[$software_id]='self-hosted RSS feed aggregator' - aSOFTWARE_CATEGORY_INDEX[$software_id]=6 - aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_WHIP_NAME[$software_id]='FreshRSS' + aSOFTWARE_WHIP_DESC[$software_id]='self-hosted RSS feed aggregator' + aSOFTWARE_CATEGORY_INDEX[$software_id]=6 + aSOFTWARE_TYPE[$software_id]=0 aSOFTWARE_REQUIRES_WEBSERVER[$software_id]=1 - aSOFTWARE_REQUIRES_PHP[$software_id]=1 - aSOFTWARE_REQUIRES_MYSQL[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=13918#p13918' + aSOFTWARE_REQUIRES_PHP[$software_id]=1 + aSOFTWARE_REQUIRES_MYSQL[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=13918#p13918' #------------------ software_id=56 - aSOFTWARE_WHIP_NAME[$software_id]='Image Gallery' - aSOFTWARE_WHIP_DESC[$software_id]='website to host / browse your images' - aSOFTWARE_CATEGORY_INDEX[$software_id]=6 - aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_WHIP_NAME[$software_id]='Image Gallery' + aSOFTWARE_WHIP_DESC[$software_id]='website to host / browse your images' + aSOFTWARE_CATEGORY_INDEX[$software_id]=6 + aSOFTWARE_TYPE[$software_id]=0 aSOFTWARE_REQUIRES_WEBSERVER[$software_id]=1 - aSOFTWARE_REQUIRES_PHP[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=480#p480' + aSOFTWARE_REQUIRES_PHP[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=480#p480' #------------------ software_id=57 - aSOFTWARE_WHIP_NAME[$software_id]='BaiKal' - aSOFTWARE_WHIP_DESC[$software_id]='lightweight caldav + carddav server' - aSOFTWARE_CATEGORY_INDEX[$software_id]=6 - aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_WHIP_NAME[$software_id]='BaiKal' + aSOFTWARE_WHIP_DESC[$software_id]='lightweight caldav + carddav server' + aSOFTWARE_CATEGORY_INDEX[$software_id]=6 + aSOFTWARE_TYPE[$software_id]=0 aSOFTWARE_REQUIRES_WEBSERVER[$software_id]=1 - aSOFTWARE_REQUIRES_PHP[$software_id]=1 - aSOFTWARE_REQUIRES_MYSQL[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1502#p1502' + aSOFTWARE_REQUIRES_PHP[$software_id]=1 + aSOFTWARE_REQUIRES_MYSQL[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1502#p1502' #------------------ software_id=58 - aSOFTWARE_WHIP_NAME[$software_id]='OpenBazaar' - aSOFTWARE_WHIP_DESC[$software_id]='decentralized peer to peer bitcoin market' - aSOFTWARE_CATEGORY_INDEX[$software_id]=6 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_BUILDESSENTIAL[$software_id]=1 - aSOFTWARE_REQUIRES_GIT[$software_id]=1 - aSOFTWARE_REQUIRES_USERINPUT[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1796#p1796' + aSOFTWARE_WHIP_NAME[$software_id]='OpenBazaar' + aSOFTWARE_WHIP_DESC[$software_id]='decentralised peer to peer bitcoin market' + aSOFTWARE_CATEGORY_INDEX[$software_id]=6 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_BUILDESSENTIAL[$software_id]=1 + aSOFTWARE_REQUIRES_GIT[$software_id]=1 + aSOFTWARE_REQUIRES_USERINPUT[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1796#p1796' #------------------ software_id=133 - aSOFTWARE_WHIP_NAME[$software_id]='YaCy' - aSOFTWARE_WHIP_DESC[$software_id]='decentralized open source search engine' - aSOFTWARE_CATEGORY_INDEX[$software_id]=6 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_JAVA_JRE_JDK[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=6202#p6202' + aSOFTWARE_WHIP_NAME[$software_id]='YaCy' + aSOFTWARE_WHIP_DESC[$software_id]='decentralised open source search engine' + aSOFTWARE_CATEGORY_INDEX[$software_id]=6 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_JAVA_JRE_JDK[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=6202#p6202' #------------------ software_id=2 @@ -1356,6 +1326,7 @@ _EOF_ aSOFTWARE_CATEGORY_INDEX[$software_id]=20 aSOFTWARE_TYPE[$software_id]=0 aSOFTWARE_ONLINEDOC_URL[$software_id]='p=13704#p13704' + # - x86_64 only for ((i=1; i<$MAX_G_HW_ARCH; i++)) do @@ -1363,7 +1334,8 @@ _EOF_ aSOFTWARE_AVAIL_G_HW_ARCH[$software_id,$i]=0 done - # - Not supported on Jessie: https://github.com/MichaIng/DietPi/pull/1992#issuecomment-410772255 + + # - Jessie: https://github.com/MichaIng/DietPi/pull/1992#issuecomment-410772255 aSOFTWARE_AVAIL_G_DISTRO[$software_id,3]=0 #------------------ @@ -1372,15 +1344,15 @@ _EOF_ #-------------------------------------------------------------------------------- software_id=59 - aSOFTWARE_WHIP_NAME[$software_id]='RPi Cam Control' - aSOFTWARE_WHIP_DESC[$software_id]='web interface & controls for your rpi camera' - aSOFTWARE_CATEGORY_INDEX[$software_id]=7 - aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_WHIP_NAME[$software_id]='RPi Cam Control' + aSOFTWARE_WHIP_DESC[$software_id]='web interface & controls for your rpi camera' + aSOFTWARE_CATEGORY_INDEX[$software_id]=7 + aSOFTWARE_TYPE[$software_id]=0 aSOFTWARE_REQUIRES_WEBSERVER[$software_id]=1 - aSOFTWARE_REQUIRES_PHP[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=48#p48' + aSOFTWARE_REQUIRES_PHP[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=48#p48' - # - Disable for All non-RPi + # - RPi only for ((i=10; i<=$MAX_G_HW_MODEL; i++)) do @@ -1391,20 +1363,16 @@ _EOF_ #------------------ software_id=136 - aSOFTWARE_WHIP_NAME[$software_id]='MotionEye' - aSOFTWARE_WHIP_DESC[$software_id]='web interface & surveillance for your camera' - aSOFTWARE_CATEGORY_INDEX[$software_id]=7 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=6610#p6610' - aSOFTWARE_REQUIRES_FFMPEG[$software_id]=1 - aSOFTWARE_REQUIRES_BUILDESSENTIAL[$software_id]=1 - - # - Disable for Jessie - if (( $G_DISTRO == 3 )); then - - aSOFTWARE_AVAIL_G_HW_MODEL[$software_id,$G_HW_MODEL]=0 + aSOFTWARE_WHIP_NAME[$software_id]='MotionEye' + aSOFTWARE_WHIP_DESC[$software_id]='web interface & surveillance for your camera' + aSOFTWARE_CATEGORY_INDEX[$software_id]=7 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=6610#p6610' + aSOFTWARE_REQUIRES_FFMPEG[$software_id]=1 + aSOFTWARE_REQUIRES_BUILDESSENTIAL[$software_id]=1 - fi + # - Jessie + aSOFTWARE_AVAIL_G_DISTRO[$software_id,3]=0 #------------------ @@ -1412,11 +1380,11 @@ _EOF_ #-------------------------------------------------------------------------------- software_id=60 - aSOFTWARE_WHIP_NAME[$software_id]='WiFi Hotspot' - aSOFTWARE_WHIP_DESC[$software_id]='turn your device into a wifi hotspot' - aSOFTWARE_CATEGORY_INDEX[$software_id]=8 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1207#p1207' + aSOFTWARE_WHIP_NAME[$software_id]='WiFi Hotspot' + aSOFTWARE_WHIP_DESC[$software_id]='turn your device into a wifi hotspot' + aSOFTWARE_CATEGORY_INDEX[$software_id]=8 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1207#p1207' # - VM aSOFTWARE_AVAIL_G_HW_MODEL[$software_id,20]=0 @@ -1424,11 +1392,11 @@ _EOF_ #------------------ software_id=61 - aSOFTWARE_WHIP_NAME[$software_id]='Tor Hotspot' - aSOFTWARE_WHIP_DESC[$software_id]='optional: route hotspot traffic through tor' - aSOFTWARE_CATEGORY_INDEX[$software_id]=8 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1529#p1529' + aSOFTWARE_WHIP_NAME[$software_id]='Tor Hotspot' + aSOFTWARE_WHIP_DESC[$software_id]='optional: route hotspot traffic through tor' + aSOFTWARE_CATEGORY_INDEX[$software_id]=8 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1529#p1529' # - VM aSOFTWARE_AVAIL_G_HW_MODEL[$software_id,20]=0 @@ -1439,55 +1407,55 @@ _EOF_ #-------------------------------------------------------------------------------- software_id=62 - aSOFTWARE_WHIP_NAME[$software_id]='DietPi-Cloudshell' - aSOFTWARE_WHIP_DESC[$software_id]='system stats displayed on lcd/panel' - aSOFTWARE_CATEGORY_INDEX[$software_id]=9 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=204#p204' + aSOFTWARE_WHIP_NAME[$software_id]='DietPi-Cloudshell' + aSOFTWARE_WHIP_DESC[$software_id]='system stats displayed on lcd/panel' + aSOFTWARE_CATEGORY_INDEX[$software_id]=9 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=204#p204' #------------------ software_id=63 - aSOFTWARE_WHIP_NAME[$software_id]='LinuxDash' - aSOFTWARE_WHIP_DESC[$software_id]='web interface system stats' - aSOFTWARE_CATEGORY_INDEX[$software_id]=9 - aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_WHIP_NAME[$software_id]='LinuxDash' + aSOFTWARE_WHIP_DESC[$software_id]='web interface system stats' + aSOFTWARE_CATEGORY_INDEX[$software_id]=9 + aSOFTWARE_TYPE[$software_id]=0 aSOFTWARE_REQUIRES_WEBSERVER[$software_id]=1 - aSOFTWARE_REQUIRES_PHP[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=108#p108' + aSOFTWARE_REQUIRES_PHP[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=108#p108' #------------------ software_id=64 - aSOFTWARE_WHIP_NAME[$software_id]='PhpSysInfo' - aSOFTWARE_WHIP_DESC[$software_id]='web interface system stats' - aSOFTWARE_CATEGORY_INDEX[$software_id]=9 - aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_WHIP_NAME[$software_id]='PhpSysInfo' + aSOFTWARE_WHIP_DESC[$software_id]='web interface system stats' + aSOFTWARE_CATEGORY_INDEX[$software_id]=9 + aSOFTWARE_TYPE[$software_id]=0 aSOFTWARE_REQUIRES_WEBSERVER[$software_id]=1 - aSOFTWARE_REQUIRES_PHP[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=451#p451' + aSOFTWARE_REQUIRES_PHP[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=451#p451' #------------------ software_id=65 - aSOFTWARE_WHIP_NAME[$software_id]='NetData' - aSOFTWARE_WHIP_DESC[$software_id]='real-time performance monitoring' - aSOFTWARE_CATEGORY_INDEX[$software_id]=9 - aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_WHIP_NAME[$software_id]='NetData' + aSOFTWARE_WHIP_DESC[$software_id]='real-time performance monitoring' + aSOFTWARE_CATEGORY_INDEX[$software_id]=9 + aSOFTWARE_TYPE[$software_id]=0 # Node.js only required for our custom package (( $G_DISTRO < 4 || ( $G_HW_MODEL < 10 && $G_DISTRO < 5 ) )) && aSOFTWARE_REQUIRES_NODEJS[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1611#p1611' + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1611#p1611' #------------------ software_id=66 - aSOFTWARE_WHIP_NAME[$software_id]='RPi-Monitor' - aSOFTWARE_WHIP_DESC[$software_id]='web interface system stats' - aSOFTWARE_CATEGORY_INDEX[$software_id]=9 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1503#p1503' + aSOFTWARE_WHIP_NAME[$software_id]='RPi-Monitor' + aSOFTWARE_WHIP_DESC[$software_id]='web interface system stats' + aSOFTWARE_CATEGORY_INDEX[$software_id]=9 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1503#p1503' - # - Disable for All non-RPi + # - RPi only for ((i=10; i<=$MAX_G_HW_MODEL; i++)) do @@ -1498,49 +1466,48 @@ _EOF_ #------------------ software_id=115 - aSOFTWARE_WHIP_NAME[$software_id]='Webmin' - aSOFTWARE_WHIP_DESC[$software_id]='web interface system management' - aSOFTWARE_CATEGORY_INDEX[$software_id]=9 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=3047#p3047' - aSOFTWARE_REQUIRES_RSYSLOG[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='Webmin' + aSOFTWARE_WHIP_DESC[$software_id]='web interface system management' + aSOFTWARE_CATEGORY_INDEX[$software_id]=9 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=3047#p3047' + aSOFTWARE_REQUIRES_RSYSLOG[$software_id]=1 #------------------ software_id=162 - aSOFTWARE_WHIP_NAME[$software_id]='Docker' - aSOFTWARE_WHIP_DESC[$software_id]='Build, ship, and run distributed applications' - aSOFTWARE_CATEGORY_INDEX[$software_id]=9 - aSOFTWARE_TYPE[$software_id]=0 - + aSOFTWARE_WHIP_NAME[$software_id]='Docker' + aSOFTWARE_WHIP_DESC[$software_id]='Build, ship, and run distributed applications' + aSOFTWARE_CATEGORY_INDEX[$software_id]=9 + aSOFTWARE_TYPE[$software_id]=0 #Remote Access #-------------------------------------------------------------------------------- software_id=67 - aSOFTWARE_WHIP_NAME[$software_id]='NoIp' - aSOFTWARE_WHIP_DESC[$software_id]='url website address for your device' - aSOFTWARE_CATEGORY_INDEX[$software_id]=10 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=58#p58' + aSOFTWARE_WHIP_NAME[$software_id]='NoIp' + aSOFTWARE_WHIP_DESC[$software_id]='url website address for your device' + aSOFTWARE_CATEGORY_INDEX[$software_id]=10 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=58#p58' #------------------ software_id=68 - aSOFTWARE_WHIP_NAME[$software_id]='Remot3.it' - aSOFTWARE_WHIP_DESC[$software_id]='(Weaved) access your device over the internet' - aSOFTWARE_CATEGORY_INDEX[$software_id]=10 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=188#p188' + aSOFTWARE_WHIP_NAME[$software_id]='Remot3.it' + aSOFTWARE_WHIP_DESC[$software_id]='(Weaved) access your device over the internet' + aSOFTWARE_CATEGORY_INDEX[$software_id]=10 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=188#p188' #------------------ software_id=138 - aSOFTWARE_WHIP_NAME[$software_id]='VirtualHere' - aSOFTWARE_WHIP_DESC[$software_id]='server: share USB devices over the network' - aSOFTWARE_CATEGORY_INDEX[$software_id]=10 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=6709#p6709' + aSOFTWARE_WHIP_NAME[$software_id]='VirtualHere' + aSOFTWARE_WHIP_DESC[$software_id]='server: share USB devices over the network' + aSOFTWARE_CATEGORY_INDEX[$software_id]=10 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=6709#p6709' #------------------ @@ -1548,13 +1515,13 @@ _EOF_ #-------------------------------------------------------------------------------- software_id=69 - aSOFTWARE_WHIP_NAME[$software_id]='RPi.GPIO' - aSOFTWARE_WHIP_DESC[$software_id]='gpio interface library for rpi (python)' - aSOFTWARE_CATEGORY_INDEX[$software_id]=11 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1065#p1065' + aSOFTWARE_WHIP_NAME[$software_id]='RPi.GPIO' + aSOFTWARE_WHIP_DESC[$software_id]='gpio interface library for rpi (python)' + aSOFTWARE_CATEGORY_INDEX[$software_id]=11 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1065#p1065' - # - Disable for All non-RPi + # - RPi only for ((i=10; i<=$MAX_G_HW_MODEL; i++)) do @@ -1565,14 +1532,14 @@ _EOF_ #------------------ software_id=70 - aSOFTWARE_WHIP_NAME[$software_id]='WiringPi' - aSOFTWARE_WHIP_DESC[$software_id]='gpio interface library (c)' - aSOFTWARE_CATEGORY_INDEX[$software_id]=11 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_BUILDESSENTIAL[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1066#p1066' + aSOFTWARE_WHIP_NAME[$software_id]='WiringPi' + aSOFTWARE_WHIP_DESC[$software_id]='gpio interface library (c)' + aSOFTWARE_CATEGORY_INDEX[$software_id]=11 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_BUILDESSENTIAL[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1066#p1066' - # - RPi / Odroids + # - RPi + Odroids only for ((i=20; i<=$MAX_G_HW_MODEL; i++)) do @@ -1580,20 +1547,20 @@ _EOF_ done - #+ BPi Pro + # + BPi Pro aSOFTWARE_AVAIL_G_HW_MODEL[$software_id,51]=1 #------------------ software_id=71 - aSOFTWARE_WHIP_NAME[$software_id]='WebIOPi' - aSOFTWARE_WHIP_DESC[$software_id]='web interface to control rpi.gpio' - aSOFTWARE_CATEGORY_INDEX[$software_id]=11 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_BUILDESSENTIAL[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=189#p189' + aSOFTWARE_WHIP_NAME[$software_id]='WebIOPi' + aSOFTWARE_WHIP_DESC[$software_id]='web interface to control rpi.gpio' + aSOFTWARE_CATEGORY_INDEX[$software_id]=11 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_BUILDESSENTIAL[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=189#p189' - # - Disable for All non-RPi and RPi3 + # - RPi1/2/Zero only for ((i=3; i<=$MAX_G_HW_MODEL; i++)) do @@ -1604,12 +1571,12 @@ _EOF_ #------------------ software_id=72 - aSOFTWARE_WHIP_NAME[$software_id]='I2c' - aSOFTWARE_WHIP_DESC[$software_id]='enables support for i2c based hardware' - aSOFTWARE_CATEGORY_INDEX[$software_id]=11 - aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_WHIP_NAME[$software_id]='I2C' + aSOFTWARE_WHIP_DESC[$software_id]='enables support for i2c based hardware' + aSOFTWARE_CATEGORY_INDEX[$software_id]=11 + aSOFTWARE_TYPE[$software_id]=0 - # - Disable for All non-RPi + # - RPi only for ((i=10; i<=$MAX_G_HW_MODEL; i++)) do @@ -1620,13 +1587,13 @@ _EOF_ #------------------ software_id=100 - aSOFTWARE_WHIP_NAME[$software_id]='PiJuice' - aSOFTWARE_WHIP_DESC[$software_id]='pisupply ups' - aSOFTWARE_CATEGORY_INDEX[$software_id]=11 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=10740#p10740' + aSOFTWARE_WHIP_NAME[$software_id]='PiJuice' + aSOFTWARE_WHIP_DESC[$software_id]='pisupply ups' + aSOFTWARE_CATEGORY_INDEX[$software_id]=11 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=10740#p10740' - # - Disable for All non-RPi + # - RPi only for ((i=10; i<=$MAX_G_HW_MODEL; i++)) do @@ -1637,45 +1604,45 @@ _EOF_ #------------------ software_id=122 - aSOFTWARE_WHIP_NAME[$software_id]='Node-Red' - aSOFTWARE_WHIP_DESC[$software_id]='tool for wiring devices, APIs and online services' - aSOFTWARE_CATEGORY_INDEX[$software_id]=11 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_NODEJS[$software_id]=1 - aSOFTWARE_REQUIRES_BUILDESSENTIAL[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=4292#p4292' + aSOFTWARE_WHIP_NAME[$software_id]='Node-Red' + aSOFTWARE_WHIP_DESC[$software_id]='tool for wiring devices, APIs and online services' + aSOFTWARE_CATEGORY_INDEX[$software_id]=11 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_NODEJS[$software_id]=1 + aSOFTWARE_REQUIRES_BUILDESSENTIAL[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=4292#p4292' #------------------ software_id=123 - aSOFTWARE_WHIP_NAME[$software_id]='Mosquitto ' - aSOFTWARE_WHIP_DESC[$software_id]='MQTT messaging broker' - aSOFTWARE_CATEGORY_INDEX[$software_id]=11 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=4293#p4293' + aSOFTWARE_WHIP_NAME[$software_id]='Mosquitto ' + aSOFTWARE_WHIP_DESC[$software_id]='MQTT messaging broker' + aSOFTWARE_CATEGORY_INDEX[$software_id]=11 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=4293#p4293' #------------------ software_id=131 - aSOFTWARE_WHIP_NAME[$software_id]='Blynk Server' - aSOFTWARE_WHIP_DESC[$software_id]='msg controller for blynk mobile app and sbcs' - aSOFTWARE_CATEGORY_INDEX[$software_id]=11 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=5901#p5901' - aSOFTWARE_REQUIRES_JAVA_JRE_JDK[$software_id]=1 - aSOFTWARE_REQUIRES_NODEJS[$software_id]=1 - aSOFTWARE_REQUIRES_BUILDESSENTIAL[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='Blynk Server' + aSOFTWARE_WHIP_DESC[$software_id]='msg controller for blynk mobile app and sbcs' + aSOFTWARE_CATEGORY_INDEX[$software_id]=11 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=5901#p5901' + aSOFTWARE_REQUIRES_JAVA_JRE_JDK[$software_id]=1 + aSOFTWARE_REQUIRES_NODEJS[$software_id]=1 + aSOFTWARE_REQUIRES_BUILDESSENTIAL[$software_id]=1 #------------------ software_id=166 - aSOFTWARE_WHIP_NAME[$software_id]='PI-SPC' - aSOFTWARE_WHIP_DESC[$software_id]='audiophonics pi-spc power control module' - aSOFTWARE_CATEGORY_INDEX[$software_id]=11 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=9359#p9359' + aSOFTWARE_WHIP_NAME[$software_id]='PI-SPC' + aSOFTWARE_WHIP_DESC[$software_id]='audiophonics pi-spc power control module' + aSOFTWARE_CATEGORY_INDEX[$software_id]=11 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=9359#p9359' - # - Disable for All non-RPi + # - RPi only for ((i=10; i<=$MAX_G_HW_MODEL; i++)) do @@ -1686,15 +1653,15 @@ _EOF_ #------------------ software_id=169 - aSOFTWARE_WHIP_NAME[$software_id]='Google AIY' - aSOFTWARE_WHIP_DESC[$software_id]='voice kit' - aSOFTWARE_CATEGORY_INDEX[$software_id]=11 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_ALSA[$software_id]=1 - aSOFTWARE_REQUIRES_GIT[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=9486#p9486' + aSOFTWARE_WHIP_NAME[$software_id]='Google AIY' + aSOFTWARE_WHIP_DESC[$software_id]='voice kit' + aSOFTWARE_CATEGORY_INDEX[$software_id]=11 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_ALSA[$software_id]=1 + aSOFTWARE_REQUIRES_GIT[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=9486#p9486' - # - Disable for All non-RPi + # - RPi only for ((i=10; i<=$MAX_G_HW_MODEL; i++)) do @@ -1705,235 +1672,240 @@ _EOF_ #------------------ software_id=74 - aSOFTWARE_WHIP_NAME[$software_id]='InfluxDB' - aSOFTWARE_WHIP_DESC[$software_id]='time-series database' - aSOFTWARE_CATEGORY_INDEX[$software_id]=11 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=12523#p12523' + aSOFTWARE_WHIP_NAME[$software_id]='InfluxDB' + aSOFTWARE_WHIP_DESC[$software_id]='time-series database' + aSOFTWARE_CATEGORY_INDEX[$software_id]=11 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=12523#p12523' #------------------ software_id=77 - aSOFTWARE_WHIP_NAME[$software_id]='Grafana' - aSOFTWARE_WHIP_DESC[$software_id]='platform for analytics and monitoring' - aSOFTWARE_CATEGORY_INDEX[$software_id]=11 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=12524#p12524' - + aSOFTWARE_WHIP_NAME[$software_id]='Grafana' + aSOFTWARE_WHIP_DESC[$software_id]='platform for analytics and monitoring' + aSOFTWARE_CATEGORY_INDEX[$software_id]=11 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=12524#p12524' #System security #-------------------------------------------------------------------------------- software_id=73 - aSOFTWARE_WHIP_NAME[$software_id]='Fail2Ban' - aSOFTWARE_WHIP_DESC[$software_id]='prevents brute-force attacks with ip ban' - aSOFTWARE_CATEGORY_INDEX[$software_id]=12 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=452#p452' + aSOFTWARE_WHIP_NAME[$software_id]='Fail2Ban' + aSOFTWARE_WHIP_DESC[$software_id]='prevents brute-force attacks with ip ban' + aSOFTWARE_CATEGORY_INDEX[$software_id]=12 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=452#p452' #------------------ #Webserver stacks #-------------------------------------------------------------------------------- software_id=75 - aSOFTWARE_WHIP_NAME[$software_id]='LASP' - aSOFTWARE_WHIP_DESC[$software_id]='apache2 | sqlite | php' - aSOFTWARE_CATEGORY_INDEX[$software_id]=13 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=52#p52' + aSOFTWARE_WHIP_NAME[$software_id]='LASP' + aSOFTWARE_WHIP_DESC[$software_id]='apache2 | sqlite | php' + aSOFTWARE_CATEGORY_INDEX[$software_id]=13 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=52#p52' #------------------ software_id=76 - aSOFTWARE_WHIP_NAME[$software_id]='LAMP' - aSOFTWARE_WHIP_DESC[$software_id]='apache2 | mariadb | php' - aSOFTWARE_CATEGORY_INDEX[$software_id]=13 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=52#p52' + aSOFTWARE_WHIP_NAME[$software_id]='LAMP' + aSOFTWARE_WHIP_DESC[$software_id]='apache2 | mariadb | php' + aSOFTWARE_CATEGORY_INDEX[$software_id]=13 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=52#p52' #------------------ software_id=78 - aSOFTWARE_WHIP_NAME[$software_id]='LESP' - aSOFTWARE_WHIP_DESC[$software_id]='nginx | sqlite | php' - aSOFTWARE_CATEGORY_INDEX[$software_id]=13 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=53#p53' + aSOFTWARE_WHIP_NAME[$software_id]='LESP' + aSOFTWARE_WHIP_DESC[$software_id]='nginx | sqlite | php' + aSOFTWARE_CATEGORY_INDEX[$software_id]=13 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=53#p53' #------------------ software_id=79 - aSOFTWARE_WHIP_NAME[$software_id]='LEMP' - aSOFTWARE_WHIP_DESC[$software_id]='nginx | mariadb | php' - aSOFTWARE_CATEGORY_INDEX[$software_id]=13 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=53#p53' + aSOFTWARE_WHIP_NAME[$software_id]='LEMP' + aSOFTWARE_WHIP_DESC[$software_id]='nginx | mariadb | php' + aSOFTWARE_CATEGORY_INDEX[$software_id]=13 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=53#p53' #------------------ software_id=81 - aSOFTWARE_WHIP_NAME[$software_id]='LLSP' - aSOFTWARE_WHIP_DESC[$software_id]='lighttpd | sqlite | php' - aSOFTWARE_CATEGORY_INDEX[$software_id]=13 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1335#p1335' + aSOFTWARE_WHIP_NAME[$software_id]='LLSP' + aSOFTWARE_WHIP_DESC[$software_id]='lighttpd | sqlite | php' + aSOFTWARE_CATEGORY_INDEX[$software_id]=13 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1335#p1335' #------------------ software_id=82 - aSOFTWARE_WHIP_NAME[$software_id]='LLMP' - aSOFTWARE_WHIP_DESC[$software_id]='lighttpd | mariadb | php' - aSOFTWARE_CATEGORY_INDEX[$software_id]=13 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1335#p1335' + aSOFTWARE_WHIP_NAME[$software_id]='LLMP' + aSOFTWARE_WHIP_DESC[$software_id]='lighttpd | mariadb | php' + aSOFTWARE_CATEGORY_INDEX[$software_id]=13 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1335#p1335' #------------------ software_id=83 - aSOFTWARE_WHIP_NAME[$software_id]='Apache2' - aSOFTWARE_WHIP_DESC[$software_id]='webserver' - aSOFTWARE_CATEGORY_INDEX[$software_id]=13 - aSOFTWARE_TYPE[$software_id]=-1 - aSOFTWARE_REQUIRES_PHP[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=52#p52' + aSOFTWARE_WHIP_NAME[$software_id]='Apache2' + aSOFTWARE_WHIP_DESC[$software_id]='webserver' + aSOFTWARE_CATEGORY_INDEX[$software_id]=13 + aSOFTWARE_TYPE[$software_id]=-1 + aSOFTWARE_REQUIRES_PHP[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=52#p52' #------------------ software_id=84 - aSOFTWARE_WHIP_NAME[$software_id]='Lighttpd' - aSOFTWARE_WHIP_DESC[$software_id]='webserver' - aSOFTWARE_CATEGORY_INDEX[$software_id]=13 - aSOFTWARE_TYPE[$software_id]=-1 - aSOFTWARE_REQUIRES_PHP[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1335#p1335' + aSOFTWARE_WHIP_NAME[$software_id]='Lighttpd' + aSOFTWARE_WHIP_DESC[$software_id]='webserver' + aSOFTWARE_CATEGORY_INDEX[$software_id]=13 + aSOFTWARE_TYPE[$software_id]=-1 + aSOFTWARE_REQUIRES_PHP[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1335#p1335' #------------------ software_id=85 - aSOFTWARE_WHIP_NAME[$software_id]='Nginx' - aSOFTWARE_WHIP_DESC[$software_id]='webserver' - aSOFTWARE_CATEGORY_INDEX[$software_id]=13 - aSOFTWARE_TYPE[$software_id]=-1 - aSOFTWARE_REQUIRES_PHP[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=53#p53' + aSOFTWARE_WHIP_NAME[$software_id]='Nginx' + aSOFTWARE_WHIP_DESC[$software_id]='webserver' + aSOFTWARE_CATEGORY_INDEX[$software_id]=13 + aSOFTWARE_TYPE[$software_id]=-1 + aSOFTWARE_REQUIRES_PHP[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=53#p53' #------------------ software_id=87 - aSOFTWARE_WHIP_NAME[$software_id]='SQlite' - aSOFTWARE_WHIP_DESC[$software_id]='database' - aSOFTWARE_CATEGORY_INDEX[$software_id]=13 - aSOFTWARE_TYPE[$software_id]=-1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1335#p1335' + aSOFTWARE_WHIP_NAME[$software_id]='SQLite' + aSOFTWARE_WHIP_DESC[$software_id]='database' + aSOFTWARE_CATEGORY_INDEX[$software_id]=13 + aSOFTWARE_TYPE[$software_id]=-1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1335#p1335' #------------------ software_id=88 - aSOFTWARE_WHIP_NAME[$software_id]='MariaDB' - aSOFTWARE_WHIP_DESC[$software_id]='database' - aSOFTWARE_CATEGORY_INDEX[$software_id]=13 - aSOFTWARE_TYPE[$software_id]=-1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1335#p1335' + aSOFTWARE_WHIP_NAME[$software_id]='MariaDB' + aSOFTWARE_WHIP_DESC[$software_id]='database' + aSOFTWARE_CATEGORY_INDEX[$software_id]=13 + aSOFTWARE_TYPE[$software_id]=-1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1335#p1335' #------------------ software_id=89 - aSOFTWARE_WHIP_NAME[$software_id]='PHP' - aSOFTWARE_WHIP_DESC[$software_id]='webserver' - aSOFTWARE_CATEGORY_INDEX[$software_id]=13 - aSOFTWARE_TYPE[$software_id]=-1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1335#p1335' + aSOFTWARE_WHIP_NAME[$software_id]='PHP' + aSOFTWARE_WHIP_DESC[$software_id]='Hypertext Preprocessor for dynamic web content' + aSOFTWARE_CATEGORY_INDEX[$software_id]=13 + aSOFTWARE_TYPE[$software_id]=-1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1335#p1335' #------------------ software_id=90 - aSOFTWARE_WHIP_NAME[$software_id]='phpMyAdmin' - aSOFTWARE_WHIP_DESC[$software_id]='optional mysql admin tools' - aSOFTWARE_CATEGORY_INDEX[$software_id]=13 - aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_WHIP_NAME[$software_id]='phpMyAdmin' + aSOFTWARE_WHIP_DESC[$software_id]='optional mysql admin tools' + aSOFTWARE_CATEGORY_INDEX[$software_id]=13 + aSOFTWARE_TYPE[$software_id]=0 aSOFTWARE_REQUIRES_WEBSERVER[$software_id]=1 - aSOFTWARE_REQUIRES_MYSQL[$software_id]=1 - aSOFTWARE_REQUIRES_PHP[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=54#p54' + aSOFTWARE_REQUIRES_MYSQL[$software_id]=1 + aSOFTWARE_REQUIRES_PHP[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=54#p54' + + # - non-RPi Buster: https://packages.debian.org/phpmyadmin + (( $G_HW_MODEL > 9 )) && aSOFTWARE_AVAIL_G_DISTRO[$software_id,5]=0 #------------------ software_id=91 - aSOFTWARE_WHIP_NAME[$software_id]='Redis' - aSOFTWARE_WHIP_DESC[$software_id]='optional non-sql database store' - aSOFTWARE_CATEGORY_INDEX[$software_id]=13 - aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_WHIP_NAME[$software_id]='Redis' + aSOFTWARE_WHIP_DESC[$software_id]='optional non-sql database store' + aSOFTWARE_CATEGORY_INDEX[$software_id]=13 + aSOFTWARE_TYPE[$software_id]=0 #------------------ software_id=92 - aSOFTWARE_WHIP_NAME[$software_id]='CertBot' - aSOFTWARE_WHIP_DESC[$software_id]='free, ssl cert install allowing https://' - aSOFTWARE_CATEGORY_INDEX[$software_id]=13 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1061#p1062' + aSOFTWARE_WHIP_NAME[$software_id]='CertBot' + aSOFTWARE_WHIP_DESC[$software_id]='free, ssl cert install allowing https://' + aSOFTWARE_CATEGORY_INDEX[$software_id]=13 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1061#p1062' #------------------ software_id=125 - aSOFTWARE_WHIP_NAME[$software_id]='Tomcat8' - aSOFTWARE_WHIP_DESC[$software_id]='apache tomcat server' - aSOFTWARE_CATEGORY_INDEX[$software_id]=13 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=4316#p4316' - aSOFTWARE_REQUIRES_JAVA_JRE_JDK[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='Tomcat8' + aSOFTWARE_WHIP_DESC[$software_id]='apache tomcat server' + aSOFTWARE_CATEGORY_INDEX[$software_id]=13 + 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 #PiHole #-------------------------------------------------------------------------------- software_id=93 - aSOFTWARE_WHIP_NAME[$software_id]='Pi-hole' - aSOFTWARE_WHIP_DESC[$software_id]='block adverts for any device on your network' - aSOFTWARE_CATEGORY_INDEX[$software_id]=14 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_GIT[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='Pi-hole' + aSOFTWARE_WHIP_DESC[$software_id]='block adverts for any device on your network' + aSOFTWARE_CATEGORY_INDEX[$software_id]=14 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_GIT[$software_id]=1 aSOFTWARE_REQUIRES_WEBSERVER[$software_id]=1 - aSOFTWARE_REQUIRES_PHP[$software_id]=1 - aSOFTWARE_REQUIRES_SQLITE[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=174#p174' + aSOFTWARE_REQUIRES_PHP[$software_id]=1 + aSOFTWARE_REQUIRES_SQLITE[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=174#p174' aSOFTWARE_REQUIRES_USERINPUT[$software_id]=1 #File servers #-------------------------------------------------------------------------------- software_id=94 - aSOFTWARE_WHIP_NAME[$software_id]='ProFTP' - aSOFTWARE_WHIP_DESC[$software_id]='lightweight ftp server' - aSOFTWARE_CATEGORY_INDEX[$software_id]=15 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=55#p55' + aSOFTWARE_WHIP_NAME[$software_id]='ProFTP' + aSOFTWARE_WHIP_DESC[$software_id]='lightweight ftp server' + aSOFTWARE_CATEGORY_INDEX[$software_id]=15 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=55#p55' #------------------ software_id=95 - aSOFTWARE_WHIP_NAME[$software_id]='vsFTPD' - aSOFTWARE_WHIP_DESC[$software_id]='alternative ftp server' - aSOFTWARE_CATEGORY_INDEX[$software_id]=15 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=2820#p2820' + aSOFTWARE_WHIP_NAME[$software_id]='vsFTPD' + aSOFTWARE_WHIP_DESC[$software_id]='alternative ftp server' + aSOFTWARE_CATEGORY_INDEX[$software_id]=15 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=2820#p2820' #------------------ software_id=96 - aSOFTWARE_WHIP_NAME[$software_id]='Samba' - aSOFTWARE_WHIP_DESC[$software_id]='feature-rich file server' - aSOFTWARE_CATEGORY_INDEX[$software_id]=15 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=56#p56' + aSOFTWARE_WHIP_NAME[$software_id]='Samba' + aSOFTWARE_WHIP_DESC[$software_id]='feature-rich file server' + aSOFTWARE_CATEGORY_INDEX[$software_id]=15 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=56#p56' #------------------ software_id=109 - aSOFTWARE_WHIP_NAME[$software_id]='NFS' - aSOFTWARE_WHIP_DESC[$software_id]='network file system server' - aSOFTWARE_CATEGORY_INDEX[$software_id]=15 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=2821#p2821' + aSOFTWARE_WHIP_NAME[$software_id]='NFS' + aSOFTWARE_WHIP_DESC[$software_id]='network file system server' + aSOFTWARE_CATEGORY_INDEX[$software_id]=15 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=2821#p2821' #------------------ @@ -1941,42 +1913,42 @@ _EOF_ #-------------------------------------------------------------------------------- software_id=97 - aSOFTWARE_WHIP_NAME[$software_id]='OpenVPN' - aSOFTWARE_WHIP_DESC[$software_id]='vpn server' - aSOFTWARE_CATEGORY_INDEX[$software_id]=16 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_RSYSLOG[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=613#p613' + aSOFTWARE_WHIP_NAME[$software_id]='OpenVPN' + aSOFTWARE_WHIP_DESC[$software_id]='vpn server' + aSOFTWARE_CATEGORY_INDEX[$software_id]=16 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_RSYSLOG[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=613#p613' #------------------ software_id=117 - aSOFTWARE_WHIP_NAME[$software_id]='PiVPN' - aSOFTWARE_WHIP_DESC[$software_id]='openvpn server install & management tool' - aSOFTWARE_CATEGORY_INDEX[$software_id]=16 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_RSYSLOG[$software_id]=1 - aSOFTWARE_REQUIRES_GIT[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=3469#p3469' + aSOFTWARE_WHIP_NAME[$software_id]='PiVPN' + aSOFTWARE_WHIP_DESC[$software_id]='openvpn server install & management tool' + aSOFTWARE_CATEGORY_INDEX[$software_id]=16 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_RSYSLOG[$software_id]=1 + aSOFTWARE_REQUIRES_GIT[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=3469#p3469' aSOFTWARE_REQUIRES_USERINPUT[$software_id]=1 #------------------ software_id=171 - aSOFTWARE_WHIP_NAME[$software_id]='DietPi-NordVPN' - aSOFTWARE_WHIP_DESC[$software_id]='vpn client with connection gui' - aSOFTWARE_CATEGORY_INDEX[$software_id]=16 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p15975#p15975' + aSOFTWARE_WHIP_NAME[$software_id]='DietPi-NordVPN' + aSOFTWARE_WHIP_DESC[$software_id]='vpn client with connection gui' + aSOFTWARE_CATEGORY_INDEX[$software_id]=16 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p15975#p15975' #------------------ software_id=172 - aSOFTWARE_WHIP_NAME[$software_id]='WireGuard' - aSOFTWARE_WHIP_DESC[$software_id]='an extremely simple yet fast and modern VPN' - aSOFTWARE_CATEGORY_INDEX[$software_id]=16 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=16308#p16308' + aSOFTWARE_WHIP_NAME[$software_id]='WireGuard' + aSOFTWARE_WHIP_DESC[$software_id]='an extremely simple yet fast and modern VPN' + aSOFTWARE_CATEGORY_INDEX[$software_id]=16 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=16308#p16308' # Required to ask for public domain/IP and desired VPN server port aSOFTWARE_REQUIRES_USERINPUT[$software_id]=1 @@ -1987,40 +1959,39 @@ _EOF_ aSOFTWARE_AVAIL_G_HW_MODEL[$software_id,$i]=0 done - # Disable for ARMv6 + + # - ARMv6 aSOFTWARE_AVAIL_G_HW_ARCH[$software_id,1]=0 - # Enable RPi/x86_64/Odroids | ARMv6 disabled - if (( $G_HW_MODEL < 10 || - $G_HW_ARCH == 10 || - $G_HW_MODEL == 10 || $G_HW_MODEL == 11 || $G_HW_MODEL == 12 || $G_HW_MODEL == 14 )); then + + # Enable RPi/Odroids/x86_64 | ARMv6 disabled + if (( $G_HW_MODEL < 13 || $G_HW_MODEL == 14 || $G_HW_ARCH == 10 )); then aSOFTWARE_AVAIL_G_HW_MODEL[$software_id,$G_HW_MODEL]=1 fi - #Advanced Networking #-------------------------------------------------------------------------------- software_id=98 - aSOFTWARE_WHIP_NAME[$software_id]='HaProxy' - aSOFTWARE_WHIP_DESC[$software_id]='high performance tcp/http load balancer' - aSOFTWARE_CATEGORY_INDEX[$software_id]=17 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_BUILDESSENTIAL[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=221#p221' + aSOFTWARE_WHIP_NAME[$software_id]='HaProxy' + aSOFTWARE_WHIP_DESC[$software_id]='high performance tcp/http load balancer' + aSOFTWARE_CATEGORY_INDEX[$software_id]=17 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_BUILDESSENTIAL[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=221#p221' #Home automation #-------------------------------------------------------------------------------- software_id=99 - aSOFTWARE_WHIP_NAME[$software_id]='EmonPi' - aSOFTWARE_WHIP_DESC[$software_id]='energy usage addon board with web interface' - aSOFTWARE_CATEGORY_INDEX[$software_id]=18 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1525#p1525' + aSOFTWARE_WHIP_NAME[$software_id]='EmonPi' + aSOFTWARE_WHIP_DESC[$software_id]='energy usage addon board with web interface' + aSOFTWARE_CATEGORY_INDEX[$software_id]=18 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1525#p1525' - # - Disable for All non-RPi + # - RPi only for ((i=10; i<=$MAX_G_HW_MODEL; i++)) do @@ -2031,15 +2002,15 @@ _EOF_ #------------------ software_id=157 - aSOFTWARE_WHIP_NAME[$software_id]='Home Assistant' - aSOFTWARE_WHIP_DESC[$software_id]='open-source home automation platform' - aSOFTWARE_CATEGORY_INDEX[$software_id]=18 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_REQUIRES_GIT[$software_id]=1 - aSOFTWARE_REQUIRES_BUILDESSENTIAL[$software_id]=1 - aSOFTWARE_REQUIRES_SQLITE[$software_id]=1 - aSOFTWARE_REQUIRES_FFMPEG[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=70#p70' + aSOFTWARE_WHIP_NAME[$software_id]='Home Assistant' + aSOFTWARE_WHIP_DESC[$software_id]='open-source home automation platform' + aSOFTWARE_CATEGORY_INDEX[$software_id]=18 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_REQUIRES_GIT[$software_id]=1 + aSOFTWARE_REQUIRES_BUILDESSENTIAL[$software_id]=1 + aSOFTWARE_REQUIRES_SQLITE[$software_id]=1 + aSOFTWARE_REQUIRES_FFMPEG[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=70#p70' #------------------ @@ -2047,26 +2018,26 @@ _EOF_ #-------------------------------------------------------------------------------- software_id=137 - aSOFTWARE_WHIP_NAME[$software_id]='CloudPrint' - aSOFTWARE_WHIP_DESC[$software_id]='print server for google cloud print' - aSOFTWARE_CATEGORY_INDEX[$software_id]=19 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='f=8&t=5&p=6630#p6630' - aSOFTWARE_REQUIRES_RSYSLOG[$software_id]=1 #Not required, but comes in as package dep + aSOFTWARE_WHIP_NAME[$software_id]='CloudPrint' + aSOFTWARE_WHIP_DESC[$software_id]='print server for google cloud print' + aSOFTWARE_CATEGORY_INDEX[$software_id]=19 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=6630#p6630' + aSOFTWARE_REQUIRES_RSYSLOG[$software_id]=1 # Not required, but comes in as package dep - #Disabled for ARMv8 on Jessie only: https://github.com/MichaIng/DietPi/issues/855#issuecomment-292712002 + # - ARMv8 on Jessie: https://github.com/MichaIng/DietPi/issues/855#issuecomment-292712002 (( $G_DISTRO == 3 )) && aSOFTWARE_AVAIL_G_HW_ARCH[$software_id,3]=0 #------------------ software_id=153 - aSOFTWARE_WHIP_NAME[$software_id]='OctoPrint' - aSOFTWARE_WHIP_DESC[$software_id]='web interface for controlling 3d printers' - aSOFTWARE_CATEGORY_INDEX[$software_id]=19 - aSOFTWARE_TYPE[$software_id]=0 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=7958#p7958' - aSOFTWARE_REQUIRES_BUILDESSENTIAL[$software_id]=1 - aSOFTWARE_REQUIRES_GIT[$software_id]=1 # Required for updates + aSOFTWARE_WHIP_NAME[$software_id]='OctoPrint' + aSOFTWARE_WHIP_DESC[$software_id]='web interface for controlling 3d printers' + aSOFTWARE_CATEGORY_INDEX[$software_id]=19 + aSOFTWARE_TYPE[$software_id]=0 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=7958#p7958' + aSOFTWARE_REQUIRES_BUILDESSENTIAL[$software_id]=1 + aSOFTWARE_REQUIRES_GIT[$software_id]=1 # Required for updates #-------------------------------------------------------------------------------- #Additional linux software items @@ -2076,74 +2047,74 @@ _EOF_ #-------------------------------------------------------------------------------- software_id=0 - aSOFTWARE_WHIP_NAME[$software_id]='OpenSSH Client' - aSOFTWARE_WHIP_DESC[$software_id]='' - aSOFTWARE_CATEGORY_INDEX[$software_id]=0 - aSOFTWARE_TYPE[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='OpenSSH Client' + aSOFTWARE_WHIP_DESC[$software_id]='' + aSOFTWARE_CATEGORY_INDEX[$software_id]=0 + aSOFTWARE_TYPE[$software_id]=1 #------------------ #File server clients #-------------------------------------------------------------------------------- software_id=1 - aSOFTWARE_WHIP_NAME[$software_id]='Samba Client' - aSOFTWARE_WHIP_DESC[$software_id]='access network shares' - aSOFTWARE_CATEGORY_INDEX[$software_id]=1 - aSOFTWARE_TYPE[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]=' dietpi-config > Network Options: NAS/Misc' + aSOFTWARE_WHIP_NAME[$software_id]='Samba Client' + aSOFTWARE_WHIP_DESC[$software_id]='access network shares' + aSOFTWARE_CATEGORY_INDEX[$software_id]=1 + aSOFTWARE_TYPE[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]=' dietpi-config > Network Options: NAS/Misc' #------------------ software_id=110 - aSOFTWARE_WHIP_NAME[$software_id]='NFS Client' - aSOFTWARE_WHIP_DESC[$software_id]='network file system client' - aSOFTWARE_CATEGORY_INDEX[$software_id]=1 - aSOFTWARE_TYPE[$software_id]=1 - aSOFTWARE_ONLINEDOC_URL[$software_id]=' dietpi-config > Network Options: NAS/Misc' + aSOFTWARE_WHIP_NAME[$software_id]='NFS Client' + aSOFTWARE_WHIP_DESC[$software_id]='network file system client' + aSOFTWARE_CATEGORY_INDEX[$software_id]=1 + aSOFTWARE_TYPE[$software_id]=1 + aSOFTWARE_ONLINEDOC_URL[$software_id]=' dietpi-config > Network Options: NAS/Misc' #------------------ #File managers #-------------------------------------------------------------------------------- software_id=3 - aSOFTWARE_WHIP_NAME[$software_id]='MC' - aSOFTWARE_WHIP_DESC[$software_id]='midnight commander, powerful file manager' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 - aSOFTWARE_TYPE[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='MC' + aSOFTWARE_WHIP_DESC[$software_id]='midnight commander, powerful file manager' + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 + aSOFTWARE_TYPE[$software_id]=1 #------------------ software_id=4 - aSOFTWARE_WHIP_NAME[$software_id]='ViFM' - aSOFTWARE_WHIP_DESC[$software_id]='file manager with vi bindings' - aSOFTWARE_CATEGORY_INDEX[$software_id]=2 - aSOFTWARE_TYPE[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='ViFM' + aSOFTWARE_WHIP_DESC[$software_id]='file manager with vi bindings' + aSOFTWARE_CATEGORY_INDEX[$software_id]=2 + aSOFTWARE_TYPE[$software_id]=1 #------------------ #System #-------------------------------------------------------------------------------- software_id=5 - aSOFTWARE_WHIP_NAME[$software_id]='ALSA' - aSOFTWARE_WHIP_DESC[$software_id]='linux sound system' - aSOFTWARE_CATEGORY_INDEX[$software_id]=3 - aSOFTWARE_TYPE[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='ALSA' + aSOFTWARE_WHIP_DESC[$software_id]='linux sound system' + aSOFTWARE_CATEGORY_INDEX[$software_id]=3 + aSOFTWARE_TYPE[$software_id]=1 #------------------ software_id=6 - aSOFTWARE_WHIP_NAME[$software_id]='Xserver' - aSOFTWARE_WHIP_DESC[$software_id]='linux display system' - aSOFTWARE_CATEGORY_INDEX[$software_id]=3 - aSOFTWARE_TYPE[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='Xserver' + aSOFTWARE_WHIP_DESC[$software_id]='linux display system' + aSOFTWARE_CATEGORY_INDEX[$software_id]=3 + aSOFTWARE_TYPE[$software_id]=1 #------------------ software_id=151 - aSOFTWARE_WHIP_NAME[$software_id]='Nvidia' - aSOFTWARE_WHIP_DESC[$software_id]='display driver' - aSOFTWARE_CATEGORY_INDEX[$software_id]=3 - aSOFTWARE_TYPE[$software_id]=1 - aSOFTWARE_REQUIRES_XSERVERXORG[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='Nvidia' + aSOFTWARE_WHIP_DESC[$software_id]='display driver' + aSOFTWARE_CATEGORY_INDEX[$software_id]=3 + aSOFTWARE_TYPE[$software_id]=1 + aSOFTWARE_REQUIRES_XSERVERXORG[$software_id]=1 - # NativePC only + # Native PC only for ((i=0; i<=$MAX_G_HW_MODEL; i++)) do @@ -2156,194 +2127,182 @@ _EOF_ #-------------------------------------------------------------------------------- software_id=7 - aSOFTWARE_WHIP_NAME[$software_id]='FFmpeg' - aSOFTWARE_WHIP_DESC[$software_id]='audio & visual libary' - aSOFTWARE_CATEGORY_INDEX[$software_id]=4 - aSOFTWARE_TYPE[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='FFmpeg' + aSOFTWARE_WHIP_DESC[$software_id]='audio & visual libary' + aSOFTWARE_CATEGORY_INDEX[$software_id]=4 + aSOFTWARE_TYPE[$software_id]=1 #------------------ software_id=8 - aSOFTWARE_WHIP_NAME[$software_id]='Java' - aSOFTWARE_WHIP_DESC[$software_id]='OpenJDK 8 + JRE libary' - aSOFTWARE_CATEGORY_INDEX[$software_id]=4 - aSOFTWARE_TYPE[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='Java' + aSOFTWARE_WHIP_DESC[$software_id]='OpenJDK + JRE libary' + aSOFTWARE_CATEGORY_INDEX[$software_id]=4 + aSOFTWARE_TYPE[$software_id]=1 #------------------ software_id=9 - aSOFTWARE_WHIP_NAME[$software_id]='Node.js' - aSOFTWARE_WHIP_DESC[$software_id]='javascript runtime' - aSOFTWARE_CATEGORY_INDEX[$software_id]=4 - aSOFTWARE_TYPE[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='Node.js' + aSOFTWARE_WHIP_DESC[$software_id]='javascript runtime' + aSOFTWARE_CATEGORY_INDEX[$software_id]=4 + aSOFTWARE_TYPE[$software_id]=1 #------------------ software_id=130 - aSOFTWARE_WHIP_NAME[$software_id]='Python Pip' - aSOFTWARE_WHIP_DESC[$software_id]='python pip package installer' - aSOFTWARE_CATEGORY_INDEX[$software_id]=4 - aSOFTWARE_TYPE[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='Python Pip' + aSOFTWARE_WHIP_DESC[$software_id]='python pip package installer' + aSOFTWARE_CATEGORY_INDEX[$software_id]=4 + aSOFTWARE_TYPE[$software_id]=1 #------------------ software_id=140 - aSOFTWARE_WHIP_NAME[$software_id]='SDL2' - aSOFTWARE_WHIP_DESC[$software_id]='simple direct layer 2' - aSOFTWARE_CATEGORY_INDEX[$software_id]=4 - aSOFTWARE_TYPE[$software_id]=1 - SOFTWARE_REQUIRES_XSERVERXORG[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='SDL2' + aSOFTWARE_WHIP_DESC[$software_id]='simple direct layer 2' + aSOFTWARE_CATEGORY_INDEX[$software_id]=4 + aSOFTWARE_TYPE[$software_id]=1 + SOFTWARE_REQUIRES_XSERVERXORG[$software_id]=1 - # Disable for ARMv8 + # - ARMv8 aSOFTWARE_AVAIL_G_HW_ARCH[$software_id,3]=0 - #------------------ software_id=150 - aSOFTWARE_WHIP_NAME[$software_id]='Mono' - aSOFTWARE_WHIP_DESC[$software_id]='runtime libraries and repo' - aSOFTWARE_CATEGORY_INDEX[$software_id]=4 - aSOFTWARE_TYPE[$software_id]=1 - - + aSOFTWARE_WHIP_NAME[$software_id]='Mono' + aSOFTWARE_WHIP_DESC[$software_id]='runtime libraries and repo' + aSOFTWARE_CATEGORY_INDEX[$software_id]=4 + aSOFTWARE_TYPE[$software_id]=1 #------------------ software_id=126 - aSOFTWARE_WHIP_NAME[$software_id]='LibSSL1.0.0' - aSOFTWARE_WHIP_DESC[$software_id]='backwards compatibility (stretch)' - aSOFTWARE_CATEGORY_INDEX[$software_id]=4 - aSOFTWARE_TYPE[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='LibSSL1.0.0' + aSOFTWARE_WHIP_DESC[$software_id]='backwards compatibility (stretch+)' + aSOFTWARE_CATEGORY_INDEX[$software_id]=4 + aSOFTWARE_TYPE[$software_id]=1 #Networking #-------------------------------------------------------------------------------- software_id=10 - aSOFTWARE_WHIP_NAME[$software_id]='iftop' - aSOFTWARE_WHIP_DESC[$software_id]='displays bandwidth usage information' - aSOFTWARE_CATEGORY_INDEX[$software_id]=5 - aSOFTWARE_TYPE[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='iftop' + aSOFTWARE_WHIP_DESC[$software_id]='displays bandwidth usage information' + aSOFTWARE_CATEGORY_INDEX[$software_id]=5 + aSOFTWARE_TYPE[$software_id]=1 #------------------ software_id=11 - aSOFTWARE_WHIP_NAME[$software_id]='IPTraf' - aSOFTWARE_WHIP_DESC[$software_id]='interactive colorful ip lan monitor' - aSOFTWARE_CATEGORY_INDEX[$software_id]=5 - aSOFTWARE_TYPE[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='IPTraf' + aSOFTWARE_WHIP_DESC[$software_id]='interactive colorful ip lan monitor' + aSOFTWARE_CATEGORY_INDEX[$software_id]=5 + aSOFTWARE_TYPE[$software_id]=1 #------------------ software_id=12 - aSOFTWARE_WHIP_NAME[$software_id]='Iperf' - aSOFTWARE_WHIP_DESC[$software_id]='internet protocol bandwidth measuring tool' - aSOFTWARE_CATEGORY_INDEX[$software_id]=5 - aSOFTWARE_TYPE[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='Iperf' + aSOFTWARE_WHIP_DESC[$software_id]='internet protocol bandwidth measuring tool' + aSOFTWARE_CATEGORY_INDEX[$software_id]=5 + aSOFTWARE_TYPE[$software_id]=1 #------------------ software_id=13 - aSOFTWARE_WHIP_NAME[$software_id]='MTR-Tiny' - aSOFTWARE_WHIP_DESC[$software_id]='full screen ncurses traceroute tool' - aSOFTWARE_CATEGORY_INDEX[$software_id]=5 - aSOFTWARE_TYPE[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='MTR-Tiny' + aSOFTWARE_WHIP_DESC[$software_id]='full screen ncurses traceroute tool' + aSOFTWARE_CATEGORY_INDEX[$software_id]=5 + aSOFTWARE_TYPE[$software_id]=1 #------------------ software_id=14 - aSOFTWARE_WHIP_NAME[$software_id]='nLoad' - aSOFTWARE_WHIP_DESC[$software_id]='realtime console network usage monitor' - aSOFTWARE_CATEGORY_INDEX[$software_id]=5 - aSOFTWARE_TYPE[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='nLoad' + aSOFTWARE_WHIP_DESC[$software_id]='realtime console network usage monitor' + aSOFTWARE_CATEGORY_INDEX[$software_id]=5 + aSOFTWARE_TYPE[$software_id]=1 #------------------ software_id=15 - aSOFTWARE_WHIP_NAME[$software_id]='tcpdump' - aSOFTWARE_WHIP_DESC[$software_id]='command-line network traffic analyzer' - aSOFTWARE_CATEGORY_INDEX[$software_id]=5 - aSOFTWARE_TYPE[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='tcpdump' + aSOFTWARE_WHIP_DESC[$software_id]='command-line network traffic analyzer' + aSOFTWARE_CATEGORY_INDEX[$software_id]=5 + aSOFTWARE_TYPE[$software_id]=1 #------------------ software_id=152 - aSOFTWARE_WHIP_NAME[$software_id]='Avahi-Daemon' - aSOFTWARE_WHIP_DESC[$software_id]='hostname broadcast (mac, pc bonjour)' - aSOFTWARE_CATEGORY_INDEX[$software_id]=5 - aSOFTWARE_TYPE[$software_id]=1 - + aSOFTWARE_WHIP_NAME[$software_id]='Avahi-Daemon' + aSOFTWARE_WHIP_DESC[$software_id]='hostname broadcast (mac, pc bonjour)' + aSOFTWARE_CATEGORY_INDEX[$software_id]=5 + aSOFTWARE_TYPE[$software_id]=1 #Development / Programming #-------------------------------------------------------------------------------- software_id=16 - aSOFTWARE_WHIP_NAME[$software_id]='Build-Essentials' - aSOFTWARE_WHIP_DESC[$software_id]='common packages for compile' - aSOFTWARE_CATEGORY_INDEX[$software_id]=6 - aSOFTWARE_TYPE[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='Build-Essentials' + aSOFTWARE_WHIP_DESC[$software_id]='common packages for compile' + aSOFTWARE_CATEGORY_INDEX[$software_id]=6 + aSOFTWARE_TYPE[$software_id]=1 #------------------ software_id=17 - aSOFTWARE_WHIP_NAME[$software_id]='Git Client' - aSOFTWARE_WHIP_DESC[$software_id]='git clone etc' - aSOFTWARE_CATEGORY_INDEX[$software_id]=6 - aSOFTWARE_TYPE[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='Git Client' + aSOFTWARE_WHIP_DESC[$software_id]='git clone etc' + aSOFTWARE_CATEGORY_INDEX[$software_id]=6 + aSOFTWARE_TYPE[$software_id]=1 #------------------ software_id=170 - aSOFTWARE_WHIP_NAME[$software_id]='Unrar' - aSOFTWARE_WHIP_DESC[$software_id]='unarchiver for .rar files' - aSOFTWARE_CATEGORY_INDEX[$software_id]=6 - aSOFTWARE_TYPE[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='Unrar' + aSOFTWARE_WHIP_DESC[$software_id]='unarchiver for .rar files' + aSOFTWARE_CATEGORY_INDEX[$software_id]=6 + aSOFTWARE_TYPE[$software_id]=1 #------------------ #Text Editors #-------------------------------------------------------------------------------- software_id=18 - aSOFTWARE_WHIP_NAME[$software_id]='Emacs' - aSOFTWARE_WHIP_DESC[$software_id]='gnu emacs editor' - aSOFTWARE_CATEGORY_INDEX[$software_id]=7 - aSOFTWARE_TYPE[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='Emacs' + aSOFTWARE_WHIP_DESC[$software_id]='gnu emacs editor' + aSOFTWARE_CATEGORY_INDEX[$software_id]=7 + aSOFTWARE_TYPE[$software_id]=1 #------------------ software_id=19 - aSOFTWARE_WHIP_NAME[$software_id]='Jed' - aSOFTWARE_WHIP_DESC[$software_id]='editor for programmers' - aSOFTWARE_CATEGORY_INDEX[$software_id]=7 - aSOFTWARE_TYPE[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='Jed' + aSOFTWARE_WHIP_DESC[$software_id]='editor for programmers' + aSOFTWARE_CATEGORY_INDEX[$software_id]=7 + aSOFTWARE_TYPE[$software_id]=1 #------------------ software_id=20 - aSOFTWARE_WHIP_NAME[$software_id]='Vim' - aSOFTWARE_WHIP_DESC[$software_id]='vi enhanced text editor' - aSOFTWARE_CATEGORY_INDEX[$software_id]=7 - aSOFTWARE_TYPE[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='Vim' + aSOFTWARE_WHIP_DESC[$software_id]='vi enhanced text editor' + aSOFTWARE_CATEGORY_INDEX[$software_id]=7 + aSOFTWARE_TYPE[$software_id]=1 #------------------ software_id=21 - aSOFTWARE_WHIP_NAME[$software_id]='Vim-Tiny' - aSOFTWARE_WHIP_DESC[$software_id]='compact release of vim' - aSOFTWARE_CATEGORY_INDEX[$software_id]=7 - aSOFTWARE_TYPE[$software_id]=1 + aSOFTWARE_WHIP_NAME[$software_id]='Vim-Tiny' + aSOFTWARE_WHIP_DESC[$software_id]='compact release of vim' + aSOFTWARE_CATEGORY_INDEX[$software_id]=7 + aSOFTWARE_TYPE[$software_id]=1 #------------------ software_id=127 - aSOFTWARE_WHIP_NAME[$software_id]='NeoVim' - aSOFTWARE_WHIP_DESC[$software_id]='heavily refactored vim fork' - aSOFTWARE_CATEGORY_INDEX[$software_id]=7 - aSOFTWARE_TYPE[$software_id]=1 - - # - Stretch only - for ((i=3; i<=$MAX_G_DISTRO; i++)) - do - - aSOFTWARE_AVAIL_G_DISTRO[$software_id,$G_DISTRO]=0 - - done - aSOFTWARE_AVAIL_G_DISTRO[$software_id,4]=1 + aSOFTWARE_WHIP_NAME[$software_id]='NeoVim' + aSOFTWARE_WHIP_DESC[$software_id]='heavily refactored vim fork' + aSOFTWARE_CATEGORY_INDEX[$software_id]=7 + aSOFTWARE_TYPE[$software_id]=1 + # - Jessie + aSOFTWARE_AVAIL_G_DISTRO[$software_id,3]=0 #------------------ #Desktop Utilities #-------------------------------------------------------------------------------- software_id=22 - aSOFTWARE_WHIP_NAME[$software_id]='QuiteRSS' - aSOFTWARE_WHIP_DESC[$software_id]='cross-platform, free rss reader' - aSOFTWARE_CATEGORY_INDEX[$software_id]=8 - aSOFTWARE_TYPE[$software_id]=1 - aSOFTWARE_REQUIRES_DESKTOP[$software_id]=1 - + aSOFTWARE_WHIP_NAME[$software_id]='QuiteRSS' + aSOFTWARE_WHIP_DESC[$software_id]='cross-platform, free rss reader' + aSOFTWARE_CATEGORY_INDEX[$software_id]=8 + aSOFTWARE_TYPE[$software_id]=1 + aSOFTWARE_REQUIRES_DESKTOP[$software_id]=1 #------------------ #-------------------------------------------------------------------------------- @@ -2351,27 +2310,27 @@ _EOF_ #-------------------------------------------------------------------------------- software_id=101 - aSOFTWARE_WHIP_NAME[$software_id]='Log Rotate' - aSOFTWARE_WHIP_DESC[$software_id]='rotates log files' - aSOFTWARE_CATEGORY_INDEX[$software_id]=0 - aSOFTWARE_TYPE[$software_id]=-1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=68#p68' + aSOFTWARE_WHIP_NAME[$software_id]='Log Rotate' + aSOFTWARE_WHIP_DESC[$software_id]='rotates log files' + aSOFTWARE_CATEGORY_INDEX[$software_id]=0 + aSOFTWARE_TYPE[$software_id]=-1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=68#p68' #------------------ software_id=102 - aSOFTWARE_WHIP_NAME[$software_id]='Rsyslog' - aSOFTWARE_WHIP_DESC[$software_id]='system logging' - aSOFTWARE_CATEGORY_INDEX[$software_id]=0 - aSOFTWARE_TYPE[$software_id]=-1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=68#p68' + aSOFTWARE_WHIP_NAME[$software_id]='Rsyslog' + aSOFTWARE_WHIP_DESC[$software_id]='system logging' + aSOFTWARE_CATEGORY_INDEX[$software_id]=0 + aSOFTWARE_TYPE[$software_id]=-1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=68#p68' #------------------ software_id=103 - aSOFTWARE_WHIP_NAME[$software_id]='DietPi-RAMlog' - aSOFTWARE_WHIP_DESC[$software_id]='minimal, optimized logging' - aSOFTWARE_CATEGORY_INDEX[$software_id]=0 - aSOFTWARE_TYPE[$software_id]=-1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=68#p68' + aSOFTWARE_WHIP_NAME[$software_id]='DietPi-RAMlog' + aSOFTWARE_WHIP_DESC[$software_id]='minimal, optimised logging' + aSOFTWARE_CATEGORY_INDEX[$software_id]=0 + aSOFTWARE_TYPE[$software_id]=-1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=68#p68' #------------------ #-------------------------------------------------------------------------------- @@ -2379,19 +2338,19 @@ _EOF_ #-------------------------------------------------------------------------------- software_id=104 - aSOFTWARE_WHIP_NAME[$software_id]='Dropbear' - aSOFTWARE_WHIP_DESC[$software_id]='lightweight ssh server' - aSOFTWARE_CATEGORY_INDEX[$software_id]=0 - aSOFTWARE_TYPE[$software_id]=-1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=62#p62' + aSOFTWARE_WHIP_NAME[$software_id]='Dropbear' + aSOFTWARE_WHIP_DESC[$software_id]='lightweight ssh server' + aSOFTWARE_CATEGORY_INDEX[$software_id]=0 + aSOFTWARE_TYPE[$software_id]=-1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=62#p62' #------------------ software_id=105 - aSOFTWARE_WHIP_NAME[$software_id]='OpenSSH Server' - aSOFTWARE_WHIP_DESC[$software_id]='feature rich ssh server' - aSOFTWARE_CATEGORY_INDEX[$software_id]=0 - aSOFTWARE_TYPE[$software_id]=-1 - aSOFTWARE_ONLINEDOC_URL[$software_id]='p=63#p63' + aSOFTWARE_WHIP_NAME[$software_id]='OpenSSH Server' + aSOFTWARE_WHIP_DESC[$software_id]='feature rich ssh server' + aSOFTWARE_CATEGORY_INDEX[$software_id]=0 + aSOFTWARE_TYPE[$software_id]=-1 + aSOFTWARE_ONLINEDOC_URL[$software_id]='p=63#p63' #------------------ #-------------------------------------------------------------------------------- @@ -2407,7 +2366,7 @@ _EOF_ aSOFTWARE_INSTALL_STATE[104]=2 # Dropbear #-------------------------------------------------------------------------------- - G_DIETPI-NOTIFY 0 'Initialized database' + G_DIETPI-NOTIFY 0 'Initialised database' } @@ -2434,16 +2393,16 @@ _EOF_ } - #Work out which additional software we need to install + # Work out which additional software we need to install # - We do reinstall =2 marked software as well, just to be sure. Install_Flag_Prereq_Software(){ - G_DIETPI-NOTIFY 3 "$G_PROGRAM_NAME" "Checking for prerequisite software" + G_DIETPI-NOTIFY 3 "$G_PROGRAM_NAME" 'Checking for prerequisite software' local software_id=-1 #------------------------------------------------------------------------- - #Pre-req software, for items that do not have their own array aSOFTWARE_REQUIRES_SOFTWARENAME + # Pre-req software, for items that do NOT have their own array aSOFTWARE_REQUIRES_SOFTWARENAME #Nextcloud extensions # Nextcloud Talk @@ -2456,6 +2415,15 @@ _EOF_ fi + #Tor Hotspot requires WiFi Hotspot + software_id=60 + if (( ${aSOFTWARE_INSTALL_STATE[61]} == 1 )); then + + aSOFTWARE_INSTALL_STATE[$software_id]=1 + G_DIETPI-NOTIFY 2 "${aSOFTWARE_WHIP_NAME[$software_id]} will be installed" + + fi + #Additional software that requires VNC4server # XRDP: https://github.com/MichaIng/DietPi/issues/1727 software_id=28 @@ -2481,16 +2449,9 @@ _EOF_ aSOFTWARE_INSTALL_STATE[36]=1 # Squeezelite aSOFTWARE_INSTALL_STATE[37]=1 # Shairport Sync - - # if (( $G_HW_MODEL == 70 )); then - - # aSOFTWARE_INSTALL_STATE[60]=1 # WiFi Hotspot - - # fi - + #(( $G_HW_MODEL == 70 )) && aSOFTWARE_INSTALL_STATE[60]=1 # WiFi Hotspot aSOFTWARE_INSTALL_STATE[65]=1 # Netdata aSOFTWARE_INSTALL_STATE[96]=1 # Samba - aSOFTWARE_INSTALL_STATE[121]=1 # Roon Bridge aSOFTWARE_INSTALL_STATE[124]=1 # NAA Daemon #aSOFTWARE_INSTALL_STATE[128]=1 # MPD (pulled in by O!MPD) @@ -2518,32 +2479,35 @@ _EOF_ ${aSOFTWARE_INSTALL_STATE[163]} == 1 )); then aSOFTWARE_INSTALL_STATE[$software_id]=1 - - #aSOFTWARE_WHIP_NAME G_DIETPI-NOTIFY 2 "${aSOFTWARE_WHIP_NAME[$software_id]} will be installed" fi - #Software that requires LibSSL1.0.0 - software_id=126 - if (( ${aSOFTWARE_INSTALL_STATE[37]} == 1 || - ${aSOFTWARE_INSTALL_STATE[60]} == 1 || - ${aSOFTWARE_INSTALL_STATE[97]} == 1 || - ${aSOFTWARE_INSTALL_STATE[134]} == 1 )); then + #Software that requires LibSSL1.0.0, Stretch+ only + if (( $G_DISTRO > 3 )); then - aSOFTWARE_INSTALL_STATE[$software_id]=1 + # Jackett (147) + software_id=126 + if (( ${aSOFTWARE_INSTALL_STATE[37]} == 1 || + ${aSOFTWARE_INSTALL_STATE[60]} == 1 || + ${aSOFTWARE_INSTALL_STATE[97]} == 1 || + ${aSOFTWARE_INSTALL_STATE[134]} == 1 || + ${aSOFTWARE_INSTALL_STATE[147]} == 1 )); then - #aSOFTWARE_WHIP_NAME - G_DIETPI-NOTIFY 2 "${aSOFTWARE_WHIP_NAME[$software_id]} will be installed" + aSOFTWARE_INSTALL_STATE[$software_id]=1 + G_DIETPI-NOTIFY 2 "${aSOFTWARE_WHIP_NAME[$software_id]} will be installed" + + fi fi #Software that requires Mono + # Jackett (147) on ARMv6: https://github.com/Jackett/Jackett#installation-on-linux-armv6-or-below software_id=150 if (( ${aSOFTWARE_INSTALL_STATE[106]} == 1 || ${aSOFTWARE_INSTALL_STATE[144]} == 1 || ${aSOFTWARE_INSTALL_STATE[145]} == 1 || - ${aSOFTWARE_INSTALL_STATE[147]} == 1 )); then + ( ${aSOFTWARE_INSTALL_STATE[147]} == 1 && $G_HW_ARCH == 1 ) )); then aSOFTWARE_INSTALL_STATE[$software_id]=1 G_DIETPI-NOTIFY 2 "${aSOFTWARE_WHIP_NAME[$software_id]} will be installed" @@ -2560,6 +2524,8 @@ _EOF_ fi #Software that requires Python-Pip: https://github.com/MichaIng/DietPi/issues/784 + # OctoPrint (153) + # HTPC Manager (155) software_id=130 if (( ${aSOFTWARE_INSTALL_STATE[99]} == 1 || ${aSOFTWARE_INSTALL_STATE[118]} == 1 || @@ -2567,6 +2533,7 @@ _EOF_ ${aSOFTWARE_INSTALL_STATE[139]} == 1 || ${aSOFTWARE_INSTALL_STATE[142]} == 1 || ${aSOFTWARE_INSTALL_STATE[153]} == 1 || + ${aSOFTWARE_INSTALL_STATE[155]} == 1 || ${aSOFTWARE_INSTALL_STATE[169]} == 1 )); then aSOFTWARE_INSTALL_STATE[$software_id]=1 @@ -2617,9 +2584,9 @@ _EOF_ fi #------------------------------------------------------------------------- - #WEBSERVER - Manual stack install + # WEBSERVER - Manual stack install # - Define extra DietPi install flags for WEBSERVER_STACKS - #LLMP + # LLMP if (( ${aSOFTWARE_INSTALL_STATE[82]} == 1 )); then aSOFTWARE_INSTALL_STATE[84]=1 @@ -2628,7 +2595,7 @@ _EOF_ fi - #LLSP + # LLSP if (( ${aSOFTWARE_INSTALL_STATE[81]} == 1 )); then aSOFTWARE_INSTALL_STATE[84]=1 @@ -2637,7 +2604,7 @@ _EOF_ fi - #LEMP + # LEMP if (( ${aSOFTWARE_INSTALL_STATE[79]} == 1 )); then aSOFTWARE_INSTALL_STATE[85]=1 @@ -2646,7 +2613,7 @@ _EOF_ fi - #LESP + # LESP if (( ${aSOFTWARE_INSTALL_STATE[78]} == 1 )); then aSOFTWARE_INSTALL_STATE[85]=1 @@ -2655,7 +2622,7 @@ _EOF_ fi - #LAMP + # LAMP if (( ${aSOFTWARE_INSTALL_STATE[76]} == 1 )); then aSOFTWARE_INSTALL_STATE[83]=1 @@ -2664,7 +2631,7 @@ _EOF_ fi - #LASP + # LASP if (( ${aSOFTWARE_INSTALL_STATE[75]} == 1 )); then aSOFTWARE_INSTALL_STATE[83]=1 @@ -2674,15 +2641,15 @@ _EOF_ fi #------------------------------------------------------------------------- - #Pre-req software, for items that do DO have their own array aSOFTWARE_REQUIRES_SOFTWARENAME + # Pre-req software, for items that DO have their own array aSOFTWARE_REQUIRES_SOFTWARENAME for i in ${!aSOFTWARE_INSTALL_STATE[@]} do (( ${aSOFTWARE_INSTALL_STATE[$i]} != 1 )) && continue - #WEBSERVER - Auto install via choice system - # - Check for existing webserver base (Apache2,Nginx,Lighttpd) installation + # WEBSERVER - Auto install via choice system + # - Check for existing webserver base (Apache2, Nginx, Lighttpd) installation if (( ${aSOFTWARE_REQUIRES_WEBSERVER[$i]:=0} && ${aSOFTWARE_INSTALL_STATE[83]} < 1 && ${aSOFTWARE_INSTALL_STATE[84]} < 1 && @@ -2691,19 +2658,19 @@ _EOF_ # - None found, select one for install, based on user preference if (( $INDEX_WEBSERVER_TARGET == 0 )); then - #WEBSERVER_APACHE + # WEBSERVER_APACHE aSOFTWARE_INSTALL_STATE[83]=1 G_DIETPI-NOTIFY 2 'Apache2 will be installed' elif (( $INDEX_WEBSERVER_TARGET == -1 )); then - #WEBSERVER_NGINX + # WEBSERVER_NGINX aSOFTWARE_INSTALL_STATE[85]=1 G_DIETPI-NOTIFY 2 'Nginx will be installed' else - #WEBSERVER_LIGHTTPD + # WEBSERVER_LIGHTTPD aSOFTWARE_INSTALL_STATE[84]=1 G_DIETPI-NOTIFY 2 'Lighttpd will be installed' @@ -2714,7 +2681,7 @@ _EOF_ fi - #WEBSERVER_PHP + # WEBSERVER_PHP software_id=89 if (( ${aSOFTWARE_REQUIRES_PHP[$i]:=0} && aSOFTWARE_INSTALL_STATE[$software_id] != 1 )); then @@ -2723,7 +2690,7 @@ _EOF_ fi - #WEBSERVER_MARIADB + # WEBSERVER_MARIADB software_id=88 if (( ${aSOFTWARE_REQUIRES_MYSQL[$i]:=0} && aSOFTWARE_INSTALL_STATE[$software_id] != 1 )); then @@ -2732,21 +2699,22 @@ _EOF_ fi - #WEBSERVER_SQLITE + # WEBSERVER_SQLITE software_id=87 if (( ${aSOFTWARE_REQUIRES_SQLITE[$i]:=0} && aSOFTWARE_INSTALL_STATE[$software_id] != 1 )); then aSOFTWARE_INSTALL_STATE[$software_id]=1 - G_DIETPI-NOTIFY 2 'SQlite will be installed' + G_DIETPI-NOTIFY 2 "${aSOFTWARE_WHIP_NAME[$software_id]} will be installed" fi - #DESKTOP + # DESKTOP if (( ${aSOFTWARE_REQUIRES_DESKTOP[$i]:=0} && ${aSOFTWARE_INSTALL_STATE[23]} < 1 && ${aSOFTWARE_INSTALL_STATE[24]} < 1 && ${aSOFTWARE_INSTALL_STATE[25]} < 1 && - ${aSOFTWARE_INSTALL_STATE[26]} < 1)); then + ${aSOFTWARE_INSTALL_STATE[26]} < 1 && + ${aSOFTWARE_INSTALL_STATE[173]} < 1 )); then # - If no desktop is selected or installed (0), default to LXDE aSOFTWARE_INSTALL_STATE[23]=1 @@ -2757,7 +2725,7 @@ _EOF_ fi - #GIT + # GIT software_id=17 if (( ${aSOFTWARE_REQUIRES_GIT[$i]:=0} && aSOFTWARE_INSTALL_STATE[$software_id] != 1 )); then @@ -2765,7 +2733,7 @@ _EOF_ G_DIETPI-NOTIFY 2 "${aSOFTWARE_WHIP_NAME[$software_id]} will be installed" fi - #BUILDESSENTIAL + # BUILDESSENTIAL software_id=16 if (( ${aSOFTWARE_REQUIRES_BUILDESSENTIAL[$i]:=0} && aSOFTWARE_INSTALL_STATE[$software_id] != 1 )); then @@ -2774,7 +2742,7 @@ _EOF_ fi - #RSYSLOG + # RSYSLOG software_id=102 if (( ${aSOFTWARE_REQUIRES_RSYSLOG[$i]:=0} && aSOFTWARE_INSTALL_STATE[$software_id] != 1 )); then @@ -2782,7 +2750,7 @@ _EOF_ G_DIETPI-NOTIFY 2 "${aSOFTWARE_WHIP_NAME[$software_id]} will be installed" fi - #FFMPEG + # FFMPEG software_id=7 if (( ${aSOFTWARE_REQUIRES_FFMPEG[$i]:=0} && aSOFTWARE_INSTALL_STATE[$software_id] != 1 )); then @@ -2791,7 +2759,7 @@ _EOF_ fi - #ORACLEJAVA + # JAVA software_id=8 if (( ${aSOFTWARE_REQUIRES_JAVA_JRE_JDK[$i]:=0} && aSOFTWARE_INSTALL_STATE[$software_id] != 1 )); then @@ -2800,7 +2768,7 @@ _EOF_ fi - #NODEJS + # NODEJS software_id=9 if (( ${aSOFTWARE_REQUIRES_NODEJS[$i]:=0} && aSOFTWARE_INSTALL_STATE[$software_id] != 1 )); then @@ -2809,7 +2777,7 @@ _EOF_ fi - #ALSA + # ALSA software_id=5 if (( ${aSOFTWARE_REQUIRES_ALSA[$i]:=0} && aSOFTWARE_INSTALL_STATE[$software_id] != 1 )); then @@ -2818,7 +2786,7 @@ _EOF_ fi - #XSERVERXORG + # XSERVERXORG software_id=6 if (( ${aSOFTWARE_REQUIRES_XSERVERXORG[$i]:=0} && aSOFTWARE_INSTALL_STATE[$software_id] != 1 )); then @@ -2829,66 +2797,61 @@ _EOF_ done - #WEBSERVER - Check for stacks and flag as installing - #WEBSERVER_APACHE + # WEBSERVER - Check for stacks and flag as installing + # WEBSERVER_APACHE if (( ${aSOFTWARE_INSTALL_STATE[83]} > 0 )); then - #SQLite - if (( ${aSOFTWARE_INSTALL_STATE[87]} > 0 )); then - - #WEBSERVER_LASP - aSOFTWARE_INSTALL_STATE[75]=1 - - fi - - #MariaDB - if (( ${aSOFTWARE_INSTALL_STATE[88]} > 0 )); then - - #WEBSERVER_LAMP - aSOFTWARE_INSTALL_STATE[76]=1 - - fi + # SQLite: LASP + (( ${aSOFTWARE_INSTALL_STATE[87]} > 0 )) && aSOFTWARE_INSTALL_STATE[75]=1 + # MariaDB: LAMP + (( ${aSOFTWARE_INSTALL_STATE[88]} > 0 )) && aSOFTWARE_INSTALL_STATE[76]=1 - #WEBSERVER_NGINX + # WEBSERVER_NGINX elif (( ${aSOFTWARE_INSTALL_STATE[85]} > 0 )); then - #SQLite - if (( ${aSOFTWARE_INSTALL_STATE[87]} > 0 )); then + # SQLite: LESP + (( ${aSOFTWARE_INSTALL_STATE[87]} > 0 )) && aSOFTWARE_INSTALL_STATE[78]=1 - #WEBSERVER_LESP - aSOFTWARE_INSTALL_STATE[78]=1 + # MariaDB: LEMP + (( ${aSOFTWARE_INSTALL_STATE[88]} > 0 )) && aSOFTWARE_INSTALL_STATE[79]=1 - fi + # WEBSERVER_LIGHTTPD + elif (( ${aSOFTWARE_INSTALL_STATE[84]} > 0 )); then - #MariaDB - if (( ${aSOFTWARE_INSTALL_STATE[88]} > 0 )); then + # SQLite: LLSP + (( ${aSOFTWARE_INSTALL_STATE[87]} > 0 )) && aSOFTWARE_INSTALL_STATE[81]=1 - #WEBSERVER_LEMP - aSOFTWARE_INSTALL_STATE[79]=1 + # MariaDB: LLMP + (( ${aSOFTWARE_INSTALL_STATE[88]} > 0 )) && aSOFTWARE_INSTALL_STATE[82]=1 - fi + fi - #WEBSERVER_LIGHTTPD - elif (( ${aSOFTWARE_INSTALL_STATE[84]} > 0 )); then + # Update PHP variables after all software titles have been marked. + if (( ${aSOFTWARE_INSTALL_STATE[89]} > 0 )); then - #SQLite - if (( ${aSOFTWARE_INSTALL_STATE[87]} > 0 )); then + # ownCloud (up to v10.2) does not yet support PHP7.3, so install PHP7.2 for now + if (( ${aSOFTWARE_INSTALL_STATE[47]} > 0 )) || [[ -f '/var/www/owncloud/version.php' ]]; then - #WEBSERVER_LLSP - aSOFTWARE_INSTALL_STATE[81]=1 + FP_PHP_BASE_DIR='/etc/php/7.2' + PHP_NAME='php7.2' + # - Prevent accidental PHP7.3 installs + echo -e '# ownCloud does not yet support PHP7.3 +Package: *php7.3*\nPin: release *\nPin-Priority: -1' > /etc/apt/preferences.d/dietpi-owncloud fi - #MariaDB - if (( ${aSOFTWARE_INSTALL_STATE[88]} > 0 )); then + # phpBB3 (up to v3.2) as well: https://github.com/phpbb/phpbb/blob/3.2.x/phpBB/install/app.php#L23 + if (( ${aSOFTWARE_INSTALL_STATE[54]} > 0 )) || [[ -f '/var/www/phpBB3/config.php' ]]; then - #WEBSERVER_LLMP - aSOFTWARE_INSTALL_STATE[82]=1 + FP_PHP_BASE_DIR='/etc/php/7.2' + PHP_NAME='php7.2' + # - Prevent accidental PHP7.3 installs + echo -e '# phpBB does not yet support PHP7.3 +Package: *php7.3*\nPin: release *\nPin-Priority: -1' > /etc/apt/preferences.d/dietpi-phpbb fi - fi } @@ -2927,16 +2890,16 @@ _EOF_ ) - for (( i=0; i<${#adesktop_items[@]}; i++)) + for i in ${adesktop_items[@]} do - G_THREAD_START wget https://raw.githubusercontent.com/MichaIng/DietPi/$G_GITBRANCH/.conf/desktop/apps/${adesktop_items[$i]} -O /usr/share/applications/${adesktop_items[$i]} + G_THREAD_START wget https://raw.githubusercontent.com/MichaIng/DietPi/$G_GITBRANCH/.conf/desktop/apps/$i -O /usr/share/applications/$i done unset adesktop_items - # - icons + # - Icons G_THREAD_START wget https://raw.githubusercontent.com/MichaIng/DietPi/$G_GITBRANCH/.conf/desktop/icons/dietpi-icon.png -O /var/lib/dietpi/dietpi-software/installed/desktop/icons/dietpi-icon.png G_THREAD_START wget https://raw.githubusercontent.com/MichaIng/DietPi/$G_GITBRANCH/.conf/desktop/icons/grey_16x16.png -O /var/lib/dietpi/dietpi-software/installed/desktop/icons/grey_16x16.png G_THREAD_START wget https://raw.githubusercontent.com/MichaIng/DietPi/$G_GITBRANCH/.conf/desktop/icons/kodi-icon.png -O /var/lib/dietpi/dietpi-software/installed/desktop/icons/kodi-icon.png @@ -2971,7 +2934,6 @@ _EOF_ if [[ ! -f $G_FP_DIETPI_USERDATA/$FOLDER_MUSIC/fourdee_tech.ogg ]]; then - #Grab My test music wget https://dietpi.com/downloads/audio/fourdee_tech.ogg -O $G_FP_DIETPI_USERDATA/$FOLDER_MUSIC/fourdee_tech.ogg #wget https://dietpi.com/downloads/audio/fourdee_space.mp3 -O $G_FP_DIETPI_USERDATA/$FOLDER_MUSIC/fourdee_space.mp3 @@ -2979,8 +2941,8 @@ _EOF_ } - #Return optimization values for BitTorrent servers based on device and hardware capabilities. - Optimize_BitTorrent(){ + # Return optimisation values for BitTorrent servers based on device and hardware capabilities. + Optimise_BitTorrent(){ local output=0 @@ -2992,12 +2954,12 @@ _EOF_ fi - #Cache size (MB) 1/10th of total mem + # Cache size (MB) 1/10th of total mem if (( $1 == 0 )); then output=$(( $RAM_TOTAL / 10 )) - #Max active downloads + # Max active downloads elif (( $1 == 1 )); then output=2 @@ -3005,7 +2967,7 @@ _EOF_ # - Bump up for x86 (( $G_HW_ARCH == 10 )) && output=3 - #Max global connections + # Max global connections elif (( $1 == 2 )); then output=20 @@ -3015,45 +2977,45 @@ _EOF_ output=40 - # - 1Gbit SBC's + # - Gbit devices elif (( $gigabit_device )); then output=30 - # - Reduce for RPi's. This is due to the USB bus ethernet in the ARM SoC, which cripples network throughput/performance/latency. - # - RPi v3 + # - Reduce for RPi. This is due to the USB bus ethernet in the ARM SoC, which cripples network throughput/performance/latency. + # - RPi3 elif (( $G_HW_MODEL == 3 )); then output=15 - # - RPi v2 + # - RPi2 elif (( $G_HW_MODEL == 2 )); then output=13 - # - RPi v1 256/512 + # - RPi1 256/512 elif (( $G_HW_MODEL <= 1 )); then output=7 fi - #Max upload slots + # Max upload slots elif (( $1 == 3 )); then output=3 # - Bump up for x86 - if (( $G_HW_MODEL == 20 || $G_HW_MODEL == 21 )); then + if (( $G_HW_ARCH == 10 )); then output=5 - # - 1Gbit devices + # - Gbit devices elif (( $gigabit_device )); then output=4 - # - Reduce for RPi's. This is due to the USB bus ethernet in the ARM SoC, which cripples network throughput/performance/latency. + # - Reduce for RPi. This is due to the USB bus ethernet in the ARM SoC, which cripples network throughput/performance/latency. elif (( $G_HW_MODEL <= 3 )); then output=2 @@ -3066,40 +3028,40 @@ _EOF_ } - #NB: This does not support installs that require user input (eg: a whiptail prompt for deb installs) + # Usage: # Download_Install 'https://file.com/file' /etc/install_here # dps_index=$software_id Download_Install 'conf_0' /etc/conf.conf + # Optional input variables: + # fallback_url='http...' = URL to use if e.g. grabbing URL from api.github.com fails: https://dietpi.com/phpbb/viewtopic.php?p=17390#p17390 + # no_check_url=[01] = Optionally disable URL check + # dps_index=$software_id = Download from DietPi GitHub repo based on software ID/index + # DEPS_LIST='pkg1 ...' = Install APT dependency packages + # NB: This does not support installs that require user input (eg: a whiptail prompt for deb installs) Download_Install(){ - #no_check_url = Optional disable URL check local url=$1 + [[ ! $url && $fallback_url ]] && url=$fallback_url local target=$2 # Extract target - local type=${url##*.} # grab ext from URL | compatbile with >> deb|zip|tar(.gz|.bz2)|7z - if [[ $type == 'gz' || $type == 'bz2' ]]; then - - type='tar' - - fi + local type=${url##*.} # Grab ext from URL | compatbile with >> deb|zip|tar(.gz|.bz2)|7z + [[ $type == 'gz' || $type == 'bz2' ]] && type='tar' + local file="$software_id.$type" - # - DietPi-Software conf/service mode - local dps_index=${dps_index:--1} - if (( $dps_index >= 0 )); then + # DietPi-Software conf/service mode + if disable_error=1 G_CHECK_VALIDINT "$dps_index" 0; then - type=$url - url="https://raw.githubusercontent.com/MichaIng/DietPi/$G_GITBRANCH/.conf/dps_$dps_index/$type" + type='dps_index' + url="https://raw.githubusercontent.com/MichaIng/DietPi/$G_GITBRANCH/.conf/dps_$dps_index/$url" fi - local file="$software_id.$type" - (( $no_check_url )) || G_CHECK_URL "$url" - unset no_check_url cd /tmp/$G_PROGRAM_NAME - # Download file (+thread if APT pre-reqs are to be installed) + # Download file if [[ $DEPS_LIST ]]; then + # - Download as background thread if dependencies are to be installed G_THREAD_START wget "$url" -O $file G_AGI $DEPS_LIST DEPS_LIST='' @@ -3112,42 +3074,36 @@ _EOF_ fi # Process downloaded file - if (( $dps_index >= 0 )); then + if [[ $type == dps_index ]]; then - # - Precreate dir + # - Pre-create dir local fp_dir=${target%/*} - if [[ ! -d $fp_dir ]]; then - - G_RUN_CMD mkdir -p $fp_dir - - fi - - [[ -f $target ]] && G_WHIP_MSG "[INFO] Configuration/data updated for:\n - $target" + [[ -d $fp_dir ]] || G_RUN_CMD mkdir -p "$fp_dir" - G_RUN_CMD cp -f $file $target + [[ -f $target ]] && G_WHIP_MSG "[INFO] Updating file: $target" + G_RUN_CMD mv $file "$target" - elif [[ $type == deb ]]; then + elif [[ $type == 'deb' ]]; then - # Allow error on first attempt, giving APT fix a change to resolve e.g. dependencies - l_message='Installing deb package' G_USER_INPUTS=0 G_ERROR_HANDLER_INFO_ONLY=1 G_RUN_CMD dpkg -i $file + # - Allow error on first attempt, giving APT fix a change to resolve e.g. dependencies + G_USER_INPUTS=0 G_ERROR_HANDLER_INFO_ONLY=1 G_RUN_CMD dpkg --force-hold,confdef,confold -i $file (( $G_ERROR_HANDLER_EXITCODE_RETURN )) && G_DIETPI-NOTIFY 2 'Trying automated APT fix' && G_AGF - #(( $G_ERROR_HANDLER_EXITCODE_RETURN )) && error? - - elif [[ $type == zip ]]; then + elif [[ $type == 'zip' ]]; then [[ $target ]] && target="-d $target" - l_message='Unzipping archive' G_RUN_CMD unzip -o $file $target + G_RUN_CMD unzip -o $file "$target" - elif [[ $type == tar ]]; then + elif [[ $type == 'tar' ]]; then - [[ $target ]] && mkdir -p $target && target="-C $target" - l_message='Unpacking tarball' G_RUN_CMD tar xf $file $target + #[[ $target ]] && target="--one-top-level=$target" # Option exist not on Jessie + [[ $target ]] && G_RUN_CMD mkdir -p "$target" && target="-C $target" + G_RUN_CMD tar xf $file "$target" - elif [[ $type == 7z ]]; then + elif [[ $type == '7z' ]]; then [[ $target ]] && target="-o$target" - l_message='Extracting 7zip archive' G_RUN_CMD 7zr x -y $file $target + G_RUN_CMD 7zr x -y $file "$target" else @@ -3155,66 +3111,42 @@ _EOF_ fi - [[ -f $file ]] && l_message='Cleaning download directory' G_RUN_CMD rm $file + [[ -f $file ]] && G_RUN_CMD rm $file + unset fallback_url dps_index no_check_url } - #///////////////////////////////////////////////////////////////////////////////////// - # This function handles the installation of the selected software. - # - # Reference: - # - Adding new software to DietPi-Software - # https://github.com/MichaIng/DietPi/issues/490#issuecomment-244416570 - # - # Installing the software: - # ------------------------------------ - # - software_id: - # This has to be the same number as software_id for the software list above. - # - # - INSTALL_URL_ADDRESS: - # This can be used to check conectivity to items you need to download later. - # A good example would also be a git repo. - # - # - Use Download_Install() (see code above) to check URL, download and install/extract - # deb|zip|tar(.gz|.bz2)|7z sources automatically and consistent, e.g. - # Download_Install 'https://www.phpbb.com/files/release/phpBB-3.2.2.zip' /var/www - # will check the URL, download phpBB archive, extract it to /var/www(/phpBB3) - # and remove the archieve afterwards. - # - # Example: - # #------------------ Bittorrent: HTPC Manager ------------------ - # software_id=155 - # if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then - # - # Banner_Installing - # - # INSTALL_URL_ADDRESS='https://github.com/Hellowlol/HTPC-Manager.git' - # - # G_CHECK_URL "$INSTALL_URL_ADDRESS" - # - # #Install Python and PIP - # G_AGI python python-pip python-imaging - # - # cd /root - # git clone --depth=1 "$INSTALL_URL_ADDRESS" - # - # # - Move HTPC Manager to a 'better' location - # mkdir -p $G_FP_DIETPI_USERDATA/htpc-manager - # mv /root/HTPC-Manager/* $G_FP_DIETPI_USERDATA/htpc-manager/ - # rm -R /root/HTPC-Manager - # - # fi - # - #///////////////////////////////////////////////////////////////////////////////////// + # Run marked software installs Install_Dietpi_Software(){ #-------------------------------------------------------------- - #Install Software + # Install Software local software_id=-1 - #Desktop LXDE - software_id=23 + software_id=23 # Desktop LXDE + 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 lxde upower policykit-1 firefox-esr + #upower policykit-1. Needed for LXDE logout menu item to show shutdown/restart ... + + # - RPi, revert to Debian pcmanfm install package: https://github.com/MichaIng/DietPi/issues/1558#issuecomment-390328173 + if (( $G_HW_MODEL < 10 )); then + + Download_Install 'https://dietpi.com/downloads/binaries/all/pcmanfm_1.2.5-3_armhf.deb' + apt-mark hold pcmanfm + + fi + + fi + + software_id=173 # Desktop LXQt if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -3223,21 +3155,15 @@ _EOF_ INSTALL_URL_ADDRESS='https://dietpi.com/downloads/conf/desktop' G_CHECK_URL "$INSTALL_URL_ADDRESS" - G_AGI lxde upower policykit-1 firefox-esr - #upower policykit-1. Needed for LXDE logout menu item to show shutdown/restart ... - - #RPi, revert to Debian pcmanfm install package: https://github.com/MichaIng/DietPi/issues/1558#issuecomment-390328173 - if (( $G_HW_MODEL < 10 )); then - - Download_Install 'https://dietpi.com/downloads/binaries/all/pcmanfm_1.2.5-3_armhf.deb' - apt-mark hold pcmanfm + # - Buster: No leafpad available, use featherpad instead: https://github.com/MichaIng/DietPi/issues/1918#issuecomment-489319719 + local editor='leafpad' + (( $G_DISTRO > 4 )) && editor='featherpad' - fi + G_AGI lxqt qterminal firefox-esr xarchiver lxde-icon-theme upower xscreensaver $editor speedcrunch fi - #Desktop MATE - software_id=24 + software_id=24 # Desktop MATE if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -3250,8 +3176,7 @@ _EOF_ fi - #Desktop GNUStep - software_id=26 + software_id=26 # Desktop GNUStep if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -3264,8 +3189,7 @@ _EOF_ fi - #DESKTOP_XFCE - software_id=25 + software_id=25 # Desktop Xfce if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -3278,8 +3202,23 @@ _EOF_ fi - #XRDP - software_id=29 + software_id=174 # GIMP + if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then + + Banner_Installing + G_AGI gimp + + fi + + software_id=175 # XFCE4 Power + if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then + + Banner_Installing + G_AGI xfce4-power-manager + + fi + + software_id=29 # XRDP if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -3287,8 +3226,7 @@ _EOF_ fi - #NOMACHINE - software_id=30 + software_id=30 # NoMachine if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -3296,8 +3234,7 @@ _EOF_ fi - #BitTorrent Transmission - software_id=44 + software_id=44 # BitTorrent Transmission if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -3305,8 +3242,7 @@ _EOF_ fi - #ProFTPd - software_id=94 + software_id=94 # ProFTPd if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -3316,15 +3252,14 @@ _EOF_ fi - #Samba Server - software_id=96 + software_id=96 # Samba Server if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing # Link disk cache to RAM: https://github.com/MichaIng/DietPi/issues/2396 # - Remove previous disk cache dir or symlink - [[ -e /var/cache/samba ]] && rm -R /var/cache/samba + [[ -d '/var/cache/samba' || -L '/var/cache/samba' ]] && rm -R /var/cache/samba # - Pre-create RAM cache dir mkdir -p /var/run/samba-cache # - Link disk cache to RAM @@ -3336,8 +3271,7 @@ _EOF_ fi - #vsFTPD - software_id=95 + software_id=95 # vsFTPD if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -3345,8 +3279,7 @@ _EOF_ fi - #NFS_SERVER - software_id=109 + software_id=109 # NFS Server if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -3360,8 +3293,7 @@ _EOF_ fi - #WEBSERVER_APACHE - software_id=83 + software_id=83 # Apache Webserver if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -3372,8 +3304,7 @@ _EOF_ fi - #WEBSERVER_NGINX - software_id=85 + software_id=85 # Nginx Webserver if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -3384,8 +3315,7 @@ _EOF_ fi - #WEBSERVER_LIGHTTPD - software_id=84 + software_id=84 # Lighttpd Webserver if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -3394,8 +3324,7 @@ _EOF_ fi - #WEBSERVER_MARIADB - software_id=88 + software_id=88 # MariaDB Database if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -3410,7 +3339,7 @@ _EOF_ # - Remove possible dead symlinks/files: rm $G_FP_DIETPI_USERDATA/mysql &> /dev/null mkdir -p $G_FP_DIETPI_USERDATA/mysql - if [[ -d /var/lib/mysql ]]; then + if [[ -d '/var/lib/mysql' ]]; then G_DIETPI-NOTIFY 2 '/var/lib/mysql exists, will migrate containing databases' G_RUN_CMD cp -a /var/lib/mysql/. $G_FP_DIETPI_USERDATA/mysql @@ -3420,7 +3349,7 @@ _EOF_ fi G_DIETPI-NOTIFY 2 'Removing /var/lib/mysql, if existent' - [[ -L /var/lib/mysql && ! $(readlink /var/lib/mysql) =~ $G_FP_DIETPI_USERDATA/mysql ]] && + [[ -L '/var/lib/mysql' && ! $(readlink /var/lib/mysql) =~ $G_FP_DIETPI_USERDATA/mysql ]] && rm -R "$(readlink /var/lib/mysql)" &> /dev/null rm -R /var/lib/mysql &> /dev/null @@ -3430,23 +3359,11 @@ _EOF_ local package_list='mariadb-server' # Install php-mysql module, if PHP was already installed - if (( ${aSOFTWARE_INSTALL_STATE[89]} == 2 )); then - - if (( $G_DISTRO < 4 )); then - # For <= Jessie, php5-mysqlnd provides the newer mysql client libraries compared to php5-mysql. - package_list+=' php5-mysqlnd' - - else - # For >= Stretch, php(7.X)-mysqlnd does not exist, thus php-mysql need to be installed: https://packages.debian.org/de/stretch/php-mysql - package_list+=" $PHP_APT_PACKAGE_NAME-mysql" - - fi - - fi + (( ${aSOFTWARE_INSTALL_STATE[89]} == 2 )) && package_list+=" $PHP_NAME-mysql" G_AGI "$package_list" # - Remove mysql.service as we use mariadb.service, both cannot exist: https://github.com/MichaIng/DietPi/issues/1913#issuecomment-441343798 - if [[ -f /etc/init.d/mysql ]] && (( $G_DISTRO >= 4 )); then + if [[ -f '/etc/init.d/mysql' ]] && (( $G_DISTRO > 3 )); then G_DIETPI-NOTIFY 2 'Switching from /etc/init.d/mysql to mariadb.service' systemctl stop mysql @@ -3457,95 +3374,130 @@ _EOF_ fi - #WEBSERVER_SQLITE - software_id=87 + software_id=87 # SQLite Database if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing local package_list='sqlite3' # Install php-sqlite module, if PHP was already installed - (( ${aSOFTWARE_INSTALL_STATE[89]} == 2 )) && package_list+=" $PHP_APT_PACKAGE_NAME-sqlite*" + (( ${aSOFTWARE_INSTALL_STATE[89]} == 2 )) && package_list+=" $PHP_NAME-sqlite3" G_AGI "$package_list" fi - #WEBSERVER_REDIS - software_id=91 + software_id=91 # Redis Database if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing local package_list='redis-server' # Install php-redis module, if PHP was already installed - (( ${aSOFTWARE_INSTALL_STATE[89]} == 2 )) && package_list+=" $PHP_BINARY-redis" + (( ${aSOFTWARE_INSTALL_STATE[89]} == 2 )) && package_list+=" $PHP_NAME-redis" G_AGI $package_list + # Fix wrong permissions from Jessie package: https://github.com/MichaIng/DietPi/issues/2736 + # - /var/run/redis is created but on boot as well with wrong root:root permissions, so we need to fix that via ExecStartPre + if (( $G_DISTRO < 4 )); then + + mkdir -p /etc/systemd/system/redis-server.service.d + echo "[Service] +PermissionsStartOnly=true +ExecStartPre=$(command -v mkdir) -p /var/run/redis /var/lib/redis +ExecStartPre=$(command -v chown) -R redis:redis /var/run/redis /var/lib/redis" > /etc/systemd/system/redis-server.service.d/dietpi-fix_permissions.conf + systemctl daemon-reload + + fi + fi - #WEBSERVER_PHP - software_id=89 + software_id=89 # PHP if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - # Install base PHP packages/modules - # - Apache - if (( ${aSOFTWARE_INSTALL_STATE[83]} >= 1 )); then + # Jessie + Stretch: Add Ondrejs PHP repository for latest PHP version (currently PHP7.3) + if (( $G_DISTRO < 5 )); then - local package_list="libapache2-mod-$PHP_APT_PACKAGE_NAME" + # Jessie: https://github.com/MichaIng/DietPi/issues/1620#issuecomment-373086888 + if (( $G_DISTRO < 4 )); then - # - Lighttpd or Nginx - elif (( ${aSOFTWARE_INSTALL_STATE[84]} >= 1 || ${aSOFTWARE_INSTALL_STATE[85]} >= 1 )); then + INSTALL_URL_ADDRESS='https://dietpi.com/downloads/binaries/all/libssl1.1_1.1.0f-3+deb9u1_' - local package_list="$PHP_APT_PACKAGE_NAME-fpm" + # - ARMv7 + if (( $G_HW_ARCH < 3 )); then - # - No webserver, /usr/bin/php cmd usage - else + INSTALL_URL_ADDRESS+='armhf.deb' - local package_list="$PHP_APT_PACKAGE_NAME-cli" + # - ARM64 + elif (( $G_HW_ARCH == 3 )); then - fi + INSTALL_URL_ADDRESS+='arm64.deb' - # php-common modules, used by most web software - package_list+=" $PHP_APT_PACKAGE_NAME-curl $PHP_APT_PACKAGE_NAME-gd $PHP_BINARY-apcu" + # - x86_64 + elif (( $G_HW_ARCH == 10 )); then - # + Stretch extras - (( $G_DISTRO > 3 )) && package_list+=" $PHP_APT_PACKAGE_NAME-mbstring $PHP_APT_PACKAGE_NAME-opcache $PHP_APT_PACKAGE_NAME-zip $PHP_APT_PACKAGE_NAME-xml" + INSTALL_URL_ADDRESS+='amd64.deb' - # PHP7.2/Buster dropped support for mcrypt: https://liorkaplan.wordpress.com/2017/09/10/php-7-2-is-coming-mcrypt-extension-isnt/ - (( $G_DISTRO < 5 )) && package_list+=" $PHP_APT_PACKAGE_NAME-mcrypt" + fi - # MySQL/MariaDB php module - if (( ${aSOFTWARE_INSTALL_STATE[88]} >= 1 )); then + Download_Install "$INSTALL_URL_ADDRESS" - if (( $G_DISTRO < 4 )); then - # For <= Jessie, php5-mysqlnd provides the newer mysql client libraries compared to php5-mysql. - package_list+=' php5-mysqlnd' + fi - else - # For >= Stretch, php(7.X)-mysqlnd does not exist, thus php-mysql need to be installed: https://packages.debian.org/de/stretch/php-mysql - package_list+=" $PHP_APT_PACKAGE_NAME-mysql" + # - Check URL + 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 - + # - 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 Jessie and Stretch: https://github.com/MichaIng/DietPi/issues/2734 + echo -e '# libssl1.1 from sury.org breaks Lighttpd install +Package: openssl libssl1.1\nPin: origin packages.sury.org\nPin-Priority: -1' > /etc/apt/preferences.d/dietpi-openssl + # - APT list update + G_AGUP - fi + fi + + # Base PHP modules + # - Apache + if (( ${aSOFTWARE_INSTALL_STATE[83]} > 0 )); then + + local package_list="libapache2-mod-$PHP_NAME" + + # - Lighttpd or Nginx + elif (( ${aSOFTWARE_INSTALL_STATE[84]} > 0 || ${aSOFTWARE_INSTALL_STATE[85]} > 0 )); then + + local package_list="$PHP_NAME-fpm" + + # - No webserver, /usr/bin/php cmd usage + else + + local package_list="$PHP_NAME-cli" fi - # SQLite php module - (( ${aSOFTWARE_INSTALL_STATE[87]} >= 1 )) && package_list+=" $PHP_APT_PACKAGE_NAME-sqlite*" # Wildcard for version (eg:3) + # Additional PHP modules, commonly used by most web applications + package_list+=" $PHP_NAME-apcu $PHP_NAME-curl $PHP_NAME-gd $PHP_NAME-mbstring $PHP_NAME-xml $PHP_NAME-zip" + + # MySQL/MariaDB PHP module + (( ${aSOFTWARE_INSTALL_STATE[88]} > 0 )) && package_list+=" $PHP_NAME-mysql" - # Redis php module - (( ${aSOFTWARE_INSTALL_STATE[91]} >= 1 )) && package_list+=" $PHP_BINARY-redis" + # SQLite PHP module + (( ${aSOFTWARE_INSTALL_STATE[87]} > 0 )) && package_list+=" $PHP_NAME-sqlite3" + + # Redis PHP module + (( ${aSOFTWARE_INSTALL_STATE[91]} > 0 )) && package_list+=" $PHP_NAME-redis" G_AGI $package_list fi - #WEBSERVER_MYADMINPHP - software_id=90 + software_id=90 # phpMyAdmin if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - #MySQL must be running during install to allow debconf setup. + # MariaDB must be running during install to allow debconf setup. G_RUN_CMD systemctl start $MARIADB_SERVICE # Set password parameters before installing @@ -3575,21 +3527,20 @@ We work around this error by running APT a second time. Please do not worry and fi - #MPD - software_id=128 + software_id=128 # MPD if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - #Jessie- + # Jessie- if (( $G_DISTRO < 4 )); then # MPD not available in Jessie repo for ARMv8 if (( $G_HW_ARCH == 3 )); then # libupnp6 for net discov with upnp/avahi - DEPS_LIST='libupnp6 libwrap0 libmpdclient2 libao-common libao4 libasound2 libasound2-data libasyncns0 libaudiofile1 libavahi-client3 libavahi-common-data libavahi-common3 libavcodec56 libavformat56 libavresample2 libavutil54 libbinio1ldbl libcaca0 libcdio-cdda1 libcdio-paranoia1 libcdio13 libcups2 libcurl3-gnutls libdirectfb-1.2-9 libdnet libfaad2 libflac8 libfluidsynth1 libgme0 libgomp1 libgsm1 libice6 libid3tag0 libiso9660-8 libjack-jackd2-0 libjson-c2 libldb1 libmad0 libmikmod3 libmms0 libmodplug1 libmp3lame0 libmpcdec6 libmpg123-0 libnfs4 libntdb1 libogg0 libopenal-data libopenal1 libopenjpeg5 libopus0 liborc-0.4-0 libpulse0 libresid-builder0c2a libroar2 libsamplerate0 libschroedinger-1.0-0 libsdl1.2debian libshout3 libsidplay2 libsidutils0 libslp1 libsm6 libsmbclient libsndfile1 libsoxr0 libspeex1 libspeexdsp1 libsqlite3-0 libtalloc2 libtdb1 libtevent0 libtheora0 libva1 libvorbis0a libvorbisenc2 libvorbisfile3 libvpx1 libwavpack1 libwbclient0 libwildmidi-config libwildmidi1 libx11-6 libx11-data libx11-xcb1 libx264-142 libxau6 libxcb1 libxdmcp6 libxext6 libxi6 libxtst6 libxvidcore4 libyajl2 libzzip-0-13 mime-support python python-talloc python2.7 samba-libs x11-common file' - Download_Install 'https://dietpi.com/downloads/binaries/all/mpd_0.20.18-1_armv8.deb' + DEPS_LIST='libupnp6 libwrap0 libmpdclient2 libao-common libao4 libasyncns0 libaudiofile1 libavahi-client3 libavahi-common-data libavahi-common3 libavcodec56 libavformat56 libavresample2 libavutil54 libbinio1ldbl libcaca0 libcdio-cdda1 libcdio-paranoia1 libcdio13 libcups2 libcurl3-gnutls libdirectfb-1.2-9 libdnet libfaad2 libflac8 libfluidsynth1 libgme0 libgomp1 libgsm1 libice6 libid3tag0 libiso9660-8 libjack-jackd2-0 libjson-c2 libldb1 libmad0 libmikmod3 libmms0 libmodplug1 libmp3lame0 libmpcdec6 libmpg123-0 libnfs4 libntdb1 libogg0 libopenal-data libopenal1 libopenjpeg5 libopus0 liborc-0.4-0 libpulse0 libresid-builder0c2a libroar2 libsamplerate0 libschroedinger-1.0-0 libsdl1.2debian libshout3 libsidplay2 libsidutils0 libslp1 libsm6 libsmbclient libsndfile1 libsoxr0 libspeex1 libspeexdsp1 libsqlite3-0 libtalloc2 libtdb1 libtevent0 libtheora0 libva1 libvorbis0a libvorbisenc2 libvorbisfile3 libvpx1 libwavpack1 libwbclient0 libwildmidi-config libwildmidi1 libx11-6 libx11-data libx11-xcb1 libx264-142 libxau6 libxcb1 libxdmcp6 libxext6 libxi6 libxtst6 libxvidcore4 libyajl2 libzzip-0-13 mime-support python python-talloc python2.7 samba-libs x11-common file' + Download_Install 'https://dietpi.com/downloads/binaries/all/mpd_0.20.23-1_aarch64.deb' else @@ -3597,7 +3548,7 @@ We work around this error by running APT a second time. Please do not worry and fi - #Stretch + # Stretch elif (( $G_DISTRO == 4 )); then DEPS_LIST='libnfs8 libsmbclient libsqlite3-0 libupnp6 libwrap0 libmpdclient2 libflac8 libyajl2 libavahi-client3 libvorbisfile3 libwavpack1 libmad0 libmpg123-0 libopus0 libavformat57 libfaad2 libcdio-paranoia1 libiso9660-8 libshout3 libid3tag0' @@ -3605,24 +3556,24 @@ We work around this error by running APT a second time. Please do not worry and # Prevent APT repo updates from overwriting apt-mark hold mpd - #Buster+ + # Buster+ else # libcdio-paranoia1, libiso9660-8 and libupnp6 not available, but ibcdio-paranoia2, libiso9660-11 and libupnp13 instead - # Buster repo version >= 0.21.4, thus stay with APT for now: + # Buster repo version >= 0.21.5, thus stay with APT for now: G_AGI mpd fi fi - software_id=54 # Forums phpBB + software_id=54 # phpBB Forum if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing # Skip install, if already present - if [[ -d /var/www/phpBB3 ]]; then + if [[ -d '/var/www/phpBB3' ]]; then G_DIETPI-NOTIFY 2 "${aSOFTWARE_WHIP_NAME[$software_id]} install dir \"/var/www/phpBB3\" already exists. Download and install steps will be skipped. - If you want to update ${aSOFTWARE_WHIP_NAME[$software_id]}, please follow the instructions from WebUI ACP. @@ -3630,69 +3581,66 @@ We work around this error by running APT a second time. Please do not worry and else - Download_Install 'https://www.phpbb.com/files/release/phpBB-3.2.5.tar.bz2' /var/www + Download_Install 'https://www.phpbb.com/files/release/phpBB-3.2.7.tar.bz2' /var/www fi fi - #OPENBAZAAR - software_id=58 + software_id=58 # OpenBazaar if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - # - Install go - # x86_64 + # Install Golang Go: https://golang.org/dl/ + # - x86_64 if (( $G_HW_ARCH == 10 )); then - INSTALL_URL_ADDRESS='https://dl.google.com/go/go1.11.2.linux-amd64.tar.gz' + INSTALL_URL_ADDRESS='https://dl.google.com/go/go1.11.10.linux-amd64.tar.gz' - # ARMv8 + # - ARMv8 elif (( $G_HW_ARCH == 3 )); then - INSTALL_URL_ADDRESS='https://dl.google.com/go/go1.11.2.linux-arm64.tar.gz' + INSTALL_URL_ADDRESS='https://dl.google.com/go/go1.11.10.linux-arm64.tar.gz' - # ARMv6/7 + # - ARMv6/7 else - INSTALL_URL_ADDRESS='https://dl.google.com/go/go1.11.2.linux-armv6l.tar.gz' + INSTALL_URL_ADDRESS='https://dl.google.com/go/go1.11.10.linux-armv6l.tar.gz' fi Download_Install "$INSTALL_URL_ADDRESS" /usr/local/ + # Export Go path variables mkdir -p $G_FP_DIETPI_USERDATA/go cat << _EOF_ > /etc/bashrc.d/go.sh #!/bin/bash export GOPATH=$G_FP_DIETPI_USERDATA/go export PATH=\$PATH:/usr/local/go/bin:$G_FP_DIETPI_USERDATA/go/bin _EOF_ - . /etc/bashrc.d/go.sh - # - Install OB + # Install OpenBazaar G_DIETPI-NOTIFY 2 "Installing ${aSOFTWARE_WHIP_NAME[$software_id]}, please wait, this will take some time (1-5 minutes)" G_RUN_CMD go get github.com/OpenBazaar/openbazaar-go fi - #YACY - software_id=133 + software_id=133 # YaCy if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - Download_Install 'http://yacy.net/release/yacy_v1.92_20161226_9000.tar.gz' /etc + Download_Install 'https://yacy.net/release/yacy_v1.92_20161226_9000.tar.gz' /etc fi - #Folding@Home - software_id=2 + software_id=2 # Folding@Home if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - # - We must uninstall previous package for reinstall, else it will fail: https://github.com/MichaIng/DietPi/issue_comments#issuecomment-411688073 + # 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' @@ -3709,18 +3657,17 @@ _EOF_ Download_Install 'https://download.foldingathome.org/releases/public/release/fahclient/debian-stable-64bit/v7.5/latest.deb' - killall -w FAHClient #due to https://github.com/FoldingAtHome/fah-issues/issues/1193 + killall -w FAHClient # Due to https://github.com/FoldingAtHome/fah-issues/issues/1193 fi - #ownCloud - software_id=47 + software_id=47 # ownCloud if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - DEPS_LIST="$PHP_APT_PACKAGE_NAME-intl" # https://doc.owncloud.org/server/administration_manual/installation/manual_installation.html#php-extensions + DEPS_LIST="$PHP_NAME-intl" # https://doc.owncloud.org/server/administration_manual/installation/manual_installation.html#php-extensions - if [[ -f /var/www/owncloud/occ ]]; then + if [[ -f '/var/www/owncloud/occ' ]]; then G_DIETPI-NOTIFY 2 'Existing ownCloud installation found, will NOT overwrite...' @@ -3749,14 +3696,13 @@ _EOF_ fi - #Nextcloud - software_id=114 + software_id=114 # Nextcloud if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - DEPS_LIST="$PHP_APT_PACKAGE_NAME-intl" # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation + DEPS_LIST="$PHP_NAME-intl" # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation - if [[ -f /var/www/nextcloud/occ ]]; then + if [[ -f '/var/www/nextcloud/occ' ]]; then G_DIETPI-NOTIFY 2 'Existing Nextcloud installation found, will NOT overwrite...' @@ -3771,11 +3717,6 @@ _EOF_ # Correct config.php data directory entry, in case it changed due to server migration: G_CONFIG_INJECT "'datadirectory'" "'datadirectory' => '$datadir'," /var/www/nextcloud/config/config.php "'dbtype'" - elif (( $G_DISTRO < 4 )); then - - G_DIETPI-NOTIFY 2 'PHP5 support was dropped with NC14, latest NC13 will be installed instead' - Download_Install 'https://download.nextcloud.com/server/releases/latest-13.tar.bz2' /var/www - else Download_Install 'https://download.nextcloud.com/server/releases/latest.tar.bz2' /var/www @@ -3790,19 +3731,17 @@ _EOF_ fi - #Nextcloud Talk - software_id=168 + software_id=168 # Nextcloud Talk if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - # Install "coturn" TURN server only, install Nextcloud Talk app after Nextcloud has been fully configured + # Install coTURN server only, install Nextcloud Talk app after Nextcloud has been fully configured G_AGI coturn fi - #YMPD - software_id=32 + software_id=32 # ympd if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -3875,13 +3814,12 @@ _EOF_ fi - #myMPD - software_id=148 + software_id=148 # myMPD if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - #Sourcebuild pre-reqs + # Sourcebuild pre-reqs DEPS_LIST='cppcheck pkg-config libssl-dev libmpdclient-dev libmpdclient2 cmake' #Download_Install 'https://github.com/jcorporation/myMPD/archive/master.zip' @@ -3890,71 +3828,63 @@ _EOF_ cd myMPD* G_RUN_CMD ./mkrelease.sh cd /tmp/$G_PROGRAM_NAME + rm -R myMPD* fi - #Roon Bridge - software_id=121 + software_id=121 # Roon Bridge if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - #x86_64 + # x86_64 if (( $G_HW_ARCH == 10 )); then - INSTALL_URL_ADDRESS='http://download.roonlabs.com/builds/RoonBridge_linuxx64.tar.bz2' + INSTALL_URL_ADDRESS='https://download.roonlabs.com/builds/RoonBridge_linuxx64.tar.bz2' - #ARMv8 + # ARMv8 elif (( $G_HW_ARCH == 3 )); then - INSTALL_URL_ADDRESS='http://download.roonlabs.com/builds/RoonBridge_linuxarmv8.tar.bz2' + INSTALL_URL_ADDRESS='https://download.roonlabs.com/builds/RoonBridge_linuxarmv8.tar.bz2' - #ARMv7 + # ARMv7 else - INSTALL_URL_ADDRESS='http://download.roonlabs.com/builds/RoonBridge_linuxarmv7hf.tar.bz2' + INSTALL_URL_ADDRESS='https://download.roonlabs.com/builds/RoonBridge_linuxarmv7hf.tar.bz2' fi Download_Install "$INSTALL_URL_ADDRESS" - # - reinstall, clear dir, prevent mv fail on non-empty dir - rm -R /etc/roonbridge &> /dev/null - - mkdir -p /etc/roonbridge - mv RoonBridge/* /etc/roonbridge - rm -R RoonBridge + # Clear dir on reinstall + [[ -d '/etc/roonbridge' ]] && rm -R /etc/roonbridge + mv RoonBridge /etc/roonbridge fi - #CAVA - software_id=119 + software_id=119 # CAVA if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - # - armv6 + # armv6 if (( $G_HW_ARCH == 1 )); then INSTALL_URL_ADDRESS='https://dietpi.com/downloads/binaries/all/cava_0.6.1-1_armv6.deb' - # - armv7 + # armv7 elif (( $G_HW_ARCH == 2 )); then INSTALL_URL_ADDRESS='https://dietpi.com/downloads/binaries/all/cava_0.6.1-1_armv7.deb' - # - arm64 + # arm64 elif (( $G_HW_ARCH == 3 )); then INSTALL_URL_ADDRESS='https://dietpi.com/downloads/binaries/all/cava_0.6.1-1_arm64.deb' # Using older binary for Odroid C2 due to: https://github.com/MichaIng/DietPi/issues/1340#issuecomment-393225267 - if (( $G_HW_MODEL == 12 )); then - - INSTALL_URL_ADDRESS='https://dietpi.com/downloads/binaries/all/cava_0.4.2_arm64.deb' + (( $G_HW_MODEL == 12 )) && INSTALL_URL_ADDRESS='https://dietpi.com/downloads/binaries/all/cava_0.4.2_arm64.deb' - fi - - # - x86_64 + # x86_64 elif (( $G_HW_ARCH == 10 )); then INSTALL_URL_ADDRESS='https://dietpi.com/downloads/binaries/all/cava_0.6.1-1_amd64.deb' @@ -3968,8 +3898,7 @@ _EOF_ fi - #Mopidy - software_id=118 + software_id=118 # Mopidy if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -3979,9 +3908,9 @@ _EOF_ # Install our config file only, if not yet existent, to preserve manual user config. # - This needs to be done prior to APT install, since this would otherwise install a default config file as well. - [[ -f /etc/mopidy/mopidy.conf ]] || dps_index=$software_id Download_Install 'mopidy.conf' /etc/mopidy/mopidy.conf + [[ -f '/etc/mopidy/mopidy.conf' ]] || dps_index=$software_id Download_Install 'mopidy.conf' /etc/mopidy/mopidy.conf - wget -q -O - "$INSTALL_URL_ADDRESS" | apt-key add - + curl -sSL "$INSTALL_URL_ADDRESS" | apt-key add - # No Buster list available yet, use stretch.list for testing: if (( $G_DISTRO > 3 )); then @@ -3995,43 +3924,41 @@ _EOF_ G_AGUP G_AGI mopidy gstreamer1.0-alsa - #ARMv8 - #NB: No ARM64 packages currently exist in mopidy repo. So it will throw a minor error when updating apt. - #Mopidy web client extensions not loading in webpage... - # if (( $G_HW_ARCH == 3 )); then + # ARMv8 + # NB: No ARM64 packages currently exist in mopidy repo. So it will throw a minor error when updating apt. + # Mopidy web client extensions not loading in webpage... + #if (( $G_HW_ARCH == 3 )); then - # G_AGI build-essential python-dev - # pip install mopidy #no effect, claims already upto date. + #G_AGI build-essential python-dev + #pip install mopidy #no effect, claims already upto date. - # fi + #fi pip install Mopidy-MusicBox-Webclient Mopidy-Local-Images fi - #Kodi - software_id=31 + software_id=31 # Kodi if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - #Odroids - if (( $G_HW_MODEL >= 10 )) && (( $G_HW_MODEL < 20 )); then + # Odroids + if (( $G_HW_MODEL > 9 )) && (( $G_HW_MODEL < 20 )); then local package_list='kodi-odroid' - #XU4 - requires pulse audio (fixes corrupt sound) - if (( $G_HW_MODEL == 11 )); then - - package_list+=' pulseaudio' + # - XU4: Requires pulse audio (fixes corrupt sound) + (( $G_HW_MODEL == 11 )) && package_list+=' pulseaudio' - fi - - #Everything else + # Everything else else local package_list='kodi' + # - RPi: Kodi 18 requires fbset to start with custom screen resolution: https://dietpi.com/phpbb/viewtopic.php?p=17550#p17550 + (( $G_HW_MODEL < 10 )) && package_list+=' fbset' + fi # - libcurl3-gnutls required for C2. But lets apply to all: https://github.com/MichaIng/DietPi/issues/446 @@ -4056,8 +3983,7 @@ _EOF_ fi - #MINIDLNA - software_id=39 + software_id=39 # MiniDLNA if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -4065,30 +3991,28 @@ _EOF_ fi - #NoIp - software_id=67 + software_id=67 # No-IP if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - #x86_x64 + # x86_x64 if (( $G_HW_ARCH == 10 )); then INSTALL_URL_ADDRESS='https://dietpi.com/downloads/binaries/all/noip_x32_x64.zip' - #ARMv8 + # ARMv8 elif (( $G_HW_ARCH == 3 )); then INSTALL_URL_ADDRESS='https://dietpi.com/downloads/binaries/all/noip_arm64.zip' - #ARMv6/7 + # ARMv6/7 else INSTALL_URL_ADDRESS='https://dietpi.com/downloads/binaries/all/noip_armhf.zip' fi - #NoIp binary install Download_Install "$INSTALL_URL_ADDRESS" mkdir -p /usr/local/bin @@ -4097,13 +4021,12 @@ _EOF_ fi - #amiberry - software_id=108 + software_id=108 # Amiberry if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - # - Backup existing autostart.uae for user + # Backup existing autostart.uae for user G_BACKUP_FP $G_FP_DIETPI_USERDATA/amiberry/conf/autostart.uae DEPS_LIST='libmpg123-0 libxml2 mpeg2dec libmpeg2-4 libsndio6.1' @@ -4111,8 +4034,7 @@ _EOF_ fi - #dxx-rebirth - software_id=112 + software_id=112 # DDX-Rebirth if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -4128,17 +4050,17 @@ _EOF_ Banner_Installing # ARMv7 - INSTALL_URL_ADDRESS='https://hndl.urbackup.org/Server/2.3.7/urbackup-server_2.3.7_armhf.deb' + INSTALL_URL_ADDRESS='https://hndl.urbackup.org/Server/latest/urbackup-server_2.3.8_armhf.deb' # x86_64 if (( $G_HW_ARCH == 10 )); then - INSTALL_URL_ADDRESS='https://hndl.urbackup.org/Server/2.3.7/urbackup-server_2.3.7_amd64.deb' + INSTALL_URL_ADDRESS='https://hndl.urbackup.org/Server/latest/urbackup-server_2.3.8_amd64.deb' # ARMv8 source elif (( $G_HW_ARCH == 3 )); then - INSTALL_URL_ADDRESS='https://hndl.urbackup.org/Server/2.3.7/urbackup-server-2.3.7.tar.gz' + INSTALL_URL_ADDRESS='https://hndl.urbackup.org/Server/latest/urbackup-server-2.3.8.tar.gz' fi @@ -4154,7 +4076,7 @@ _EOF_ G_RUN_CMD make -j $G_HW_CPU_CORES G_RUN_CMD make install - sed -i "/ExecStart=/c ExecStart=/usr/local/bin/urbackupsrv run --config /etc/default/urbackupsrv --no-consoletime" urbackup-server.service + sed -i '/ExecStart=/c ExecStart=/usr/local/bin/urbackupsrv run --config /etc/default/urbackupsrv --no-consoletime' urbackup-server.service cp urbackup-server.service /etc/systemd/system/urbackupsrv.service cp defaults_server /etc/default/urbackupsrv cp logrotate_urbackupsrv /etc/logrotate.d/urbackupsrv @@ -4172,20 +4094,28 @@ _EOF_ fi - #OpenTyrian - software_id=51 + software_id=51 # OpenTyrian if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - DEPS_LIST='ibsdl1.2debian libsdl-net1.2' - Download_Install 'https://dietpi.com/downloads/binaries/rpi/opentyrian_armhf.zip' / - chmod +x /usr/local/games/opentyrian/opentyrian + if (( $G_HW_MODEL > 9 )); then + + G_AGI opentyrian + + else + + DEPS_LIST='ibsdl1.2debian libsdl-net1.2' + Download_Install 'https://dietpi.com/downloads/binaries/rpi/opentyrian_armhf.zip' / + cp -R /usr/local/games/opentyrian /usr/games/ # cp 'just does it', mv will fail if already exists. + rm -R /usr/local/games/opentyrian + chmod +x /usr/games/opentyrian/opentyrian + + fi fi - #RPi Cam Control - software_id=59 + software_id=59 # RPi Cam Control if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -4195,30 +4125,30 @@ _EOF_ cd RPi_Cam* - #Config /etc/motion + # Config /etc/motion mkdir -p /etc/motion cp etc/motion/motion.conf.1 /etc/motion/motion.conf - #Config /etc/raspimjpeg + # Config /etc/raspimjpeg cp etc/raspimjpeg/raspimjpeg.1 /etc/raspimjpeg - #Setup /var/www/rpicam + # Setup /var/www/rpicam mkdir -p /var/www/rpicam/media cp -R www/* /var/www/rpicam/ #chmod +x /var/www/rpicam/raspizip.sh mknod /var/www/rpicam/FIFO p mknod /var/www/rpicam/FIFO1 p - #symlink cam preview and status + # Symlink cam preview and status ln -sf /run/shm/mjpeg/cam.jpg /var/www/rpicam/cam.jpg ln -sf /run/shm/mjpeg/status_mjpeg.txt /var/www/rpicam/status_mjpeg.txt - #Setup Raspimjpeg binary + # Setup Raspimjpeg binary cp bin/raspimjpeg /opt/vc/bin/raspimjpeg chmod +x /opt/vc/bin/raspimjpeg ln -s /opt/vc/bin/raspimjpeg /usr/bin/raspimjpeg - #Cleanup / remove extracted source + # Cleanup / remove extracted source cd /tmp/$G_PROGRAM_NAME rm -R RPi_Cam* @@ -4232,8 +4162,7 @@ _EOF_ fi - #WEBMIN - software_id=115 + software_id=115 # Webmin if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -4243,22 +4172,20 @@ _EOF_ fi - #O!MPD - software_id=129 + software_id=129 # O!MPD if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - # Download_Install 'https://github.com/ArturSierzant/OMPD/archive/master.zip' /var/www + #Download_Install 'https://github.com/ArturSierzant/OMPD/archive/master.zip' /var/www Download_Install 'https://github.com/ArturSierzant/OMPD/archive/2a2909be2d7abc8cce7dff741f529c7d876d4094.zip' /var/www - rm -R /var/www/ompd &> /dev/null #Replace/upgrade existing installs + rm -R /var/www/ompd &> /dev/null # Replace/upgrade existing installs mv /var/www/OMPD* /var/www/ompd fi - #IceCast + DarkIce - software_id=135 + software_id=135 # IceCast + DarkIce if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -4266,8 +4193,7 @@ _EOF_ fi - #LINUXDASH - software_id=63 + software_id=63 # LinuxDash if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -4284,24 +4210,24 @@ _EOF_ Banner_Installing - INSTALL_URL_ADDRESS='http://install.pi-hole.net' + INSTALL_URL_ADDRESS='https://install.pi-hole.net' G_CHECK_URL "$INSTALL_URL_ADDRESS" - # - Check free available memory. Increase swapfile size to prevent gravity running out of mem. + # Check free available memory. Increase swapfile size to prevent gravity running out of mem. if (( $(free -m | mawk '/Mem:/ {print $4;exit}') < 512 && $(grep -m1 '^[[:blank:]]*AUTO_SETUP_SWAPFILE_SIZE=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') < 512 )); then G_DIETPI-NOTIFY 2 'Increasing swapfile size to 512MB before running gravity.sh, please wait...\n' - /DietPi/dietpi/func/dietpi-set_dphys-swapfile 512 + /DietPi/dietpi/func/dietpi-set_swapfile 512 fi - # - Install + # Install wget "$INSTALL_URL_ADDRESS" -O install.sh chmod +x install.sh - # Skip Lighttpd install, since user properly has chosen a different one, which was installed as pre-req. + # - Skip Lighttpd install, since user properly has chosen a different one, which was installed as pre-req. ./install.sh --disable-install-webserver - # We can't do reasonable exit code check, since installer always returns 5! + # - We can't do reasonable exit code check, since installer always returns 5! rm install.sh fi @@ -4325,8 +4251,8 @@ _EOF_ Banner_Installing - #G_AGI lame #conflicts with our ffmpeg package: https://github.com/MichaIng/DietPi/issues/946#issuecomment-300738228 - Download_Install 'https://dietpi.com/downloads/binaries/all/subsonic-6.1.3.deb' + #DEPS_LIST='lame' # Conflicts with our ffmpeg package: https://github.com/MichaIng/DietPi/issues/946#issuecomment-300738228 + Download_Install 'https://dietpi.com/downloads/binaries/all/subsonic.deb' fi @@ -4357,11 +4283,10 @@ _EOF_ fi - #WEBIOPI requires RPIGPIO + # WebIOPi requires RPi GPIO (( ${aSOFTWARE_INSTALL_STATE[71]} == 1 )) && aSOFTWARE_INSTALL_STATE[69]=1 - #RPIGPIO - software_id=69 + software_id=69 # RPi GPIO if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -4369,24 +4294,23 @@ _EOF_ fi - #WIRINGPI - software_id=70 + software_id=70 # WebIOPi if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - # - RPi + # RPi if (( $G_HW_MODEL < 10 )); then - # http://git.drogon.net/?p=wiringPi;a=shortlog;h=refs/heads/master snapshot + # https://git.drogon.net/?p=wiringPi;a=shortlog;h=refs/heads/master snapshot Download_Install 'https://dietpi.com/downloads/binaries/all/wiringPi-8d188fa.tar.gz' - # - Odroid's + # Odroids elif (( $G_HW_MODEL < 20 )); then Download_Install 'https://github.com/hardkernel/wiringPi/archive/master.zip' - # - BPiPro + # BPi Pro elif (( $G_HW_MODEL == 51 )); then Download_Install 'https://github.com/LeMaker/WiringBP/archive/bananapro.zip' @@ -4405,8 +4329,7 @@ _EOF_ fi - #RPII2C - software_id=72 + software_id=72 # RPi I2C if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -4414,8 +4337,7 @@ _EOF_ fi - #nodered - software_id=122 + software_id=122 # Node-RED if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -4430,8 +4352,7 @@ _EOF_ fi - #mosquitto - software_id=123 + software_id=123 # Mosquitto if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -4439,8 +4360,7 @@ _EOF_ fi - #Blynk Server - software_id=131 + software_id=131 # Blynk Server if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -4448,11 +4368,23 @@ _EOF_ INSTALL_URL_ADDRESS='https://api.github.com/repos/blynkkk/blynk-server/releases/latest' G_CHECK_URL "$INSTALL_URL_ADDRESS" - INSTALL_URL_ADDRESS=$(curl -s "$INSTALL_URL_ADDRESS" | grep -m1 'browser_download_url' | cut -d \" -f 4) + # On Buster use non-Java8 binary, else Java 8 + local java='java8' + (( $G_DISTRO > 4 )) && java='[^a].' # Exclude "a" von jav[a]8 but allow "8" as this can be from version string + INSTALL_URL_ADDRESS=$(curl -s "$INSTALL_URL_ADDRESS" | grep -m1 "browser_download_url.*$java\.jar" | cut -d \" -f 4) + + # Fallback URL + if [[ ! $INSTALL_URL_ADDRESS ]]; then + + INSTALL_URL_ADDRESS='https://github.com/blynkkk/blynk-server/releases/download/v0.41.5/server-0.41.5-java8.jar' + (( $G_DISTRO > 4 )) && INSTALL_URL_ADDRESS='https://github.com/blynkkk/blynk-server/releases/download/v0.41.5/server-0.41.5-java8.jar' + + fi + mkdir -p $G_FP_DIETPI_USERDATA/blynk/data G_THREAD_START wget "$INSTALL_URL_ADDRESS" -O $G_FP_DIETPI_USERDATA/blynk/blynkserver.jar - # - Install Blynk JS Libary + # Install Blynk JS libary G_AGI python npm i -g --unsafe-perm onoff npm i -g --unsafe-perm blynk-library @@ -4461,77 +4393,66 @@ _EOF_ fi - #NAA Daemon - software_id=124 + software_id=124 # NAA Daemon if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - # - Skip license for NAA daemon: + # Skip license debconf-set-selections <<< 'networkaudiod networkaudiod/license note false' - #Packages + # Packages local apackages=() - # Jessie - requires stretch packages - if (( $G_DISTRO == 3 )); then + # - Jessie: Requires Stretch packages + if (( $G_DISTRO < 4 )); then - apackages+=('https://dietpi.com/downloads/binaries/all/gcc-6-base_6.3.0-6_armhf.deb') - apackages+=('https://dietpi.com/downloads/binaries/all/libstdc++6_6.3.0-6_armhf.deb') + apackages+=("https://dietpi.com/downloads/binaries/jessie/gcc-6-base_$G_HW_ARCH_DESCRIPTION.deb") + apackages+=("https://dietpi.com/downloads/binaries/jessie/libstdc++6_$G_HW_ARCH_DESCRIPTION.deb") fi # - ARMv6/7 - if (( $G_HW_ARCH <= 2 )); then + if (( $G_HW_ARCH < 3 )); then - apackages+=('https://www.signalyst.eu/bins/naa/linux/stretch/networkaudiod_3.5.5-39_armhf.deb') + apackages+=('https://www.signalyst.eu/bins/naa/linux/stretch/networkaudiod_3.5.6-41_armhf.deb') # - ARMv8 elif (( $G_HW_ARCH == 3 )); then - apackages+=('https://www.signalyst.eu/bins/naa/linux/xenial/networkaudiod_3.5.5-39_arm64.deb') + apackages+=('https://www.signalyst.eu/bins/naa/linux/stretch/networkaudiod_3.5.6-41_arm64.deb') # - x86_64 else - apackages+=('https://www.signalyst.eu/bins/naa/linux/stretch/networkaudiod_3.5.5-39_amd64.deb') + apackages+=('https://www.signalyst.eu/bins/naa/linux/stretch/networkaudiod_3.5.6-41_amd64.deb') fi - # - check online - for ((i=0; i<${#apackages[@]}; i++)) + # Check online + for i in "${apackages[@]}" do - G_CHECK_URL "${apackages[$i]}" + G_CHECK_URL "$i" done - # - Prereqs - DEPS_LIST='libasound2' - - # - Stretch, install additional packages - if (( $G_DISTRO >= 4 )); then - - DEPS_LIST+=' gcc-6-base libstdc++6' - - fi - - for ((i=0; i<${#apackages[@]}; i++)) + # Install + for i in "${apackages[@]}" do - no_check_url=1 Download_Install "${apackages[$i]}" + no_check_url=1 Download_Install "$i" done unset apackages - #Enable logging for NAA Daemon - #echo -e "NETWORKAUDIOD_LOGFILE='/var/log/naadaemon.log'" > /etc/default/networkaudiod + # Enable logging for NAA Daemon + #echo "NETWORKAUDIOD_LOGFILE='/var/log/naadaemon.log'" > /etc/default/networkaudiod fi - #Tomcat8 - software_id=125 + software_id=125 # Tomcat8 if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -4539,8 +4460,7 @@ _EOF_ fi - #WEBIOPI - software_id=71 + software_id=71 # WebIOPi if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -4550,34 +4470,31 @@ _EOF_ cd WebIOPi* - #Automate Weaved prompt + # Automate Weaved prompt sed -i '/read response/c\response="n"' setup.sh - #Run setup script + # Run setup script ./setup.sh - printf '\ec' # clear current terminal screen cd /tmp/$G_PROGRAM_NAME - #Cleanup + # Cleanup rm -R WebIOPi* fi - #DIETPICLOUDSHELL - software_id=62 + software_id=62 # DietPi-CloudShell if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - #LCD panels can be enabled in Dietpi-config > display options - # XU4 enable cloudshell + # LCD panels can be enabled in Dietpi-config > display options + # - XU4 enable cloudshell (( $G_HW_MODEL == 11 )) && /DietPi/dietpi/func/dietpi-set_hardware lcdpanel odroid-cloudshell fi - #HAPROXY - software_id=98 + software_id=98 # HAProxy if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -4587,63 +4504,45 @@ _EOF_ cd haproxy-* - #Compile and install + # Compile and install make -j $G_HW_CPU_CORES TARGET=linux2628 CPU=generic USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1 USE_LINUX_SPLICE=1 make install mkdir /etc/haproxy - #Exit directory + # Exit directory cd /tmp/$G_PROGRAM_NAME - #Clean up + # Clean up rm -R haproxy-* - #Install init script as service + # Install init script as service dps_index=$software_id Download_Install 'haproxy.service' /etc/init.d/haproxy chmod +x /etc/init.d/haproxy update-rc.d haproxy defaults fi - #SQUEEZEBOXSERVER - software_id=35 + software_id=35 # Logitech Media Server if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - # - ARMv8 under ARMv6/7 - if (( $G_HW_ARCH == 3 )); then - - dpkg --add-architecture armhf - G_AGUP - - fi - - Download_Install 'https://dietpi.com/downloads/binaries/all/logitechmediaserver_7.9.1_all.deb' - - # - ARMv8, CPAN - if (( $G_HW_ARCH == 3 )); then - - if (( $G_DISTRO == 3 )); then - - INSTALL_URL_ADDRESS='https://dietpi.com/downloads/binaries/all/DietPi-LMS7.9-CPAN_arm64.zip' - - else - - INSTALL_URL_ADDRESS='https://dietpi.com/downloads/binaries/all/logitechmediaserver_7.9.1_CPAN-armv8-stretch.zip' - - fi + # Instructions: http://wiki.slimdevices.com/index.php/DebianPackage#installing_7.9.2 + # - Grab architecture + local arch='arm' + (( $G_HW_ARCH == 10 )) && arch='amd64' - DEPS_LIST='libxml-parser-perl zlib1g-dev libjpeg-dev libpng-dev libjpeg62-turbo-dev' # shared libs needed for Image::Scale@0.08 - Download_Install "$INSTALL_URL_ADDRESS" /usr/share/squeezeboxserver + # - Grab URL for the latest package (nightly) + INSTALL_URL_ADDRESS="https://www.mysqueezebox.com/update/?version=7.9.2&revision=1&geturl=1&os=deb$arch" + G_CHECK_URL "$INSTALL_URL_ADDRESS" - fi + # - Install, failsafe checking this URL again + Download_Install "$(curl -s "$INSTALL_URL_ADDRESS")" fi - #WORDPRESS - software_id=55 + software_id=55 # Wordpress if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -4651,23 +4550,20 @@ _EOF_ fi - #FRESHRSS - software_id=38 + software_id=38 # FreshRSS if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing # Install required PHP modules: https://github.com/FreshRSS/FreshRSS#example-of-full-installation-on-linux-debianubuntu - DEPS_LIST="$PHP_APT_PACKAGE_NAME-curl $PHP_APT_PACKAGE_NAME-gmp $PHP_APT_PACKAGE_NAME-intl $PHP_APT_PACKAGE_NAME-json" - (( $G_DISTRO > 3 )) && DEPS_LIST+=" $PHP_APT_PACKAGE_NAME-mbstring $PHP_APT_PACKAGE_NAME-xml $PHP_APT_PACKAGE_NAME-zip" + DEPS_LIST="$PHP_NAME-curl $PHP_NAME-gmp $PHP_NAME-intl $PHP_NAME-json $PHP_NAME-mbstring $PHP_NAME-xml $PHP_NAME-zip" Download_Install 'https://github.com/FreshRSS/FreshRSS/archive/master.zip' /opt mv /opt/FreshRSS-master /opt/FreshRSS fi - #TIGHTVNCSERVER - software_id=27 + software_id=27 # TightVNC Server if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -4675,50 +4571,74 @@ _EOF_ fi - #VNC4SERVER - software_id=28 + software_id=28 # VNC4 Server if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing local package_list='vnc4server x11vnc' - # - Stretch+ - if (( $G_DISTRO >= 4 )); then - - package_list+=' tigervnc-common' - - fi + # Stretch+ + (( $G_DISTRO > 3 )) && package_list+=' tigervnc-common' G_AGI $package_list fi - #REALVNCSERVER - software_id=120 + software_id=120 # RealVNC Server if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - # - Available in Raspbian apt + # Available in Raspbian APT repo G_AGI realvnc-vnc-server fi - #FAIL2BAN - software_id=73 + software_id=73 # Fail2Ban if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - >> /var/log/auth.log #: https://github.com/MichaIng/DietPi/issues/475#issuecomment-310873879 + # Create jail.conf (backend = systemd) first, to prevent APT failure due to missing /var/log/auth.log: https://github.com/MichaIng/DietPi/issues/475#issuecomment-310873879 + mkdir -p /etc/fail2ban + [[ -f '/etc/fail2ban/jail.conf' ]] || cat << _EOF_ > /etc/fail2ban/jail.conf +[DEFAULT] +ignoreip = 127.0.0.1/8 +ignorecommand = +bantime = 600 +findtime = 600 +maxretry = 3 +backend = systemd +enabled = true +filter = %(__name__)s +port = 0:65535 +banaction = route +action_ = %(banaction)s[name=%(__name__)s, bantime="%(bantime)s", port="%(port)s"] +action = %(action_)s + +[sshd] +port = ssh + +[dropbear] +port = ssh +_EOF_ + + if (( $G_DISTRO > 3 )); then + + G_AGI python3-systemd fail2ban + + # On Jessie, the systemd backend is not yet supported, so we install the Stretch package manually + else + + DEPS_LIST='python3-systemd' + Download_Install 'https://dietpi.com/downloads/binaries/all/fail2ban.deb' - G_AGI python3-systemd fail2ban + fi fi - #InfluxDB - software_id=74 + software_id=74 # InfluxDB if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -4726,7 +4646,7 @@ _EOF_ INSTALL_URL_ADDRESS='https://repos.influxdata.com/influxdb.key' G_CHECK_URL "$INSTALL_URL_ADDRESS" - curl -sL "$INSTALL_URL_ADDRESS" | apt-key add - + curl -sSL "$INSTALL_URL_ADDRESS" | apt-key add - echo "deb https://repos.influxdata.com/debian $G_DISTRO_NAME stable" > /etc/apt/sources.list.d/influxdb.list G_AGUP @@ -4734,8 +4654,7 @@ _EOF_ fi - #Grafana - software_id=77 + software_id=77 # Grafana if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -4751,7 +4670,7 @@ _EOF_ fi G_CHECK_URL "$INSTALL_URL_ADDRESS" - curl -sL "$INSTALL_URL_ADDRESS" | apt-key add - + curl -sSL "$INSTALL_URL_ADDRESS" | apt-key add - # APT repo source & update echo "$deb_address" > /etc/apt/sources.list.d/grafana.list @@ -4762,8 +4681,7 @@ _EOF_ fi - #PHPSYSINFO - software_id=64 + software_id=64 # phpSysInfo if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -4773,8 +4691,7 @@ _EOF_ fi - #Ubooquity - software_id=80 + software_id=80 # Ubooquity if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -4787,8 +4704,7 @@ _EOF_ fi - #PHPIMAGEGALLERY - software_id=56 + software_id=56 # PHP Image Gallery if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -4796,8 +4712,7 @@ _EOF_ fi - #AMPACHE - software_id=40 + software_id=40 # Ampache if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -4820,8 +4735,7 @@ _EOF_ fi - #OPENVPNSERVER - software_id=97 + software_id=97 # OpenVPN Server if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -4829,8 +4743,7 @@ _EOF_ fi - #PiVPN - software_id=117 + software_id=117 # PiVPN if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -4840,14 +4753,14 @@ _EOF_ G_AGI lsb-release iptables-persistent dnsutils expect net-tools openvpn - # - Requires underpriv user: https://github.com/MichaIng/DietPi/issues/570#issuecomment-255588307 + # Requires underpriv user: https://github.com/MichaIng/DietPi/issues/570#issuecomment-255588307 useradd pivpn mkdir -p /home/pivpn wget "$INSTALL_URL_ADDRESS" -O pivpn_install.sh chmod +x pivpn_install.sh - # - Disable reboot + # Disable reboot sed -i '/shutdown[[:space:]]/d' pivpn_install.sh until ./pivpn_install.sh @@ -4883,10 +4796,10 @@ _EOF_ kernel_packages='raspberrypi-bootloader raspberrypi-kernel libraspberrypi-bin libraspberrypi0 raspberrypi-kernel-headers' - # - Odroid C1 - elif (( $G_HW_MODEL == 10 )); then + # - Odroid C1: REMOVE v6.24 + elif (( $G_HW_MODEL == 10 && $G_DISTRO == 3 )); then - kernel_packages='linux-image-armhf-odroid-c1 linux-headers-armhf-odroid-c1' + kernel_packages='linux-image-armhf-odroid-c1 linux-headers-armhf-odroid-c1' # - Odroid XU4 elif (( $G_HW_MODEL == 11 )); then @@ -4911,7 +4824,7 @@ _EOF_ fi # Odroids need to purge before we install, else, does not update to latest version... - (( $G_HW_MODEL >= 10 && $G_HW_MODEL < 20 )) && G_AGP $kernel_packages + (( $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 @@ -4921,7 +4834,7 @@ _EOF_ # - Disable sid repo via priority "-1", to prevent any accidental package upgrades: https://github.com/MichaIng/DietPi/issues/2568 # - Enable but set sid WireGuard package priorities low enough to install only if not available in main repo(s) echo -e 'Package: *\nPin: release n=sid\nPin-Priority: -1\n -Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Priority: 99' > /etc/apt/preferences.d/dietpi-wireguard +Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Priority: 100' > /etc/apt/preferences.d/dietpi-wireguard # RPi: Install debian-archive-keyring, currently version 2018.1 from sid branch: https://packages.debian.org/de/sid/debian-archive-keyring (( $G_HW_MODEL < 10 )) && Download_Install 'https://dietpi.com/downloads/binaries/rpi/debian-archive-keyring.deb' @@ -4981,7 +4894,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior else # - Remove/Update existing certbot installer scripts - [[ -d /etc/certbot_scripts ]] && rm -R /etc/certbot_scripts + [[ -d '/etc/certbot_scripts' ]] && rm -R /etc/certbot_scripts Download_Install 'https://github.com/certbot/certbot/archive/master.zip' /etc mv /etc/certbot* /etc/certbot_scripts @@ -4995,11 +4908,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior fi - #TORHOTSPOT requires WIFIHOTSPOT: - (( ${aSOFTWARE_INSTALL_STATE[61]} == 1 )) && aSOFTWARE_INSTALL_STATE[60]=1 - - #WIFIHOTSPOT - software_id=60 + software_id=60 # WiFi Hotspot if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -5014,7 +4923,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior fi - #Which binary to install + # Which binary to install local filename_hostapd='' local filename_hostapd_cli='' @@ -5049,25 +4958,20 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior rm hostapd-* - #Enable wifi modules + # Enable wifi modules /DietPi/dietpi/func/dietpi-set_hardware wifimodules enable fi - - #TORHOTSPOT - software_id=61 + software_id=61 # Tor Hotspot if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - - # - Prereqs G_AGI tor fi - #SHAIRPORTSYNC - software_id=37 + software_id=37 # Shairport-Sync if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -5081,17 +4985,13 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior fi - #PYDIO - software_id=48 + software_id=48 # Pydio if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing # Install required PHP modules - DEPS_LIST="$PHP_BINARY-apcu $PHP_APT_PACKAGE_NAME-gd $PHP_APT_PACKAGE_NAME-intl" - - # - Stretch extras - (( $G_DISTRO > 3 )) && DEPS_LIST+=" $PHP_APT_PACKAGE_NAME-mbstring $PHP_APT_PACKAGE_NAME-opcache $PHP_APT_PACKAGE_NAME-xml" + DEPS_LIST="$PHP_NAME-apcu $PHP_NAME-gd $PHP_NAME-intl $PHP_NAME-mbstring $PHP_NAME-opcache $PHP_NAME-xml" # Skip install, if already present if [[ -d /var/www/pydio ]]; then @@ -5111,8 +5011,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior fi - #SQUEEZELITE - software_id=36 + software_id=36 # SqueezeLite if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -5150,25 +5049,23 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior fi - #EMONHUB - software_id=99 + software_id=99 # EmonHub if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing DEPS_LIST='minicom python-serial python-configobj' - Download_Install 'https://github.com/MichaIng/emonhub/archive/emon-pi.zip' + Download_Install 'https://github.com/Fourdee/emonhub/archive/emon-pi.zip' pip install paho-mqtt pydispatcher - # - move everything to /etc/emonhub + # Move everything to /etc/emonhub rm -R /etc/emonhub mv emonhub-* /etc/emonhub fi - #RPIMONITOR - software_id=66 + software_id=66 # RPi Monitor if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -5196,8 +5093,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior fi - #BAIKAL - software_id=57 + software_id=57 # BaiKal if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -5207,8 +5103,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior fi - #MUMBLESERVER - software_id=43 + software_id=43 # Mumble Server if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -5216,8 +5111,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior fi - #EMBYSERVER - software_id=41 + software_id=41 # Emby Server if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -5240,6 +5134,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior fi + local fallback_url="https://github.com/MediaBrowser/Emby.Releases/releases/download/4.0.2.0/emby-server-deb_4.0.2.0_$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)" unset arch @@ -5251,45 +5146,36 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior Banner_Installing - # Derive latest version from: https://plex.tv/pms/downloads/5 - INSTALL_URL_ADDRESS='https://plex.tv/pms/downloads/5' + # 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 - - # ARMv7 - local arch='armhf' - - # ARMv8 - if (( $G_HW_ARCH == 3 )); then - - arch='arm64' - - # x86_64 - elif (( $G_HW_ARCH == 10 )); then - - arch='amd64' + # Apply APT repo + echo 'deb https://downloads.plex.tv/repo/deb public main' > /etc/apt/sources.list.d/plexmediaserver.list - fi + # Update APT lists + G_AGUP - # Derive URL from arch - no_check_url=1 Download_Install "$(curl -s "$INSTALL_URL_ADDRESS" | grep -m1 "distro=\"debian\".*$arch\.deb" | cut -d \" -f 8)" + # Install PMS + G_AGI plexmediaserver fi - #CUBERITE - software_id=52 + software_id=52 # Cuberite if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - #x86_64 + # x86_64 if (( $G_HW_ARCH == 10 )); then - INSTALL_URL_ADDRESS='http://builds.cuberite.org/job/Cuberite%20Linux%20x64%20Master/lastSuccessfulBuild/artifact/Cuberite.tar.gz' + INSTALL_URL_ADDRESS='https://builds.cuberite.org/job/Cuberite%20Linux%20x64%20Master/lastSuccessfulBuild/artifact/Cuberite.tar.gz' - #32bit ARM + # 32bit ARM elif (( $G_HW_ARCH == 1 || $G_HW_ARCH == 2 )); then - INSTALL_URL_ADDRESS='http://builds.cuberite.org/job/Cuberite%20Linux%20raspi-armhf%20Master/lastSuccessfulBuild/artifact/Cuberite.tar.gz' + INSTALL_URL_ADDRESS='https://builds.cuberite.org/job/Cuberite%20Linux%20raspi-armhf%20Master/lastSuccessfulBuild/artifact/Cuberite.tar.gz' fi @@ -5301,8 +5187,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior fi - #MINEOS - software_id=53 + software_id=53 # MineOS if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -5335,8 +5220,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior fi - #GOGS - software_id=49 + software_id=49 # Gogs if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -5364,8 +5248,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior fi - #QBITTORRENT - software_id=46 + software_id=46 # qBitTorrent if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -5458,7 +5341,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior fi - #Web interface + # Web interface Download_Install 'https://github.com/ziahamza/webui-aria2/archive/master.zip' cp -R webui-aria2* /var/www/aria2 @@ -5466,8 +5349,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior fi - #Medusa - software_id=116 + software_id=116 # Medusa if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -5490,13 +5372,12 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior fi - #SYNCTHING - software_id=50 + software_id=50 # Syncthing if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - if [[ -d /etc/syncthing ]]; then + if [[ -d '/etc/syncthing' ]]; then G_DIETPI-NOTIFY 2 "${aSOFTWARE_WHIP_NAME[$software_id]} install dir \"/etc/syncthing\" already exists. Download and install steps will be skipped. - If you want to update ${aSOFTWARE_WHIP_NAME[$software_id]}, please use the internal updater from WebUI. @@ -5531,8 +5412,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior fi - #TONIDO - software_id=134 + software_id=134 # Tonido if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -5553,7 +5433,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior INSTALL_URL_ADDRESS1='https://dietpi.com/downloads/binaries/all/libjpeg8_8d1-2_amd64.deb' (( $G_DISTRO > 3 )) && INSTALL_URL_ADDRESS2='https://dietpi.com/downloads/binaries/all/libpng12-0_1.2.50-2+deb8u3_amd64.deb' || DEPS_LIST+=' libpng12-0' - INSTALL_URL_ADDRESS3='http://www.tonido.com/download.php?tonido64.tar.gz' + INSTALL_URL_ADDRESS3='https://www.tonido.com/download.php?tonido64.tar.gz' fi @@ -5565,17 +5445,16 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior fi - #CHROMIUM - software_id=113 + software_id=113 # Chromium if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - #Pre-Req's + # Pre-reqs G_AG_CHECK_INSTALL_PREREQ lsb-release - #Stretch via apt - if (( $G_DISTRO >= 4 )); then + # Stretch+ via APT + if (( $G_DISTRO > 3 )); then if (( $G_HW_MODEL < 10 )); then @@ -5589,20 +5468,20 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior else - #armv6+ + # ARMv6/7 if (( $G_HW_ARCH == 1 || $G_HW_ARCH == 2 )); then INSTALL_URL_ADDRESS='https://dietpi.com/downloads/binaries/all/chromium_52.0.2743.116-1-deb8u1.1_armhf.deb' - #ARMv8 + # ARMv8 elif (( $G_HW_ARCH == 3 )); then INSTALL_URL_ADDRESS='https://dietpi.com/downloads/binaries/all/chromium_52.0.2743.116-1-deb8u1.1_arm64.deb' fi - # - Odroid's, 'apt-get install -f' removes chromium package, rather than install required deps... - if (( $G_HW_MODEL >= 10 && $G_HW_MODEL < 20 )); then + # Odroids, 'apt-get -f install' removes chromium package, rather than install required deps... + if (( $G_HW_MODEL > 9 && $G_HW_MODEL < 20 )); then DEPS_LIST='libgnome-keyring0 libnspr4 libnss3 libnss3-1d libspeechd2 libxslt1.1 libxss1 xdg-utils libgnome-keyring-common libltdl7' @@ -5612,27 +5491,26 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior Download_Install 'https://dietpi.com/downloads/binaries/all/chromium-l10n_52.0.2743.116-1-deb8u1.1_all.deb' - # armv6+ + # ARMv6/7 if (( $G_HW_ARCH == 1 || $G_HW_ARCH == 2 )); then Download_Install 'https://dietpi.com/downloads/binaries/all/chromedriver_52.0.2743.116-1-deb8u1.1_armhf.deb' - # arm64 + # ARMv8 elif (( $G_HW_ARCH == 3 )); then Download_Install 'https://dietpi.com/downloads/binaries/all/chromedriver_52.0.2743.116-1-deb8u1.1_arm64.deb' fi - # - Prevent Debian repo from replacing our chromium packages: https://github.com/MichaIng/DietPi/issues/658 + # Prevent Debian repo from replacing our chromium packages: https://github.com/MichaIng/DietPi/issues/658 apt-mark hold chromium chromedriver fi fi - #MotionEye - software_id=136 + software_id=136 # MotionEye if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -5645,25 +5523,25 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior fi - #CloudPrint - software_id=137 + software_id=137 # CloudPrint if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - if (( $G_DISTRO == 3 )); then #https://github.com/MichaIng/DietPi/issues/855#issuecomment-292712002 + if (( $G_DISTRO == 3 )); then # https://github.com/MichaIng/DietPi/issues/855#issuecomment-292712002 - INSTALL_URL_ADDRESS='http://davesteele.github.io/cloudprint-service' - - #url/redirect fails wget spider test... + # Apply APT key + INSTALL_URL_ADDRESS='https://davesteele.github.io/key-366150CE.pub.txt' G_CHECK_URL "$INSTALL_URL_ADDRESS" + curl -sSL "$INSTALL_URL_ADDRESS" | apt-key add - - INSTALL_URL_ADDRESS+='/repo' + # Apply APT repo + echo 'deb https://davesteele.github.io/cloudprint-service/repo cloudprint-jessie main' > /etc/apt/sources.list.d/cloudprint.list - echo -e "deb $INSTALL_URL_ADDRESS cloudprint-jessie main" > /etc/apt/sources.list.d/cloudprint.list - wget -q -O - https://davesteele.github.io/key-366150CE.pub.txt | apt-key add - + # Update APT lists G_AGUP + # Install CloudPrint G_AGI cloudprint-service else @@ -5674,25 +5552,24 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior fi - #VirtualHere - software_id=138 + software_id=138 # VirtualHere if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing INSTALL_URL_ADDRESS='https://virtualhere.com/sites/default/files/usbserver/vhusbd' - #armv6+ + # ARMv6/7 if (( $G_HW_ARCH == 1 || $G_HW_ARCH == 2 )); then INSTALL_URL_ADDRESS+='arm' - #ARMv8 + # ARMv8 elif (( $G_HW_ARCH == 3 )); then INSTALL_URL_ADDRESS+='arm64' - #x86_64 + # x86_64 elif (( $G_HW_ARCH == 10 )); then INSTALL_URL_ADDRESS+='x86_64' @@ -5707,41 +5584,48 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior fi - #sabnzbd - software_id=139 + software_id=139 # SABnzbd if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then - Banner_Installing + Banner_Installing # https://sabnzbd.org/wiki/installation/install-off-modules + + # Pre-reqs + DEPS_LIST='par2 p7zip-full' + # - Pre-compiling required on ARM + (( $G_HW_ARCH < 10 )) && DEPS_LIST+=' libffi-dev libssl-dev' - local version='2.3.5' + Download_Install 'https://github.com/sabnzbd/sabnzbd/archive/master.zip' - #prereqs - DEPS_LIST='par2 python-dev libffi-dev libssl-dev' + # Clear old install dir (in case of reinstall) + if [[ -d '/etc/sabnzbd' ]]; then - Download_Install "https://github.com/sabnzbd/sabnzbd/archive/$version.zip" /etc/sabnzbd + # - Preserve old config file + [[ -f '/etc/sabnzbd/sabnzbd.ini' ]] && mv /etc/sabnzbd/sabnzbd.ini sabnzbd-master/ + rm -R /etc/sabnzbd - mv /etc/sabnzbd/sabnzbd-"$version"/* /etc/sabnzbd/ - rm -R /etc/sabnzbd/sabnzbd-"$version" + fi + + # Install new files + mv sabnzbd-master /etc/sabnzbd + # Required Python modules pip install cheetah cryptography sabyenc fi - #spotifyconnectweb - software_id=141 + software_id=141 # Spotify Connect Web if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - INSTALL_URL_ADDRESS='https://github.com/Fornoth/spotify-connect-web/releases' #full path fails wget spider test... + INSTALL_URL_ADDRESS='https://github.com/Fornoth/spotify-connect-web/releases' # Full path fails wget spider test... G_CHECK_URL "$INSTALL_URL_ADDRESS" no_check_url=1 Download_Install "$INSTALL_URL_ADDRESS/download/0.0.4-alpha/spotify-connect-web_0.0.4-alpha.tar.gz" $G_FP_DIETPI_USERDATA fi - #couchpotato - software_id=142 + software_id=142 # CouchPotato if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -5756,15 +5640,13 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior fi - #Koel - software_id=143 + software_id=143 # Koel if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing # Needed PHP modules, (re)install to be failsafe: https://koel.phanan.net/docs/#/?id=server, https://laravel.com/docs/5.6/installation#server-requirements - DEPS_LIST="python $PHP_APT_PACKAGE_NAME-json" - (( $G_DISTRO > 3 )) && DEPS_LIST+=" $PHP_APT_PACKAGE_NAME-mbstring $PHP_APT_PACKAGE_NAME-xml" + DEPS_LIST="python $PHP_NAME-json $PHP_NAME-mbstring $PHP_NAME-xml" Download_Install 'https://github.com/phanan/koel/archive/v3.7.2.zip' mv koel-* $G_FP_DIETPI_USERDATA/koel @@ -5789,23 +5671,22 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior fi - #Sonarr - software_id=144 + software_id=144 # Sonarr if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - #ARMv8 binary install: https://github.com/MichaIng/DietPi/issues/1502 + # ARMv8 binary install: https://github.com/MichaIng/DietPi/issues/1502 if (( $G_HW_ARCH == 3 )); then - Download_Install 'http://update.sonarr.tv/v2/develop/mono/NzbDrone.develop.tar.gz' /opt + Download_Install 'https://update.sonarr.tv/v2/develop/mono/NzbDrone.develop.tar.gz' /opt G_AGI mediainfo - #Repo install + # Repo install else apt-key adv --keyserver keyserver.ubuntu.com --recv-keys FDA5DFFC - echo 'deb http://apt.sonarr.tv/ develop main' > /etc/apt/sources.list.d/sonarr.list + echo 'deb https://apt.sonarr.tv/ develop main' > /etc/apt/sources.list.d/sonarr.list G_AGUP G_AGI nzbdrone @@ -5813,14 +5694,13 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior fi - #Radarr - software_id=145 + software_id=145 # Radarr if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing INSTALL_URL_ADDRESS='https://api.github.com/repos/Radarr/Radarr/releases' - G_CHECK_URL "$INSTALL_URL_ADDRESS" #full filepath below, returns --spider error :( + 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.*linux\.tar\.gz' | cut -d \" -f 4) DEPS_LIST='mediainfo' @@ -5828,8 +5708,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior fi - #Lidarr - software_id=106 + software_id=106 # Lidarr if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -5843,8 +5722,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior fi - #PlexPy - software_id=146 + software_id=146 # PlexPy if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -5869,38 +5747,80 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior fi - #Jackett - software_id=147 + software_id=147 # Jackett if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing + # Grab latest version download link INSTALL_URL_ADDRESS='https://api.github.com/repos/Jackett/Jackett/releases/latest' - G_CHECK_URL "$INSTALL_URL_ADDRESS" #full filepath below, returns --spider error :( + 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) + fallback_url='https://github.com/Jackett/Jackett/releases/download/v0.11.295/Jackett.Binaries.Mono.tar.gz' + + # - ARMv7 + if (( $G_HW_ARCH == 2 )); then + + INSTALL_URL_ADDRESS=${INSTALL_URL_ADDRESS/Mono/LinuxARM32} + fallback_url=${fallback_url/Mono/LinuxARM32} + + # - ARMv8 + elif (( $G_HW_ARCH == 3 )); then + + INSTALL_URL_ADDRESS=${INSTALL_URL_ADDRESS/Mono/LinuxARM64} + fallback_url=${fallback_url/Mono/LinuxARM64} + + # - x86_64 + elif (( $G_HW_ARCH == 10 )); then + + INSTALL_URL_ADDRESS=${INSTALL_URL_ADDRESS/Mono/LinuxAMDx64} + fallback_url=${fallback_url/Mono/LinuxAMDx64} + + fi + + # Standalone version dependencies: https://docs.microsoft.com/en-us/dotnet/core/linux-prerequisites?tabs=netcore30#linux-distribution-dependencies + if (( $G_HW_ARCH != 1 )); then + + DEPS_LIST='liblttng-ust0' + if (( $G_DISTRO < 4 )); then + + DEPS_LIST+=' libicu52' + + elif (( $G_DISTRO == 4 )); then + + DEPS_LIST+=' libicu57' + + elif (( $G_DISTRO > 4 )); then + + DEPS_LIST+=' libicu63' + + fi + + fi + # Download: wget --spider/curl -LI return 403 no_check_url=1 Download_Install "$INSTALL_URL_ADDRESS" /opt # Move existing configs to unpacked install dir - [[ -d /opt/jackett/.mono ]] && mv /opt/jackett/.mono /opt/Jackett/ - [[ -d /opt/jackett/.config ]] && mv /opt/jackett/.config /opt/Jackett/ + [[ -d '/opt/jackett/Jackett' ]] && mv /opt/jackett/Jackett /opt/Jackett/ + [[ -d '/opt/jackett/.mono' ]] && mv /opt/jackett/.mono /opt/Jackett/ # Remove existing install dir - [[ -d /opt/jackett ]] && rm -R /opt/jackett + [[ -d '/opt/jackett' ]] && rm -R /opt/jackett # Move unpacked install dir in place mv /opt/Jackett /opt/jackett fi - #NZBget - software_id=149 + software_id=149 # NZBget if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing INSTALL_URL_ADDRESS='https://nzbget.net' - G_CHECK_URL "$INSTALL_URL_ADDRESS" INSTALL_URL_ADDRESS+='/download/nzbget-latest-bin-linux.run' @@ -5912,33 +5832,32 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior fi - #------------------ Bittorrent: HTPC Manager ------------------ - software_id=155 + software_id=155 # HTPC Manager if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing INSTALL_URL_ADDRESS='https://github.com/Hellowlol/HTPC-Manager.git' - G_CHECK_URL "$INSTALL_URL_ADDRESS" - #Install Python and PIP - G_AGI python python-pip python-imaging python-dev + G_THREAD_START git clone --depth=1 "$INSTALL_URL_ADDRESS" + + # Pre-reqs + # - psutil for system stats + # - Python Image library: https://htpc.io/installation.html#linux + pip install psutil + G_AGI python-pil # pip install PIL fails at least on Debian Buster x86_64 - git clone --depth=1 "$INSTALL_URL_ADDRESS" + G_THREAD_WAIT - # - Move HTPC Manager to a 'better' location + # Move HTPC Manager to a 'better' location mkdir -p $G_FP_DIETPI_USERDATA/htpc-manager cp -R HTPC-Manager/* $G_FP_DIETPI_USERDATA/htpc-manager/ rm -R HTPC-Manager - # - psutil for system stats - pip install psutil - fi - #OctoPrint - software_id=153 + software_id=153 # OctoPrint if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -5948,7 +5867,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior G_THREAD_START git clone "$INSTALL_URL_ADDRESS" - G_AGI python python-dev libjpeg-dev + G_AGI libjpeg-dev G_THREAD_WAIT mv OctoPrint* $G_FP_DIETPI_USERDATA/octoprint @@ -5961,18 +5880,17 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior fi - #RoonServer - software_id=154 + software_id=154 # Roon Server if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then - Banner_Installing + Banner_Installing # http://kb.roonlabs.com/LinuxInstall - DEPS_LIST='libav-tools cifs-utils' + DEPS_LIST='cifs-utils' # Skip download and install, if already existent, manual removal or internal updater can be used: if [[ ! -d $G_FP_DIETPI_USERDATA/roonserver ]]; then - Download_Install 'http://download.roonlabs.com/builds/RoonServer_linuxx64.tar.bz2' $G_FP_DIETPI_USERDATA + Download_Install 'https://download.roonlabs.com/builds/RoonServer_linuxx64.tar.bz2' $G_FP_DIETPI_USERDATA mv $G_FP_DIETPI_USERDATA/RoonServer $G_FP_DIETPI_USERDATA/roonserver else @@ -5986,8 +5904,7 @@ If you want to update ${aSOFTWARE_WHIP_NAME[$software_id]}, please use it's inte fi - #Steam - software_id=156 + software_id=156 # Steam if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -5998,8 +5915,7 @@ If you want to update ${aSOFTWARE_WHIP_NAME[$software_id]}, please use it's inte fi - #Minio - software_id=158 + software_id=158 # Minio if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -6016,32 +5932,29 @@ If you want to update ${aSOFTWARE_WHIP_NAME[$software_id]}, please use it's inte INSTALL_URL_ADDRESS='https://dl.minio.io/server/minio/release/linux-arm/minio' fi - G_CHECK_URL "$INSTALL_URL_ADDRESS" - #Download executable - [ -d /usr/local/bin ] || mkdir /usr/local/bin - wget -O /usr/local/bin/minio $INSTALL_URL_ADDRESS + # Download executable + [[ -d '/usr/local/bin' ]] || mkdir -p /usr/local/bin + wget -O /usr/local/bin/minio "$INSTALL_URL_ADDRESS" chmod +x /usr/local/bin/minio # Check, Download, Install startup script INSTALL_URL_ADDRESS='https://github.com/minio/minio-service/raw/master/linux-systemd/minio.service' - G_CHECK_URL "$INSTALL_URL_ADDRESS" # Download the systemd service script - wget -O /etc/systemd/system/minio.service $INSTALL_URL_ADDRESS + wget -O /etc/systemd/system/minio.service "$INSTALL_URL_ADDRESS" # Create no login, with home directory, with group of same name, user to run Minio in adduser --system --group minio-user # Create default data directory & grant minio-user proper access - mkdir $G_FP_DIETPI_USERDATA/minio-data + mkdir -p $G_FP_DIETPI_USERDATA/minio-data fi - #Docker - software_id=162 + software_id=162 # Docker if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -6056,36 +5969,35 @@ Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix G_CHECK_URL "$INSTALL_URL_ADDRESS" # Offical Docker recommended install command - wget -O DockerInstall.sh "$INSTALL_URL_ADDRESS" + wget "$INSTALL_URL_ADDRESS" -O DockerInstall.sh chmod +x DockerInstall.sh ./DockerInstall.sh #rm DockerInstall.sh fi - #FuguHub - software_id=161 + software_id=161 # FuguHub if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing if (( $G_HW_ARCH == 10 )); then - INSTALL_URL_ADDRESS='http://FuguHub.com/install/FuguHub.linux.install' + INSTALL_URL_ADDRESS='https://FuguHub.com/install/FuguHub.linux.install' else - INSTALL_URL_ADDRESS='http://FuguHub.com/releases/raspberrypi/install.sh' + INSTALL_URL_ADDRESS='https://FuguHub.com/releases/raspberrypi/install.sh' fi - G_CHECK_URL "$INSTALL_URL_ADDRESS" + optional_cmd_inputs='--no-check-certificate' G_CHECK_URL "$INSTALL_URL_ADDRESS" - wget -O FHinstall.sh "$INSTALL_URL_ADDRESS" + wget --no-check-certificate "$INSTALL_URL_ADDRESS" -O FHinstall.sh chmod +x FHinstall.sh ./FHinstall.sh rm FHinstall.sh - wget http://fuguhub.com/box.zip -O /home/bd/applications/box.zip + wget --no-check-certificate https://fuguhub.com/box.zip -O /home/bd/applications/box.zip fi @@ -6098,8 +6010,8 @@ Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix G_CHECK_URL "$INSTALL_URL_ADDRESS" - mkdir /usr/local/bin/nukkit - wget -O /usr/local/bin/nukkit/nukkit.jar "$INSTALL_URL_ADDRESS" + mkdir -p /usr/local/bin/nukkit + wget "$INSTALL_URL_ADDRESS" -O /usr/local/bin/nukkit/nukkit.jar fi @@ -6110,22 +6022,22 @@ Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix INSTALL_URL_ADDRESS='https://dl.gitea.io/gitea/1.7/gitea-1.7-' - #armv6 + # armv6 if (( $G_HW_ARCH == 1 )); then INSTALL_URL_ADDRESS+='linux-arm-6' - #armv7 + # armv7 elif (( $G_HW_ARCH == 2 )); then INSTALL_URL_ADDRESS+='linux-arm-7' - #armv8 + # armv8 elif (( $G_HW_ARCH == 3 )); then INSTALL_URL_ADDRESS+='linux-arm64' - #x86_64 + # x86_64 elif (( $G_HW_ARCH == 10 )); then INSTALL_URL_ADDRESS+='linux-amd64' @@ -6134,7 +6046,7 @@ Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix G_CHECK_URL "$INSTALL_URL_ADDRESS" - # - Data storage / user data + # Data storage / user data mkdir -p $G_FP_DIETPI_USERDATA/gitea/gitea-repositories wget "$INSTALL_URL_ADDRESS" -O $G_FP_DIETPI_USERDATA/gitea/gitea @@ -6211,7 +6123,7 @@ Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix INSTALL_URL_ADDRESS='https://dtcooper.github.io/raspotify/key.asc' G_CHECK_URL "$INSTALL_URL_ADDRESS" - wget -O - "$INSTALL_URL_ADDRESS" | apt-key add - + curl -sSL "$INSTALL_URL_ADDRESS" | apt-key add - echo 'deb https://dtcooper.github.io/raspotify jessie main' > /etc/apt/sources.list.d/raspotify.list G_AGUP @@ -6219,8 +6131,7 @@ Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix fi - #Google AIY - software_id=169 + software_id=169 # Google AIY if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -6236,11 +6147,7 @@ Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix env/bin/pip install -r requirements.txt #??? ARMv7 only - if (( $G_HW_ARCH == 2 )); then - - env/bin/pip install google-assistant-library==0.0.3 - - fi + (( $G_HW_ARCH == 2 )) && env/bin/pip install google-assistant-library==0.0.3 # - Services sed -i "s#/home/pi#$G_FP_DIETPI_USERDATA#g" systemd/voice-recognizer.service @@ -6259,8 +6166,7 @@ Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix fi - #Roon Extension Manager - software_id=86 + software_id=86 # Roon Extension Manager if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -6286,7 +6192,7 @@ Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix local software_id=-1 - software_id=5 + software_id=5 # ALSA if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -6309,14 +6215,13 @@ Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix fi - #LibSSL1.0.0 - software_id=126 + software_id=126 # LibSSL1.0.0 if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - # - Stretch, libssl1.0.0 no longer available: https://github.com/MichaIng/DietPi/issues/1299 - if (( $G_DISTRO >= 4 )); then + # - Stretch+, libssl1.0.0 no longer available: https://github.com/MichaIng/DietPi/issues/1299 + if (( $G_DISTRO > 3 )); then INSTALL_URL_ADDRESS='https://dietpi.com/downloads/binaries/all/' @@ -6337,18 +6242,19 @@ Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix fi + DEPS_LIST='multiarch-support' Download_Install "$INSTALL_URL_ADDRESS" fi fi - software_id=6 + software_id=6 # Xserver if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - #Xserver Prereqs (ALL) + # Xserver Prereqs (ALL) G_AGI xserver-xorg xinit xcompmgr xterm dbus-x11 xfonts-base x11-xserver-utils x11-utils libgl1-mesa-dri mesa-utils mesa-utils-extra G_BACKUP_FP /etc/X11/xorg.conf @@ -6359,36 +6265,36 @@ Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix # - Disable DPMS and all screen blanking dps_index=$software_id Download_Install '99-dietpi-dpms_off.conf' /etc/X11/xorg.conf.d/99-dietpi-dpms_off.conf - #RPI + # RPI if (( $G_HW_MODEL < 10 )); then : - #Odroid N1 + # Odroid N1 elif (( $G_HW_MODEL == 14 )); then DEPS_LIST='libmali-rk-midgard-t86x-r14p0 xserver-xorg-video-armsoc-rk3399-odroid' dps_index=$software_id Download_Install 'xorg_n1.conf' /etc/X11/xorg.conf - #Odroid C2 + # Odroid C2 elif (( $G_HW_MODEL == 12 )); then DEPS_LIST='aml-libs-odroid mali450-odroid xf86-video-mali-odroid libump-odroid xf86-video-fbturbo-odroid' dps_index=$software_id Download_Install 'xorg_c2.conf' /etc/X11/xorg.conf - #Odroid XU4 + # Odroid XU4 elif (( $G_HW_MODEL == 11 )); then G_AGI firmware-samsung xf86-video-armsoc-odroid malit628-odroid #dps_index=$software_id Download_Install 'xorg_xu4.conf' /etc/X11/xorg.conf - #Odroid C1 - elif (( $G_HW_MODEL == 10 )); then + # Odroid C1: REMOVE v6.24 + elif (( $G_HW_MODEL == 10 && $G_DISTRO == 3 )); then - DEPS_LIST='aml-libs-odroid xf86-video-mali-odroid libump-odroid mali450-odroid' + DEPS_LIST='aml-libs-odroid xf86-video-mali-odroid libump-odroid mali450-odroid' dps_index=$software_id Download_Install 'xorg_c1.conf' /etc/X11/xorg.conf - #Pine64 + # Pine64 elif (( $G_HW_MODEL == 40 )); then Download_Install 'https://dietpi.com/downloads/binaries/all/libump_1-1_arm64.deb' @@ -6397,32 +6303,32 @@ Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix dps_index=$software_id Download_Install 'xorg_pine64.conf' /etc/X11/xorg.conf - #RK3399 + # RK3399 # elif (( $G_HW_MODEL == 42 || $G_HW_MODEL == 68 )); then - #/usr/lib/xorg/Xorg: symbol lookup error: /usr/lib/xorg/modules/libglamoregl.so: undefined symbol: gbm_create_device - #Retry with kernel/uboot from Ubuntu image??? - - # dps_index=$software_id Download_Install 'xorg_rk3399.conf' /etc/X11/xorg.conf - # dps_index=$software_id Download_Install '50-dietpi-rk3399.rules' /etc/udev/rules.d/50-rk3399.rules - - ## wget https://github.com/rockchip-linux/libmali/raw/29mirror/lib/aarch64-linux-gnu/libmali-midgard-t86x-r14p0-x11-fbdev.so -O /usr/lib/aarch64-linux-gnu/libMali.so - ## wget https://github.com/rockchip-linux/libmali/raw/29mirror/lib/aarch64-linux-gnu/libmali-midgard-t86x-r14p0-fbdev.so -O /usr/lib/aarch64-linux-gnu/libMali.so - ## wget https://github.com/rockchip-linux/libmali/raw/29mirror/lib/aarch64-linux-gnu/libmali-midgard-t86x-r14p0-gbm.so -O /usr/lib/aarch64-linux-gnu/libMali.so #works but no GLES - # wget https://github.com/rockchip-linux/libmali/raw/29mirror/lib/aarch64-linux-gnu/libmali-midgard-t86x-r14p0.so -O /usr/lib/aarch64-linux-gnu/libMali.so - # rm $(ls /usr/lib/aarch64-linux-gnu/libGLESv2.*) - # rm $(ls /usr/lib/aarch64-linux-gnu/libEGL.*) - # ln -sf /usr/lib/aarch64-linux-gnu/libMali.so /usr/lib/aarch64-linux-gnu/libEGL.so.1 - # ln -sf /usr/lib/aarch64-linux-gnu/libMali.so /usr/lib/aarch64-linux-gnu/libEGL.so.1.0.0 - # ln -sf /usr/lib/aarch64-linux-gnu/libMali.so /usr/lib/aarch64-linux-gnu/libGLESv2.so.2 - # ln -sf /usr/lib/aarch64-linux-gnu/libMali.so /usr/lib/aarch64-linux-gnu/libGLESv2.so.2.0.0 - # ln -sf /usr/lib/aarch64-linux-gnu/libMali.so /usr/lib/aarch64-linux-gnu/libgbm.so.1 - # ln -sf /usr/lib/aarch64-linux-gnu/libMali.so /usr/lib/aarch64-linux-gnu/libgbm.so.1.0.0 - # ln -sf /usr/lib/aarch64-linux-gnu/libMali.so /usr/lib/aarch64-linux-gnu/libmali.so - # ln -sf /usr/lib/aarch64-linux-gnu/libMali.so /usr/lib/aarch64-linux-gnu/libMaliOpenCL.so - # ln -sf /usr/lib/aarch64-linux-gnu/libMali.so /usr/lib/aarch64-linux-gnu/libOpenCL.so - - #ASUS TB + # /usr/lib/xorg/Xorg: symbol lookup error: /usr/lib/xorg/modules/libglamoregl.so: undefined symbol: gbm_create_device + # Retry with kernel/uboot from Ubuntu image??? + + #dps_index=$software_id Download_Install 'xorg_rk3399.conf' /etc/X11/xorg.conf + #dps_index=$software_id Download_Install '50-dietpi-rk3399.rules' /etc/udev/rules.d/50-rk3399.rules + + ##wget https://github.com/rockchip-linux/libmali/raw/29mirror/lib/aarch64-linux-gnu/libmali-midgard-t86x-r14p0-x11-fbdev.so -O /usr/lib/aarch64-linux-gnu/libMali.so + ##wget https://github.com/rockchip-linux/libmali/raw/29mirror/lib/aarch64-linux-gnu/libmali-midgard-t86x-r14p0-fbdev.so -O /usr/lib/aarch64-linux-gnu/libMali.so + ##wget https://github.com/rockchip-linux/libmali/raw/29mirror/lib/aarch64-linux-gnu/libmali-midgard-t86x-r14p0-gbm.so -O /usr/lib/aarch64-linux-gnu/libMali.so #works but no GLES + #wget https://github.com/rockchip-linux/libmali/raw/29mirror/lib/aarch64-linux-gnu/libmali-midgard-t86x-r14p0.so -O /usr/lib/aarch64-linux-gnu/libMali.so + #rm $(ls /usr/lib/aarch64-linux-gnu/libGLESv2.*) + #rm $(ls /usr/lib/aarch64-linux-gnu/libEGL.*) + #ln -sf /usr/lib/aarch64-linux-gnu/libMali.so /usr/lib/aarch64-linux-gnu/libEGL.so.1 + #ln -sf /usr/lib/aarch64-linux-gnu/libMali.so /usr/lib/aarch64-linux-gnu/libEGL.so.1.0.0 + #ln -sf /usr/lib/aarch64-linux-gnu/libMali.so /usr/lib/aarch64-linux-gnu/libGLESv2.so.2 + #ln -sf /usr/lib/aarch64-linux-gnu/libMali.so /usr/lib/aarch64-linux-gnu/libGLESv2.so.2.0.0 + #ln -sf /usr/lib/aarch64-linux-gnu/libMali.so /usr/lib/aarch64-linux-gnu/libgbm.so.1 + #ln -sf /usr/lib/aarch64-linux-gnu/libMali.so /usr/lib/aarch64-linux-gnu/libgbm.so.1.0.0 + #ln -sf /usr/lib/aarch64-linux-gnu/libMali.so /usr/lib/aarch64-linux-gnu/libmali.so + #ln -sf /usr/lib/aarch64-linux-gnu/libMali.so /usr/lib/aarch64-linux-gnu/libMaliOpenCL.so + #ln -sf /usr/lib/aarch64-linux-gnu/libMali.so /usr/lib/aarch64-linux-gnu/libOpenCL.so + + # ASUS TB elif (( $G_HW_MODEL == 52 )); then Download_Install 'https://dietpi.com/downloads/binaries/asus/ASUSTB_GPU.7z' gpu_driver @@ -6456,8 +6362,7 @@ Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix fi - #Nvidia driver - software_id=151 + software_id=151 # Nvidia driver if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -6466,8 +6371,7 @@ Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix fi - #Avahi-Daemon - software_id=152 + software_id=152 # Avahi-Daemon if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -6475,7 +6379,7 @@ Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix fi - software_id=16 + software_id=16 # Build essentials if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -6491,7 +6395,7 @@ Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix fi - software_id=17 + software_id=17 # Git client if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -6616,7 +6520,7 @@ Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix Banner_Installing - #Remove Information file + # Remove Information file rm /mnt/samba/readme.txt &> /dev/null G_AGI smbclient cifs-utils @@ -6738,19 +6642,19 @@ Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix Banner_Installing - #Workaround for dpkg failure on 1st install if service is already running but APT not installed: https://github.com/MichaIng/DietPi/pull/2277/#issuecomment-441460925 + # Workaround for dpkg failure on 1st install if service is already running but APT not installed: https://github.com/MichaIng/DietPi/pull/2277/#issuecomment-441460925 systemctl stop rsyslog &> /dev/null G_AGI rsyslog systemctl start rsyslog &> /dev/null fi - software_id=7 + software_id=7 # FFmpeg if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - #RPi + OpenMAX HW Encoding: https://github.com/MichaIng/DietPi/issues/869 + # RPi + OpenMAX HW Encoding: https://github.com/MichaIng/DietPi/issues/869 if (( $G_HW_MODEL < 10 )); then Download_Install 'https://dietpi.com/downloads/binaries/rpi/ffmpeg_rpi.7z' ffmpeg_rpi @@ -6758,7 +6662,7 @@ Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix dpkg -i ffmpeg_rpi/*.deb rm -R ffmpeg_rpi - #Everything else + # Everything else else G_AGI ffmpeg @@ -6772,44 +6676,50 @@ Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix Banner_Installing - local packages='ca-certificates-java openjdk-8-jre-headless openjdk-8-jdk-headless' + # On Jessie we need to our self-hosted packages: + if (( $G_DISTRO < 4 )); then - # On Jessie use backports repo: - if (( $G_DISTRO == 3 )); then + Download_Install "https://dietpi.com/downloads/binaries/jessie/openjdk-8-jre_$G_HW_ARCH_DESCRIPTION.7z" + Download_Install "https://dietpi.com/downloads/binaries/jessie/openjdk-8-jdk_$G_HW_ARCH_DESCRIPTION.7z" + dpkg --force-hold,confdef,confold -i ca-certificates-java.deb openjdk-8-jre-headless.deb openjdk-8-jdk-headless.deb + G_AGF + rm ca-certificates-java.deb openjdk-8-jre-headless.deb openjdk-8-jdk-headless.deb - cat << _EOF_ > /etc/apt/preferences.d/99-dietpi-openjdk-8-jdk -Package: ca-certificates-java java-common openjdk-8-* -Pin: release a=jessie-backports -Pin-Priority: 990 -_EOF_ - packages+=' -t jessie-backports' + else + + local version=8 + (( $G_DISTRO == 5 )) && version=11 - fi + local packages="ca-certificates-java openjdk-$version-jre-headless openjdk-$version-jdk-headless" + # Workaround for ARM install issue: https://github.com/MichaIng/DietPi/issues/2524 + apt-get install -y -qq $packages + G_AGI $packages - # Workaround for ARM install issue: https://github.com/MichaIng/DietPi/issues/2524 - apt-get install -y -qq $packages - G_AGI $packages + fi fi - software_id=9 + software_id=9 # Node.js if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - INSTALL_URL_ADDRESS='http://raw.githubusercontent.com/taaem/nodejs-linux-installer/master/node-install.sh' + 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" -O node_install.sh - chmod +x node_install.sh + 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 - ./node_install.sh - rm node_install.sh + chmod +x node-install.sh + ./node-install.sh + rm node-install.sh fi - software_id=130 + software_id=130 # Python pip if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -6828,55 +6738,47 @@ _EOF_ fi - #SDL2 - software_id=140 + software_id=140 # SDL2 if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - #X86_64 + # X86_64 if (( $G_HW_ARCH == 10 )); then # G_AGI libsdl2-2.0-0 libsdl2-image-2.0-0 libsdl2-ttf-2.0-0 libsdl2-net-2.0-0 libsdl2-mixer-2.0-0 INSTALL_URL_ADDRESS='https://dietpi.com/downloads/binaries/all/sdl2-x86_64_stretch.7z' - #ARMv6 + # ARMv6 elif (( $G_HW_ARCH == 1 )); then INSTALL_URL_ADDRESS='https://dietpi.com/downloads/binaries/all/sdl2-armv6_stretch.7z' - #ARMv7 FKMS: + # ARMv7 FKMS: # ./configure --disable-video-rpi --enable-video-kmsdrm elif (( $G_HW_ARCH == 2 )); then INSTALL_URL_ADDRESS='https://dietpi.com/downloads/binaries/all/sdl2-armv7_stretch.7z' # - RPi 2/3 Enable fkms OpenGL - if (( $G_HW_MODEL < 10 )); then - - /DietPi/dietpi/func/dietpi-set_hardware rpi-opengl vc4-fkms-v3d - - fi + (( $G_HW_MODEL < 10 )) && /DietPi/dietpi/func/dietpi-set_hardware rpi-opengl vc4-fkms-v3d fi Download_Install "$INSTALL_URL_ADDRESS" sdl2 - dpkg -i sdl2/*.deb - rm -R sdl2 fi - #Mono repo - software_id=150 + software_id=150 # Mono runtime if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF - #RPi's + ARMv6 only available in raspbian repo: https://github.com/MichaIng/DietPi/issues/1023 + # RPi's + ARMv6 only available in raspbian repo: https://github.com/MichaIng/DietPi/issues/1023 if (( $G_HW_MODEL < 10 || $G_HW_ARCH == 1 )); then echo "deb https://download.mono-project.com/repo/debian raspbian$G_DISTRO_NAME main" > /etc/apt/sources.list.d/mono-xamarin.list @@ -6896,8 +6798,7 @@ _EOF_ fi - #------------------ Home Automation: Home Assistant ------------------ - software_id=157 + software_id=157 # Home Assistant if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -6961,16 +6862,15 @@ _EOF_ fi - #Unrar - software_id=170 + software_id=170 # Unrar if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - #Raspbian "unrar-free" only available in repos + # Raspbian "unrar-free" only available in repos if (( $G_HW_MODEL < 10 )); then - #G_AGI unrar-free #Does not support all rar formats, better use "unrar-nonfree" from Debian repo + #G_AGI unrar-free # Does not support all rar formats, better use "unrar-nonfree" from Debian repo Download_Install "https://dietpi.com/downloads/binaries/rpi/unrar-armhf-$G_DISTRO_NAME.deb" else @@ -6990,8 +6890,8 @@ _EOF_ Apply_SSHServer_Choices(){ - #Work out which SSH server needs installing from IDs (if any) - #Work out which SSH server needs removing (if any) + # Work out which SSH server needs installing from IDs (if any) + # Work out which SSH server needs removing (if any) if (( $INDEX_SSHSERVER_TARGET != $INDEX_SSHSERVER_CURRENT )); then # - No SSH server @@ -7021,26 +6921,26 @@ _EOF_ Apply_FileServer_Choices(){ - #Work out which File Server needs installing from IDs (if any) - #Work out which File server needs removing (if any) + # Work out which File Server needs installing from IDs (if any) + # Work out which File server needs removing (if any) if (( $INDEX_FILESERVER_TARGET != $INDEX_FILESERVER_CURRENT )); then # Run uninstall of old file servers, after install loop UNINSTALL_REQUIRED=1 - #No File server + # No File server if (( $INDEX_FILESERVER_TARGET == 0 )); then (( ${aSOFTWARE_INSTALL_STATE[94]} == 2 )) && aSOFTWARE_INSTALL_STATE[94]=-1 (( ${aSOFTWARE_INSTALL_STATE[96]} == 2 )) && aSOFTWARE_INSTALL_STATE[96]=-1 - #ProFTP + # ProFTP elif (( $INDEX_FILESERVER_TARGET == -1 )); then aSOFTWARE_INSTALL_STATE[94]=1 (( ${aSOFTWARE_INSTALL_STATE[96]} == 2 )) && aSOFTWARE_INSTALL_STATE[96]=-1 - #Samba + # Samba elif (( $INDEX_FILESERVER_TARGET == -2 )); then aSOFTWARE_INSTALL_STATE[96]=1 @@ -7048,7 +6948,7 @@ _EOF_ fi - #Update Current SSHSERVER index + # Update Current SSHSERVER index INDEX_FILESERVER_CURRENT=$INDEX_FILESERVER_TARGET fi @@ -7057,35 +6957,35 @@ _EOF_ 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 UNINSTALL_REQUIRED=1 - #None + # None if (( $INDEX_LOGGING_TARGET == 0 )); then (( ${aSOFTWARE_INSTALL_STATE[101]} == 2 )) && aSOFTWARE_INSTALL_STATE[101]=-1 (( ${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 1H to /root/logfile_storage, then clear. elif (( $INDEX_LOGGING_TARGET == -2 )); 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 - #Logrotate + rsyslog - logs to disk + # Logrotate + rsyslog - logs to disk elif (( $INDEX_LOGGING_TARGET == -3 )); then aSOFTWARE_INSTALL_STATE[101]=1 @@ -7094,7 +6994,7 @@ _EOF_ fi - #Update Current Logging index + # Update Current Logging index INDEX_LOGGING_CURRENT=$INDEX_LOGGING_TARGET fi @@ -7105,50 +7005,14 @@ _EOF_ if (( $INDEX_WEBSERVER_TARGET != $INDEX_WEBSERVER_CURRENT )); then - #Update Current to Target + # Update Current to Target INDEX_WEBSERVER_CURRENT=$INDEX_WEBSERVER_TARGET fi } - #///////////////////////////////////////////////////////////////////////////////////// - # Configuration post installation goes here. - # - # Reference: - # - Adding new software to DietPi-Software - # https://github.com/MichaIng/DietPi/issues/490#issuecomment-244416570 - # - # Adding post installation steps. - # ------------------------------------ - # - software_id: - # This has to be the same number as software_id for the software list above. - # - # Here you can add any configuration changes or addtions to systemd. After this - # has run it will reload the systemd environment and start any services installed - # and referenced in 'dietpi-services' - # - # Example: - # #------------------ Desktop: MATE ------------------ - # software_id=24 - # if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then - # - # # - file manager desktop icon - # ln -sf /usr/share/applications/caja.desktop /root/Desktop/caja.desktop - # - # Create_Desktop_Shared_Items - # - # #Odroid C2, define default pulseaudio sink: https://github.com/MichaIng/DietPi/issues/415 - # if (( $G_HW_MODEL == 12 )) && - # ! grep -qi '^set-default-sink alsa_output.platform-odroid_hdmi.37.analog-stereo' /etc/pulse/default.pa; then - # - # echo 'set-default-sink alsa_output.platform-odroid_hdmi.37.analog-stereo' >> /etc/pulse/default.pa - # - # fi - # - # fi - # - #///////////////////////////////////////////////////////////////////////////////////// + # Configure marked software titles Install_Apply_Configs(){ # Copy/Set optimised Software settings. @@ -7156,13 +7020,12 @@ _EOF_ local software_id=-1 - #DESKTOP_LXDE - software_id=23 + software_id=23 # Desktop LXDE if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - #Pre-create dirs + # Pre-create dirs mkdir -p /root/.config/openbox mkdir -p /root/.config/lxpanel/LXDE/panels mkdir -p /root/.config/pcmanfm/LXDE @@ -7178,17 +7041,17 @@ _EOF_ 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) - [[ -f /usr/share/applications/lxrandr.desktop ]] && rm /usr/share/applications/lxrandr.desktop + [[ -f '/usr/share/applications/lxrandr.desktop' ]] && rm /usr/share/applications/lxrandr.desktop # - Disable Trash G_CONFIG_INJECT 'use_trash=' 'use_trash=0' /etc/xdg/libfm/libfm.conf # - Firefox optimizations # ??? These keep adding new entries, ignore existing entry??? - # G_CONFIG_INJECT 'extensions.update.enabled' 'pref("extensions.update.enabled", false);' /etc/firefox-esr/firefox-esr.js - # G_CONFIG_INJECT 'datareporting.healthreport.uploadEnabled' 'pref("datareporting.healthreport.uploadEnabled", false);' /etc/firefox-esr/firefox-esr.js - # G_CONFIG_INJECT 'browser.cache.disk.parent_directory' 'pref("browser.cache.disk.parent_directory", "/tmp/firefox_cache");' /etc/firefox-esr/firefox-esr.js - # G_CONFIG_INJECT 'general.smoothScroll' 'pref("general.smoothScroll", false);' /etc/firefox-esr/firefox-esr.js + #G_CONFIG_INJECT 'extensions.update.enabled' 'pref("extensions.update.enabled", false);' /etc/firefox-esr/firefox-esr.js + #G_CONFIG_INJECT 'datareporting.healthreport.uploadEnabled' 'pref("datareporting.healthreport.uploadEnabled", false);' /etc/firefox-esr/firefox-esr.js + #G_CONFIG_INJECT 'browser.cache.disk.parent_directory' 'pref("browser.cache.disk.parent_directory", "/tmp/firefox_cache");' /etc/firefox-esr/firefox-esr.js + #G_CONFIG_INJECT 'general.smoothScroll' 'pref("general.smoothScroll", false);' /etc/firefox-esr/firefox-esr.js G_THREAD_WAIT @@ -7199,18 +7062,17 @@ _EOF_ fi - #Desktop MATE - software_id=24 + software_id=24 # Desktop MATE if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration Create_Desktop_Shared_Items - # - file manager desktop icon + # File manager desktop icon ln -sf /usr/share/applications/caja.desktop /root/Desktop/caja.desktop - #Odroid C2, define default pulseaudio sink: https://github.com/MichaIng/DietPi/issues/415 + # Odroid C2, define default pulseaudio sink: https://github.com/MichaIng/DietPi/issues/415 if (( $G_HW_MODEL == 12 )); then G_CONFIG_INJECT 'set-default-sink[[:blank:]]' 'set-default-sink alsa_output.platform-odroid_hdmi.37.analog-stereo' /etc/pulse/default.pa @@ -7219,8 +7081,22 @@ _EOF_ fi - #Desktop GNUStep - software_id=26 + software_id=173 # Desktop LXQt + if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then + + Banner_Configuration + + # Configs + Download_Install "https://github.com/MichaIng/DietPi/raw/$G_GITBRANCH/.conf/desktop/lxqt/lxqt-$G_DISTRO_NAME.7z" /root/.config + # Disable trash + # - Skip on Buster since trash seems to be implemented differently: https://github.com/MichaIng/DietPi/issues/1918#issuecomment-488085982 + (( $G_DISTRO < 5 )) && G_CONFIG_INJECT 'use_trash=' 'use_trash=0' /etc/xdg/libfm/libfm.conf + + Create_Desktop_Shared_Items + + fi + + software_id=26 # Desktop GNUStep if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -7228,8 +7104,7 @@ _EOF_ fi - #DESKTOP_XFCE - software_id=25 + software_id=25 # Desktop Xfce if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -7237,13 +7112,12 @@ _EOF_ fi - #WEBSERVER_APACHE - software_id=83 + software_id=83 # Apache Webserver if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - #Apache2 confs + # Apache2 confs G_BACKUP_FP /etc/apache2/apache2.conf dps_index=$software_id Download_Install 'apache2.conf' /etc/apache2/apache2.conf cat << _EOF_ > /etc/apache2/sites-available/000-default.conf @@ -7290,7 +7164,7 @@ _EOF_ _EOF_ - #Use /var/www as default webfolder + # Use /var/www as default webfolder mv /var/www/html/index.html /var/www/index.html &> /dev/null [[ $(ls -A /var/www/html 2>&1) ]] || rm -R /var/www/html @@ -7299,8 +7173,7 @@ _EOF_ fi - #WEBSERVER_NGINX - software_id=85 + software_id=85 # Nginx Webserver if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -7311,15 +7184,7 @@ _EOF_ G_BACKUP_FP /etc/nginx/nginx.conf dps_index=$software_id Download_Install 'nginx.conf' /etc/nginx/nginx.conf # Adjust socket name to PHP version - if (( $G_DISTRO < 4 )); then - - sed -i 's#/run/php/php7.0-fpm.sock#/run/php5-fpm.sock#g' /etc/nginx/nginx.conf - - elif (( $G_DISTRO > 4 )); then - - sed -i 's#php7.0-fpm.sock#php7.3-fpm.sock#g' /etc/nginx/nginx.conf - - fi + sed -i "s#/run/php/php.*-fpm.sock#/run/php/$PHP_NAME-fpm.sock#g" /etc/nginx/nginx.conf # - CPU core count sed -i "/worker_processes/c\worker_processes $G_HW_CPU_CORES;" /etc/nginx/nginx.conf @@ -7333,60 +7198,55 @@ _EOF_ fi - #WEBSERVER_LIGHTTPD - software_id=84 + software_id=84 # Lighttpd Webserver if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - #www path + # www path G_BACKUP_FP /etc/lighttpd/lighttpd.conf sed -i '/^server.document-root/c\server.document-root = "/var/www"' /etc/lighttpd/lighttpd.conf - #Configure fastcgi for PHP-FPM - local fp_php_fpm_sock="/var/run/php/$PHP_APT_PACKAGE_NAME-fpm.sock" - (( $G_DISTRO < 4 )) && fp_php_fpm_sock='/var/run/php5-fpm.sock' - + # Configure fastcgi for PHP-FPM cat << _EOF_ > /etc/lighttpd/conf-available/15-fastcgi-php.conf # -*- depends: fastcgi -*- # /usr/share/doc/lighttpd/fastcgi.txt.gz -# http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions#mod_fastcgi-fastcgi +# https://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions#mod_fastcgi-fastcgi ## Start an FastCGI server using php-fpm fastcgi.server += ( ".php" => (( - "socket" => "$fp_php_fpm_sock", + "socket" => "/run/php/${PHP_NAME}-fpm.sock", "broken-scriptfilename" => "enable" )) ) _EOF_ - #enable cgi/php + # Enable cgi/php lighttpd-enable-mod fastcgi lighttpd-enable-mod fastcgi-php - #Move default page + # Move default page mv /var/www/html/index.lighttpd.html /var/www/ [[ $(ls -A /var/www/html 2>&1) ]] || rm -R /var/www/html fi - #WEBSERVER_PHP - software_id=89 + software_id=89 # PHP if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - # - Apache2 has its own PHP module - if (( ${aSOFTWARE_INSTALL_STATE[83]} >= 1 )); then + # Apache2 has its own PHP module + if (( ${aSOFTWARE_INSTALL_STATE[83]} > 0 )); then # https://github.com/MichaIng/DietPi/issues/1144 local php_service='/lib/systemd/system/apache2.service' - # - Nginx and Lighttpd use PHP-FPM - elif (( ${aSOFTWARE_INSTALL_STATE[84]} >= 1 || ${aSOFTWARE_INSTALL_STATE[85]} >= 1 )); then + # Nginx and Lighttpd use PHP-FPM + elif (( ${aSOFTWARE_INSTALL_STATE[84]} > 0 || ${aSOFTWARE_INSTALL_STATE[85]} > 0 )); then - local php_service='/lib/systemd/system/php*-fpm.service' + local php_service="/lib/systemd/system/${PHP_NAME}-fpm.service" # - PHP-FPM confs sed -i '/cgi.fix_pathinfo=/c\cgi.fix_pathinfo=1' "$FP_PHP_BASE_DIR"/fpm/php.ini @@ -7408,70 +7268,59 @@ _EOF_ fi - # PHP cache settings - local target_php_cachesize=$(( $RAM_TOTAL / 30 )) - (( $target_php_cachesize < 10 )) && target_php_cachesize=10 - - # - OPcache - local target_php_ini="$FP_PHP_BASE_DIR/mods-available/opcache.ini" - - G_CONFIG_INJECT 'opcache.enable[[:blank:]]*=' 'opcache.enable=1' $target_php_ini - G_CONFIG_INJECT 'opcache.memory_consumption[[:blank:]]*=' "opcache.memory_consumption=$target_php_cachesize" $target_php_ini - G_CONFIG_INJECT 'opcache.revalidate_freq[[:blank:]]*=' 'opcache.revalidate_freq=60' $target_php_ini - - # - APCu - target_php_ini="$FP_PHP_BASE_DIR/mods-available/apcu.ini" - # - apc.shm_size= requires M at end to prevent warning: https://github.com/MichaIng/DietPi/issues/218 - target_php_cachesize+='M' - # - 3days TTL - local target_apc_ttl='259200' - - G_CONFIG_INJECT 'apc.shm_size[[:blank:]]*=' "apc.shm_size=$target_php_cachesize" $target_php_ini - G_CONFIG_INJECT 'apc.ttl[[:blank:]]*=' "apc.ttl=$target_apc_ttl" $target_php_ini - # We create our own PHP mod to add DietPi specific configs. target_php_ini="$FP_PHP_BASE_DIR/mods-available/dietpi.ini" - echo -e '; DietPi PHP settngs\n; priority=99' > $target_php_ini + echo -e '; DietPi PHP settngs\n; priority=98' > $target_php_ini - # - Set tmp_upload_dir to sd. Can't be /tmp as its ramdisk and limited size. Also used by ownCloud/Nextcloud uploads + # - Set upload_tmp_dir to disk. Can't be /tmp as its ramdisk and limited size. Also used by ownCloud/Nextcloud uploads # - If PHP uses PrivateTmp, we must not use own subfolder: https://github.com/MichaIng/DietPi/issues/1144 if [[ -f $php_service ]] && grep -q '^[[:blank:]]*PrivateTmp=true' $php_service; then - local tmp_upload_dir='/var/tmp' + local upload_tmp_dir='/var/tmp' else - local tmp_upload_dir='/var/tmp/php_upload_tmp' - mkdir -p $tmp_upload_dir - chown -R www-data:www-data $tmp_upload_dir + local upload_tmp_dir='/var/tmp/php_upload_tmp' + mkdir -p $upload_tmp_dir + chown -R www-data:www-data $upload_tmp_dir fi - G_CONFIG_INJECT 'upload_tmp_dir[[:blank:]]*=' "upload_tmp_dir=$tmp_upload_dir" $target_php_ini + G_CONFIG_INJECT 'upload_tmp_dir[[:blank:]]*=' "upload_tmp_dir=$upload_tmp_dir" $target_php_ini - # - max upload size + # - Max upload size local php_max_upload_size="$(( $(php -r 'print(PHP_INT_MAX);') / 1024 / 1024))M" # - upload_max_filesize G_CONFIG_INJECT 'upload_max_filesize[[:blank:]]*=' "upload_max_filesize=$php_max_upload_size" $target_php_ini # - post_max_size G_CONFIG_INJECT 'post_max_size[[:blank:]]*=' "post_max_size=$php_max_upload_size" $target_php_ini - # - Nginx - Set client_max_body_size to avoid 2MB upload error: https://github.com/MichaIng/DietPi/issues/546 - if (( ${aSOFTWARE_INSTALL_STATE[85]} >= 1 )); then + # - Nginx: Set client_max_body_size to avoid 2MB upload error: https://github.com/MichaIng/DietPi/issues/546 + if (( ${aSOFTWARE_INSTALL_STATE[85]} > 0 )); then - sed -i "/client_max_body_size/c\ client_max_body_size $php_max_upload_size;" /etc/nginx/nginx.conf + sed -i "/client_max_body_size/c\ client_max_body_size $php_max_upload_size;" /etc/nginx/nginx.conf fi # - Set UTF-8 G_CONFIG_INJECT 'default_charset[[:blank:]]*=' 'default_charset="UTF-8"' $target_php_ini - # Enable all installed and available PHP modules. - local modules_to_enable=$(ls "$FP_PHP_BASE_DIR"/mods-available | grep '.ini' | sed 's/.ini//') - ${PHP_BINARY}enmod "$modules_to_enable" + # - PHP cache settings + local target_php_cachesize=$(( $RAM_TOTAL / 30 )) + (( $target_php_cachesize < 10 )) && target_php_cachesize=10 + # - OPcache + G_CONFIG_INJECT 'opcache.enable[[:blank:]]*=' 'opcache.enable=1' $target_php_ini + G_CONFIG_INJECT 'opcache.memory_consumption[[:blank:]]*=' "opcache.memory_consumption=$target_php_cachesize" $target_php_ini + G_CONFIG_INJECT 'opcache.revalidate_freq[[:blank:]]*=' 'opcache.revalidate_freq=60' $target_php_ini + # - APCu + G_CONFIG_INJECT 'apc.shm_size[[:blank:]]*=' "apc.shm_size=${target_php_cachesize}M" $target_php_ini + G_CONFIG_INJECT 'apc.ttl[[:blank:]]*=' 'apc.ttl=259200' $target_php_ini # 3 days TTL + + # Enable all available PHP modules + phpenmod $(ls $FP_PHP_BASE_DIR/mods-available | sed -n '/\.ini$/{s/\.ini$//;p}') # Create PHP info pages within webroot, if webserver is installed. - if (( ${aSOFTWARE_INSTALL_STATE[83]} >= 1 || - ${aSOFTWARE_INSTALL_STATE[84]} >= 1 || - ${aSOFTWARE_INSTALL_STATE[85]} >= 1 )); then + if (( ${aSOFTWARE_INSTALL_STATE[83]} > 0 || + ${aSOFTWARE_INSTALL_STATE[84]} > 0 || + ${aSOFTWARE_INSTALL_STATE[85]} > 0 )); then # PHP info page echo '' > /var/www/phpinfo.php @@ -7487,8 +7336,7 @@ _EOF_ fi - #WEBSERVER_MARIADB - software_id=88 + software_id=88 # MariaDB Database if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -7505,8 +7353,8 @@ _EOF_ fi ### Also for MariaDB? - # Optimize for reduced memory use: https://github.com/MichaIng/DietPi/issues/605#issue-188930987 - #cat << _EOF_ > /etc/mysql/conf.d/reduce_resources.cnf + # Optimise for reduced memory use: https://github.com/MichaIng/DietPi/issues/605#issue-188930987 + #cat << _EOF_ > /etc/mysql/mariadb.conf.d/99-dietpi.cnf #[mysqld] #key_buffer_size=8M #max_connections=30 @@ -7517,8 +7365,7 @@ _EOF_ fi - #WEBSERVER_MYADMINPHP - software_id=90 + software_id=90 # phpMyAdmin if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -7539,27 +7386,25 @@ _EOF_ fi - #WEBSERVER_REDIS - software_id=91 + software_id=91 # Redis Database if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration # Enable redis php module, if installed: - ${PHP_BINARY}enmod redis 2> /dev/null + phpenmod redis 2> /dev/null fi - #OPENBAZAAR - software_id=58 + software_id=58 # OpenBazaar if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - # - Data dir + # Data dir mkdir -p $G_FP_DIETPI_USERDATA/openbazaar - # - Init OB to have config file available, if not yet the case, and edit to allow remote client access + # Init OB to have config file available, if not yet the case, and edit to allow remote client access if [[ ! -f $G_FP_DIETPI_USERDATA/openbazaar/config ]]; then openbazaar-go init -d $G_FP_DIETPI_USERDATA/openbazaar @@ -7599,13 +7444,12 @@ This is required, since the ${aSOFTWARE_WHIP_NAME[$software_id]} server node by fi - # - service + # Service cat << _EOF_ > /etc/systemd/system/openbazaar.service [Unit] Description=OpenBazaar (DietPi) [Service] -Type=simple Environment=GOPATH=$G_FP_DIETPI_USERDATA/go WorkingDirectory=$G_FP_DIETPI_USERDATA/go ExecStart=$(command -v openbazaar-go) start -d $G_FP_DIETPI_USERDATA/openbazaar @@ -7616,8 +7460,7 @@ _EOF_ fi - #YaCy - software_id=133 + software_id=133 # YaCy if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -7629,23 +7472,20 @@ _EOF_ Description=YaCy (DietPi) [Service] -Type=simple RemainAfterExit=yes -ExecStart=/bin/bash -c '/etc/yacy/startYACY.sh' -ExecStop=/bin/bash -c '/etc/yacy/stopYACY.sh' +ExecStart=/etc/yacy/startYACY.sh +ExecStop=/etc/yacy/stopYACY.sh [Install] WantedBy=multi-user.target _EOF_ - systemctl daemon-reload - # Create admin login account: + # Create admin login account: /etc/yacy/bin/passwd.sh "$GLOBAL_PW" fi - #Folding@Home - software_id=2 + software_id=2 # Folding@Home if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -7665,7 +7505,6 @@ _EOF_ Description=Folding@Home (DietPi) [Service] -Type=simple User=fahclient Group=dietpi WorkingDirectory=$G_FP_DIETPI_USERDATA/fahclient @@ -7673,24 +7512,23 @@ ExecStart=$(command -v FAHClient) --allow='0/0' --web-allow='0/0' --daemon=false [Install] WantedBy=multi-user.target - _EOF_ fi - #ownCloud - software_id=47 + software_id=47 # ownCloud if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration G_DIETPI-NOTIFY 2 'Enabling needed PHP modules.' # https://doc.owncloud.org/server/administration_manual/installation/manual_installation.html#php-extensions - ${PHP_BINARY}enmod curl gd intl json pdo_mysql opcache apcu redis + phpenmod curl gd intl json pdo_mysql opcache apcu redis # Following modules are switchable since Stretch: (( $G_DISTRO > 3 )) && phpenmod ctype dom fileinfo iconv mbstring posix simplexml xmlwriter xmlreader zip exif G_DIETPI-NOTIFY 2 'Enabling APCu memory cache for PHP command line usage (CLI) as well, including ownCloud occ command and cron jobs.' - G_CONFIG_INJECT 'apc.enable_cli[[:blank:]=]' 'apc.enable_cli=1' "$FP_PHP_BASE_DIR/mods-available/apcu.ini" + echo -e '; ownCloud PHP settngs\n; priority=99\napc.enable_cli=1' > $FP_PHP_BASE_DIR/mods-available/dietpi-owncloud.ini + phpenmod dietpi-owncloud if (( ${aSOFTWARE_INSTALL_STATE[83]} > 0 )); then @@ -7787,7 +7625,7 @@ url.redirect += ( fi # Cal/CardDAV redirects to ownCloud DAV endpoint - if [[ ! -f /etc/nginx/sites-dietpi/dietpi-dav_redirect.conf ]]; then + if [[ ! -f '/etc/nginx/sites-dietpi/dietpi-dav_redirect.conf' ]]; then echo '# Redirect Cal/CardDAV requests to ownCloud endpoint: location = /.well-known/carddav { @@ -7899,7 +7737,7 @@ _EOF_ sed -i "s|'http://localhost'|'http://localhost/owncloud'|g" $config_php # Set pretty URLs (without /index.php/) on Apache: - if (( ${aSOFTWARE_INSTALL_STATE[83]} >= 1 )); then + if (( ${aSOFTWARE_INSTALL_STATE[83]} > 0 )); then GCI_PRESERVE=1 G_CONFIG_INJECT "'htaccess.RewriteBase'" "'htaccess.RewriteBase' => '/owncloud'," $config_php "'overwrite.cli.url'" occ maintenance:update:htaccess @@ -7943,27 +7781,20 @@ _EOF_ fi - #Nextcloud - software_id=114 + software_id=114 # Nextcloud if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - G_DIETPI-NOTIFY 2 'Enabling needed PHP modules.' # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation - ${PHP_BINARY}enmod curl gd intl json pdo_mysql opcache apcu redis + G_DIETPI-NOTIFY 2 'Enabling required PHP modules.' # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation + phpenmod curl gd intl json pdo_mysql opcache apcu redis # Following modules are switchable since Stretch: (( $G_DISTRO > 3 )) && phpenmod ctype dom fileinfo iconv mbstring posix simplexml xmlwriter xmlreader zip exif - G_DIETPI-NOTIFY 2 'Enabling APCu memory cache for PHP command line usage (CLI) as well, including Nextcloud ncc command and cron jobs.' - G_CONFIG_INJECT 'apc.enable_cli[[:blank:]=]' 'apc.enable_cli=1' "$FP_PHP_BASE_DIR/mods-available/apcu.ini" - - G_DIETPI-NOTIFY 2 'Enabling and configuring OPcache for Nextcloud.' # https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/server_tuning.html#enable-php-opcache - G_CONFIG_INJECT 'opcache.enable[[:blank:]=]' 'opcache.enable=1' "$FP_PHP_BASE_DIR/mods-available/opcache.ini" - G_CONFIG_INJECT 'opcache.enable_cli[[:blank:]=]' 'opcache.enable_cli=1' "$FP_PHP_BASE_DIR/mods-available/opcache.ini" - G_CONFIG_INJECT 'opcache.interned_strings_buffer[[:blank:]=]' 'opcache.interned_strings_buffer=8' "$FP_PHP_BASE_DIR/mods-available/opcache.ini" - G_CONFIG_INJECT 'opcache.max_accelerated_files[[:blank:]=]' 'opcache.max_accelerated_files=10000' "$FP_PHP_BASE_DIR/mods-available/opcache.ini" - G_CONFIG_INJECT 'opcache.save_comments[[:blank:]=]' 'opcache.save_comments=1' "$FP_PHP_BASE_DIR/mods-available/opcache.ini" - G_CONFIG_INJECT 'opcache.revalidate_freq[[:blank:]=]' 'opcache.revalidate_freq=1' "$FP_PHP_BASE_DIR/mods-available/opcache.ini" + G_DIETPI-NOTIFY 2 'Optimising APCu and OPcache modules for Nextcloud.' # https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/server_tuning.html#enable-php-opcache + echo -e '; Nextcloud PHP settngs\n; priority=99\napc.enable_cli=1\nopcache.enable=1\nopcache.interned_strings_buffer=8 +opcache.max_accelerated_files=10000\nopcache.memory_consumption=128\nopcache.save_comments=1\nopcache.revalidate_freq=1' > $FP_PHP_BASE_DIR/mods-available/dietpi-nextcloud.ini + phpenmod dietpi-nextcloud if (( ${aSOFTWARE_INSTALL_STATE[83]} > 0 )); then @@ -8059,7 +7890,7 @@ url.redirect += ( fi # Cal/CardDAV redirects to Nextcloud DAV endpoint - if [[ ! -f /etc/nginx/sites-dietpi/dietpi-dav_redirect.conf ]]; then + if [[ ! -f '/etc/nginx/sites-dietpi/dietpi-dav_redirect.conf' ]]; then echo '# Redirect Cal/CardDAV requests to Nextcloud endpoint: location = /.well-known/carddav { @@ -8200,7 +8031,7 @@ The install script will now exit. After applying one of the the above, rerun die sed -i "s|'http://localhost'|'http://localhost/nextcloud'|g" $config_php # Set pretty URLs (without /index.php/) on Apache: - if (( ${aSOFTWARE_INSTALL_STATE[83]} >= 1 )); then + if (( ${aSOFTWARE_INSTALL_STATE[83]} > 0 )); then GCI_PRESERVE=1 G_CONFIG_INJECT "'htaccess.RewriteBase'" "'htaccess.RewriteBase' => '/nextcloud'," $config_php "'overwrite.cli.url'" ncc maintenance:update:htaccess @@ -8254,11 +8085,11 @@ The install script will now exit. After applying one of the the above, rerun die G_DIETPI-NOTIFY 2 'Configuring TURN server:' # Buster (systemd unit) - if (( $G_DISTRO > 4 )); then + if [[ -f '/lib/systemd/system/coturn.service' ]]; then # - Remove init.d service traces - [[ -f /etc/init.d/coturn ]] && rm /etc/init.d/coturn - [[ -f /etc/default/coturn ]] && rm /etc/default/coturn + [[ -f '/etc/init.d/coturn' ]] && rm /etc/init.d/coturn + [[ -f '/etc/default/coturn' ]] && rm /etc/default/coturn # - Disable coturn logging by default, this can be overridden via /etc/turnserver.conf mkdir -p /etc/systemd/system/coturn.service.d @@ -8295,13 +8126,13 @@ The install script will now exit. After applying one of the the above, rerun die done invalid_text='' - local port=5349 + local port=3478 while : 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: 5349" +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 port=$G_WHIP_RETURNED_VALUE @@ -8315,40 +8146,41 @@ NB: This port needs to be forwarded by your router and/or opened in your firewal done - # Adjust coturn settings + # Adjust coTURN settings # - On Buster by default /etc/turnserver.conf is not created. Use example or create empty file: - if [[ ! -f /etc/turnserver.conf ]]; then + if [[ ! -f '/etc/turnserver.conf' ]]; then > /etc/turnserver.conf - [[ -f /usr/share/doc/coturn/examples/etc/turnserver.conf.gz ]] && gzip -cd /usr/share/doc/coturn/examples/etc/turnserver.conf.gz > /etc/turnserver.conf + [[ -f '/usr/share/doc/coturn/examples/etc/turnserver.conf.gz' ]] && gzip -cd /usr/share/doc/coturn/examples/etc/turnserver.conf.gz > /etc/turnserver.conf fi + # - Estimate coTURN version to handle outdated settings correctly + local version=$(dpkg-query -Wf '${Version}' coturn); version=${version:0:7}; version=${version//./} + # https://help.nextcloud.com/t/howto-setup-nextcloud-talk-with-turn-server/30794 + G_CONFIG_INJECT 'listening-port=' "listening-port=$port" /etc/turnserver.conf G_CONFIG_INJECT 'fingerprint' 'fingerprint' /etc/turnserver.conf G_CONFIG_INJECT 'use-auth-secret' 'use-auth-secret' /etc/turnserver.conf + if (( $version < 4508 )); then + + G_CONFIG_INJECT 'lt-cred-mech' 'lt-cred-mech' /etc/turnserver.conf + + else + + sed -i '/^[[:blank:]]*lt-cred-mech/#lt-cred-mech/' /etc/turnserver.conf + + fi G_CONFIG_INJECT 'realm=' "realm=$domain" /etc/turnserver.conf GCI_PRESERVE=1 G_CONFIG_INJECT 'total-quota=' 'total-quota=100' /etc/turnserver.conf GCI_PRESERVE=1 G_CONFIG_INJECT 'bps-capacity=' 'bps-capacity=0' /etc/turnserver.conf G_CONFIG_INJECT 'stale-nonce' 'stale-nonce' /etc/turnserver.conf G_CONFIG_INJECT 'no-loopback-peers' 'no-loopback-peers' /etc/turnserver.conf - G_CONFIG_INJECT 'no-multicast-peers' 'no-multicast-peers' /etc/turnserver.conf - - # Add TLS settings, if LetsEncrypt certificates are available: - if [[ -f /DietPi/dietpi/.dietpi-letsencrypt && - -f /etc/letsencrypt/live/$(sed -n 1p /DietPi/dietpi/.dietpi-letsencrypt)/cert.pem ]]; then - - G_DIETPI-NOTIFY 2 'LetsEncrypt certificate found, will configure coturn TURN server to accept TLS connections' - # - Disable non-TLS listening port, enable TLS listening port: - G_CONFIG_INJECT 'listening-port=' "#listening-port=$port" /etc/turnserver.conf - G_CONFIG_INJECT 'tls-listening-port=' "tls-listening-port=$port" /etc/turnserver.conf - local fp_cert_dir="/etc/letsencrypt/live/$(sed -n 1p /DietPi/dietpi/.dietpi-letsencrypt)" - G_CONFIG_INJECT 'cert=' "cert=$fp_cert_dir/cert.pem" /etc/turnserver.conf - G_CONFIG_INJECT 'pkey=' "pkey=$fp_cert_dir/privkey.pem" /etc/turnserver.conf - # - Proven working default cipher, but thus should be properly reworked, e.g. to match webserver settings? - G_CONFIG_INJECT 'cipher-list=' 'cipher-list="ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AES:RSA+3DES:!ADH:!AECDH:!MD5"' /etc/turnserver.conf + if (( $version < 4510 )); then + + G_CONFIG_INJECT 'no-multicast-peers' 'no-multicast-peers' /etc/turnserver.conf else - G_CONFIG_INJECT 'listening-port=' "listening-port=$port" /etc/turnserver.conf + sed -i '/^[[:blank:]]*no-multicast-peers/d' /etc/turnserver.conf fi @@ -8356,7 +8188,7 @@ NB: This port needs to be forwarded by your router and/or opened in your firewal G_RUN_CMD systemctl start $MARIADB_SERVICE G_RUN_CMD systemctl start redis-server G_RUN_CMD ncc maintenance:mode --off - [[ -d /var/www/nextcloud/apps/spreed ]] || G_RUN_CMD ncc app:install spreed + [[ -d '/var/www/nextcloud/apps/spreed' ]] || G_RUN_CMD ncc app:install spreed ncc app:enable spreed # Adjust Nextcloud Talk settings to use coturn @@ -8368,7 +8200,7 @@ NB: This port needs to be forwarded by your router and/or opened in your firewal secret=$(grep -m1 '^[[:blank:]]*static-auth-secret=' /etc/turnserver.conf) secret=${secret#*static-auth-secret=} ncc config:app:set spreed turn_servers --value="[{\"server\":\"$domain:$port\",\"secret\":\"$secret\",\"protocols\":\"udp,tcp\"}]" - unset secret domain port invalid_text + unset secret domain port invalid_text version fi @@ -8377,20 +8209,19 @@ NB: This port needs to be forwarded by your router and/or opened in your firewal Banner_Configuration - # Remove obsolete init.d service and it's environment file - [[ -f /etc/init.d/transmission-daemon ]] && rm /etc/init.d/transmission-daemon - [[ -f /etc/default/transmission-daemon ]] && rm /etc/default/transmission-daemon + # Remove obsolete init.d service and its environment file + [[ -f '/etc/init.d/transmission-daemon' ]] && rm /etc/init.d/transmission-daemon + [[ -f '/etc/default/transmission-daemon' ]] && rm /etc/default/transmission-daemon # Run service as "dietpi" group: https://github.com/MichaIng/DietPi/issues/350#issuecomment-423763518 mkdir -p /etc/systemd/system/transmission-daemon.service.d echo -e '[Service]\nGroup=dietpi' > /etc/systemd/system/transmission-daemon.service.d/dietpi-group.conf - # Apply optimized settings - G_CONFIG_INJECT '"cache-size-mb"' ' "cache-size-mb": '$(Optimize_BitTorrent 0)',' /etc/transmission-daemon/settings.json '^\{$' - G_CONFIG_INJECT '"download-queue-size"' ' "download-queue-size": '$(Optimize_BitTorrent 1)',' /etc/transmission-daemon/settings.json '^\{$' - G_CONFIG_INJECT '"peer-limit-global"' ' "peer-limit-global": '$(Optimize_BitTorrent 2)',' /etc/transmission-daemon/settings.json '^\{$' - G_CONFIG_INJECT '"max-peers-global"' ' "max-peers-global": '$(Optimize_BitTorrent 2)',' /etc/transmission-daemon/settings.json '^\{$' - G_CONFIG_INJECT '"upload-slots-per-torrent"' ' "upload-slots-per-torrent": '$(Optimize_BitTorrent 3)',' /etc/transmission-daemon/settings.json '^\{$' + # Apply optimised settings + G_CONFIG_INJECT '"cache-size-mb"' ' "cache-size-mb": '$(Optimise_BitTorrent 0)',' /etc/transmission-daemon/settings.json '^\{$' + G_CONFIG_INJECT '"download-queue-size"' ' "download-queue-size": '$(Optimise_BitTorrent 1)',' /etc/transmission-daemon/settings.json '^\{$' + G_CONFIG_INJECT '"peer-limit-global"' ' "peer-limit-global": '$(Optimise_BitTorrent 2)',' /etc/transmission-daemon/settings.json '^\{$' + G_CONFIG_INJECT '"upload-slots-per-torrent"' ' "upload-slots-per-torrent": '$(Optimise_BitTorrent 3)',' /etc/transmission-daemon/settings.json '^\{$' G_CONFIG_INJECT '"port-forwarding-enabled"' ' "port-forwarding-enabled": true,' /etc/transmission-daemon/settings.json '^\{$' G_CONFIG_INJECT '"encryption"' ' "encryption": 2,' /etc/transmission-daemon/settings.json '^\{$' @@ -8402,7 +8233,9 @@ NB: This port needs to be forwarded by your router and/or opened in your firewal G_CONFIG_INJECT '"trash-original-torrent-files"' ' "trash-original-torrent-files": true,' /etc/transmission-daemon/settings.json '^\{$' G_CONFIG_INJECT '"download-dir"' ' "download-dir": "'$G_FP_DIETPI_USERDATA'/downloads",' /etc/transmission-daemon/settings.json '^\{$' - G_CONFIG_INJECT '"rpc-password"' ' "rpc-password": "'"$GLOBAL_PW"'",' /etc/transmission-daemon/settings.json '^\{$' + # - Double quotes need to be escaped in .json files: https://github.com/MichaIng/DietPi/issues/2484#issuecomment-481374924 + # - ToDo: Hash password directly. Which hash method is used? + GCI_PASSWORD=1 G_CONFIG_INJECT '"rpc-password"' ' "rpc-password": "'"${GLOBAL_PW//\"/\\\"}"'",' /etc/transmission-daemon/settings.json '^\{$' G_CONFIG_INJECT '"rpc-username"' ' "rpc-username": "root",' /etc/transmission-daemon/settings.json '^\{$' G_CONFIG_INJECT '"rpc-whitelist-enabled"' ' "rpc-whitelist-enabled": false,' /etc/transmission-daemon/settings.json '^\{$' G_CONFIG_INJECT '"message-level"' ' "message-level": 0,' /etc/transmission-daemon/settings.json '^\{$' @@ -8412,8 +8245,7 @@ NB: This port needs to be forwarded by your router and/or opened in your firewal fi - #PHPBB - software_id=54 + software_id=54 # phpBB Forum if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -8441,12 +8273,12 @@ NB: This port needs to be forwarded by your router and/or opened in your firewal >> $G_FP_DIETPI_USERDATA/.mpd_cache/state >> $G_FP_DIETPI_USERDATA/.mpd_cache/sticker.sql # - Symlink from MPD defaults that applications may still expect/use. - [[ ! -e /var/lib/mpd/music || -L /var/lib/mpd/music ]] || mv -n /var/lib/mpd/music/* $G_FP_DIETPI_USERDATA/Music/ &> /dev/null - [[ ! -e /var/lib/mpd/playlists || -L /var/lib/mpd/playlists ]] || mv -n /var/lib/mpd/playlists/* $G_FP_DIETPI_USERDATA/Music/ &> /dev/null - [[ ! -e /var/lib/mpd/mpd.db || -L /var/lib/mpd/mpd.db ]] || mv -n /var/lib/mpd/mpd.db $G_FP_DIETPI_USERDATA/.mpd_cache/db_file - [[ ! -e /var/lib/mpd/state || -L /var/lib/mpd/state ]] || mv -n /var/lib/mpd/state $G_FP_DIETPI_USERDATA/.mpd_cache/state - [[ ! -e /var/lib/mpd/sticker.sql || -L /var/lib/mpd/sticker.sql ]] || mv -n /var/lib/mpd/sticker.sql $G_FP_DIETPI_USERDATA/.mpd_cache/sticker.sql - [[ -d /var/lib/mpd ]] && rm -R /var/lib/mpd + [[ ! -e '/var/lib/mpd/music' || -L '/var/lib/mpd/music' ]] || mv -n /var/lib/mpd/music/* $G_FP_DIETPI_USERDATA/Music/ &> /dev/null + [[ ! -e '/var/lib/mpd/playlists' || -L '/var/lib/mpd/playlists' ]] || mv -n /var/lib/mpd/playlists/* $G_FP_DIETPI_USERDATA/Music/ &> /dev/null + [[ ! -e '/var/lib/mpd/mpd.db' || -L '/var/lib/mpd/mpd.db' ]] || mv -n /var/lib/mpd/mpd.db $G_FP_DIETPI_USERDATA/.mpd_cache/db_file + [[ ! -e '/var/lib/mpd/state' || -L '/var/lib/mpd/state' ]] || mv -n /var/lib/mpd/state $G_FP_DIETPI_USERDATA/.mpd_cache/state + [[ ! -e '/var/lib/mpd/sticker.sql' || -L '/var/lib/mpd/sticker.sql' ]] || mv -n /var/lib/mpd/sticker.sql $G_FP_DIETPI_USERDATA/.mpd_cache/sticker.sql + [[ -d '/var/lib/mpd' ]] && rm -R /var/lib/mpd mkdir -p /var/lib/mpd ln -sf $G_FP_DIETPI_USERDATA/Music /var/lib/mpd/music ln -sf $G_FP_DIETPI_USERDATA/Music /var/lib/mpd/playlists @@ -8466,7 +8298,7 @@ NB: This port needs to be forwarded by your router and/or opened in your firewal fi # MPD service/confs - [[ -f /etc/default/mpd ]] && rm /etc/default/mpd + [[ -f '/etc/default/mpd' ]] && rm /etc/default/mpd # - Upsteam systemd unit: https://github.com/MusicPlayerDaemon/MPD/blob/master/systemd/system/mpd.service.in # - Debian package systemd unit: https://deb.debian.org/debian/pool/main/m/mpd/ @@ -8542,8 +8374,7 @@ _EOF_ fi - # Proftpd - software_id=94 + software_id=94 # ProFTPD if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -8555,8 +8386,7 @@ _EOF_ fi - #Samba Server - software_id=96 + software_id=96 # Samba Server if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -8571,8 +8401,7 @@ _EOF_ fi - #vsFTPD - software_id=95 + software_id=95 # vsFTPD if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -8587,8 +8416,7 @@ _EOF_ fi - #NFS_SERVER - software_id=109 + software_id=109 # NFS Server if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -8599,8 +8427,7 @@ _EOF_ fi - #YMPD - software_id=32 + software_id=32 # ympd if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -8609,14 +8436,13 @@ _EOF_ getent passwd ympd &> /dev/null && usercmd='usermod' $usercmd ympd -G dietpi -s /usr/sbin/nologin - #YMPD service + # YMPD service cat << _EOF_ > /etc/systemd/system/ympd.service [Unit] Description=YMPD (DietPi) After=mpd.service [Service] -Type=simple #User=ympd # Changes to ympd during run Group=dietpi ExecStart=/usr/bin/ympd --user ympd --webport 1337 @@ -8627,8 +8453,7 @@ _EOF_ fi - #myMPD - software_id=148 + software_id=148 # myMPD if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -8643,7 +8468,6 @@ Description=myMPD (DietPi) After=mpd.service [Service] -Type=simple #User=mympd # Changes at runlevel Group=dietpi ExecStart=$(command -v mympd) /etc/mympd/mympd.conf @@ -8659,18 +8483,17 @@ _EOF_ mkdir -p /var/lib/mympd/smartpls /var/lib/mympd/tmp - #symlink music/libary folders used by mympd + # Symlink music/libary folders used by mympd if [[ $(readlink /usr/share/mympd/htdocs/library) != $G_FP_DIETPI_USERDATA/Music ]]; then - [[ -d /usr/share/mympd/htdocs/library ]] && rm -R /usr/share/mympd/htdocs/library + [[ -d '/usr/share/mympd/htdocs/library' ]] && rm -R /usr/share/mympd/htdocs/library ln -sf $G_FP_DIETPI_USERDATA/Music /usr/share/mympd/htdocs/library fi fi - #Roon Bridge - software_id=121 + software_id=121 # Roon Bridge if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -8696,23 +8519,21 @@ _EOF_ fi - #NodeRed - software_id=122 + software_id=122 # Node-RED if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration mkdir -p $G_FP_DIETPI_USERDATA/node-red - adduser nodered --system --group --shell=/bin/nologin + adduser nodered --system --group --shell=/usr/bin/nologin usermod -a -G gpio nodered cat << _EOF_ > /etc/systemd/system/node-red.service [Unit] -Description=Node-Red (DietPi) +Description=Node-RED (DietPi) [Service] -Type=simple User=nodered ExecStart=/usr/local/bin/node-red -u $G_FP_DIETPI_USERDATA/node-red @@ -8725,17 +8546,18 @@ _EOF_ fi - #Tomcat8 - software_id=125 + software_id=125 # Tomcat8 if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - sed -i "/JAVA_HOME=/c\JAVA_HOME=$(find \/usr\/lib\/jvm\/ -name java-8-openjdk*)" /etc/default/tomcat8 + + local java=8 + (( $G_DISTRO > 4 )) && java=11 + G_CONFIG_INJECT 'JAVA_HOME=' "JAVA_HOME=$(find /usr/lib/jvm/ -name java-$java-openjdk*)" /etc/default/tomcat8 fi - #CAVA - software_id=119 + software_id=119 # CAVA if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -8770,8 +8592,7 @@ _EOF_ fi - #Mopidy - software_id=118 + software_id=118 # Mopidy if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -8781,14 +8602,13 @@ _EOF_ G_CONFIG_INJECT 'cache_dir[[:blank:]]*=' 'cache_dir = /mnt/dietpi_userdata/mopidy/cache' /etc/mopidy/mopidy.conf '\[core\]' # - Move existing home+data to dietpi_userdata, if not yet existent - if [[ -d /var/lib/mopidy && ! -d $G_FP_DIETPI_USERDATA/mopidy ]]; then + if [[ -d '/var/lib/mopidy' && ! -d $G_FP_DIETPI_USERDATA/mopidy ]]; then mv /var/lib/mopidy $G_FP_DIETPI_USERDATA/mopidy mkdir -p $G_FP_DIETPI_USERDATA/mopidy/data # - Non-hidden files/folders are data mv $G_FP_DIETPI_USERDATA/mopidy/* $G_FP_DIETPI_USERDATA/mopidy/data - else mkdir -p $G_FP_DIETPI_USERDATA/mopidy/data @@ -8797,7 +8617,7 @@ _EOF_ fi # - Move existing cache to dietpi_userdata, if not yet existent - if [[ -d /var/cache/mopidy && ! -d $G_FP_DIETPI_USERDATA/mopidy/cache ]]; then + if [[ -d '/var/cache/mopidy' && ! -d $G_FP_DIETPI_USERDATA/mopidy/cache ]]; then mv /var/cache/mopidy $G_FP_DIETPI_USERDATA/mopidy/cache @@ -8819,8 +8639,7 @@ _EOF_ fi - #Kodi - software_id=31 + software_id=31 # Kodi if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -8829,7 +8648,7 @@ _EOF_ userdel -r kodi &> /dev/null #Run Kodi as root - [[ -f /etc/default/kodi ]] && G_CONFIG_INJECT 'USER=' 'USER=root' /etc/default/kodi + [[ -f '/etc/default/kodi' ]] && G_CONFIG_INJECT 'USER=' 'USER=root' /etc/default/kodi #Copy udev rules, probably not needed for root, but we'll do it anyway dps_index=$software_id Download_Install '99-dietpi-kodi.rules' /etc/udev/rules.d/99-dietpi-kodi.rules @@ -8837,14 +8656,13 @@ _EOF_ #Create .desktop SymLinks mkdir -p /root/Desktop - [[ -f /usr/share/applications/kodi.desktop ]] && rm /usr/share/applications/kodi.desktop + [[ -f '/usr/share/applications/kodi.desktop' ]] && rm /usr/share/applications/kodi.desktop G_RUN_CMD wget https://raw.githubusercontent.com/MichaIng/DietPi/$G_GITBRANCH/.conf/desktop/apps/kodi.desktop -O /usr/share/applications/kodi.desktop ln -sf /usr/share/applications/kodi.desktop /root/Desktop/kodi.desktop fi - #MINIDLNA - software_id=39 + software_id=39 # MiniDLNA if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -8862,7 +8680,6 @@ Description=MiniDLNA (DietPi) After=network.target [Service] -Type=simple User=minidlna Group=dietpi RuntimeDirectory=minidlna @@ -8870,31 +8687,28 @@ ExecStart=$(command -v minidlnad) -SR -f /etc/minidlna.conf [Install] WantedBy=multi-user.target - _EOF_ - #Copy Config + # Copy Config G_BACKUP_FP /etc/minidlna.conf dps_index=$software_id Download_Install 'minidlna.conf' /etc/minidlna.conf - #Setup data directories + # Setup data directories mkdir -p $G_FP_DIETPI_USERDATA/.MiniDLNA_Cache Download_Test_Media fi - - #NoIp - software_id=67 + software_id=67 # No-IP if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - #Failsafe: Directory required for "noip2 -C" to create the config file + # Failsafe: Directory required for "noip2 -C" to create the config file mkdir -p /usr/local/etc - #noip2 service file + # noip2 service file cat << _EOF_ > /etc/systemd/system/noip2.service [Unit] Description=noip2 (DietPi) @@ -8904,7 +8718,6 @@ ConditionPathExists=/usr/local/etc/no-ip2.conf [Service] Type=forking RemainAfterExit=yes - ExecStart=/usr/local/bin/noip2 ExecStop=/usr/bin/killall -w noip2 @@ -8914,13 +8727,12 @@ _EOF_ fi - #amiberry - software_id=108 + software_id=108 # Amiberry if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - #Allow binary execution + # Allow binary execution chmod -R +x $G_FP_DIETPI_USERDATA/amiberry local amiberry_filename=0 @@ -8964,7 +8776,7 @@ _EOF_ mkdir -p $G_FP_DIETPI_USERDATA/amiberry/hdf mkdir -p $G_FP_DIETPI_USERDATA/amiberry/cd - #Uae4arm does not support browsing symlinks (https://github.com/MichaIng/DietPi/issues/474#issuecomment-242973839) + # Uae4arm does not support browsing symlinks (https://github.com/MichaIng/DietPi/issues/474#issuecomment-242973839) # So we need to change config file default paths to actual userdata location: local fp_userdata_actual=$(readlink $G_FP_DIETPI_USERDATA) # Only returns a value if symlink exists (eg: off SDcard) if [[ -n $fp_userdata_actual ]]; then @@ -8987,7 +8799,6 @@ _EOF_ Description=AmiBerry Amiga Emulator (DietPi) [Service] -Type=simple #StandardOutput=tty #StandardInput=tty #TTYPath=/dev/tty1 @@ -9001,7 +8812,7 @@ WantedBy=local-fs.target _EOF_ cat << _EOF_ > $G_FP_DIETPI_USERDATA/amiberry/run.sh -#!/bin/bash +#!/bin/dash cd $G_FP_DIETPI_USERDATA/amiberry ./$amiberry_filename -f conf/autostart.uae _EOF_ @@ -9010,13 +8821,12 @@ _EOF_ fi - #dxx-rebirth - software_id=112 + software_id=112 # DDX-Rebirth if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - #Symlink savegames to root + # Symlink savegames to root # - Remove existing syslinks rm -R /root/.d1x-rebirth &> /dev/null rm -R /root/.d2x-rebirth &> /dev/null @@ -9024,10 +8834,10 @@ _EOF_ ln -sf $G_FP_DIETPI_USERDATA/dxx-rebirth/descent_1_profiles /root/.d1x-rebirth ln -sf $G_FP_DIETPI_USERDATA/dxx-rebirth/descent_2_profiles /root/.d2x-rebirth - #+exe + # +exe chmod +x -R $G_FP_DIETPI_USERDATA/dxx-rebirth/* - #Create .Desktop SymLinks + # Create .Desktop SymLinks mkdir -p /root/Desktop mkdir -p /usr/share/applications @@ -9036,17 +8846,16 @@ _EOF_ fi - #OpenTyrian - software_id=51 + software_id=51 # OpenTyrian if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - #Copy the DietPi run file for OpenTyrian - dps_index=$software_id Download_Install 'run' /usr/local/games/opentyrian/run - chmod +x /usr/local/games/opentyrian/run + # Copy the DietPi run file for OpenTyrian + dps_index=$software_id Download_Install 'run' /usr/games/opentyrian/run + chmod +x /usr/games/opentyrian/run - #Create .Desktop SymLinks + # Create .Desktop SymLinks mkdir -p /root/Desktop rm /usr/share/applications/opentyrian.desktop &> /dev/null G_RUN_CMD wget https://raw.githubusercontent.com/MichaIng/DietPi/$G_GITBRANCH/.conf/desktop/apps/opentyrian.desktop -O /usr/share/applications/opentyrian.desktop @@ -9054,8 +8863,7 @@ _EOF_ fi - #DIETPICAM - software_id=59 + software_id=59 # RPi Cam Control if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -9077,17 +8885,16 @@ _EOF_ Description=Raspimjpeg (DietPi) [Service] -Type=simple RemainAfterExit=yes -ExecStart=$(command -v bash) -c '/var/lib/dietpi/dietpi-software/installed/raspimjpeg.sh start' -ExecStop=$(command -v bash) -c '/var/lib/dietpi/dietpi-software/installed/raspimjpeg.sh stop' +ExecStart=/var/lib/dietpi/dietpi-software/installed/raspimjpeg.sh start +ExecStop=/var/lib/dietpi/dietpi-software/installed/raspimjpeg.sh stop [Install] WantedBy=multi-user.target _EOF_ # - Replace confs with /var/www to /var/www/rpicam, once - if (( ! $(grep -ci -m1 '/rpicam' /etc/raspimjpeg) )); then + if ! grep -q '/rpicam' /etc/raspimjpeg; then sed -i 's#/var/www#/var/www/rpicam#g' /etc/raspimjpeg sed -i 's#/var/www#/var/www/rpicam#g' /etc/motion/motion.conf @@ -9153,7 +8960,7 @@ WantedBy=multi-user.target _EOF_ # Add web.log to logrotate config - if [[ -f /etc/logrotate.d/deluged ]] && ! grep -q 'web.log' /etc/logrotate.d/deluged; then + if [[ -f '/etc/logrotate.d/deluged' ]] && ! grep -q 'web.log' /etc/logrotate.d/deluged; then echo -e "\n$(> /etc/logrotate.d/deluged sed -i '1,1s/daemon.log/web.log/' /etc/logrotate.d/deluged @@ -9172,18 +8979,18 @@ _EOF_ # Apply optimised settings # - Cache size is in steps of 16 KiB. (Cachesize * 16 = total KiB) - sed -i '/"cache_size": /c\ "cache_size": '$(( $(Optimize_BitTorrent 0) * 1024 / 16 ))',' $G_FP_DIETPI_USERDATA/deluge/.config/deluge/core.conf - sed -i '/"max_active_limit": /c\ "max_active_limit": '$(Optimize_BitTorrent 1)',' $G_FP_DIETPI_USERDATA/deluge/.config/deluge/core.conf - sed -i '/"max_active_downloading": /c\ "max_active_downloading": '$(Optimize_BitTorrent 1)',' $G_FP_DIETPI_USERDATA/deluge/.config/deluge/core.conf - sed -i '/"max_connections_global": /c\ "max_connections_global": '$(Optimize_BitTorrent 2)',' $G_FP_DIETPI_USERDATA/deluge/.config/deluge/core.conf - sed -i '/"max_upload_slots_global": /c\ "max_upload_slots_global": '$(Optimize_BitTorrent 3)',' $G_FP_DIETPI_USERDATA/deluge/.config/deluge/core.conf + sed -i '/"cache_size": /c\ "cache_size": '$(( $(Optimise_BitTorrent 0) * 1024 / 16 ))',' $G_FP_DIETPI_USERDATA/deluge/.config/deluge/core.conf + sed -i '/"max_active_limit": /c\ "max_active_limit": '$(Optimise_BitTorrent 1)',' $G_FP_DIETPI_USERDATA/deluge/.config/deluge/core.conf + sed -i '/"max_active_downloading": /c\ "max_active_downloading": '$(Optimise_BitTorrent 1)',' $G_FP_DIETPI_USERDATA/deluge/.config/deluge/core.conf + sed -i '/"max_connections_global": /c\ "max_connections_global": '$(Optimise_BitTorrent 2)',' $G_FP_DIETPI_USERDATA/deluge/.config/deluge/core.conf + sed -i '/"max_upload_slots_global": /c\ "max_upload_slots_global": '$(Optimise_BitTorrent 3)',' $G_FP_DIETPI_USERDATA/deluge/.config/deluge/core.conf fi # Remove init.d service leftovers, installed by Debian APT package - [[ -f /etc/init.d/deluged ]] && rm /etc/init.d/deluged - [[ -f /etc/default/deluged ]] && rm /etc/default/deluged - [[ -d /var/lib/deluged ]] && rm -R /var/lib/deluged + [[ -f '/etc/init.d/deluged' ]] && rm /etc/init.d/deluged + [[ -f '/etc/default/deluged' ]] && rm /etc/default/deluged + [[ -d '/var/lib/deluged' ]] && rm -R /var/lib/deluged fi @@ -9200,8 +9007,8 @@ Description=Webmin (DietPi) [Service] Type=forking -ExecStart=$(command -v bash) -c '/etc/webmin/start' -ExecStop=$(command -v bash) -c '/etc/webmin/stop' +ExecStart=/etc/webmin/start +ExecStop=/etc/webmin/stop [Install] WantedBy=multi-user.target @@ -9209,8 +9016,7 @@ _EOF_ fi - #PIHOLE - software_id=93 + software_id=93 # Pi-hole if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -9251,8 +9057,7 @@ Do you want to enable the Pi-hole blocking page?'; then pihole -g # - Generate web interface PW: https://github.com/MichaIng/DietPi/issues/662 - pihole -a -p "$GLOBAL_PW" - G_WHIP_MSG "DietPi has changed the Pi-hole web interface password to:\n - $GLOBAL_PW\n\nPlease use this password when logging into the web interface:\n - http://$(sed -n 4p /DietPi/dietpi/.network)/admin\n\nThis password can be changed, please see pihole binary for info:\n - pihole --help" + pihole -a -p "$GLOBAL_PW" &> /dev/null #do not print. fi @@ -9265,7 +9070,7 @@ Do you want to enable the Pi-hole blocking page?'; then getent passwd airsonic &> /dev/null && usercmd='usermod' $usercmd airsonic -G dietpi,audio -d $G_FP_DIETPI_USERDATA/airsonic -s /usr/sbin/nologin - #Optimize memory limit + # Optimise memory limit local airsonic_memory_max=$(( $RAM_TOTAL / 5 )) (( $airsonic_memory_max < 200 )) && airsonic_memory_max=200 airsonic_memory_max+='m' @@ -9285,10 +9090,10 @@ ExecStart=$(command -v java) -Xmx$airsonic_memory_max -Dairsonic.home=$G_FP_DIET WantedBy=multi-user.target _EOF_ - #Symlink FFmpeg to Airsonic transcoder - ln -sf $(command -v ffmpeg) $G_FP_DIETPI_USERDATA/airsonic/transcode + # Symlink FFmpeg to Airsonic transcoder + command -v ffmpeg &> /dev/null && ln -sf $(command -v ffmpeg) $G_FP_DIETPI_USERDATA/airsonic/transcode - #Grab our test media for user + # Grab our test media for user Download_Test_Media fi @@ -9298,59 +9103,55 @@ _EOF_ Banner_Configuration - #Optimize memory limit - local subsonic_memory_max=$(( $RAM_TOTAL / 5 )) - if (( $subsonic_memory_max < 200 )); then - - subsonic_memory_max=200 + local usercmd='useradd -rM' + getent passwd subsonic &> /dev/null && usercmd='usermod' + $usercmd subsonic -G dietpi,audio -d /var/subsonic -s /usr/sbin/nologin - fi + # Optimise memory limit + local subsonic_memory_max=$(( $RAM_TOTAL / 5 )) + (( $subsonic_memory_max < 200 )) && subsonic_memory_max=200 - cat << _EOF_ > /etc/default/subsonic -SUBSONIC_USER=root -SUBSONIC_ARGS='--quiet --pidfile=/run/subsonic.pid --max-memory=$subsonic_memory_max --default-music-folder=$G_FP_DIETPI_USERDATA/$FOLDER_MUSIC --default-podcast-folder=$G_FP_DIETPI_USERDATA/$FOLDER_MUSIC --default-playlist-folder=$G_FP_DIETPI_USERDATA/$FOLDER_MUSIC' -_EOF_ + G_CONFIG_INJECT 'SUBSONIC_USER=' 'SUBSONIC_USER=subsonic' /etc/default/subsonic + G_CONFIG_INJECT 'SUBSONIC_ARGS=' "SUBSONIC_ARGS='--quiet --pidfile=/run/subsonic.pid --max-memory=$subsonic_memory_max --default-music-folder=$G_FP_DIETPI_USERDATA/$FOLDER_MUSIC --default-podcast-folder=$G_FP_DIETPI_USERDATA/$FOLDER_MUSIC --default-playlist-folder=$G_FP_DIETPI_USERDATA/$FOLDER_MUSIC'" /etc/default/subsonic - #Symlink FFmpeg to Subsonic transcoder - ln -fs $(command -v ffmpeg) /var/subsonic/transcode + # Symlink FFmpeg to Subsonic transcoder + mkdir -p /var/subsonic/transcode + command -v ffmpeg &> /dev/null && ln -sf $(command -v ffmpeg) /var/subsonic/transcode - #Grab our test media for user + # Grab our test media for user Download_Test_Media fi - #WEBIOPI - software_id=71 + software_id=71 # WebIOPi if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - #auto start + # Autostart update-rc.d webiopi defaults fi - #DIETPICLOUDSHELL - software_id=62 + software_id=62 # DietPi-CloudShell if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - #Enable DietPi-Cloudshell autostart + # Enable DietPi-Cloudshell autostart /DietPi/dietpi/dietpi-autostart 5 - #Service + # Service cat << _EOF_ > /etc/systemd/system/dietpi-cloudshell.service [Unit] Description=dietpi-cloudshell on main screen (DietPi) [Service] -Type=simple StandardOutput=tty TTYPath=/dev/tty1 ExecStartPre=$(command -v setterm) --term linux --blank 0 --powersave off --cursor off -ExecStart=/bin/bash -c '/DietPi/dietpi/dietpi-cloudshell 1' +ExecStart=/DietPi/dietpi/dietpi-cloudshell 1 ExecStop=$(command -v setterm) --reset ExecStop=$(command -v echo) 'DietPi-Cloudshell terminated, have a nice day!' @@ -9360,23 +9161,22 @@ _EOF_ fi - #HAPROXY - software_id=98 + software_id=98 # HAProxy if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - #Create jail directory + # Create jail directory mkdir -p /var/lib/haproxy cat << _EOF_ > /etc/haproxy/haproxy.cfg global - #rsyslog is required for logging + # rsyslog is required for logging #log /var/log local0 #log /var/log local1 notice maxconn 64 - #Jail directory + # Jail directory chroot /var/lib/haproxy stats socket /run/haproxy.sock mode 660 level admin stats timeout 30s @@ -9427,7 +9227,7 @@ backend nodes server web02 127.0.0.1:9001 check server web03 127.0.0.1:9002 check -#Admin web page +# Admin web page listen stats bind *:1338 @@ -9437,7 +9237,7 @@ backend nodes stats auth admin:dietpi _EOF_ - #Add html error pages + # Add html error pages mkdir -p /etc/haproxy/errors local errorcode=0 @@ -9451,56 +9251,59 @@ _EOF_ fi - #SQUEEZEBOXSERVER - software_id=35 + software_id=35 # Logitech Media Server if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - #Remove bundled service + # Remove bundled SysVinit service systemctl stop logitechmediaserver &> /dev/null - killall -w squeezeboxserver &> /dev/null #provided service may not wait for exit, kill: https://github.com/MichaIng/DietPi/issues/1613#issuecomment-372787574 - + systemctl disable logitechmediaserver &> /dev/null + killall -qwr squeezeboxserver* # Provided service may not wait for exit, kill: https://github.com/MichaIng/DietPi/issues/1613#issuecomment-372787574 update-rc.d logitechmediaserver remove &> /dev/null - rm /etc/init.d/logitechmediaserver &> /dev/null + [[ -f '/etc/init.d/logitechmediaserver' ]] && rm /etc/init.d/logitechmediaserver + [[ -f '/etc/default/logitechmediaserver' ]] && rm /etc/default/logitechmediaserver - #Service - cat << _EOF_ > /etc/systemd/system/squeezeboxserver.service + # Grant user access to audio devices and DietPi media files + usermod -aG audio,dietpi squeezeboxserver + + # systemd service + cat << _EOF_ > /etc/systemd/system/logitechmediaserver.service [Unit] -Description=Squeezebox Server/LMS (DietPi) +Description=Logitech Media Server (DietPi) [Service] -Type=simple -ExecStart=$(command -v squeezeboxserver) --prefsdir /var/lib/squeezeboxserver/prefs --logfile /var/log/squeezeboxserver/error.log --logdir /var/log/squeezeboxserver/ --cachedir /var/lib/squeezeboxserver/cache --user root +User=squeezeboxserver +ExecStart=$(command -v squeezeboxserver) --prefsdir /var/lib/squeezeboxserver/prefs --logdir /var/log/squeezeboxserver/ --cachedir /var/lib/squeezeboxserver/cache --charset=utf8 --logfile /var/log/squeezeboxserver/error.log +Restart=on-failure +RestartSec=5 [Install] WantedBy=multi-user.target _EOF_ - #Grab our test media for user + # Grab our test media for user Download_Test_Media fi - #WORDPRESS - software_id=55 + software_id=55 # Wordpress if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - #Create mysql DB + # Create MariaDB database /DietPi/dietpi/func/create_mysql_db wordpress wordpress "$GLOBAL_PW" fi - #FRESHRSS - software_id=38 + software_id=38 # FreshRSS if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration # Enable required PHP modules: https://github.com/FreshRSS/FreshRSS#requirements - ${PHP_BINARY}enmod curl gmp intl json pdo_mysql + phpenmod curl gmp intl json pdo_mysql (( $G_DISTRO > 3 )) && phpenmod ctype dom mbstring xml zip # Apache configuration @@ -9545,15 +9348,14 @@ _EOF_ fi - #TIGHTVNCSERVER / VNC4SERVER / RealVNC - Shared setup - #software_id=27/28/120 + #software_id=27/28/120 # TightVNC/VNC4/RealVNC Server - Shared setup if (( ${aSOFTWARE_INSTALL_STATE[27]} == 1 || ${aSOFTWARE_INSTALL_STATE[28]} == 1 || ${aSOFTWARE_INSTALL_STATE[120]} == 1 )); then #Banner_Configuration - echo -e "$GLOBAL_PW=\n$GLOBAL_PW=\nn" | vncpasswd + echo -e "$GLOBAL_PW=\n$GLOBAL_PW=\nn\n" | vncpasswd cat << _EOF_ > /etc/systemd/system/vncserver.service [Unit] @@ -9562,75 +9364,73 @@ Before=xrdp.service xrdp-sesman.service After=dietpi-boot.service dietpi-ramdisk.service dietpi-ramlog.service [Service] -Type=simple -User=root RemainAfterExit=yes PAMName=login Environment=HOME=/root -ExecStart=/bin/bash /usr/local/bin/vncserver start -ExecStop=/bin/bash /usr/local/bin/vncserver stop +ExecStart=/usr/local/bin/vncserver start +ExecStop=/usr/local/bin/vncserver stop [Install] WantedBy=multi-user.target _EOF_ - systemctl daemon-reload - systemctl enable vncserver.service + systemctl enable vncserver cat << _EOF_ > /usr/local/bin/vncserver #!/bin/bash -#Globals +# Globals VNC_INSTALLED=0 BINARY_FP=0 SHARED_MODE=0 -WIDTH=\$(grep -m1 '^[[:blank:]]*SOFTWARE_VNCSERVER_WIDTH=' /DietPi/dietpi.txt | sed 's/^.*=//') -HEIGHT=\$(grep -m1 '^[[:blank:]]*SOFTWARE_VNCSERVER_HEIGHT=' /DietPi/dietpi.txt | sed 's/^.*=//') -DEPTH=\$(grep -m1 '^[[:blank:]]*SOFTWARE_VNCSERVER_DEPTH=' /DietPi/dietpi.txt | sed 's/^.*=//') -DISPLAY=\$(grep -m1 '^[[:blank:]]*SOFTWARE_VNCSERVER_DISPLAY_INDEX=' /DietPi/dietpi.txt | sed 's/^.*=//') -SHARED_MODE=\$(grep -m1 '^[[:blank:]]*SOFTWARE_VNCSERVER_SHARE_DESKTOP=' /DietPi/dietpi.txt | sed 's/^.*=//') +WIDTH=\$(grep -m1 '^[[:blank:]]*SOFTWARE_VNCSERVER_WIDTH=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') +HEIGHT=\$(grep -m1 '^[[:blank:]]*SOFTWARE_VNCSERVER_HEIGHT=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') +DEPTH=\$(grep -m1 '^[[:blank:]]*SOFTWARE_VNCSERVER_DEPTH=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') +DISPLAY=\$(grep -m1 '^[[:blank:]]*SOFTWARE_VNCSERVER_DISPLAY_INDEX=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') +SHARED_MODE=\$(grep -m1 '^[[:blank:]]*SOFTWARE_VNCSERVER_SHARE_DESKTOP=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') -#RealVNC | Slightly different launch method to VNC4server +# RealVNC | Slightly different launch method to VNC4server REALVNC=0 -if (( \$(dpkg --get-selections | grep -ci -m1 '^realvnc-vnc-server') )); then +if dpkg-query -s realvnc-vnc-server &> /dev/null; then REALVNC=1 - #Set shared desktop mode if autostart is enabled for desktops. This prevents another VNC server being launched on :1. - if (( \$( /dev/null - killall -w x11vnc &> /dev/null - killall -w Xtigervnc &> /dev/null - ;; + stop) + \$BINARY_FP -kill :\$DISPLAY &> /dev/null + killall -qw x11vnc + killall -qw Xtigervnc + ;; esac @@ -9667,47 +9467,51 @@ _EOF_ # + RealVNC | enable services if (( ${aSOFTWARE_INSTALL_STATE[120]} == 1 )); then - systemctl enable vncserver-x11-serviced.service - systemctl enable vncserver-virtuald.service + systemctl enable vncserver-x11-serviced + systemctl enable vncserver-virtuald fi # - Stretch + TigerVNC: Disable Localhost only by default - if (( $G_DISTRO >= 4 )); then + if (( $G_DISTRO > 3 )); then - echo -e '$localhost = "no";' >> /etc/vnc.conf + echo '$localhost = "no";' >> /etc/vnc.conf fi fi - #VNC4SERVER / RealVNC - software_id=28 - if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} >= 1 || - ${aSOFTWARE_INSTALL_STATE[120]} >= 1 )); then + software_id=28 # VNC4/RealVNC Server + if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} > 0 || + ${aSOFTWARE_INSTALL_STATE[120]} > 0 )); then Banner_Configuration local cmd_launch_desktop='' - #DESKTOP_LXDE - if (( ${aSOFTWARE_INSTALL_STATE[23]} >= 1 )); then + # DESKTOP_LXDE + if (( ${aSOFTWARE_INSTALL_STATE[23]} > 0 )); then - cmd_launch_desktop='/usr/bin/lxsession -s LXDE &' + cmd_launch_desktop='lxsession -s LXDE &' - #DESKTOP_MATE - elif (( ${aSOFTWARE_INSTALL_STATE[24]} >= 1 )); then + # DESKTOP_MATE + elif (( ${aSOFTWARE_INSTALL_STATE[24]} > 0 )); then - cmd_launch_desktop='/usr/bin/mate-session &' + cmd_launch_desktop='mate-session &' - #DESKTOP_GNUSTEP - elif (( ${aSOFTWARE_INSTALL_STATE[26]} >= 1 )); then + # DESKTOP_GNUSTEP + elif (( ${aSOFTWARE_INSTALL_STATE[26]} > 0 )); then cmd_launch_desktop='x-window-manager &' - #DESKTOP_XFCE - elif (( ${aSOFTWARE_INSTALL_STATE[25]} >= 1 )); then + # DESKTOP_XFCE + elif (( ${aSOFTWARE_INSTALL_STATE[25]} > 0 )); then + + cmd_launch_desktop='xfce4-session &' + + # DESKTOP_LXQT + elif (( ${aSOFTWARE_INSTALL_STATE[173]} > 0 )); then - cmd_launch_desktop='/usr/bin/xfce4-session &' + cmd_launch_desktop='startlxqt &' fi @@ -9721,83 +9525,31 @@ xsetroot -solid grey vncconfig -iconic & $cmd_launch_desktop _EOF_ - chmod +x /root/.vnc/xstartup fi - #FAIL2BAN - software_id=73 - if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then - - Banner_Configuration - - G_BACKUP_FP /etc/fail2ban/fail2ban.conf /etc/fail2ban/jail.conf - cat << _EOF_ > /etc/fail2ban/fail2ban.conf -[Definition] -# loglevel #1=error #2=warn #3=info -loglevel = 3 -logtarget = /var/log/fail2ban.log -socket = /var/run/fail2ban/fail2ban.sock -pidfile = /var/run/fail2ban/fail2ban.pid -_EOF_ - - cat << _EOF_ > /etc/fail2ban/jail.conf -[DEFAULT] - -enabled = true -ignoreip = 127.0.0.1/8 -ignorecommand = -backend = systemd -bantime = 600 -findtime = 600 -maxretry = 3 -banaction = route -action_ = %(banaction)s[name=%(__name__)s, bantime="%(bantime)s", port="%(port)s"] -action = %(action_)s - -[sshd] - -enabled = true -port = ssh -filter = sshd -logpath = /var/log/auth.log -maxretry = 3 - -[dropbear] - -enabled = true -port = ssh -filter = dropbear -logpath = /var/log/auth.log -maxretry = 3 -_EOF_ - - fi - - #InfluxDB - software_id=74 + software_id=74 # InfluxDB if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - # - Move DB/datadir to userdata location + # Move DB/datadir to userdata location mv /var/lib/influxdb $G_FP_DIETPI_USERDATA/ ln -sf $G_FP_DIETPI_USERDATA/influxdb /var/lib/influxdb fi - #Grafana - software_id=77 + software_id=77 # Grafana if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - # - Move DB/plugins to userdata location, if not already existent + # Move DB/plugins to userdata location, if not already existent if [[ -d $G_FP_DIETPI_USERDATA/grafana ]]; then G_DIETPI-NOTIFY 2 "Existing database/plugin directory $G_FP_DIETPI_USERDATA/grafana found. Will not overwrite..." - [[ -e /var/lib/grafana ]] && rm -R /var/lib/grafana + [[ -e '/var/lib/grafana' ]] && rm -R /var/lib/grafana else @@ -9806,14 +9558,13 @@ _EOF_ fi ln -sf $G_FP_DIETPI_USERDATA/grafana /var/lib/grafana - # - Set password, wrap into trippled double quotes in case of ; or # being contained, according to docs: http://docs.grafana.org/installation/configuration/#password - GCI_PRESERVE=1 G_CONFIG_INJECT 'admin_password[[:blank:]]*=' "admin_password = \"\"\"$GLOBAL_PW\"\"\"" /etc/grafana/grafana.ini + # Set password, wrap into trippled double quotes in case of ; or # being contained, according to docs: http://docs.grafana.org/installation/configuration/#password + GCI_PASSWORD=1 GCI_PRESERVE=1 G_CONFIG_INJECT 'admin_password[[:blank:]]*=' "admin_password = \"\"\"$GLOBAL_PW\"\"\"" /etc/grafana/grafana.ini G_CONFIG_INJECT 'http_port = ' 'http_port = 3001' /etc/grafana/grafana.ini fi - #Ubooquity - software_id=80 + software_id=80 # Ubooquity if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -9829,7 +9580,6 @@ Description=Ubooquity (DietPi) After=dietpi-boot.service network.target [Service] -Type=simple User=ubooquity WorkingDirectory=$G_FP_DIETPI_USERDATA/ubooquity ExecStart=$(command -v java) -jar $G_FP_DIETPI_USERDATA/ubooquity/Ubooquity.jar --headless --remoteadmin --adminport 2038 --libraryport 2039 @@ -9840,8 +9590,7 @@ _EOF_ fi - #PHPSYSINFO - software_id=64 + software_id=64 # phpSysInfo if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -9851,58 +9600,55 @@ _EOF_ fi - #PHPIMAGEGALLERY - software_id=56 + software_id=56 # PHP Image Gallery if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - #Get test images + # Get test images mkdir -p /var/www/gallery/DietPi wget https://dietpi.com/images/dietpi-logo_256.png -O /var/www/gallery/DietPi/logo_256.png mkdir -p /var/www/gallery/Tr-Zero - wget http://media.indiedb.com/images/games/1/25/24673/SS_0.jpg -O /var/www/gallery/Tr-Zero/SS_0.jpg - wget http://media.indiedb.com/images/games/1/25/24673/SS_44.jpg -O /var/www/gallery/Tr-Zero/SS_1.jpg - wget http://media.indiedb.com/images/games/1/25/24673/3.png -O /var/www/gallery/Tr-Zero/SS_2.jpg + wget https://media.indiedb.com/images/games/1/25/24673/SS_0.jpg -O /var/www/gallery/Tr-Zero/SS_0.jpg + wget https://media.indiedb.com/images/games/1/25/24673/SS_44.jpg -O /var/www/gallery/Tr-Zero/SS_1.jpg + wget https://media.indiedb.com/images/games/1/25/24673/3.png -O /var/www/gallery/Tr-Zero/SS_2.jpg - #permissions for cache/thumbnail/database + # Permissions for cache/thumbnail/database mkdir -p /var/www/gallery/_sfpg_data - #enable (Some type of security trigger) + # Enable (Some type of security trigger) sed -i "/define('SECURITY_PHRASE'/c\define('SECURITY_PHRASE', 'true');" /var/www/gallery/index.php fi - #AMPACHE - software_id=40 + software_id=40 # Ampache if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration Download_Test_Media - #create/insert our pre-made ampache sql db + # Create/insert our pre-made ampache sql db Download_Install 'https://dietpi.com/downloads/mysql_databases/ampache_mysql_3.8.2-v6.0.zip' /DietPi/dietpi/func/create_mysql_db ampache ampache "$GLOBAL_PW" mysql ampache < ampache.sql rm ampache.sql - #Grab config + # Grab config G_RUN_CMD wget https://dietpi.com/downloads/conf/ampache.cfg.php_3.8.2-v6.0 -O /var/www/ampache/config/ampache.cfg.php fi - #OPENVPNSERVER - software_id=97 + software_id=97 # OpenVPN Server if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration local key_size=2048 - #Start Cert/Key generation. + # Start Cert/Key generation. cp -a /usr/share/easy-rsa/ /etc/openvpn mkdir -p /etc/openvpn/easy-rsa/keys cat << _EOF_ >> /etc/openvpn/easy-rsa/vars @@ -9916,11 +9662,11 @@ export KEY_OU='DietPi' export KEY_NAME='DietPi_OpenVPN_Server' _EOF_ - #Create Server Cert Auth + # Create Server Cert Auth G_DIETPI-NOTIFY 2 'Generating unique OpenVPN certificates and keys. Please wait...\n' openssl dhparam -out /etc/openvpn/dh${key_size}.pem $key_size - #Build Server certs/keys + # Build Server certs/keys chmod -R +x /etc/openvpn/easy-rsa cd /etc/openvpn/easy-rsa # - https://github.com/MichaIng/DietPi/issues/1450#issuecomment-362608574 @@ -9931,16 +9677,16 @@ _EOF_ ./build-ca --batch DietPi_OpenVPN_Server ./build-key-server --batch DietPi_OpenVPN_Server - #Copy Server cert/keys + # Copy Server cert/keys cp -a /etc/openvpn/easy-rsa/keys/{DietPi_OpenVPN_Server.crt,DietPi_OpenVPN_Server.key,ca.crt} /etc/openvpn/ - #Build client cert/keys + # Build client cert/keys ./build-key --batch DietPi_OpenVPN_Client cd /tmp/$G_PROGRAM_NAME - #End Cert/Key generation. + # End Cert/Key generation. - #Server config + # Server config cat << _EOF_ > /etc/openvpn/server.conf port 1194 proto udp @@ -9965,19 +9711,19 @@ persist-key persist-tun verb 3 -#Web Forwarding (uncomment to enable) +# Web Forwarding (uncomment to enable) #push "redirect-gateway" #push "dhcp-option DNS 10.8.0.1" _EOF_ - #Client config + # Client config cat << _EOF_ > /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn client proto udp dev tun -#Ip/Domain name of DietPi system, running OpenVPN server. +# Ip/Domain name of DietPi system, running OpenVPN server. remote mywebsite.com 1194 resolv-retry infinite @@ -9995,7 +9741,7 @@ verb 3 _EOF_ - #Unified client file. Add DietPi generated certs/keys. + # Unified client file. Add DietPi generated certs/keys. # - Add Server Cert auth echo '' >> /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn cat /etc/openvpn/ca.crt >> /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn @@ -10009,22 +9755,21 @@ _EOF_ cat /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.key >> /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn echo '' >> /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn - #Copy client file to userdata location + # Copy client file to userdata location cp /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn $G_FP_DIETPI_USERDATA/ # - and /boot partition cp /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn /boot/ - #Enable IP forwarding + # Enable IP forwarding echo -e 'net.ipv4.ip_forward=1\nnet.ipv6.conf.all.forwarding=1\nnet.ipv6.conf.default.forwarding=1' > /etc/sysctl.d/dietpi-openvpn.conf sysctl net.ipv4.ip_forward=1 net.ipv6.conf.all.forwarding=1 net.ipv6.conf.default.forwarding=1 - #Web Fowarding (Setup IPtables, must also be run during boot) + # Web Fowarding (Setup IPtables, must also be run during boot) #iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o "$(sed -n 3p /DietPi/dietpi/.network)" -j MASQUERADE fi - #WireGuard - software_id=172 + software_id=172 # WireGuard if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then # Try to enable module, if it fails, a reboot is required @@ -10039,7 +9784,7 @@ _EOF_ G_WHIP_MENU_ARRAY=( 'Server' ': Use this machine as VPN server and allow clients to connect to it.' - 'Client' ': Use this machine as VPN client, e.g. to connect to a VPN service provider.' + 'Client' ': Use this machine as VPN client to connect to another VPN server or service provider.' ) @@ -10111,8 +9856,13 @@ Address = 10.9.0.1/24 PrivateKey = $( /etc/sysctl.d/dietpi-wireguard.conf - # - Start WireGuard interface via systemd unit (( $module_active )) && systemctl start wg-quick@wg0 # persistent @@ -10203,8 +9948,7 @@ If no WireGuard (auto)start is included, but you require it, please do the follo fi - #WIFIHOTSPOT - software_id=60 + software_id=60 # WiFi Hostspot if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -10231,14 +9975,12 @@ subnet 192.168.42.0 netmask 255.255.255.0 { _EOF_ # - Assign wlan as interface for dhcp server. - cat << _EOF_ > /etc/default/isc-dhcp-server -INTERFACES="wlan$wifi_index" -_EOF_ + echo "INTERFACESv4=\"wlan$wifi_index\"" > /etc/default/isc-dhcp-server # - Remove all entries below wlan, so we can recreate them. sed -i '/allow-hotplug wlan/q0' /etc/network/interfaces - # - enable up wlan + # - Enable up wlan sed -i "/allow-hotplug wlan/c\allow-hotplug wlan$wifi_index" /etc/network/interfaces # - Add wifi settings to network interfaces config @@ -10255,38 +9997,31 @@ up iptables-restore < /etc/iptables.ipv4.nat _EOF_ # - Assign static IP for wlan now - #ifconfig wlan$wifi_index 192.168.42.1 - ip addr add 192.168.42.1 dev wlan$wifi_index + ip a add 192.168.42.1 dev wlan$wifi_index # - Create access point config G_BACKUP_FP /etc/hostapd/hostapd.conf cat << _EOF_ > /etc/hostapd/hostapd.conf interface=wlan$wifi_index driver=nl80211 -ssid=$(grep -m1 '^[[:blank:]]*SOFTWARE_WIFI_HOTSPOT_SSID=' /DietPi/dietpi.txt | sed 's/^.*=//') +ssid=$(grep -m1 '^[[:blank:]]*SOFTWARE_WIFI_HOTSPOT_SSID=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') hw_mode=g -channel=$(grep -m1 '^[[:blank:]]*SOFTWARE_WIFI_HOTSPOT_CHANNEL=' /DietPi/dietpi.txt | sed 's/^.*=//') +channel=$(grep -m1 '^[[:blank:]]*SOFTWARE_WIFI_HOTSPOT_CHANNEL=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 wpa=2 -wpa_passphrase=$(grep -m1 '^[[:blank:]]*SOFTWARE_WIFI_HOTSPOT_KEY=' /DietPi/dietpi.txt | sed 's/^.*=//') +wpa_passphrase=$(grep -m1 '^[[:blank:]]*SOFTWARE_WIFI_HOTSPOT_KEY=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP _EOF_ # - Check for RTL8188C* device, use the patched driver with compiled binary: https://github.com/pritambaral/hostapd-rtl871xdrv#why - if (( $WIFIHOTSPOT_RTL8188C_DEVICE )); then - - sed -i "/^driver=/c\driver=rtl871xdrv" /etc/hostapd/hostapd.conf - - fi + (( $WIFIHOTSPOT_RTL8188C_DEVICE )) && G_CONFIG_INJECT 'driver=' 'driver=rtl871xdrv' /etc/hostapd/hostapd.conf # - Enable access point config - cat << _EOF_ > /etc/default/hostapd -DAEMON_CONF="/etc/hostapd/hostapd.conf" -_EOF_ + echo "DAEMON_CONF=\"/etc/hostapd/hostapd.conf\"" > /etc/default/hostapd # - Enable IP forwarding echo -e 'net.ipv4.ip_forward=1\nnet.ipv6.conf.all.forwarding=1\nnet.ipv6.conf.default.forwarding=1' > /etc/sysctl.d/dietpi-wifihotspot.conf @@ -10300,18 +10035,12 @@ _EOF_ # - Save IP tables, applied during ifup in /etc/network/interfaces. iptables-save > /etc/iptables.ipv4.nat - # - RPi 3 - onboard wifi, enable N - if (( $G_HW_MODEL == 3 && ! $WIFIHOTSPOT_RTL8188C_DEVICE )); then - - # - Add Wireless N support - G_CONFIG_INJECT 'ieee80211n=' 'ieee80211n=1' /etc/hostapd/hostapd.conf - - fi + # - RPi 3 Onboard WiFi: Enable N support + (( $G_HW_MODEL == 3 && ! $WIFIHOTSPOT_RTL8188C_DEVICE )) && G_CONFIG_INJECT 'ieee80211n=' 'ieee80211n=1' /etc/hostapd/hostapd.conf fi - #TORHOTSPOT - software_id=61 + software_id=61 # Tor Hotspot if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -10351,13 +10080,12 @@ _EOF_ fi - #SHAIRPORTSYNC - software_id=37 + software_id=37 # Shairport-Sync if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - #Enable SOXR by default: + # Enable SOXR by default: G_BACKUP_FP /usr/local/etc/shairport-sync.conf cat << _EOF_ > /usr/local/etc/shairport-sync.conf general = @@ -10377,7 +10105,6 @@ metadata = socket_msglength = 65000; }; - alsa = { // mixer_control_name = "PCM"; @@ -10386,21 +10113,20 @@ alsa = }; _EOF_ - #Create shairport user + # Create shairport user useradd -rM shairport-sync -G audio -s /usr/sbin/nologin chmod +x /usr/local/bin/shairport-sync fi - #PYDIO - software_id=48 + software_id=48 # Pydio if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration # PHP configuration - ${PHP_BINARY}enmod apcu gd intl pdo_mysql + phpenmod apcu gd intl pdo_mysql (( $G_DISTRO > 3 )) && phpenmod dom mbstring xml # Webserver config @@ -10467,9 +10193,7 @@ _EOF_ fi - - #SQUEEZELITE - software_id=36 + software_id=36 # SqueezeLite if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -10483,8 +10207,7 @@ _EOF_ fi - #EMONHUB - software_id=99 + software_id=99 # EmonHub if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -10499,7 +10222,7 @@ _EOF_ chmod +x -R /etc/emonhub - #RPI 3 - Must disable BCM BT to recover UART 0 + # RPI 3 - Must disable BCM BT to recover UART 0 if (( $G_HW_MODEL == 3 )); then # - Add DToverlay to disable bluetooth @@ -10529,8 +10252,7 @@ _EOF_ fi - #RPIMONITOR - software_id=66 + software_id=66 # RPi Monitor if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -10621,8 +10343,7 @@ _EOF_ fi - #BAIKAL - software_id=57 + software_id=57 # BaiKal if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -10677,29 +10398,27 @@ location = /.well-known/caldav { fi - #MUMBLESERVER - software_id=43 + software_id=43 # Mumble Server if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - #Cap total connections + # Cap total connections local max_users=$(( $G_HW_CPU_CORES * 8 )) sed -i "/users=/c\users=$max_users" /etc/mumble-server.ini - #Name the root channel + # Name the root channel sed -i '/registerName=/c\registerName=DietPi Mumble Server' /etc/mumble-server.ini - #Disable DB logging + # Disable DB logging sed -i '/logdays=/c\logdays=-1' /etc/mumble-server.ini - #Set Superuser passwd: https://dietpi.com/phpbb/viewtopic.php?f=11&t=2024#p8084 + # Set Superuser passwd: https://dietpi.com/phpbb/viewtopic.php?f=11&t=2024#p8084 murmurd -ini /etc/mumble-server.ini -supw "$GLOBAL_PW" fi - #EMBYSERVER - software_id=41 + software_id=41 # Emby Server if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -10719,13 +10438,14 @@ location = /.well-known/caldav { fi - #CUBERITE - software_id=52 + software_id=52 # Cuberite if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - useradd -rM cuberite -G dietpi -s /usr/sbin/nologin + usercmd='useradd -rM' + getent passwd cuberite &> /dev/null && usercmd='usermod' + $usercmd cuberite -G dietpi -d $G_FP_DIETPI_USERDATA/cubrite -s $(command -v nologin) cat << _EOF_ > /etc/systemd/system/cuberite.service [Unit] @@ -10742,7 +10462,7 @@ ExecStart=$G_FP_DIETPI_USERDATA/cubrite/Cuberite --service WantedBy=multi-user.target _EOF_ - #WebUI settings + # WebUI settings cat << _EOF_ > $G_FP_DIETPI_USERDATA/cubrite/webadmin.ini [User:admin] Password=$GLOBAL_PW @@ -10754,18 +10474,17 @@ _EOF_ fi - #MINEOS - software_id=53 + software_id=53 # MineOS if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - # - Add underprivilged user for web access | no longer works, could be a nodejs v8 issue? + # Add underprivilged user for web access | no longer works, could be a nodejs v8 issue? useradd mineos echo -e "$GLOBAL_PW\n$GLOBAL_PW\n" | passwd mineos - #Stop mineos from running while we config it. When we didnt do this, the program would constantly overwrite our symlink from (/var/games/minecraft). - /DietPi/dietpi/dietpi-services stop + # Stop mineos from running while we config it. When we didnt do this, the program would constantly overwrite our symlink from (/var/games/minecraft). + #/DietPi/dietpi/dietpi-services stop # Already done after install step now killall -w supervisord &> /dev/null killall -w node &> /dev/null killall -w nodejs &> /dev/null @@ -10803,23 +10522,24 @@ _EOF_ fi - #GOGS - software_id=49 + software_id=49 # Gogs if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - adduser gogs --system --no-create-home --group --shell=/bin/nologin + # User + usercmd='useradd -rM' + getent passwd gogs &> /dev/null && usercmd='usermod' + $usercmd gogs -d /etc/gogs -s $(command -v nologin) - # - Data storage / user data - mkdir -p $G_FP_DIETPI_USERDATA/gogs-repo - mkdir -p /var/log/gogs - > /var/log/gogs/gogs_daemon.log - chown -R gogs:gogs /var/log/gogs + # Directories + mkdir -p $G_FP_DIETPI_USERDATA/gogs-repo /var/log/gogs + chown -R gogs:gogs $G_FP_DIETPI_USERDATA/gogs-repo /var/log/gogs - # - sqldb + # Database /DietPi/dietpi/func/create_mysql_db gogs gogs "$GLOBAL_PW" + # Service cat << _EOF_ > /etc/systemd/system/gogs.service [Unit] Description=Gogs (DietPi) @@ -10827,13 +10547,9 @@ DefaultDependencies=no After=mysqld.service mysql.service mariadb.service [Service] -Type=simple User=gogs -Group=gogs WorkingDirectory=/etc/gogs -Environment=USER=gogs HOME=/etc/gogs -ExecStart=/etc/gogs/gogs web &> /var/log/gogs/gogs_daemon.log -StandardOutput=tty +ExecStart=/bin/dash -c '/etc/gogs/gogs web 2>&1 > /var/log/gogs/gogs_daemon.log' [Install] WantedBy=multi-user.target @@ -10841,15 +10557,14 @@ _EOF_ fi - #QBITTORRENT - software_id=46 + software_id=46 # qBitTorrent if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - useradd -rm qbittorrent -p "$GLOBAL_PW" -G dietpi -s /usr/sbin/nologin + useradd -rm qbittorrent -p "$GLOBAL_PW" -G dietpi -s $(command -v nologin) - # - conf. + # Config mkdir -p /home/qbittorrent/.config/qBittorrent G_BACKUP_FP /home/qbittorrent/.config/qBittorrent/qBittorrent.conf cat << _EOF_ > /home/qbittorrent/.config/qBittorrent/qBittorrent.conf @@ -10857,16 +10572,16 @@ _EOF_ ported_to_new_savepath_system=true [Preferences] -Downloads\DiskWriteCacheSize=$(Optimize_BitTorrent 0) +Downloads\DiskWriteCacheSize=$(Optimise_BitTorrent 0) Downloads\DiskWriteCacheTTL=60 -Queueing\MaxActiveDownloads=$(Optimize_BitTorrent 1) -Queueing\MaxActiveTorrents=$(Optimize_BitTorrent 1) +Queueing\MaxActiveDownloads=$(Optimise_BitTorrent 1) +Queueing\MaxActiveTorrents=$(Optimise_BitTorrent 1) Queueing\MaxActiveUploads=1 Queueing\IgnoreSlowTorrents=false -Bittorrent\MaxConnecs=$(Optimize_BitTorrent 2) -Bittorrent\MaxConnecsPerTorrent=$(Optimize_BitTorrent 2) -Bittorrent\MaxUploads=$(Optimize_BitTorrent 3) -Bittorrent\MaxUploadsPerTorrent=$(Optimize_BitTorrent 3) +Bittorrent\MaxConnecs=$(Optimise_BitTorrent 2) +Bittorrent\MaxConnecsPerTorrent=$(Optimise_BitTorrent 2) +Bittorrent\MaxUploads=$(Optimise_BitTorrent 3) +Bittorrent\MaxUploadsPerTorrent=$(Optimise_BitTorrent 3) WebUI\Port=1340 WebUI\Enabled=true General\Locale=en @@ -10930,17 +10645,16 @@ enabled=false program= _EOF_ - #Jessie WebUI\Password_ha1 breaks login with m5dsum generated pw, revert to default 'adminadmin': https://github.com/MichaIng/DietPi/issues/1499#issuecomment-364769146 + # - Jessie WebUI\Password_ha1 breaks login with m5dsum generated pw, revert to default 'adminadmin': https://github.com/MichaIng/DietPi/issues/1499#issuecomment-364769146 (( $G_DISTRO == 3 )) && sed -i '/Password_ha1=/d' /root/.config/qBittorrent/qBittorrent.conf - # - service + # Service cat << _EOF_ > /etc/systemd/system/qbittorrent.service [Unit] Description=qBittorrent (DietPi) After=network.target [Service] -Type=simple User=qbittorrent Group=dietpi RemainAfterExit=yes @@ -11086,7 +10800,6 @@ _EOF_ G_CONFIG_INJECT 'ExecStart=' "ExecStart=$(command -v rtorrent)" /etc/systemd/system/rtorrent.service fi - systemctl daemon-reload # - Default conf, do not overwrite if existent # Example: https://github.com/rakshasa/rtorrent/blob/master/doc/rtorrent.rc @@ -11102,20 +10815,20 @@ network.max_open_files.set = 50 scheduler.max_active.set = 3 # byte value -pieces.memory.max.set = $(( $(Optimize_BitTorrent 0) * 1024 * 1024 )) +pieces.memory.max.set = $(( $(Optimise_BitTorrent 0) * 1024 * 1024 )) # Maximum and minimum number of peers to connect to per torrent. throttle.min_peers.normal.set = 1 -throttle.max_peers.normal.set = $(( $(Optimize_BitTorrent 2) / 2 + 1 )) +throttle.max_peers.normal.set = $(( $(Optimise_BitTorrent 2) / 2 + 1 )) # Same as above but for seeding completed torrents (-1 = same as downloading) throttle.min_peers.seed.set = -1 throttle.max_peers.seed.set = -1 # Maximum number of simultaneous downloads -throttle.max_downloads.set = $(Optimize_BitTorrent 2) +throttle.max_downloads.set = $(Optimise_BitTorrent 2) # Maximum number of simultaneous uploads -throttle.max_uploads.set = $(Optimize_BitTorrent 3) +throttle.max_uploads.set = $(Optimise_BitTorrent 3) # Global upload and download rate in KiB. "0" for unlimited. throttle.global_down.max_rate.set_kb = 0 @@ -11251,11 +10964,11 @@ pause=false log=/var/log/aria2.log log-level=warn -split=$(Optimize_BitTorrent 1) +split=$(Optimise_BitTorrent 1) continue=true check-integrity=true -max-concurrent-downloads=$(Optimize_BitTorrent 1) -max-connection-per-server=$(Optimize_BitTorrent 1) +max-concurrent-downloads=$(Optimise_BitTorrent 1) +max-connection-per-server=$(Optimise_BitTorrent 1) # Bandwidth limits: https://aria2.github.io/manual/en/html/aria2c.html#cmdoption-max-overall-upload-limit max-overall-download-limit=0 max-overall-upload-limit=0 @@ -11263,7 +10976,7 @@ max-file-not-found=3 max-tries=5 retry-wait=60 ftp-pasv=true -bt-max-peers=$(Optimize_BitTorrent 2) +bt-max-peers=$(Optimise_BitTorrent 2) listen-port=6881-6999 check-certificate=false @@ -11285,7 +10998,6 @@ _EOF_ Description=Aria2 (DietPi) [Service] -Type=simple ExecStart=$(command -v aria2c) --conf-path=/var/lib/dietpi/dietpi-software/installed/aria2.conf [Install] @@ -11294,50 +11006,48 @@ _EOF_ fi - #SYNCTHING - software_id=50 + software_id=50 # Syncthing if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - # - Generate dir's + # Generate dirs mkdir -p $G_FP_DIETPI_USERDATA/syncthing mkdir -p $G_FP_DIETPI_USERDATA/syncthing_data - # Logs/Binary + # - Logs/Binary mkdir -p /var/log/syncthing >> /var/log/syncthing/syncthing.log chown -R dietpi:dietpi /var/log/syncthing chown -R dietpi:dietpi /etc/syncthing - # - Run Syncthing to create cert/config and exit + # Run Syncthing to create cert/config and exit /etc/syncthing/syncthing -generate=$G_FP_DIETPI_USERDATA/syncthing - # - Disable automatic upgrades + # Disable automatic upgrades sed -i '/<\/autoUpgradeIntervalH>/c\ 0<\/autoUpgradeIntervalH>' $G_FP_DIETPI_USERDATA/syncthing/config.xml - # - Allow external access (LAN). + # Allow external access (LAN). sed -i '/:8384<\/address>/c\
0.0.0.0:8384<\/address>' $G_FP_DIETPI_USERDATA/syncthing/config.xml - # - Set default folder + # Set default folder sed -i '/label=\"Default Folder/c\ ' $G_FP_DIETPI_USERDATA/syncthing/config.xml - # - Disable browser starting + # Disable browser starting sed -i '/<\/startBrowser>/c\ false<\/startBrowser>' $G_FP_DIETPI_USERDATA/syncthing/config.xml - # - Enable filesystem watcher (previously inotify) + # Enable filesystem watcher (previously inotify) sed -i 's/fsWatcherEnabled=\"false\"/fsWatcherEnabled=\"true\"/g' $G_FP_DIETPI_USERDATA/syncthing/config.xml - #services + # Services cat << _EOF_ > /etc/systemd/system/syncthing.service [Unit] Description=Syncthing (DietPi) After=network.target [Service] -Type=simple -ExecStart=/etc/syncthing/syncthing -logfile=/var/log/syncthing/syncthing.log -logflags=3 -home=$G_FP_DIETPI_USERDATA/syncthing User=dietpi +ExecStart=/etc/syncthing/syncthing -logfile=/var/log/syncthing/syncthing.log -logflags=3 -home=$G_FP_DIETPI_USERDATA/syncthing [Install] WantedBy=multi-user.target @@ -11363,8 +11073,7 @@ _EOF_ fi - #Medusa - software_id=116 + software_id=116 # Medusa if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -11378,42 +11087,42 @@ _EOF_ fi - #TONIDO - software_id=134 + software_id=134 # Tonido if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - useradd -rm tonido -G dietpi -s /usr/sbin/nologin + usercmd='useradd -rm' + getent passwd tonido &> /dev/null && usercmd='usermod' + $usercmd tonido -G dietpi -s $(command -v nologin) - #service + # Service cat << _EOF_ > /etc/systemd/system/tonido.service [Unit] Description=Tonido (DietPi) [Service] -Type=simple User=tonido Group=dietpi WorkingDirectory=$G_FP_DIETPI_USERDATA/tonido -ExecStart=/bin/bash -c 'export LD_LIBRARY_PATH=$G_FP_DIETPI_USERDATA/tonido; export TONIDODIR=$G_FP_DIETPI_USERDATA/tonido; ./tonidoconsole' +ExecStart=/bin/dash -c 'export LD_LIBRARY_PATH=$G_FP_DIETPI_USERDATA/tonido; export TONIDODIR=$G_FP_DIETPI_USERDATA/tonido; ./tonidoconsole' [Install] WantedBy=multi-user.target _EOF_ - # - userdirs + # User dirs mkdir -p $G_FP_DIETPI_USERDATA/tonido/sync mkdir -p $G_FP_DIETPI_USERDATA/tonido/syncdata - # symlink + # - Symlink cp -R /home/tonido/tonido $G_FP_DIETPI_USERDATA/ &> /dev/null rm -R /home/tonido/tonido &> /dev/null ln -sf $G_FP_DIETPI_USERDATA/tonido /home/tonido/tonido ln -sf $G_FP_DIETPI_USERDATA/tonido/sync /home/tonido/TonidoSync ln -sf $G_FP_DIETPI_USERDATA/tonido/syncdata /home/tonido/TonidoSyncData - # - armv7 switch + # ARMv7 switch if (( $G_HW_ARCH == 2 )); then sed -i 's/armv6l/armv7l/' $G_FP_DIETPI_USERDATA/tonido/manifest.xml @@ -11423,13 +11132,12 @@ _EOF_ fi - #Chromium - software_id=113 + software_id=113 # Chromium if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - #Allow root, start maximized and disable sandbox under root (blank screen without) + # Allow root, start maximized and disable sandbox under root (blank screen without) local export_options="export CHROMIUM_FLAGS=\"\$CHROMIUM_FLAGS \ --test-type \ --no-sandbox \ @@ -11442,10 +11150,10 @@ _EOF_ --profiler-timing=0 \ --disable-composited-antialiasing " - #RPi + # RPi if (( $G_HW_MODEL < 10 )); then - # OpenGL + # - OpenGL #if (( $G_HW_MODEL >= 2 )); then # Hangs xinit: https://github.com/MichaIng/DietPi/issues/834 @@ -11454,12 +11162,12 @@ _EOF_ #fi : - #OpenGL + # OpenGL elif (( $G_HW_MODEL == 21 )); then : - #GLES + # GLES else export_options+='--use-gl=egl' @@ -11469,28 +11177,25 @@ _EOF_ export_options+="\"" mkdir -p /etc/chromium.d - cat << _EOF_ > /etc/chromium.d/custom_flags -$export_options -_EOF_ + echo "$export_options" > /etc/chromium.d/custom_flags - # Chromium 60+ + # Chromium 60+ cp /etc/chromium.d/custom_flags /root/.chromium-browser.init - #Symlink to desktop - # * for RPi Stretch due to chromium-browser.desktop + # Symlink to desktop + # - * for RPi Stretch due to chromium-browser.desktop ln -sf /usr/share/applications/chromium*.desktop /root/Desktop/chromium.desktop &> /dev/null - # - Autostart run script for Kiosk mode, based on @AYapejian https://github.com/MichaIng/DietPi/issues/1737#issue-318697621 - + # Autostart run script for Kiosk mode, based on @AYapejian https://github.com/MichaIng/DietPi/issues/1737#issue-318697621 cat << _EOF_ > /var/lib/dietpi/dietpi-software/installed/chromium-autostart.sh #!/bin/bash -#Autostart run script for Kiosk mode, based on @AYapejian https://github.com/MichaIng/DietPi/issues/1737#issue-318697621 +# Autostart run script for Kiosk mode, based on @AYapejian https://github.com/MichaIng/DietPi/issues/1737#issue-318697621 # - Please see /root/.chromium-browser.init (and /etc/chromium.d/custom_flags) for additional egl/gl init options # Command line switches https://peter.sh/experiments/chromium-command-line-switches/ -# --test-type gets rid of some of the chromium warnings that you may or may not care about in kiosk on a LAN -# --pull-to-refresh=1 -# --ash-host-window-bounds="400,300" +# --test-type gets rid of some of the chromium warnings that you may or may not care about in kiosk on a LAN +# --pull-to-refresh=1 +# --ash-host-window-bounds="400,300" # - Resolution to use for kiosk mode, should ideally match current system resolution RES_X=\$(grep -m1 '^[[:blank:]]*SOFTWARE_CHROMIUM_RES_X=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') @@ -11504,7 +11209,7 @@ CHROMIUM_OPTS="--kiosk --test-type --window-size=\$RES_X,\$RES_Y --start-fullscr URL=\$(grep -m1 '^[[:blank:]]*SOFTWARE_CHROMIUM_AUTOSTART_URL=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') CHROMIUM_OPTS+=" --homepage \$URL" -#Find absolute filepath location of Chromium binary. +# Find absolute filepath location of Chromium binary. FP_CHROMIUM=\$(command -v chromium) if [[ ! \$FP_CHROMIUM ]]; then @@ -11519,8 +11224,7 @@ _EOF_ fi - #O!MPD - software_id=129 + software_id=129 # O!MPD if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -11542,23 +11246,22 @@ _EOF_ fi - #IceCast + DarkIce - software_id=135 + software_id=135 # IceCast + DarkIce if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - #icecast set passwords: + # IceCast set passwords sed -i '/\/c\\'"$GLOBAL_PW"'\<\/source-password\>' /etc/icecast2/icecast.xml sed -i '/\/c\\'"$GLOBAL_PW"'\<\/relay-password\>' /etc/icecast2/icecast.xml - # Create random password + # - Create random password local admin_password=$(tr -cd '[:alnum:]' < /dev/urandom | fold -w10 | head -n1) sed -i "/\/c\\$admin_password\<\/admin-password\>" /etc/icecast2/icecast.xml sed -i '/ENABLE=/c\ENABLE=true' /etc/default/icecast2 - #Darkice + # DarkIce local input_device_index=$(arecord -l | mawk '/card/ {print $2;exit}' | sed 's/://') cat << _EOF_ > /etc/darkice.cfg @@ -11589,16 +11292,15 @@ public = no #localDumpFile = $G_FP_DIETPI_USERDATA/darkice_recording.ogg _EOF_ - #Systemd service for Darkice + # Systemd service for DarkIce rm /etc/init.d/darkice cat << _EOF_ > /etc/systemd/system/darkice.service [Unit] Description=DarkIce (DietPi) -After=icecast2.service Requires=icecast2.service +After=icecast2.service [Service] -Type=simple ExecStart=$(command -v darkice) [Install] @@ -11607,8 +11309,7 @@ _EOF_ fi - #mosquitto - software_id=123 + software_id=123 # Mosquitto if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -11620,7 +11321,6 @@ Description=Mosquitto (DietPi) After=network.target [Service] -Type=simple ExecStart=$(command -v mosquitto) -c /etc/mosquitto/mosquitto.conf [Install] @@ -11629,35 +11329,39 @@ _EOF_ fi - #Blynk - software_id=131 + software_id=131 # Blynk Server if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - # - Preserve existing config + # Preserve existing config if [[ ! -f $G_FP_DIETPI_USERDATA/blynk/server.properties ]]; then local config_file_url_address='https://raw.githubusercontent.com/blynkkk/blynk-server/master/server/core/src/main/resources/server.properties' G_RUN_CMD wget "$config_file_url_address" -O $G_FP_DIETPI_USERDATA/blynk/server.properties G_CONFIG_INJECT 'data.folder=' "data.folder=$G_FP_DIETPI_USERDATA/blynk/data" $G_FP_DIETPI_USERDATA/blynk/server.properties + # - Log to RAMlog + mkdir -p /var/log/blynk + G_CONFIG_INJECT 'logs.folder=' 'logs.folder=/var/log/blynk' $G_FP_DIETPI_USERDATA/blynk/server.properties fi - # - User - useradd -rM blynk -G dietpi -s /usr/sbin/nologin + # User + usercmd='useradd -rM' + getent passwd blynk &> /dev/null && usercmd='usermod' + $usercmd blynk -G dietpi -d $G_FP_DIETPI_USERDATA/blynk -s /usr/sbin/nologin - # - Service + # Service cat << _EOF_ > /etc/systemd/system/blynkserver.service [Unit] Description=Blynk Server (DietPi) After=network.target [Service] -Type=simple User=blynk Group=dietpi -ExecStart=$(command -v java) -jar $G_FP_DIETPI_USERDATA/blynk/blynkserver.jar -serverConfig $G_FP_DIETPI_USERDATA/blynk/server.properties +WorkingDirectory=$G_FP_DIETPI_USERDATA/blynk +ExecStart=$(command -v java) -jar $G_FP_DIETPI_USERDATA/blynk/blynkserver.jar [Install] WantedBy=multi-user.target @@ -11665,13 +11369,12 @@ _EOF_ fi - #MotionEye - software_id=136 + software_id=136 # MotionEye if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - #Enable RPi cam + # Enable RPi cam if (( $G_HW_MODEL < 10 )); then /DietPi/dietpi/func/dietpi-set_hardware rpi-camera enable @@ -11685,18 +11388,17 @@ _EOF_ mkdir -p $G_FP_DIETPI_USERDATA/motioneye sed -i "/^media_path/c\media_path $G_FP_DIETPI_USERDATA/motioneye" /etc/motioneye/motioneye.conf - # service + # Service cp /usr/local/share/motioneye/extra/motioneye.systemd-unit-local /etc/systemd/system/motioneye.service fi - #CloudPrint - software_id=137 + software_id=137 # CloudPrint if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - # - Enable web admin + # Enable web admin G_RUN_CMD systemctl start cups cupsctl --remote-admin usermod -a -G lpadmin root @@ -11704,8 +11406,7 @@ _EOF_ fi - #VirtualHere - software_id=138 + software_id=138 # VirtualHere if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -11716,96 +11417,105 @@ Description=VirtualHere (DietPi) After=local-fs.target [Service] -Type=simple - ExecStart=/etc/vhusbd/vhusbd -r /var/log/virtualhere.log [Install] WantedBy=multi-user.target _EOF_ - systemctl daemon-reload - echo -e "ServerName='DietPi'" > /etc/vhusbd/config.ini + echo "ServerName='DietPi'" > /etc/vhusbd/config.ini fi - #SABnzbd - software_id=139 + software_id=139 # SABnzbd if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - useradd -rM sabnzbd -G dietpi -s /usr/sbin/nologin + # User + local usercmd='useradd -rM' + getent passwd sabnzbd &> /dev/null && usercmd='usermod' + $usercmd sabnzbd -G dietpi -d /etc/sabnzbd -s $(command -v nologin) + + # Service: https://github.com/sabnzbd/sabnzbd/blob/master/linux/sabnzbd%40.service + # - Options: https://sabnzbd.org/wiki/advanced/command-line-parameters + # "-OO": Optimise code and remove doc lines (default shebang of SABnzbd.py, but we run python2.7 explicitly to avoid version conflicts) + # "-d": Run in daemon mode without terminal and browser start (requires "-f ") + # NB: In systemd unit leads to unreliable long taking webserver start. A new process is forked which allows web access, but sometimes after very long time, sometimes never: https://github.com/sabnzbd/sabnzbd/issues/1283 + # "-b 0": Do no start browser with daemon cat << _EOF_ > /etc/systemd/system/sabnzbd.service [Unit] -Description=sabnzbd (DietPi) +Description=SABnzbd (DietPi) +Documentation=https://sabnzbd.org/wiki/ +Wants=network-online.target +After=network-online.target [Service] User=sabnzbd Group=dietpi -Type=simple -ExecStart=$(command -v python) /etc/sabnzbd/SABnzbd.py -f /etc/sabnzbd/sabnzbd.ini +ExecStart=$(command -v python2.7) -OO /etc/sabnzbd/SABnzbd.py -b 0 -f /etc/sabnzbd/sabnzbd.ini +Restart=on-failure [Install] WantedBy=multi-user.target _EOF_ - systemctl daemon-reload + # Log dir and permissions mkdir -p /var/log/sabnzbd - chown -R sabnzbd:dietpi /etc/sabnzbd - chown -R sabnzbd:dietpi /var/log/sabnzbd - - #Create config: - # API keys and intial config are only generated during 1st run of sabnzbd - # We need to launch program, then apply our config tweaks, else, wizard setup in web interface simply loops without API keys. - rm /etc/sabnzbd/sabnzbd.ini &> /dev/null + chown -R sabnzbd:sabnzbd /etc/sabnzbd /var/log/sabnzbd - systemctl start sabnzbd - G_DIETPI-NOTIFY 2 "Generating initial config, please wait..." - while [[ ! -f '/etc/sabnzbd/sabnzbd.ini' ]] - do + # Create config + # - Touch only if it does not yet exist, assume reinstall otherwise and preserve custom changes + # - API keys and initial config are only generated during 1st run + # - We need to launch program, then apply our config tweaks, else, wizard setup in web interface simply loops without API keys. + if [[ ! -f '/etc/sabnzbd/sabnzbd.ini' ]]; then - sleep 1 + systemctl daemon-reload + systemctl start sabnzbd - done + G_DIETPI-NOTIFY 2 'Generating initial config, please wait...' + while [[ ! -f '/etc/sabnzbd/sabnzbd.ini' ]] + do - sleep 2 + sleep 0.5 - systemctl stop sabnzbd + done + sleep 2 - sleep 2 #additional wait, config being overwritten after below changes: https://dietpi.com/phpbb/viewtopic.php?f=11&t=1848&p=7085#p7082 + systemctl stop sabnzbd + sleep 2 # Additional wait, config being overwritten after below changes: https://dietpi.com/phpbb/viewtopic.php?p=7082#p7082 - sed -i "/^download_dir =/c\download_dir = $G_FP_DIETPI_USERDATA/downloads/incomplete" /etc/sabnzbd/sabnzbd.ini - sed -i "/^complete_dir =/c\complete_dir = $G_FP_DIETPI_USERDATA/downloads/complete" /etc/sabnzbd/sabnzbd.ini - sed -i "/^nzb_backup_dir =/c\nzb_backup_dir = $G_FP_DIETPI_USERDATA/downloads/sabnzbd_nzb_backup" /etc/sabnzbd/sabnzbd.ini - sed -i "/^admin_dir =/c\admin_dir = $G_FP_DIETPI_USERDATA/downloads/sabnzbd_admin" /etc/sabnzbd/sabnzbd.ini - sed -i "/^log_dir =/c\log_dir = /var/log/sabnzbd" /etc/sabnzbd/sabnzbd.ini - sed -i "/^log_level =/c\log_level = 0" /etc/sabnzbd/sabnzbd.ini #err only - sed -i "/^refresh_rate =/c\refresh_rate = 2" /etc/sabnzbd/sabnzbd.ini - sed -i "/^host =/c\host = 0.0.0.0" /etc/sabnzbd/sabnzbd.ini + G_CONFIG_INJECT 'download_dir =' "download_dir = $G_FP_DIETPI_USERDATA/downloads/incomplete" /etc/sabnzbd/sabnzbd.ini + G_CONFIG_INJECT 'complete_dir =' "complete_dir = $G_FP_DIETPI_USERDATA/downloads/complete" /etc/sabnzbd/sabnzbd.ini + G_CONFIG_INJECT 'nzb_backup_dir =' "nzb_backup_dir = $G_FP_DIETPI_USERDATA/downloads/sabnzbd_nzb_backup" /etc/sabnzbd/sabnzbd.ini + G_CONFIG_INJECT 'admin_dir =' "admin_dir = $G_FP_DIETPI_USERDATA/downloads/sabnzbd_admin" /etc/sabnzbd/sabnzbd.ini + G_CONFIG_INJECT 'log_dir =' 'log_dir = /var/log/sabnzbd' /etc/sabnzbd/sabnzbd.ini + G_CONFIG_INJECT 'log_level =' 'log_level = 0' /etc/sabnzbd/sabnzbd.ini # Warning errors only + G_CONFIG_INJECT 'refresh_rate =' 'refresh_rate = 2' /etc/sabnzbd/sabnzbd.ini + G_CONFIG_INJECT 'host =' 'host = 0.0.0.0' /etc/sabnzbd/sabnzbd.ini + G_CONFIG_INJECT 'permissions =' 'permissions = 0775' /etc/sabnzbd/sabnzbd.ini + G_CONFIG_INJECT 'auto_browser =' 'auto_browser = 0' /etc/sabnzbd/sabnzbd.ini - G_CONFIG_INJECT 'permissions =' 'permissions = "0775"' /etc/sabnzbd/sabnzbd.ini + fi - # - Install language packs: https://github.com/MichaIng/DietPi/issues/1917#issue-340631943 + # Install language packs: https://github.com/MichaIng/DietPi/issues/1917#issue-340631943 cd /etc/sabnzbd - G_RUN_CMD python tools/make_mo.py - cd /root + G_RUN_CMD python2.7 tools/make_mo.py + cd /tmp/$G_PROGRAM_NAME fi - #spotifyconnectweb - software_id=141 + software_id=141 # Spotify Connect Web if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration cat << _EOF_ > /etc/systemd/system/spotify-connect-web.service [Unit] -Description=spotify-connect-web (DietPi) +Description=Spotify Connect Web (DietPi) After=sound.target [Service] -Type=simple WorkingDirectory=$G_FP_DIETPI_USERDATA/spotify-connect-web ExecStart=$G_FP_DIETPI_USERDATA/spotify-connect-web/spotify-connect-web @@ -11815,8 +11525,7 @@ _EOF_ fi - #couchpotato - software_id=142 + software_id=142 # CouchPotato if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -11833,8 +11542,7 @@ _EOF_ fi - #Koel - software_id=143 + software_id=143 # Koel if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -11851,11 +11559,11 @@ _EOF_ G_CONFIG_INJECT 'DB_HOST=' 'DB_HOST=127.0.0.1' .env G_CONFIG_INJECT 'DB_DATABASE=' 'DB_DATABASE=koel' .env G_CONFIG_INJECT 'DB_USERNAME=' 'DB_USERNAME=koel' .env - G_CONFIG_INJECT 'DB_PASSWORD=' "DB_PASSWORD=$GLOBAL_PW" .env + GCI_PASSWORD=1 G_CONFIG_INJECT 'DB_PASSWORD=' "DB_PASSWORD=$GLOBAL_PW" .env # ADMIN env vars are not used any more, user prompt will ask for info. #G_CONFIG_INJECT 'ADMIN_EMAIL=' 'ADMIN_EMAIL=dietpi@dietpi.com' .env #G_CONFIG_INJECT 'ADMIN_NAME=' 'ADMIN_NAME=admin' .env - #G_CONFIG_INJECT 'ADMIN_PASSWORD=' "ADMIN_PASSWORD=$GLOBAL_PW" .env + #GCI_PASSWORD=1 G_CONFIG_INJECT 'ADMIN_PASSWORD=' "ADMIN_PASSWORD=$GLOBAL_PW" .env G_CONFIG_INJECT 'FFMPEG_PATH=' "FFMPEG_PATH=$(command -v ffmpeg)" .env php artisan koel:init @@ -11868,7 +11576,6 @@ _EOF_ Description=Koel (DietPi) [Service] -Type=simple User=koel Group=dietpi WorkingDirectory=$G_FP_DIETPI_USERDATA/koel @@ -11880,13 +11587,14 @@ _EOF_ fi - #Sonarr - software_id=144 + software_id=144 # Sonarr if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - useradd -rM sonarr -G dietpi -s /usr/sbin/nologin + usercmd='useradd -rM' + getent passwd sonarr &> /dev/null && usercmd='usermod' + $usercmd sonarr -G dietpi -d $G_FP_DIETPI_USERDATA/sonarr -s $(command -v nologin) mkdir -p $G_FP_DIETPI_USERDATA/sonarr @@ -11898,7 +11606,6 @@ After=network.target [Service] User=sonarr Group=dietpi -Type=simple ExecStart=/usr/bin/mono -O=-aot /opt/NzbDrone/NzbDrone.exe -nobrowser -data=$G_FP_DIETPI_USERDATA/sonarr [Install] @@ -11915,13 +11622,14 @@ _EOF_ fi - #Radarr - software_id=145 + software_id=145 # Radarr if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - useradd -rM radarr -G dietpi -s /usr/sbin/nologin + usercmd='useradd -rM' + getent passwd radarr &> /dev/null && usercmd='usermod' + $usercmd radarr -G dietpi -d $G_FP_DIETPI_USERDATA/radarr -s $(command -v nologin) mkdir -p $G_FP_DIETPI_USERDATA/radarr @@ -11933,7 +11641,6 @@ After=network.target [Service] User=radarr Group=dietpi -Type=simple ExecStart=/usr/bin/mono -O=-aot /opt/Radarr/Radarr.exe -nobrowser -data=$G_FP_DIETPI_USERDATA/radarr [Install] @@ -11950,13 +11657,14 @@ _EOF_ fi - #Lidarr - software_id=106 + software_id=106 # Lidarr if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - useradd -rM lidarr -G dietpi -s /usr/sbin/nologin + usercmd='useradd -rM' + getent passwd lidarr &> /dev/null && usercmd='usermod' + $usercmd lidarr -G dietpi -d $G_FP_DIETPI_USERDATA/lidarr -s $(command -v nologin) mkdir -p $G_FP_DIETPI_USERDATA/lidarr @@ -11968,14 +11676,13 @@ After=network.target [Service] User=lidarr Group=dietpi -Type=simple ExecStart=/usr/bin/mono -O=-aot /opt/Lidarr/Lidarr.exe -nobrowser -data=$G_FP_DIETPI_USERDATA/lidarr [Install] WantedBy=multi-user.target _EOF_ - # - logs to RAM + # Logs to RAM rm -R $G_FP_DIETPI_USERDATA/lidarr/logs* &> /dev/null mkdir -p /var/log/lidarr ln -sf /var/log/lidarr $G_FP_DIETPI_USERDATA/lidarr/logs @@ -11985,16 +11692,21 @@ _EOF_ fi - #PlexPy - software_id=146 + software_id=146 # PlexPy if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - mkdir -p $G_FP_DIETPI_USERDATA/plexpy + # User + usercmd='useradd -rM' + getent passwd plexpy &> /dev/null && usercmd='usermod' + $usercmd plexpy -G dietpi -d /opt/plexpy -s $(command -v nologin) - useradd -rM plexpy -G dietpi -s /usr/sbin/nologin + # Directory + mkdir -p $G_FP_DIETPI_USERDATA/plexpy + chown plexpy:dietpi /opt/plexpy $G_FP_DIETPI_USERDATA/plexpy + # Service cat << _EOF_ > /etc/systemd/system/plexpy.service [Unit] Description=Tautulli - Stats for Plex Media Server usage (DietPi) @@ -12012,14 +11724,20 @@ _EOF_ fi - #Jackett - software_id=147 + software_id=147 # Jackett if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - adduser jackett --system --no-create-home --group --shell=/usr/sbin/nologin + # User + usercmd='useradd -rM' + getent passwd jackett &> /dev/null && usercmd='usermod' + $usercmd jackett -d /opt/jackett -s $(command -v nologin) + + # Permissions + chown -R jackett:jackett /opt/jackett + # Service: https://github.com/Jackett/Jackett/wiki/systemd-service cat << _EOF_ > /etc/systemd/system/jackett.service [Unit] Description=Jackett Daemon (DietPi) @@ -12027,23 +11745,37 @@ After=network.target [Service] User=jackett -Group=jackett -WorkingDirectory=/opt/jackett -Environment=USER=jackett HOME=/opt/jackett +Environment=XDG_CONFIG_HOME=/opt/jackett +ExecStart=$(command -v mono) -O=-aot /opt/jackett/JackettConsole.exe --NoRestart Restart=always RestartSec=5 -Type=simple -ExecStart=/usr/bin/mono -O=-aot /opt/jackett/JackettConsole.exe TimeoutStopSec=20 +# These lines optionally isolate (sandbox) Jackett from the rest of the system. +ProtectSystem=strict +ProtectHome=true +PrivateDevices=true +PrivateTmp=true +ReadWritePaths=/opt/jackett + [Install] WantedBy=multi-user.target _EOF_ + # - Non-ARMv6 devices run the standalone version: https://github.com/Jackett/Jackett#install-on-linux-amdx64 + (( $G_HW_ARCH != 1 )) && G_CONFIG_INJECT 'ExecStart=' 'ExecStart=/opt/jackett/jackett --NoRestart' /etc/systemd/system/jackett.service + + # - Jessie: ProtectSystem=strict and ReadWritePaths not supported, use ProtectSystem=full instead: https://manpages.debian.org/jessie/systemd/systemd.exec.5.en.html + if (( $G_DISTRO < 4 )); then + + G_CONFIG_INJECT 'ProtectSystem=' 'ProtectSystem=full' /etc/systemd/system/jackett.service + sed -i '/^ReadWritePaths=/d' /etc/systemd/system/jackett.service + + fi + fi - #NZBget - software_id=149 + software_id=149 # NZBget if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -12072,9 +11804,9 @@ _EOF_ sed -i "/CrashTrace=/c\CrashTrace=no" $G_FP_DIETPI_USERDATA/nzbget/nzbget.conf sed -i "/DetailTarget=/c\DetailTarget=none" $G_FP_DIETPI_USERDATA/nzbget/nzbget.conf - sed -i "/ParBuffer=/c\ParBuffer=$(Optimize_BitTorrent 0)" $G_FP_DIETPI_USERDATA/nzbget/nzbget.conf - sed -i "/ArticleCache=/c\ArticleCache=$(Optimize_BitTorrent 0)" $G_FP_DIETPI_USERDATA/nzbget/nzbget.conf - sed -i "/WriteBuffer=/c\WriteBuffer=$(Optimize_BitTorrent 0)" $G_FP_DIETPI_USERDATA/nzbget/nzbget.conf + sed -i "/ParBuffer=/c\ParBuffer=$(Optimise_BitTorrent 0)" $G_FP_DIETPI_USERDATA/nzbget/nzbget.conf + sed -i "/ArticleCache=/c\ArticleCache=$(Optimise_BitTorrent 0)" $G_FP_DIETPI_USERDATA/nzbget/nzbget.conf + sed -i "/WriteBuffer=/c\WriteBuffer=$(Optimise_BitTorrent 0)" $G_FP_DIETPI_USERDATA/nzbget/nzbget.conf cat << _EOF_ > /etc/systemd/system/nzbget.service [Unit] @@ -12093,8 +11825,7 @@ _EOF_ fi - #HTPC Manager - software_id=155 + software_id=155 # HTPC Manager if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -12105,7 +11836,6 @@ Description=HTPC Manager (DietPi) After=network.target [Service] -Type=simple ExecStart=/usr/bin/python $G_FP_DIETPI_USERDATA/htpc-manager/Htpc.py [Install] @@ -12114,8 +11844,7 @@ _EOF_ fi - #OctoPrint - software_id=153 + software_id=153 # OctoPrint if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -12125,7 +11854,6 @@ _EOF_ Description=OctoPrint (DietPi) [Service] -Type=simple ExecStart=$(command -v octoprint) serve --iknowwhatimdoing [Install] @@ -12134,8 +11862,7 @@ _EOF_ fi - #RoonServer - software_id=154 + software_id=154 # Roon Server if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -12146,7 +11873,6 @@ Description=Roon Server (DietPi) After=network.target [Service] -Type=simple Environment=ROON_DATAROOT=$G_FP_DIETPI_USERDATA/roonserver ExecStart=$G_FP_DIETPI_USERDATA/roonserver/start.sh @@ -12156,8 +11882,7 @@ _EOF_ fi - #Steam - software_id=156 + software_id=156 # Steam if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -12170,8 +11895,7 @@ _EOF_ fi - #------------------ Home Automation: Home Assistant ------------------ - software_id=157 + software_id=157 # Home Assistant if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -12182,7 +11906,6 @@ Description=Home Assistant (DietPi) After=network.target [Service] -Type=simple User=homeassistant ExecStart=/srv/homeassistant/homeassistant-start.sh @@ -12198,10 +11921,8 @@ _EOF_ ln -sf $G_FP_DIETPI_USERDATA/homeassistant /home/homeassistant/.homeassistant fi - #------------------------------------------------------------------- - #Minio Config - software_id=158 + software_id=158 # Minio if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -12223,13 +11944,12 @@ _EOF_ fi - #Docker Config - software_id=162 + software_id=162 # Docker if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - #Set docker service to 'simple': https://github.com/MichaIng/DietPi/issues/2238#issuecomment-439474766 + # Set docker service to 'simple': https://github.com/MichaIng/DietPi/issues/2238#issuecomment-439474766 mkdir -p /lib/systemd/system/docker.service.d echo -e '[Service]\nType=simple' > /lib/systemd/system/docker.service.d/dietpi-simple.conf @@ -12248,9 +11968,7 @@ _EOF_ fi - #------------------------------------------------------------------- - #FuguHub Config - software_id=161 + software_id=161 # FuguHub if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -12276,9 +11994,7 @@ _EOF_ fi - #------------------------------------------------------------------- - #Nukkit Config - software_id=164 + software_id=164 # Nukkit if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -12330,9 +12046,7 @@ _EOF_ fi - - #Allo Config - software_id=159 # 160 for quick reinstall/update + software_id=159 # Allo: 160 for quick reinstall/update if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 || ${aSOFTWARE_INSTALL_STATE[160]} == 1 )); then @@ -12340,19 +12054,19 @@ _EOF_ #Create allo user for GUI useradd -m allo -s /bin/bash -G www-data - chpasswd <<< "allo:allo" - echo -e "allo ALL=NOPASSWD: ALL" > /etc/sudoers.d/allo + chpasswd <<< 'allo:allo' + echo 'allo ALL=NOPASSWD: ALL' > /etc/sudoers.d/allo #Always Drop DB, and, recreate it, due to error issue with reinstall over the top. mysqladmin drop allo_db -f &> /dev/null - mysql -e "drop user allo_db@localhost" &> /dev/null + mysql -e 'drop user allo_db@localhost' &> /dev/null /DietPi/dietpi/func/create_mysql_db allo_db allo_db "$GLOBAL_PW" mysql allo_db < /var/www/allo_db.sql - rm /var/www/allo_db.sql + [[ -f /var/www/allo_db.sql ]] && rm /var/www/allo_db.sql # - Redirect to web interface by default: - rm /var/www/index.htm* + rm -f /var/www/index.htm* cat << _EOF_ > /var/www/index.php _EOF_ - #HW specific changes + # HW specific changes # - SPARKY ONLY - Auto detect eth adapter if (( $G_HW_MODEL == 70 )); then @@ -12375,15 +12089,14 @@ Description=Sparky auto detect and set onboard ETH/USB ETH (DietPi) After=network.target networking.service [Service] -Type=simple RemainAfterExit=yes -ExecStart=/bin/bash -c '/usr/local/bin/sparky_eth_controller.sh' +ExecStart=/usr/local/bin/sparky_eth_controller.sh [Install] WantedBy=multi-user.target _EOF_ systemctl daemon-reload - systemctl enable sparky_eth_controller.service + systemctl enable sparky_eth_controller cat << _EOF_ > /usr/local/bin/sparky_eth_controller.sh #!/bin/bash @@ -12392,22 +12105,19 @@ sleep 20 # - Set USB ETH if found if ip a | grep -qi 'eth1'; then - echo -e "blacklist ethernet" > /etc/modprobe.d/disable_sparkysbc_ethernet.conf - rm /etc/udev/rules.d/70-persistent-net.rules &> /dev/null - rm /etc/udev/rules.d/70-persistant-net.rules &> /dev/null + echo 'blacklist ethernet' > /etc/modprobe.d/disable_sparkysbc_ethernet.conf + rm -f /etc/udev/rules.d/70-persist{a,e}nt-net.rules reboot # - Enable onboard ETH if no adapter found elif ! ip a | grep -qi 'eth0'; then - rm /etc/modprobe.d/disable_sparkysbc_ethernet.conf &> /dev/null - rm /etc/udev/rules.d/70-persistent-net.rules &> /dev/null - rm /etc/udev/rules.d/70-persistant-net.rules &> /dev/null + [[ -f '/etc/modprobe.d/disable_sparkysbc_ethernet.conf' ]] && rm /etc/modprobe.d/disable_sparkysbc_ethernet.conf + rm -f /etc/udev/rules.d/70-persist{a,e}nt-net.rules reboot fi _EOF_ - chmod +x /usr/local/bin/sparky_eth_controller.sh fi @@ -12464,11 +12174,11 @@ PATH+=':$HOME/wiringPi/gpio' TICKRATE=0.25 -echo -e "Audiophonics Shutdown script starting..." -echo -e "Asserting pins : " -echo -e "ShutDown : GPIO17=in, Low" -echo -e "BootOK : GPIO22=out, High" -echo -e "SoftSD : GPIO04=out, Low" +echo 'Audiophonics Shutdown script starting... +Asserting pins : +ShutDown : GPIO17=in, Low +BootOK : GPIO22=out, High +SoftSD : GPIO04=out, Low' gpio -g mode 04 out gpio -g write 04 0 @@ -12482,7 +12192,7 @@ do if (( \$(gpio -g read 17) == 1 )); then - G_DIETPI-NOTIFY 0 "AudioPhonics Pi-SPC: Power off requested. Shutting down system." + G_DIETPI-NOTIFY 0 'AudioPhonics Pi-SPC: Power off requested. Shutting down system.' sudo poweroff #sudo shutdown -h -P now break @@ -12495,7 +12205,6 @@ done exit 0 _EOF_ - chmod +x /var/lib/dietpi/dietpi-software/installed/pi-spc/sds.sh cat << _EOF_ > /etc/systemd/system/pi-spc.service @@ -12503,44 +12212,40 @@ _EOF_ Description=AudioPhonics Pi-SPC (DietPi) [Service] -Type=simple StandardOutput=tty - -ExecStart=/bin/bash -c '/var/lib/dietpi/dietpi-software/installed/pi-spc/sds.sh' +ExecStart=/var/lib/dietpi/dietpi-software/installed/pi-spc/sds.sh [Install] WantedBy=multi-user.target _EOF_ - # G_CONFIG_INJECT 'dtoverlay=gpio-shutdown' 'dtoverlay=gpio-shutdown,gpio_pin=22,active_low=0' /DietPi/config.txt - # G_CONFIG_INJECT 'dtoverlay=gpio-poweroff' 'dtoverlay=gpio-poweroff,gpio_pin=17' /DietPi/config.txt + #G_CONFIG_INJECT 'dtoverlay=gpio-shutdown' 'dtoverlay=gpio-shutdown,gpio_pin=22,active_low=0' /DietPi/config.txt + #G_CONFIG_INJECT 'dtoverlay=gpio-poweroff' 'dtoverlay=gpio-poweroff,gpio_pin=17' /DietPi/config.txt fi - #Google AIY - software_id=169 + software_id=169 # Google AIY if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - # - Symlink userdata location for assistant.json + # Symlink userdata location for assistant.json ln -sf $G_FP_DIETPI_USERDATA/voice-recognizer-raspi/assistant.json /home/dietpi/assistant.json - # - Generate cache dir + # Generate cache dir mkdir -p /home/dietpi/.cache/voice-recognizer - #Setup soundcard + # Setup soundcard /DietPi/dietpi/func/dietpi-set_hardware soundcard googlevoicehat-soundcard fi - #PiJuice - software_id=100 + software_id=100 # PiJuice if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration - #RPi enable i2c required for GUI + # RPi enable i2c required for GUI (( $G_HW_MODEL < 10 )) && /DietPi/dietpi/func/dietpi-set_hardware i2c enable mkdir -p /var/lib/dietpi/dietpi-software/installed/pijuice @@ -12616,14 +12321,6 @@ _EOF_ fi - #Roon Extension Manager - software_id=86 - if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then - - Banner_Configuration - - fi - #------------------------------------------------------------------ } @@ -12633,7 +12330,7 @@ _EOF_ local gpu_enabled=0 local gpu_memory=0 - #Define Memory Split Modes with installed software + # Define Memory Split Modes with installed software local hw_memory_size=$(cat /DietPi/dietpi/.hw_model | grep -m1 'HW_MEMORY_SIZE=' | sed 's/^[^=]*=//') # - Kodi @@ -12674,7 +12371,7 @@ _EOF_ fi - #Apply + # Apply if (( $gpu_memory > 0 && $G_HW_MODEL < 10 )); then # - Never override a higher existing value @@ -12689,7 +12386,7 @@ _EOF_ fi - #Disable headless/enable GPU's + # Disable headless/enable GPU's (( $gpu_enabled )) && /DietPi/dietpi/func/dietpi-set_hardware headless 0 } @@ -12700,7 +12397,7 @@ _EOF_ FP_DIETPI_DEDICATED_USBDRIVE=$(df -P | mawk '/^\/dev\/sda1/ {print $6;exit}') - #Only enable if mounted + # Only enable if mounted if [[ $FP_DIETPI_DEDICATED_USBDRIVE ]] && df -P | grep -qi "$FP_DIETPI_DEDICATED_USBDRIVE"; then @@ -12712,7 +12409,7 @@ _EOF_ Uninstall_Software(){ - #NB: systemctl daemon-reload is executed at the end of this function + # NB: systemctl daemon-reload is executed at the end of this function local software_id=-1 @@ -12722,7 +12419,35 @@ _EOF_ apt-mark unhold pcmanfm #RPi Banner_Uninstalling - G_AGP lxde $(dpkg --get-selections lxde-* | mawk '{print $1}') upower policykit-1 firefox-esr + apt-mark auto upower policykit-1 firefox-esr + G_AGP lxde $(dpkg --get-selections lxde-* | mawk '{print $1}') + rm -Rf /root/.config/{lxpanel,lxsession,lxterminal} + + fi + + software_id=173 + if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then + + Banner_Uninstalling + apt-mark auto qterminal firefox-esr xarchiver lxde-icon-theme upower xscreensaver leafpad featherpad speedcrunch + G_AGP lxqt + [[ -d '/root/.config/lxqt' ]] && rm -R /root/.config/lxqt + + fi + + software_id=174 + if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then + + Banner_Uninstalling + G_AGP gimp + + fi + + software_id=175 + if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then + + Banner_Uninstalling + G_AGP xfce4-power-manager fi @@ -12730,7 +12455,8 @@ _EOF_ if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then Banner_Uninstalling - G_AGP mate-desktop-environment-extras upower policykit-1 firefox-esr + apt-mark auto upower policykit-1 firefox-esr + G_AGP mate-desktop-environment-extras fi @@ -12738,7 +12464,8 @@ _EOF_ if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then Banner_Uninstalling - G_AGP x-window-system-core wmaker gnustep gnustep-devel gnustep-games upower policykit-1 firefox-esr + apt-mark auto upower policykit-1 firefox-esr + G_AGP x-window-system-core wmaker gnustep gnustep-devel gnustep-games fi @@ -12746,7 +12473,8 @@ _EOF_ if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then Banner_Uninstalling - G_AGP xfce4 gnome-icon-theme tango-icon-theme firefox-esr + apt-mark auto gnome-icon-theme tango-icon-theme firefox-esr + G_AGP xfce4 fi @@ -12790,6 +12518,9 @@ _EOF_ Banner_Uninstalling # Remove background cron job crontab -u www-data -l | grep -v '/var/www/owncloud/cron.php' | crontab -u www-data - + # Disable and remove PHP modules + phpdismod dietpi-owncloud &> /dev/null + rm -f /etc/php/*/mods-available/dietpi-owncloud.ini # Disable and remove webserver configs a2dissite dietpi-owncloud 2> /dev/null rm /etc/apache2/sites-available/dietpi-owncloud.conf 2> /dev/null @@ -12825,16 +12556,18 @@ _EOF_ fi grep -q 'owncloud' /etc/nginx/sites-dietpi/dietpi-dav_redirect.conf &> /dev/null && rm /etc/nginx/sites-dietpi/dietpi-dav_redirect.conf + # PHP7.3 block removal + [[ -f '/etc/apt/preferences.d/dietpi-owncloud' ]] && rm /etc/apt/preferences.d/dietpi-owncloud fi - software_id=168 # Nextcloud Talk + TURN server "coturn" + software_id=168 # Nextcloud Talk + coTURN server if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then Banner_Uninstalling G_AGP coturn - [[ -f /etc/turnserver.conf ]] && rm /etc/turnserver.conf - [[ -d /etc/systemd/system/coturn.service.d ]] && rm -R /etc/systemd/system/coturn.service.d + [[ -f '/etc/turnserver.conf' ]] && rm /etc/turnserver.conf + [[ -d '/etc/systemd/system/coturn.service.d' ]] && rm -R /etc/systemd/system/coturn.service.d systemctl start $MARIADB_SERVICE systemctl start redis-server ncc maintenance:mode --off @@ -12848,6 +12581,9 @@ _EOF_ Banner_Uninstalling crontab -u www-data -l | grep -v '/var/www/nextcloud/cron.php' | crontab -u www-data - + # Disable and remove PHP modules + phpdismod dietpi-nextcloud &> /dev/null + rm -f /etc/php/*/mods-available/dietpi-nextcloud.ini # Disable and remove webserver configs a2dissite dietpi-nextcloud 2> /dev/null rm /etc/apache2/sites-available/dietpi-nextcloud.conf 2> /dev/null @@ -12921,7 +12657,7 @@ _EOF_ if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then Banner_Uninstalling - G_AGP sqlite3 + G_AGP sqlite3 php*-sqlite3 fi @@ -12929,22 +12665,22 @@ _EOF_ if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then Banner_Uninstalling - G_AGP "$PHP_BINARY"-redis redis-server redis-tools + G_AGP redis-server redis-tools php*-redis + [[ -d '/etc/systemd/system/redis-server.service.d' ]] && rm -R /etc/systemd/system/redis-server.service.d # Jessie permissions fix fi - software_id=89 + software_id=89 # PHP if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then Banner_Uninstalling - rm $FP_PHP_BASE_DIR/fpm/pool.d/www.conf 2> /dev/null - rm $FP_PHP_BASE_DIR/mods-available/dietpi.ini 2> /dev/null - G_AGP $(dpkg --get-selections | grep -E '(php[0-9]?\.?[0-9]?-*|libapache2-mod-php*)' | mawk '{print $1}') - rm /var/www/phpinfo.php - rm /var/www/apc.php - rm /var/www/opcache.php + G_AGP $(dpkg --get-selections | grep -E '^(php[0-9.]*-|libapache2-mod-php)' | mawk '{print $1}') + [[ -d '/etc/php' ]] && rm -R /etc/php + [[ -f '/var/www/phpinfo.php' ]] && rm /var/www/phpinfo.php + [[ -f '/var/www/apc.php' ]] && rm /var/www/apc.php + [[ -f '/var/www/opcache.php' ]] && rm /var/www/opcache.php # temp php uploads, if it was created - rm -R /var/tmp/php_upload_tmp 2> /dev/null + [[ -d '/var/tmp/php_upload_tmp' ]] && rm -R /var/tmp/php_upload_tmp fi @@ -12959,14 +12695,15 @@ _EOF_ fi - software_id=54 + software_id=54 # phpBB Forum if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then Banner_Uninstalling systemctl start $MARIADB_SERVICE mysqladmin drop phpbb3 -f mysql -e "drop user 'phpbb3'@'localhost'" - rm -R /var/www/phpBB3 + [[ -d '/var/www/phpBB3' ]] && rm -R /var/www/phpBB3 + [[ -f '/etc/apt/preferences.d/dietpi-phpbb' ]] && rm /etc/apt/preferences.d/dietpi-phpbb fi @@ -13040,7 +12777,7 @@ _EOF_ fi - software_id=124 + software_id=124 # NAA Daemon if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then Banner_Uninstalling @@ -13049,7 +12786,7 @@ _EOF_ fi - software_id=125 + software_id=125 # Tomcat8 if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then Banner_Uninstalling @@ -13084,15 +12821,19 @@ _EOF_ fi - software_id=131 + software_id=131 # Blynk Server if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then Banner_Uninstalling - [[ -f /etc/systemd/system/blynkserver.service ]] && rm /etc/systemd/system/blynkserver.service - [[ -d $G_FP_DIETPI_USERDATA/blynk ]] && rm -R $G_FP_DIETPI_USERDATA/blynk - [[ -d /etc/blynkserver ]] && rm -R /etc/blynkserver #pre v6.19 + if [[ -f '/etc/systemd/system/blynkserver.service' ]]; then + + systemctl disable blynkserver + rm /etc/systemd/system/blynkserver.service + fi userdel -rf blynk + [[ -d $G_FP_DIETPI_USERDATA/blynk ]] && rm -R $G_FP_DIETPI_USERDATA/blynk + [[ -d '/etc/blynkserver' ]] && rm -R /etc/blynkserver # Pre-v6.19 fi @@ -13188,13 +12929,18 @@ _EOF_ fi - software_id=139 + software_id=139 # SABnzbd if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then Banner_Uninstalling - userdel -rf sabnzbd - rm -R /etc/sabnzbd - rm /etc/systemd/system/sabnzbd.service + getent passwd sabnzbd &> /dev/null && userdel -rf sabnzbd + [[ -d '/etc/sabnzbd' ]] && rm -R /etc/sabnzbd + if [[ -f '/etc/systemd/system/sabnzbd.service' ]]; then + + systemctl disable sabnzbd + rm /etc/systemd/system/sabnzbd.service + + fi fi @@ -13306,13 +13052,18 @@ _EOF_ fi - software_id=147 + software_id=147 # Jackett if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then Banner_Uninstalling - userdel -rf jackett - rm -R /opt/jackett - rm /etc/systemd/system/jackett.service + getent passwd jackett &> /dev/null && userdel -rf jackett + [[ -d '/opt/jackett' ]] && rm -R /opt/jackett + if [[ -f '/etc/systemd/system/jackett.service' ]]; then + + systemctl disable jackett + rm /etc/systemd/system/jackett.service + + fi fi @@ -13342,7 +13093,6 @@ _EOF_ Banner_Uninstalling apt-mark auto mono-complete mono-devel mono-runtime libmono-cil-dev 2>/dev/null rm /etc/apt/sources.list.d/mono-xamarin.list - G_AGUP fi @@ -13373,7 +13123,6 @@ _EOF_ fi - software_id=121 if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then @@ -13456,10 +13205,19 @@ _EOF_ if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then Banner_Uninstalling - G_AGP ibsdl1.2debian libsdl-net1.2 - rm -R /usr/local/games/opentyrian + if (( $G_HW_MODEL >= 10 )); then + + G_AGP opentyrian + + else + + G_AGP ibsdl1.2debian libsdl-net1.2 + + fi + rm /usr/share/applications/opentyrian.desktop rm /root/Desktop/opentyrian.desktop + rm -R /usr/games/opentyrian fi @@ -13585,6 +13343,7 @@ _EOF_ Banner_Uninstalling G_AGP subsonic + getent passwd subsonic &> /dev/null && userdel -rf subsonic [[ -d /var/subsonic ]] && rm -R /var/subsonic fi @@ -13639,15 +13398,15 @@ _EOF_ fi - software_id=35 + software_id=35 # Logitech Media Server if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then Banner_Uninstalling - #apt-mark auto libxml-parser-perl zlib1g-dev libjpeg-dev libpng-dev libjpeg62-turbo-dev &> /dev/null G_AGP logitechmediaserver - rm /etc/systemd/system/squeezeboxserver.service - rm -R /var/lib/squeezeboxserver - rm -R /usr/share/squeezeboxserver + getent passwd squeezeboxserver &> /dev/null && userdel -rf squeezeboxserver + [[ -f '/etc/systemd/system/logitechmediaserver.service' ]] && rm /etc/systemd/system/logitechmediaserver.service + [[ -d '/var/lib/squeezeboxserver' ]] && rm -R /var/lib/squeezeboxserver + [[ -d '/usr/share/squeezeboxserver' ]] && rm -R /usr/share/squeezeboxserver fi @@ -13702,11 +13461,13 @@ _EOF_ fi - software_id=73 + software_id=73 # Fail2Ban if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then Banner_Uninstalling G_AGP fail2ban + apt-mark auto python3-systemd + [[ -d '/etc/fail2ban' ]] && rm -R /etc/fail2ban fi @@ -13768,11 +13529,10 @@ _EOF_ [[ -d /etc/wireguard ]] && rm -R /etc/wireguard [[ -f /etc/apt/sources.list.d/dietpi-wireguard.list ]] && rm /etc/apt/sources.list.d/dietpi-wireguard.list [[ -f /etc/apt/preferences.d/dietpi-wireguard ]] && rm /etc/apt/preferences.d/dietpi-wireguard - [[ -f /etc/sysctl.d/dietpi-wireguard.conf ]] && rm /etc/sysctl.d/dietpi-wireguard.conf fi - software_id=171 + software_id=171 # DietPi-NordVPN if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then Banner_Uninstalling @@ -13816,7 +13576,6 @@ _EOF_ Banner_Uninstalling G_AGP i2c-tools - #Disable /DietPi/dietpi/func/dietpi-set_hardware i2c disable fi @@ -13891,10 +13650,10 @@ _EOF_ Banner_Uninstalling #apt-mark auto libssl1.0.0 openssl libsoxr0 libavahi-client3 libtool libconfig9 libpopt0 libdaemon0 &> /dev/null - # No package is installed anymore, files are directly extracted into places, need to remove them manually? + # No package is installed any more, files are directly extracted into places, need to remove them manually? # https://github.com/MichaIng/DietPi/blob/testing/dietpi/dietpi-software#L5968 #G_AGP shairport-sync - rm /lib/systemd/system/shairport-sync.service /usr/local/bin/shairport-sync /usr/local/etc/shairport-sync.conf* /usr/local/share/man/man7/shairport-sync.7.gz &> /dev/null + rm -f /lib/systemd/system/shairport-sync.service /usr/local/bin/shairport-sync /usr/local/etc/shairport-sync.conf* /usr/local/share/man/man7/shairport-sync.7.gz userdel -rf shairport-sync fi @@ -13925,7 +13684,7 @@ _EOF_ Banner_Uninstalling G_AGP squeezelite - rm -R /usr/bin/squeezelite* + rm -Rf /usr/bin/squeezelite* rm /etc/systemd/system/squeezelite.service fi @@ -14019,14 +13778,13 @@ _EOF_ fi - software_id=58 + software_id=58 # OpenBazaar if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then Banner_Uninstalling - - rm /etc/systemd/system/openbazaar.service - rm -R $G_FP_DIETPI_USERDATA/go/src/github.com/OpenBazaar - rm -R /etc/openbazaar-server &> /dev/null # Pre v6.15 OB1.0 + [[ -f '/etc/systemd/system/openbazaar.service' ]] && rm /etc/systemd/system/openbazaar.service + [[ -d $G_FP_DIETPI_USERDATA/go/src/github.com/OpenBazaar ]] && rm -R $G_FP_DIETPI_USERDATA/go/src/github.com/OpenBazaar + [[ -d '/etc/openbazaar-server' ]] && rm -R /etc/openbazaar-server # Pre v6.15 OB1.0 fi @@ -14034,10 +13792,9 @@ _EOF_ if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then Banner_Uninstalling - G_AGP $(dpkg --get-selections plexmediaserver* | mawk '{print $1}') - [[ -d /etc/systemd/system/plexmediaserver.service.d ]] && rm -R /etc/systemd/system/plexmediaserver.service.d # post v6.17 - [[ -d /var/lib/plexmediaserver ]] && rm -R /var/lib/plexmediaserver # pre v6.22 Plex v1.15 - [[ -f etc/apt/sources.list.d/plex.list ]] && rm /etc/apt/sources.list.d/plex.list && G_AGUP # pre v6.22 + G_AGP plexmediaserver + [[ -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 fi @@ -14381,7 +14138,7 @@ _EOF_ # On Jessie, purging MariaDB server with unix_socket authentication fails, thus revert to password: (( $G_DISTRO < 4 )) && mysql -e "grant all privileges on *.* to 'root'@'localhost' identified by '$GLOBAL_PW' with grant option;flush privileges" systemctl stop $MARIADB_SERVICE - G_AGP mariadb-server + G_AGP mariadb-server php*-mysql # - config folder rm -R /etc/mysql 2> /dev/null @@ -14399,7 +14156,7 @@ _EOF_ Banner_Uninstalling G_AGP influxdb - rm /etc/apt/sources.list.d/influxdb.list && G_AGUP + rm /etc/apt/sources.list.d/influxdb.list rm -R /var/lib/influxdb rm -R $G_FP_DIETPI_USERDATA/influxdb @@ -14448,7 +14205,6 @@ _EOF_ fi - #---------------------------------------------------------------------- #LINUX SOFTWARE @@ -14548,9 +14304,9 @@ _EOF_ Banner_Uninstalling umount -f /mnt/samba G_AGP smbclient - #Disable in fstab + # Disable in fstab sed -i '/\/mnt\/samba/c\#\/mnt\/samba . Please use dietpi-drive_manager to setup this mount' /etc/fstab - #Add info file for installation method. + # Add info file for installation method. echo -e 'Samba client can be installed and setup by DietPi-Drive_Manager.\nSimply run: dietpi-drive_manager and select the "Add network drive" option.' > /mnt/samba/readme.txt fi @@ -14586,10 +14342,10 @@ _EOF_ fi - #Disable in fstab + # Disable in fstab sed -i '/\/mnt\/nfs_client/c\#\/mnt\/nfs_client . Please use DietPi-Drive_Manager to setup this mount' /etc/fstab - #Add info file for installation method. + # Add info file for installation method. echo -e 'NFS client can be installed and setup by DietPi-Drive_Manager.\nSimply run: dietpi-drive_manager and select the "Add network drive" option.' > /mnt/nfs_client/readme.txt fi @@ -14641,9 +14397,7 @@ _EOF_ if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then Banner_Uninstalling - apt-mark auto $(dpkg --get-selections default-jre* default-jdk* openjdk-* | mawk '{print $1}') ca-certificates-java - [[ -f /etc/apt/preferences.d/99-dietpi-openjdk-8-jdk ]] && rm /etc/apt/preferences.d/99-dietpi-openjdk-8-jdk fi @@ -14686,7 +14440,7 @@ Before=dietpi-preboot.service rsyslog.service syslog.service [Service] Type=oneshot StandardOutput=tty -ExecStart=/bin/bash -c '/var/lib/dietpi/dietpi-ramlog/disable.sh &> /var/tmp/dietpi/logs/dietpi-ramlog_disable_debug.log' +ExecStart=/bin/dash -c '/var/lib/dietpi/dietpi-ramlog/disable.sh 2>&1 > /var/tmp/dietpi/logs/dietpi-ramlog_disable_debug.log' [Install] WantedBy=local-fs.target @@ -14734,12 +14488,7 @@ _EOF_ G_AGP nodejs # - old install via repo - if [[ -f /etc/apt/sources.list.d/nodesource_nodejs.list ]]; then - - rm /etc/apt/sources.list.d/nodesource_nodejs.list - G_AGUP - - fi + [[ -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 [[ -d /usr/local/n ]] && rm -R /usr/local/n @@ -14749,9 +14498,9 @@ _EOF_ [[ -d /usr/local/share/doc/node ]] && rm -R /usr/local/share/doc/node [[ -f /usr/local/man/man1/node.1 ]] && rm /usr/local/man/man1/node.1 [[ -f /usr/local/share/man/man1/node.1 ]] && rm /usr/local/share/man/man1/node.1 - [[ -f /usr/local/README.md ]] && /usr/local/README.md - [[ -f /usr/local/CHANGELOG.md ]] && /usr/local/CHANGELOG.md - [[ -f /usr/local/LICENSE ]] && /usr/local/LICENSE + [[ -f /usr/local/README.md ]] && rm /usr/local/README.md + [[ -f /usr/local/CHANGELOG.md ]] && rm /usr/local/CHANGELOG.md + [[ -f /usr/local/LICENSE ]] && rm /usr/local/LICENSE [[ -f /usr/local/share/systemtap/tapset/node.stp ]] && rm /usr/local/share/systemtap/tapset/node.stp [[ -d /root/.npm ]] && rm -R /root/.npm [[ -f /root/.config/configstore/update-notifier-npm.json ]] && rm /root/.config/configstore/update-notifier-npm.json @@ -14841,7 +14590,7 @@ _EOF_ # Unmask all services: https://github.com/MichaIng/DietPi/issues/1320 DISABLE_SERVICES_START=1 /DietPi/dietpi/dietpi-services unmask all # Stop services - /DietPi/dietpi/dietpi-services stop + [[ $G_SERVICE_CONTROL == 0 ]] || /DietPi/dietpi/dietpi-services stop #------------------------------------------------------------ #Generate userdata folders: Create_UserContent_Folders @@ -14893,7 +14642,7 @@ _EOF_ /DietPi/dietpi/dietpi-services stop Install_Linux_Software - # Install DietPi Optimized Software + # Install DietPi Optimised Software /DietPi/dietpi/dietpi-services stop Install_Dietpi_Software @@ -15010,7 +14759,7 @@ _EOF_ FirstRun_Automation_Init(){ - #Get settings + # Get settings AUTOINSTALL_ENABLED=$(grep -m1 '^[[:blank:]]*AUTO_SETUP_AUTOMATED=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') AUTOINSTALL_AUTOSTARTTARGET=$(grep -m1 '^[[:blank:]]*AUTO_SETUP_AUTOSTART_TARGET_INDEX=' /DietPi/dietpi.txt | sed 's/^[^=]*=//' ) AUTOINSTALL_SSHINDEX=$(grep -m1 '^[[:blank:]]*AUTO_SETUP_SSH_SERVER_INDEX=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') @@ -15028,13 +14777,13 @@ _EOF_ G_DIETPI-NOTIFY 3 "$G_PROGRAM_NAME" 'Running automated installation' - #Skip dietpi-software menu + # Skip dietpi-software menu TARGETMENUID=-1 - #Set start install + # Set start install GOSTARTINSTALL=1 - #Find all software entries of AUTO_SETUP_INSTALL_SOFTWARE_ID= in dietpi.txt. Then set to state 1 for installation. + # Find all software entries of AUTO_SETUP_INSTALL_SOFTWARE_ID= in dietpi.txt. Then set to state 1 for installation. while read -r software_id do @@ -15051,13 +14800,13 @@ _EOF_ fi - #Further Automated options. (Applied regardless of AUTOINSTALL_ENABLED) + # Further Automated options. (Applied regardless of AUTOINSTALL_ENABLED) INDEX_SSHSERVER_TARGET=$AUTOINSTALL_SSHINDEX INDEX_FILESERVER_TARGET=$AUTOINSTALL_FILESERVERINDEX INDEX_LOGGING_TARGET=$AUTOINSTALL_LOGGINGINDEX INDEX_WEBSERVER_TARGET=$AUTOINSTALL_WEBSERVERINDEX - #Re-flag RAMlog for install, if enabled, ensures AUTO_SETUP_RAMLOG_MAXSIZE gets applied + # Re-flag RAMlog for install, if enabled, ensures AUTO_SETUP_RAMLOG_MAXSIZE gets applied if (( $INDEX_LOGGING_TARGET == -1 || $INDEX_LOGGING_TARGET == -2 )); then aSOFTWARE_INSTALL_STATE[103]=1 @@ -15079,7 +14828,7 @@ _EOF_ local input=$@ input=${input#*[[:blank:]]} - #Install software and exit. + # Install software and exit. if [[ $1 == 'install' || $1 == 'reinstall' || $1 == 'uninstall' ]]; then G_DIETPI-NOTIFY 3 "$G_PROGRAM_NAME" "Automated $1" @@ -15092,14 +14841,14 @@ _EOF_ else # - Uninstall | Stop services prior - [[ $1 == 'uninstall' ]] && /DietPi/dietpi/dietpi-services stop + [[ $1 == 'uninstall' && $G_SERVICE_CONTROL != 0 ]] && /DietPi/dietpi/dietpi-services stop # - Process inputs for i in $input do # - Check if input software ID exists, install state was defined - if disable_error=1 G_CHECK_VALIDINT $i 0 + if disable_error=1 G_CHECK_VALIDINT $i 0 && disable_error=1 G_CHECK_VALIDINT ${aSOFTWARE_INSTALL_STATE[$i]}; then if [[ $1 == 'uninstall' ]]; then @@ -15174,71 +14923,46 @@ _EOF_ # - Reinstall, prompt for backup if [[ $1 == 'reinstall' ]]; then - if (( $GOSTARTINSTALL )); then - - G_PROMPT_BACKUP - - fi + (( $GOSTARTINSTALL )) && G_PROMPT_BACKUP # - Uninstall | Finish up and clear non-required packages elif [[ $1 == 'uninstall' ]]; then Uninstall_Software - #Save + # - Save Write_InstallFileList # - Start services - /DietPi/dietpi/dietpi-services start + [[ $G_SERVICE_CONTROL == 0 ]] || /DietPi/dietpi/dietpi-services start fi fi - #List unique software names and ID's + # List software IDs, names and additional info elif [[ $1 == 'list' ]]; then for i in ${!aSOFTWARE_INSTALL_STATE[@]} do - local string='' - - if (( ${aSOFTWARE_INSTALL_STATE[$i]} == 2 )); then - - string="\e[32mID $i | " - - else - - string="\e[0mID $i | " - - fi + local string="\e[0mID $i | " + (( ${aSOFTWARE_INSTALL_STATE[$i]} == 2 )) && string="\e[32mID $i | " string+="=${aSOFTWARE_INSTALL_STATE[$i]} | ${aSOFTWARE_WHIP_NAME[$i]}:\e[0m \e[90m${aSOFTWARE_WHIP_DESC[$i]}\e[0m |" (( ${aSOFTWARE_REQUIRES_ALSA[$i]:=0} == 1 )) && string+=' +ALSA' - (( ${aSOFTWARE_REQUIRES_XSERVERXORG[$i]:=0} == 1 )) && string+=' +XSERVER' - (( ${aSOFTWARE_REQUIRES_DESKTOP[$i]:=0} == 1 )) && string+=' +DESKTOP' - (( ${aSOFTWARE_REQUIRES_RSYSLOG[$i]:=0} == 1 )) && string+=' +RSYSLOG' - (( ${aSOFTWARE_REQUIRES_FFMPEG[$i]:=0} == 1 )) && string+=' +FFMPEG' - - (( ${aSOFTWARE_REQUIRES_JAVA_JRE_JDK[$i]:=0} == 1 )) && string+=' +ORACLEJAVA' - + (( ${aSOFTWARE_REQUIRES_JAVA_JRE_JDK[$i]:=0} == 1 )) && string+=' +JAVA' (( ${aSOFTWARE_REQUIRES_NODEJS[$i]:=0} == 1 )) && string+=' +NODEJS' - (( ${aSOFTWARE_REQUIRES_BUILDESSENTIAL[$i]:=0} == 1 )) && string+=' +BUILDESSENTIAL' - (( ${aSOFTWARE_REQUIRES_GIT[$i]:=0} == 1 )) && string+=' +GIT' - (( ${aSOFTWARE_REQUIRES_WEBSERVER[$i]:=0} == 1 )) && string+=' +WEBSERVER' - (( ${aSOFTWARE_REQUIRES_PHP[$i]:=0} == 1 )) && string+=' +PHP' - (( ${aSOFTWARE_REQUIRES_MYSQL[$i]:=0} == 1 )) && string+=' +MARIADB' - (( ${aSOFTWARE_REQUIRES_SQLITE[$i]:=0} == 1 )) && string+=' +SQLITE' # - Available for G_HW_ARCH? @@ -15261,11 +14985,23 @@ _EOF_ # - Online docs [[ ${aSOFTWARE_ONLINEDOC_URL[$i]} ]] && string+=" | \e[90m$FP_ONLINEDOC_URL${aSOFTWARE_ONLINEDOC_URL[$i]}\e[0m" - #Convert string to lowercase + # - Convert string to lowercase echo -e "${string,,}" done + elif [[ $1 == 'free' ]]; then + + # Get highest software array index + local max=0 + for max in ${!aSOFTWARE_INSTALL_STATE[@]}; do :; done + + # Check for unused indices + local free='' + for (( i=0; i<=$max; i++ )); do [[ ${aSOFTWARE_INSTALL_STATE[$i]} ]] || free+=" $i"; done + + echo "Free software ID(s):${free:- None, so use $(($max+1))!}" + else G_DIETPI-NOTIFY 2 "Unknown command $1" @@ -15282,11 +15018,11 @@ _EOF_ Menu_CreateSoftwareList(){ - #software type for this menu + # Software type for this menu local input_mode=$1 #-1=search all mode #0=dietpi 1=linux local display_software_menu=1 #only used to disable display of CHECKLIST when search finds no results - #Search Mode + # Search Mode if (( $input_mode == -1 )); then local search_string='' #show all @@ -15316,8 +15052,6 @@ _EOF_ fi - echo $i - G_WHIP_CHECKLIST_ARRAY+=($i "${aSOFTWARE_WHIP_NAME[$i]}: ${aSOFTWARE_WHIP_DESC[$i]}" "$selected") display_software_menu=1 @@ -15329,7 +15063,7 @@ _EOF_ fi - #Generate Whiptail menu list, of all items in specific software type, based on category + # Generate Whiptail menu list, of all items in specific software type, based on category else # - Prewarnings - Linux @@ -15353,14 +15087,14 @@ _EOF_ for ((i=0; i<$max_categories; i++)) do - #Only add the category if we have software for it. + # Only add the category if we have software for it. local category_enabled=0 - #Now run through all available software + # Now run through all available software for j in ${!aSOFTWARE_CATEGORY_INDEX[@]} do - #Check if this software matches the current category and software type for this menu. + # Check if this software matches the current category and software type for this menu. if (( ${aSOFTWARE_CATEGORY_INDEX[$j]} == $i && ${aSOFTWARE_TYPE[$j]} == $input_mode )); then # + is available for hardware? @@ -15403,7 +15137,7 @@ _EOF_ fi - #Add this option to whiptail list + # Add this option to whiptail list G_WHIP_CHECKLIST_ARRAY+=($j "${aSOFTWARE_WHIP_NAME[$j]}: ${aSOFTWARE_WHIP_DESC[$j]}" $selected) fi @@ -15418,15 +15152,15 @@ _EOF_ if (( $display_software_menu )); then - G_WHIP_SIZE_X_MAX=83 + G_WHIP_SIZE_X_MAX=90 G_WHIP_BUTTON_CANCEL_TEXT='Back' G_WHIP_CHECKLIST "Please use the spacebar to select the software you wish to install.\n - Software and usage details: https://dietpi.com/software - NB: Pressing 'ESC' or selecting 'Back' will clear all changed selections" - #Reset Choices made flag + # Reset Choices made flag INSTALL_SOFTWARE_CHOICESMADE=0 - #Check for matching results (selected items) + # Check for matching results (selected items) for i in ${G_WHIP_RETURNED_VALUE[@]} do @@ -15441,9 +15175,9 @@ _EOF_ done #----------------------------------------------------------------------------- - #Install Info/Warnings + # Install Info/Warnings - #DietPi-Drive_Manager can be used to setup Samba/NFS shares with ease! + # DietPi-Drive_Manager can be used to setup Samba/NFS shares with ease! if (( ${aSOFTWARE_INSTALL_STATE[1]} == 1 || ${aSOFTWARE_INSTALL_STATE[110]} == 1 )); then G_WHIP_MSG "NFS/Samba client info:\n\nDietPi-Drive_Manager is a powerful tool which vastly simplifies the mounting of NFS and Samba shares.\n @@ -15451,7 +15185,7 @@ Once $G_PROGRAM_NAME has finished installation, simply run 'dietpi-drive_manager fi - #Gogs: Requires OpenSSH for ssh-keygen binary: https://github.com/MichaIng/DietPi/issues/442 + # Gogs: Requires OpenSSH for ssh-keygen binary: https://github.com/MichaIng/DietPi/issues/442 if (( ${aSOFTWARE_INSTALL_STATE[49]} == 1 && $INDEX_SSHSERVER_TARGET != -2 )); then if G_WHIP_YESNO "Gogs requires OpenSSH server to function.\n\nIf you continue, OpenSSH will be selected for install on your system. OpenSSH will also replace Dropbear (if currently installed).\n @@ -15468,7 +15202,7 @@ Would you like to continue with the Gogs installation?"; then fi - #Webserver stacks + # Webserver stacks for i in 75 76 78 79 81 82 do @@ -15484,7 +15218,7 @@ TLDR: You do NOT need to select a webserver stack for installation with DietPi. done - #RPiCamInterface - warn user of locking out camera: https://github.com/MichaIng/DietPi/issues/249 + # RPiCamInterface - warn user of locking out camera: https://github.com/MichaIng/DietPi/issues/249 if (( ${aSOFTWARE_INSTALL_STATE[59]} == 1 )); then G_WHIP_MSG 'RPi Cam Control Interface will automatically start and activate the camera during boot. This will prevent other programs (eg: raspistill) from using the camera.\n @@ -15492,7 +15226,7 @@ You can free up the camera by selecting "Stop Camera" from the web interface:\n fi - #EmonHUB/EmonPi + # EmonHUB/EmonPi if (( ${aSOFTWARE_INSTALL_STATE[99]} == 1 )); then # - Enter API KEY @@ -15501,7 +15235,7 @@ You can free up the camera by selecting "Stop Camera" from the web interface:\n while (( $USER_EMONHUB_APIKEY_COMPLETED == 0 )); do - G_WHIP_INPUTBOX "EmonHUB/EmonPi:\n\nPlease enter the \"Write API KEY\":\n - Visit http://emoncms.org to register an account and login. + 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 @@ -15523,7 +15257,7 @@ You can free up the camera by selecting "Stop Camera" from the web interface:\n fi - #Pi-hole. + # Pi-hole if (( ${aSOFTWARE_INSTALL_STATE[93]} == 1 )); then # - prompt for static ip. @@ -15540,10 +15274,10 @@ Once completed, select "Apply Save Changes", then exit DietPi-Config to resume s fi - #Wifi Hotspot Criteria + # WiFi Hotspot Criteria if (( ${aSOFTWARE_INSTALL_STATE[60]} == 1 || ${aSOFTWARE_INSTALL_STATE[61]} == 1 )); then - #Enable wifi modules + # Enable WiFi modules /DietPi/dietpi/func/dietpi-set_hardware wifimodules enable while :; do @@ -15573,14 +15307,14 @@ Once completed, select "Apply Save Changes", then exit DietPi-Config to resume s fi - #Passed + # Passed if (( $criteria_passed )); then output_string+='\n\nPASSED: Criteria met. Good to go.' G_WHIP_MSG "$output_string" break - #Failed, retry? + # Failed, retry? else output_string+='\n\nFAILED: Criteria not met. Would you like to check again?' @@ -15599,7 +15333,7 @@ Once completed, select "Apply Save Changes", then exit DietPi-Config to resume s fi - #Weaved + # Weaved/Remot3.it 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 @@ -15607,7 +15341,7 @@ Once DietPi has completed your software installations, and rebooted, please foll fi - #LetsEncrypt + # 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: @@ -15615,7 +15349,7 @@ Once DietPi has completed your software installations, and rebooted, please foll fi - #dietpi-config can be used to install/configure the following software. Ask user. + # dietpi-config can be used to install/configure the following software. Ask user. # NoIp if (( ${aSOFTWARE_INSTALL_STATE[67]} == 1 )); then @@ -15635,7 +15369,7 @@ Once DietPi has completed your software installations, and rebooted, please foll fi - #Boot Choices + # Boot Choices if (( ${aSOFTWARE_INSTALL_STATE[23]} == 1 || ${aSOFTWARE_INSTALL_STATE[24]} == 1 || ${aSOFTWARE_INSTALL_STATE[25]} == 1 || @@ -15645,7 +15379,8 @@ Once DietPi has completed your software installations, and rebooted, please foll ${aSOFTWARE_INSTALL_STATE[108]} == 1 || ${aSOFTWARE_INSTALL_STATE[112]} == 1 || ${aSOFTWARE_INSTALL_STATE[119]} == 1 || - ${aSOFTWARE_INSTALL_STATE[155]} == 1 )); then + ${aSOFTWARE_INSTALL_STATE[155]} == 1 || + ${aSOFTWARE_INSTALL_STATE[173]} == 1 )); then # Set Boot Order G_WHIP_YESNO 'Would you like to configure the auto boot options for DietPi?\n @@ -15660,7 +15395,7 @@ This will allow you to choose which program loads automatically, after the syste Menu_Main(){ - #Data for storing SSH server index info + # Data for storing SSH server index info local index_sshserver_text='None' if (( $INDEX_SSHSERVER_TARGET == -1 )); then @@ -15672,7 +15407,7 @@ This will allow you to choose which program loads automatically, after the syste fi - #Data for storing Fileserver index info + # Data for storing Fileserver index info local index_fileserver_text='None' if (( $INDEX_FILESERVER_TARGET == -1 )); then @@ -15684,7 +15419,7 @@ This will allow you to choose which program loads automatically, after the syste fi - #Data for storing Logging index info + # Data for storing Logging index info local index_logging_text='None' if (( $INDEX_LOGGING_TARGET == -1 )); then @@ -15700,13 +15435,13 @@ This will allow you to choose which program loads automatically, after the syste fi - #Hold our string that tells the user what software will be removed when using Index based choice systems + # Hold our string that tells the user what software will be removed when using Index based choice systems local toberemoved_text='' - #Check status of USB drive + # Check status of USB drive Check_USB_Drive_Installed - #Where is userdata stored? + # Where is userdata stored? local user_data_location_current=$(readlink -f $G_FP_DIETPI_USERDATA) local user_data_location_description='' @@ -15742,7 +15477,7 @@ This will allow you to choose which program loads automatically, after the syste 'DietPi-Config' ': Feature-rich configuration tool for your device' '' '●─ Select Software ' 'Search' ': Find a software title for installation' - 'Software Optimized' ': Select DietPi optimized software for installation' + 'Software Optimised' ': Select DietPi optimised software for installation' 'Software Additional' ': Select additional Linux software for installation' 'SSH Server' ": [$index_sshserver_text]" 'File Server' ": [$index_fileserver_text]" @@ -15777,7 +15512,7 @@ This will allow you to choose which program loads automatically, after the syste ;; - 'Software Optimized') + 'Software Optimised') TARGETMENUID=1 @@ -15831,7 +15566,7 @@ This will allow you to choose which program loads automatically, after the syste fi - #Check for changes + # Check for changes INSTALL_SSHSERVER_CHOICESMADE=0 if (( $INDEX_SSHSERVER_TARGET != $INDEX_SSHSERVER_CURRENT )); then @@ -15886,7 +15621,7 @@ This will allow you to choose which program loads automatically, after the syste fi - #Check for changes + # Check for changes INSTALL_FILESERVER_CHOICESMADE=0 if (( $INDEX_FILESERVER_TARGET != $INDEX_FILESERVER_CURRENT )); then @@ -15948,7 +15683,7 @@ This will allow you to choose which program loads automatically, after the syste fi - #Check for changes + # Check for changes INSTALL_LOGGING_CHOICESMADE=0 if (( $INDEX_LOGGING_TARGET != $INDEX_LOGGING_CURRENT )); then @@ -15967,15 +15702,15 @@ This will allow you to choose which program loads automatically, after the syste G_WHIP_MENU_ARRAY=( - 'List' ': Select from a list of available drive mounts, to move user data.' - 'Custom' ': Input a manual location to move user data.' - 'Drive' ': Launches DietPi Drive Manager.' + 'List' ': Select from a list of available drives to move user data.' + 'Custom' ': Manually enter a location location to move user data.' + 'Drive' ': Launch DietPi-Drive_Manager.' ) 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?f=8&t=478&p=2087\n\n- DietPi-Drive Manager: Launch DietPi-Drive Manager to setup external drives, and, move user data to different locations.' + 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 # - DriveMan @@ -16023,7 +15758,7 @@ More information on user data in DietPi:\n- https://dietpi.com/phpbb/viewtopic.p else - G_WHIP_MSG "User data transfer: Failed\n\n$(cat /var/log/dietpi-move_userdata.log)\n\nNo changes have been applied." + G_WHIP_MSG "User data transfer: Failed\n\n$( uninstall), before trying again." - # - Apply preference selection else @@ -16179,7 +15913,7 @@ When you select any software for install that requires a webserver, DietPi will esac - #Exit/Abort Setup + # Exit/Abort Setup else Menu_Exit @@ -16190,22 +15924,20 @@ When you select any software for install that requires a webserver, DietPi will Menu_Exit(){ - #Return to Main Menu - TARGETMENUID=0 + TARGETMENUID=0 # Return to Main Menu - #1st run install + # 1st run install if (( $G_DIETPI_INSTALL_STAGE == 1 )); then G_WHIP_MSG 'DietPi has not fully been installed.\nThis must be completed prior to using DietPi by selecting:\n - Go Start Install.' - #Standard exit + # Standard exit elif (( $G_DIETPI_INSTALL_STAGE == 2 )); then if G_WHIP_YESNO 'Do you wish to exit DietPi-Software?\n\nAll changes to software selections will be cleared.'; then Banner_Aborted - #Exit script NOW - exit + exit 0 fi @@ -16215,7 +15947,7 @@ When you select any software for install that requires a webserver, DietPi will Menu_ConfirmInstall(){ - #Obtain list of pending software installation: + # Obtain list of pending software installation: local string_output='' for i in ${!aSOFTWARE_INSTALL_STATE[@]} do @@ -16227,23 +15959,21 @@ When you select any software for install that requires a webserver, DietPi will fi done + [[ $G_SERVICE_CONTROL == 0 ]] || string_output+='\nNB: Software services will be temporarily controlled (stopped) by DietPi during this process. Please inform connected users, before continuing. SSH is not affected.' - #Confirm Software install + # Confirm Software install if G_WHIP_YESNO "DietPi is now ready to install your software choices: $string_output\n -Software details, usernames, passwords etc:\n - https://dietpi.com/software\n -NB: Software services will be temporarily controlled (stopped) by DietPi during this process. Please inform connected users, before continuing. SSH is not affected.\n -Would you like to begin?"; then +Software details, usernames, passwords etc:\n - https://dietpi.com/software\n\nWould you like to begin?"; then - #exit menu system + # Exit menu system TARGETMENUID=-1 - #Enable installation start flag + # Enable installation start flag GOSTARTINSTALL=1 else - #Return to Main Menu - TARGETMENUID=0 + TARGETMENUID=0 # Return to Main Menu fi @@ -16251,7 +15981,7 @@ Would you like to begin?"; then Menu_StartInstall(){ - #Check if the user has made changes to their software selections. + # Check if the user has made changes to their software selections. if (( $INSTALL_SOFTWARE_CHOICESMADE || $INSTALL_SSHSERVER_CHOICESMADE || $INSTALL_FILESERVER_CHOICESMADE || @@ -16262,29 +15992,27 @@ Would you like to begin?"; then else - #1st run install + # 1st run install if (( $G_DIETPI_INSTALL_STAGE == 1 )); then G_WHIP_YESNO 'DietPi was unable to detect any additional software selections for install.\n -NB: You can use dietpi-software at a later date, to install optimized software from our catalogue as required.\n\nDo you wish to continue with DietPi as a pure minimal image?' +NB: You can use dietpi-software at a later date, to install optimised software from our catalogue as required.\n\nDo you wish to continue with DietPi as a pure minimal image?' if (( $? == 0 )); then - #exit menu system - TARGETMENUID=-1 + TARGETMENUID=-1 # Exit menu DISABLE_REBOOT=1 - #Enable installation start flag + # Enable installation start flag GOSTARTINSTALL=1 else - #Return to Main Menu - TARGETMENUID=0 + TARGETMENUID=0 # Main menu fi - #Not 1st run + # Not 1st run elif (( $G_DIETPI_INSTALL_STAGE == 2 )); then G_WHIP_MSG 'No changes have been detected. Unable to start installation.' @@ -16295,38 +16023,35 @@ NB: You can use dietpi-software at a later date, to install optimized software f } - #TARGETMENUID=1 + # TARGETMENUID=1 Menu_Dietpi_Software(){ - #Generate Whiptail menu and store results into our software arrays + # Generate Whiptail menu and store results into our software arrays Menu_CreateSoftwareList 0 - #Return to Main Menu - TARGETMENUID=0 + TARGETMENUID=0 # Main menu } - #TARGETMENUID=2 + # TARGETMENUID=2 Menu_Linux_Software(){ - #Generate Whiptail menu and store results into our software arrays + # Generate Whiptail menu and store results into our software arrays Menu_CreateSoftwareList 1 - #Return to Main Menu - TARGETMENUID=0 + TARGETMENUID=0 # Main menu } - #TARGETMENUID=3 + # TARGETMENUID=3 Menu_Uninstall_Software(){ - #Return to main menu - TARGETMENUID=0 + TARGETMENUID=0 # Return to Main Menu - #Array which will hold all software IDs to be removed. + # Array which will hold all software IDs to be removed. G_WHIP_CHECKLIST_ARRAY=() - #Obtain list of installed software + # Obtain list of installed software local software_available_for_uninstall=0 for i in ${!aSOFTWARE_INSTALL_STATE[@]} do @@ -16341,12 +16066,12 @@ NB: You can use dietpi-software at a later date, to install optimized software f done - #No software installed + # No software installed if (( ! $software_available_for_uninstall )); then G_WHIP_MSG 'No software is currently installed, or, available for removal.' - #Run menu + # Run menu else G_WHIP_BUTTON_CANCEL_TEXT='Back' @@ -16361,14 +16086,14 @@ NB: You can use dietpi-software at a later date, to install optimized software f UNINSTALL_REQUIRED=1 done + [[ $G_SERVICE_CONTROL == 0 ]] || output_string+='\nNB: Software services will be temporarily controlled (stopped) by DietPi during this process. Please inform connected users, before continuing. SSH is not affected.' if (( $UNINSTALL_REQUIRED )); then - G_WHIP_YESNO "$output_string \n\nNB: Software services will be temporarily controlled (stopped) by DietPi during this process. Please inform connected users, before continuing. SSH is not affected.\n\nDo you wish to continue?" - if (( $? == 0 )); then + if G_WHIP_YESNO "$output_string\n\nDo you wish to continue?"; then - # - stop services - /DietPi/dietpi/dietpi-services stop + # - Stop services + [[ $G_SERVICE_CONTROL == 0 ]] || /DietPi/dietpi/dietpi-services stop # - Run uninstall for i in ${G_WHIP_RETURNED_VALUE[@]} @@ -16379,11 +16104,11 @@ NB: You can use dietpi-software at a later date, to install optimized software f done Uninstall_Software - #Save + # - Save Write_InstallFileList - # - start services - /DietPi/dietpi/dietpi-services start + # - Start services + [[ $G_SERVICE_CONTROL == 0 ]] || /DietPi/dietpi/dietpi-services start G_WHIP_MSG 'Uninstall completed.' @@ -16440,20 +16165,20 @@ NB: You can use dietpi-software at a later date, to install optimized software f Banner_Configs(){ - G_DIETPI-NOTIFY 3 "$G_PROGRAM_NAME" 'Optimize and configure software' + G_DIETPI-NOTIFY 3 "$G_PROGRAM_NAME" 'Optimise and configure software' G_DIETPI-NOTIFY 2 "Applying DietPi optimizations and configurations for $G_HW_MODEL_DESCRIPTION, please wait...\n" } Banner_Aborted(){ - #1st run abort + # 1st run abort if (( $G_DIETPI_INSTALL_STAGE == 1 )); then /DietPi/dietpi/func/dietpi-banner 0 G_DIETPI-NOTIFY 1 '\n Installation aborted by user.\n Installation must be completed prior to using DietPi.\n Please run dietpi-software to restart the installation.\n' - #Standard abort + # Standard abort else /DietPi/dietpi/func/dietpi-banner 1 @@ -16466,26 +16191,26 @@ NB: You can use dietpi-software at a later date, to install optimized software f # Main Loop #///////////////////////////////////////////////////////////////////////////////////// #-------------------------------------------------------------------------------------- - #Init software arrays + # Init software arrays Software_Arrays_Init #-------------------------------------------------------------------------------------- - #load .installed file, update vars, if it exists + # Load .installed file, update vars, if it exists Read_InstallFileList #-------------------------------------------------------------------------------------- - #Update GLOBAL_PW + # Update GLOBAL_PW Update_Global_Pw #-------------------------------------------------------------------------------------- - # - CLi input mode + # - CLI input mode if [[ $1 ]]; then # - Run input mode Input_Modes "$@" #-------------------------------------------------------------------------------------- - #Standard launch + # Standard launch else - #1st run dietpi-software + # 1st run dietpi-software if (( $G_DIETPI_INSTALL_STAGE == 1 )); then # - Load all automation vars @@ -16506,12 +16231,12 @@ NB: You can use dietpi-software at a later date, to install optimized software f fi # - Disable serial? - # must be enabled for the following: + # Must be enabled for the following: # XU4: https://github.com/MichaIng/DietPi/issues/2038#issuecomment-416089875 # RockPro64: Fails to boot into kernel without serial enabled # NanoPi Neo Air: Required for end users/debugging/setting up WiFi without automation - if (( $(grep -m1 '^[[:blank:]]*CONFIG_SERIAL_CONSOLE_ENABLE=' /DietPi/dietpi.txt | sed 's/^.*=//') == 1 && - $G_HW_MODEL != 11 && $G_HW_MODEL != 42 && $G_HW_MODEL != 64 )); then + if grep -q '^[[:blank:]]*CONFIG_SERIAL_CONSOLE_ENABLE=1' /DietPi/dietpi.txt && + (( $G_HW_MODEL != 11 && $G_HW_MODEL != 42 && $G_HW_MODEL != 64 )); then if G_WHIP_YESNO 'Serial console is currently enabled, would you like to disable it?\n - Disabling serial console will reduce memory consumption slightly\n - If you are unsure on what serial console is, it is safe to disable it'; then @@ -16569,9 +16294,9 @@ NB: You can use dietpi-software at a later date, to install optimized software f # Unmask systemd-logind if set in dietpi.txt / libpam-systemd was installed / Kodi if [[ $(readlink /etc/systemd/system/systemd-logind.service) == '/dev/null' ]] && - ( grep -q '^[[:blank:]]*AUTO_UNMASK_LOGIND=1' /DietPi/dietpi.txt || + { grep -q '^[[:blank:]]*AUTO_UNMASK_LOGIND=1' /DietPi/dietpi.txt || dpkg-query -s 'libpam-systemd' &> /dev/null || - (( ${aSOFTWARE_INSTALL_STATE[31]} > 0 )) ); then + (( ${aSOFTWARE_INSTALL_STATE[31]} > 0 )); }; then G_RUN_CMD systemctl unmask systemd-logind # systemd-logind is currently a static unit, but to be failsafe: @@ -16581,14 +16306,15 @@ NB: You can use dietpi-software at a later date, to install optimized software f fi # Upload DietPi-Survey Data, if opted in, prompt user choice, if no settings file exists - /DietPi/dietpi/dietpi-survey 1 + # - Skip, if G_SERVICE_CONTROL == 0, which is exported by patch_file (DietPi-Update) which sends survey already + [[ $G_SERVICE_CONTROL == 0 ]] || /DietPi/dietpi/dietpi-survey 1 G_DIETPI-NOTIFY 3 "$G_PROGRAM_NAME" 'Installation completed' if (( $DISABLE_REBOOT )); then # - Start services (restart to reload webserver configs) - /DietPi/dietpi/dietpi-services restart + [[ $G_SERVICE_CONTROL == 0 ]] || /DietPi/dietpi/dietpi-services restart else diff --git a/dietpi/func/change_hostname b/dietpi/func/change_hostname index 845113f068..571a168d7b 100644 --- a/dietpi/func/change_hostname +++ b/dietpi/func/change_hostname @@ -18,22 +18,22 @@ #//////////////////////////////////// #Import DietPi-Globals --------------------------------------------------------------- . /DietPi/dietpi/func/dietpi-globals + G_PROGRAM_NAME='DietPi-Change_hostname' G_CHECK_ROOT_USER G_CHECK_ROOTFS_RW - G_PROGRAM_NAME='DietPi-Change_hostname' G_INIT #Import DietPi-Globals --------------------------------------------------------------- #///////////////////////////////////////////////////////////////////////////////////// #Change Hostname #///////////////////////////////////////////////////////////////////////////////////// - HOSTNAME_NEW="$1" + HOSTNAME_NEW=$1 #///////////////////////////////////////////////////////////////////////////////////// # Main Loop #///////////////////////////////////////////////////////////////////////////////////// G_CONFIG_INJECT '127.0.1.1 ' "127.0.1.1 $HOSTNAME_NEW" /etc/hosts - echo "$HOSTNAME_NEW" > /etc/hostname + echo $HOSTNAME_NEW > /etc/hostname #----------------------------------------------------------------------------------- exit diff --git a/dietpi/func/dietpi-banner b/dietpi/func/dietpi-banner index 7f9d86e6ac..9d75fac5b2 100644 --- a/dietpi/func/dietpi-banner +++ b/dietpi/func/dietpi-banner @@ -15,6 +15,7 @@ # Usage: # - dietpi-banner 0 = top section only # - dietpi-banner 1 = top section and credits + clear + # - dietpi-banner 2 = banner customisation menu #//////////////////////////////////// # Import DietPi-Globals -------------------------------------------------------------- @@ -43,10 +44,11 @@ 'Weather (wttr.in)' 'Custom banner entry' 'Display DietPi useful commands?' + 'MOTD' ) # Set defaults - aENABLED=(1 0 1 0 0 1 0 0 0 0 0 1) + aENABLED=(1 0 1 0 0 1 0 0 0 0 0 1 1) COLOUR_RESET='\e[0m' aCOLOUR=( @@ -58,9 +60,12 @@ ) + # Load settings here, to have chosen ${aCOLOUR[0]} applied to below strings + [[ -f $FP_SAVEFILE ]] && . $FP_SAVEFILE + GREEN_LINE=" ${aCOLOUR[0]}─────────────────────────────────────────────────────$COLOUR_RESET" GREEN_BULLET=" ${aCOLOUR[0]}-$COLOUR_RESET" - GREEN_SEPERATOR="${aCOLOUR[0]}:$COLOUR_RESET" + GREEN_SEPARATOR="${aCOLOUR[0]}:$COLOUR_RESET" . /DietPi/dietpi/.version DIETPI_VERSION="$G_DIETPI_VERSION_CORE.$G_DIETPI_VERSION_SUB.$G_DIETPI_VERSION_RC" @@ -80,8 +85,6 @@ } - Load(){ [[ -f $FP_SAVEFILE ]] && . $FP_SAVEFILE; } - Save(){ > $FP_SAVEFILE @@ -129,11 +132,17 @@ fi echo -e "$GREEN_LINE - ${aCOLOUR[1]}DietPi v$DIETPI_VERSION$COLOUR_RESET $GREEN_SEPERATOR $text_update_available_date$COLOUR_RESET + ${aCOLOUR[1]}DietPi v$DIETPI_VERSION$COLOUR_RESET $GREEN_SEPARATOR $text_update_available_date$COLOUR_RESET $GREEN_LINE" } + Print_Local_Ip(){ + + echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[5]} $GREEN_SEPARATOR $(mawk 'NR==3 {dev=$0} NR==4 {print $0" ("dev")"}' /DietPi/dietpi/.network 2>&1)" #5: LAN IP (adapter) + + } + Print_Credits(){ echo -e " ${aCOLOUR[2]}DietPi Team : MichaIng (lead), Daniel Knight (founder)" @@ -152,13 +161,13 @@ $GREEN_LINE" # Update available? if (( $UPDATE_AVAILABLE )); then - if [[ $UPDATE_AVAILABLE_VERSION = '-1' ]]; then + if [[ $UPDATE_AVAILABLE_VERSION == '-1' ]]; then echo -e " ${aCOLOUR[3]}Updated DietPi image is available, please download it:$COLOUR_RESET\n https://dietpi.com/#download\n" else - echo -e " ${aCOLOUR[1]}dietpi-update$COLOUR_RESET $GREEN_SEPERATOR ${aCOLOUR[3]}Run now to update DietPi from v$DIETPI_VERSION to v$UPDATE_AVAILABLE_VERSION.$COLOUR_RESET\n" + echo -e " ${aCOLOUR[1]}dietpi-update$COLOUR_RESET $GREEN_SEPARATOR ${aCOLOUR[3]}Run now to update DietPi from v$DIETPI_VERSION to v$UPDATE_AVAILABLE_VERSION.$COLOUR_RESET\n" fi @@ -168,36 +177,48 @@ $GREEN_LINE" Print_Useful_Commands(){ - echo -e "${aCOLOUR[1]} dietpi-launcher$COLOUR_RESET $GREEN_SEPERATOR All the DietPi programs in one place. - ${aCOLOUR[1]}dietpi-config$COLOUR_RESET $GREEN_SEPERATOR Feature rich configuration tool for your device. - ${aCOLOUR[1]}dietpi-software$COLOUR_RESET $GREEN_SEPERATOR Select optimized software for installation. - ${aCOLOUR[1]}htop$COLOUR_RESET $GREEN_SEPERATOR Resource monitor. - ${aCOLOUR[1]}cpu$COLOUR_RESET $GREEN_SEPERATOR Shows CPU information and stats.\n" + echo -e "${aCOLOUR[1]} dietpi-launcher$COLOUR_RESET $GREEN_SEPARATOR All the DietPi programs in one place. + ${aCOLOUR[1]}dietpi-config$COLOUR_RESET $GREEN_SEPARATOR Feature rich configuration tool for your device. + ${aCOLOUR[1]}dietpi-software$COLOUR_RESET $GREEN_SEPARATOR Select optimized software for installation. + ${aCOLOUR[1]}htop$COLOUR_RESET $GREEN_SEPARATOR Resource monitor. + ${aCOLOUR[1]}cpu$COLOUR_RESET $GREEN_SEPARATOR Shows CPU information and stats.\n" } Print_Banner(){ - # - Source DietPi-Globals if CPU temp chosen - [[ ${aENABLED[2]} != 1 || $G_PROGRAM_NAME ]] || . /DietPi/dietpi/func/dietpi-globals + # - Source DietPi-Globals if not yet sourced from main menu and CPU temp chosen + [[ ${aENABLED[2]} != 1 && ${aENABLED[12]} != 1 || $G_PROGRAM_NAME ]] || . /DietPi/dietpi/func/dietpi-globals # - Re-obtain network details if missing and LAN IP chosen - [[ ${aENABLED[5]} != 1 || -f /DietPi/dietpi/.network ]] || /DietPi/dietpi/func/obtain_network_details + [[ ${aENABLED[5]} != 1 || -f '/DietPi/dietpi/.network' ]] || /DietPi/dietpi/func/obtain_network_details printf '\ec' # clear current terminal screen Print_Header - (( ${aENABLED[0]} == 1 )) && echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[0]} $GREEN_SEPERATOR $(mawk 'NR==2 {print $0}' /DietPi/dietpi/.hw_model 2>&1)" #0: Device model - (( ${aENABLED[1]} == 1 )) && echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[1]} $GREEN_SEPERATOR $(uptime -p 2>&1)" #1: Uptime - (( ${aENABLED[2]} == 1 )) && echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[2]} $GREEN_SEPERATOR $(print_full_info=1 G_OBTAIN_CPU_TEMP 2>&1)" #2: CPU temp - (( ${aENABLED[3]} == 1 )) && echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[3]} $GREEN_SEPERATOR $(hostname -f 2>&1)" #3: Hostname - (( ${aENABLED[4]} == 1 )) && echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[4]} $GREEN_SEPERATOR $(hostname -y 2>&1)" #4: Domain name - (( ${aENABLED[5]} == 1 )) && echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[5]} $GREEN_SEPERATOR $(mawk 'NR==3 {dev=$0} NR==4 {print $0" ("dev")"}' /DietPi/dietpi/.network 2>&1)" #5: LAN IP (adapter) - (( ${aENABLED[6]} == 1 )) && echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[6]} $GREEN_SEPERATOR $(curl -sLm 2 https://dietpi.com/myip.php 2>&1)" #6: WAN IP # Move this to /DietPi/dietpi/.network? - (( ${aENABLED[7]} == 1 )) && echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[7]} $GREEN_SEPERATOR $(df -h --output=avail / | mawk 'NR==2 {print $1}' 2>&1)" #7: Freespace (RootFS) - (( ${aENABLED[8]} == 1 )) && echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[8]} $GREEN_SEPERATOR $(df -h --output=avail /mnt/dietpi_userdata | mawk 'NR==2 {print $1}' 2>&1)" #8: Freespace (DietPi userdata) - (( ${aENABLED[9]} == 1 )) && echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[9]} $GREEN_SEPERATOR $(curl -sLm 2 https://wttr.in/?format=4 2>&1)" #9: Weather - (( ${aENABLED[10]} == 1 )) && [[ -x $FP_CUSTOM ]] && echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[10]} $GREEN_SEPERATOR $(bash $FP_CUSTOM 2>&1)" #10: Custom + (( ${aENABLED[0]} == 1 )) && echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[0]} $GREEN_SEPARATOR $(mawk 'NR==2 {print $0}' /DietPi/dietpi/.hw_model 2>&1)" #0: Device model + (( ${aENABLED[1]} == 1 )) && echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[1]} $GREEN_SEPARATOR $(uptime -p 2>&1)" #1: Uptime + (( ${aENABLED[2]} == 1 )) && echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[2]} $GREEN_SEPARATOR $(print_full_info=1 G_OBTAIN_CPU_TEMP 2>&1)" #2: CPU temp + (( ${aENABLED[3]} == 1 )) && echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[3]} $GREEN_SEPARATOR $(hostname -f 2>&1)" #3: Hostname + (( ${aENABLED[4]} == 1 )) && echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[4]} $GREEN_SEPARATOR $(hostname -y 2>&1)" #4: Domain name + (( ${aENABLED[5]} == 1 )) && Print_Local_Ip + (( ${aENABLED[6]} == 1 )) && echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[6]} $GREEN_SEPARATOR $(curl -sLm 2 https://dietpi.com/myip.php 2>&1)" #6: WAN IP # Move this to /DietPi/dietpi/.network? + (( ${aENABLED[7]} == 1 )) && echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[7]} $GREEN_SEPARATOR $(df -h --output=avail / | mawk 'NR==2 {print $1}' 2>&1)" #7: Freespace (RootFS) + (( ${aENABLED[8]} == 1 )) && echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[8]} $GREEN_SEPARATOR $(df -h --output=avail /mnt/dietpi_userdata | mawk 'NR==2 {print $1}' 2>&1)" #8: Freespace (DietPi userdata) + (( ${aENABLED[9]} == 1 )) && echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[9]} $GREEN_SEPARATOR $(curl -sLm 2 https://wttr.in/?format=4 2>&1)" #9: Weather + (( ${aENABLED[10]} == 1 )) && [[ -x $FP_CUSTOM ]] && echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[10]} $GREEN_SEPARATOR $(bash $FP_CUSTOM 2>&1)" #10: Custom + if (( ${aENABLED[12]} == 1 )); then + + local fp_motd='/tmp/.dietpi_motd' + [[ -f $fp_motd ]] || curl -sLm 2 https://dietpi.com/motd > $fp_motd + if [[ -f $fp_motd ]]; then + + . $fp_motd # Creates $motd variable + echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[12]} $GREEN_SEPARATOR $motd" #12: MOTD + + fi + + fi echo -e "$GREEN_LINE\n" Print_Credits @@ -217,12 +238,12 @@ $GREEN_LINE" do local state='off' - (( ${aENABLED[$i]=0} == 1 )) && state='on' + (( ${aENABLED[$i]:=0} == 1 )) && state='on' G_WHIP_CHECKLIST_ARRAY+=($i "${aDESCRIPTION[$i]}" $state) done - if G_WHIP_CHECKLIST "Please select options to enable in $G_PROGRAM_NAME display:"; then + if G_WHIP_CHECKLIST "Please (de)select options via spacebar to be shown in the $G_PROGRAM_NAME:"; then for i in ${!aDESCRIPTION[@]} do @@ -268,12 +289,10 @@ NB: It is executed as bash script, so it needs to be in bash compatible syntax. #///////////////////////////////////////////////////////////////////////////////////// # Main Loop #///////////////////////////////////////////////////////////////////////////////////// - #----------------------------------------------------------------------------------- - Load - #----------------------------------------------------------------------------------- if (( $INPUT == 0 )); then Print_Header + Print_Local_Ip elif (( $INPUT == 1 )); then diff --git a/dietpi/func/dietpi-benchmark b/dietpi/func/dietpi-benchmark index 4a1202fe80..188bd02675 100644 --- a/dietpi/func/dietpi-benchmark +++ b/dietpi/func/dietpi-benchmark @@ -72,7 +72,7 @@ # ------------------------- # DietPi-Benchmark # ------------------------- -BENCH_VERSION=1 +BENCH_VERSION=2 BENCH_HW_MODEL=$G_HW_MODEL BENCH_CPU='$BENCH_CPU' BENCH_ROOTFS_WRITE='$BENCH_ROOTFS_WRITE' @@ -194,7 +194,7 @@ NB: A lower 'Total time' is faster" local benchmark_file_name='benchmark.file' local min_benchmark_size=10 local max_benchmark_size=$(( $(G_CHECK_FREESPACE $FP_BENCHFILE) - 100 )) - (( $max_benchmark_size > 1000 )) && max_benchmark_size=1000 + #(( $max_benchmark_size > 10000 )) && max_benchmark_size=10000 [[ $FP_BENCHFILE != *'/' ]] && FP_BENCHFILE+='/' FP_BENCHFILE+=$benchmark_file_name @@ -326,14 +326,15 @@ NB: A lower 'Total time' is faster" CPU_Benchmark #FS/RAM - BENCH_FILESIZE=10 # - RAM FP_BENCHFILE='/tmp' + BENCH_FILESIZE=$(( $(mawk '/MemFree:/ {print $2;exit}' /proc/meminfo) / 1000 / 4 )) #Free mem / 4 Filesystem_Benchmark # - Rootfs FP_BENCHFILE='/' + BENCH_FILESIZE=100 Filesystem_Benchmark SHOW_RESULTS=1 @@ -388,6 +389,11 @@ Compare these results online with other users, using the link below: #///////////////////////////////////////////////////////////////////////////////////// # Main Loop #///////////////////////////////////////////////////////////////////////////////////// + #----------------------------------------------------------------------------------- + #Run at highest CPU priority and IO + renice -n -19 $$ + ionice -p $$ -c 1 -n 0 + #----------------------------------------------------------------------------------- #Init vars for sourcing if (( $INPUT == 0 )); then diff --git a/dietpi/func/dietpi-globals b/dietpi/func/dietpi-globals index 5c32b13a1f..41cc37b1a5 100644 --- a/dietpi/func/dietpi-globals +++ b/dietpi/func/dietpi-globals @@ -9,17 +9,10 @@ #//////////////////////////////////// # # Info: - # - Provides/Exports shared/global DietPi variables/functions for current bash session and other scripts + # - 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-login.sh - # - Sourced/Loaded as start of all DietPi script, except those listed below - # - # Excluded scripts, which do NOT load these globals: - # - dietpi-ramlog - # - dietpi-ramdisk - # - dietpi-obtain_hw_model - # - dietpi.txt and all other .txt, .ini or config files - # + # - Sourced/Loaded in interactive bash sessions: /etc/bashrc.d/dietpi.bash + # - Sourced/Loaded as start of most DietPi script #//////////////////////////////////// #----------------------------------------------------------------------------------- @@ -33,36 +26,36 @@ #----------------------------------------------------------------------------------- #----------------------------------------------------------------------------------- - # Core varianles, functions and environment, used at start of all scripts + # Core variables, functions and environment, used at start of all scripts #----------------------------------------------------------------------------------- - #To be exported by the originating script, after loading globals and before calling G_INIT() - # - Used in G_ERROR_ and G_WHIP_ - G_PROGRAM_NAME='' + # To be exported by the originating script, after loading globals and before calling G_INIT() + # - Used in G_ERROR_HANDLER, G_WHIP_* and G_DIETPI-NOTIFY functions + unset G_PROGRAM_NAME - #Debug enable - G_DEBUG=${G_DEBUG:-0} + # Debug mode + # - Do no pre-generate to reduce bash session variables: Needs to be checked via: [[ $G_DEBUG == 1 ]] + #G_DEBUG=${G_DEBUG:-0} - #Flag, if we are in interactive shell, by checking STDIN availability + # Flag, if we are in interactive shell, by checking STDIN availability # OK | systemd = non-STDIN # OK | Cron = non-STDIN # NB | ~/.bashrc = STDIN # - Affects whether G_ERROR_ and G_WHIP_ prompts are displayed or not # NB: You can export G_USER_INPUTS=0 to force non-interactive/automated scipt calls. Run 'unset G_USER_INPUTS' afterwards to return to auto detection. - if [[ -z $G_USER_INPUTS ]]; then + if [[ $G_USER_INPUTS != [01] ]]; then - G_USER_INPUTS=0 - [[ -t 0 ]] && G_USER_INPUTS=1 + [[ -t 0 ]] && G_USER_INPUTS=1 || G_USER_INPUTS=0 fi - #DietPi First-Run Stage | -2 = PREP_SYSTEM/Unknown | -1 = first boot | 0 = 1st run dietpi-update | 1 = 1st run dietpi-software | 2 = completed | 10 = Pre-installed image, converts to 2 during 1st boot + # DietPi First-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 G_DIETPI_INSTALL_STAGE=-2 [[ -f '/DietPi/dietpi/.install_stage' ]] && G_DIETPI_INSTALL_STAGE=$( /dev/null rm /tmp/dietpi-process.pid &> /dev/null @@ -265,7 +258,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then tput ed fi - output_string+='\r\e[K' + output_string='\r\e[K' } @@ -287,13 +280,14 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then # - $1 = start printing from word number $1 Print_Output_String(){ - if (( $1 == 1 )) && [[ $G_PROGRAM_NAME ]]; then + if [[ $1 == 1 && $G_PROGRAM_NAME ]]; then output_string+="\e[90m$G_PROGRAM_NAME | \e[0m" fi local i=0 - for (( i=$1; i<${#ainput_string[@]}; i++ )); do + for ((i=$1; i<${#ainput_string[@]}; i++)) + do output_string+=${ainput_string[$i]} @@ -305,8 +299,8 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then #-------------------------------------------------------------------------------------- # Main Loop #-------------------------------------------------------------------------------------- - #Exit code, print OK or Failed - #$2 = exit code + # Exit code, print OK or Failed + # $2 = exit code # - Use this at end of DietPi scripts, EG: G_DIETPI-NOTIFY -1 ${EXIT_CODE:=0} if (( $1 == -1 )); then @@ -325,11 +319,11 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then fi #-------------------------------------------------------------------------------------- - #Status Processing - #$@ = txt desc + # Status Processing + # $@ = txt desc elif (( $1 == -2 )); then - output_string+="\r$bracket_l\e[33m .... $bracket_r " + output_string="\r$bracket_l\e[33m .... $bracket_r " Print_Output_String 1 if [[ -t 0 ]]; then @@ -388,24 +382,24 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then fi - #Status Ok - #$@ = txt desc + # Status Ok + # $@ = txt desc elif (( $1 == 0 )); then Status_Ok ainput_string+=('\n') Print_Output_String 1 - #Status failed - #$@ = txt desc + # Status failed + # $@ = txt desc elif (( $1 == 1 )); then Status_Failed ainput_string+=('\n') Print_Output_String 1 - #Status Info - #$@ = txt desc + # Status Info + # $@ = txt desc elif (( $1 == 2 )); then Clean_Process_Animation @@ -415,70 +409,59 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then ainput_string+=('\n') Print_Output_String 1 - #DietPi banner style - #$2 = txt program name - #$3 = txt mode + # DietPi banner style + # $2 = txt program name + # $3 = txt mode elif (( $1 == 3 )); then Clean_Process_Animation if disable_error=1 G_CHECK_VALIDINT $HIERARCHY && (( $HIERARCHY > 0 )); then - # >=10 should never occur, however, if it is, lets make it line up regardless - if (( $HIERARCHY < 10 )); then + local status_subfunction="$HIERARCHY " + # > 9 should never occur, however, if it is, lets make it line up regardless + (( $HIERARCHY > 9 )) && status_subfunction=$HIERARCHY - local status_subfunction="$HIERARCHY " - - else - - local status_subfunction=$HIERARCHY - - fi output_string+="$bracket_l\e[33m SUB$status_subfunction$bracket_r $2 > " ainput_string+=('\n') - Print_Output_String 2 else - output_string+="\n \e[38;5;154m$2\e[0m" - output_string+='\n\e[90m─────────────────────────────────────────────────────' - output_string+='\n Mode: \e[0m' + output_string+=" + \e[38;5;154m$2\e[0m +\e[90m───────────────────────────────────────────────────── + Mode: \e[0m" ainput_string+=('\n\n') - Print_Output_String 2 fi + Print_Output_String 2 + fi #----------------------------------------------------------------------------------- - # Unset internal functions, otherwise they are accessible from terminal: - unset Clean_Process_Animation - unset Status_Ok - unset Status_Failed - unset Print_Output_String + # Unset internal functions, otherwise they are accessible from terminal + unset Clean_Process_Animation Status_Ok Status_Failed Print_Output_String #----------------------------------------------------------------------------------- } - # $1 = mode - # - 0 = Exit all linked scripts (kill all) - # - 1 = Kill current script only, excluding the shell. + # $1 = mode + # 1 = Kill current script only, excluding the shell. + # else = Exit all linked scripts (kill all) G_CHECK_ROOT_USER(){ if [[ $G_CHECK_ROOT_USER_VERIFIED != 1 ]]; then if (( $UID )); then - local input=0 - disable_error=1 G_CHECK_VALIDINT "$1" && input=$1 + G_DIETPI-NOTIFY 1 'Root privileges required. Please run the command with "sudo" or "G_SUDO".' - G_DIETPI-NOTIFY 1 'Root privileges required. Please run the command with "G_SUDO", or, "sudo -s".' + if [[ $1 == 1 ]]; then - if (( $input == 0 )); then - - exit 1 + kill -INT $$ - elif (( $input == 1 )); then + else - kill -INT $$ + exit 1 fi @@ -506,7 +489,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then else export G_CHECK_ROOTFS_RW_VERIFIED=1 - G_DIETPI-NOTIFY 0 'RootFS R/W access verified.\n' + G_DIETPI-NOTIFY 0 'RootFS R/W access verified.' fi @@ -517,12 +500,13 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then #----------------------------------------------------------------------------------- # Alias defines #----------------------------------------------------------------------------------- - #DietPi scripts, moved from /etc/bash.bashrc - # - Sudo command, that ensures DietPi-Globals with G_* commands are loaded - G_SUDO(){ sudo -s . /DietPi/dietpi/func/dietpi-globals && $@; } + # DietPi scripts, moved from /etc/bash.bashrc + # - sudo command that ensures DietPi-Globals with G_* commands are loaded + G_SUDO(){ sudo -s . /DietPi/dietpi/func/dietpi-globals && "$@"; } + # - sudo alias that allows running other aliases with "sudo" + alias sudo='sudo ' # https://github.com/MichaIng/DietPi/issues/424 # - DietPi programs - alias sudo='sudo ' # https://github.com/MichaIng/DietPi/issues/424 alias dietpi-process_tool='/DietPi/dietpi/dietpi-process_tool' alias dietpi-letsencrypt='/DietPi/dietpi/dietpi-letsencrypt' alias dietpi-autostart='/DietPi/dietpi/dietpi-autostart' @@ -542,54 +526,59 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then alias dietpi-survey='/DietPi/dietpi/dietpi-survey' alias dietpi-explorer='/DietPi/dietpi/dietpi-explorer' alias dietpi-banner='/DietPi/dietpi/func/dietpi-banner 2' + alias dietpi-justboom='/DietPi/dietpi/misc/dietpi-justboom' alias cpu='/DietPi/dietpi/dietpi-cpuinfo' + + # - 1337 moments ;) alias 1337='echo Indeed, you are =\)' + # - Helpers + #alias dd='dd status=progress ' # needs to be at end... + # - Optional DietPi software aliases/functions - [[ -d /var/lib/dietpi/dietpi-software/installed/dietpi-nordvpn ]] && alias dietpi-nordvpn='/DietPi/dietpi/misc/dietpi-nordvpn' - [[ -f /opt/retropie/supplementary/emulationstation/emulationstation ]] && alias emulationstation='/opt/retropie/supplementary/emulationstation/emulationstation' - [[ -f /usr/local/games/opentyrian/run ]] && alias opentyrian='/usr/local/games/opentyrian/run' - [[ -f /DietPi/dietpi/misc/dietpi-justboom ]] && alias dietpi-justboom='/DietPi/dietpi/misc/dietpi-justboom' + [[ -d '/var/lib/dietpi/dietpi-software/installed/dietpi-nordvpn' ]] && alias dietpi-nordvpn='/DietPi/dietpi/misc/dietpi-nordvpn' + [[ -f '/opt/retropie/supplementary/emulationstation/emulationstation' ]] && alias emulationstation='/opt/retropie/supplementary/emulationstation/emulationstation' + [[ -f '/usr/local/games/opentyrian/run' ]] && alias opentyrian='/usr/local/games/opentyrian/run' [[ -f $G_FP_DIETPI_USERDATA/dxx-rebirth/run.sh ]] && alias dxx-rebirth="$G_FP_DIETPI_USERDATA/dxx-rebirth/run.sh" - [[ -f /usr/share/applications/kodi.desktop ]] && alias startkodi='/DietPi/dietpi/misc/start_kodi' - [[ -f /etc/systemd/system/dietpi-cloudshell.service ]] && alias dietpi-cloudshell='/DietPi/dietpi/dietpi-cloudshell' + [[ -f '/usr/share/applications/kodi.desktop' ]] && alias startkodi='/DietPi/dietpi/misc/start_kodi' + [[ -f '/etc/systemd/system/dietpi-cloudshell.service' ]] && alias dietpi-cloudshell='/DietPi/dietpi/dietpi-cloudshell' + (( $G_DISTRO > 3 )) && [[ -d $G_FP_DIETPI_USERDATA/sonarr || -d $G_FP_DIETPI_USERDATA/radarr || -d $G_FP_DIETPI_USERDATA/lidarr ]] && alias dietpi-arr_to_RAM='/DietPi/dietpi/misc/dietpi-arr_to_RAM' # - occ/ncc need to be global function, as aliases are not accessible from non-interactive scripts: - [[ -f /var/www/owncloud/occ ]] && occ(){ sudo -u www-data php /var/www/owncloud/occ "$@"; } - [[ -f /var/www/nextcloud/occ ]] && ncc(){ sudo -u www-data php /var/www/nextcloud/occ "$@"; } + [[ -f '/var/www/owncloud/occ' ]] && occ(){ sudo -u www-data php /var/www/owncloud/occ "$@"; } + [[ -f '/var/www/nextcloud/occ' ]] && ncc(){ sudo -u www-data php /var/www/nextcloud/occ "$@"; } #----------------------------------------------------------------------------------- # Whiptail (Whippy-da-whip-whip-whip tail!) # - Automatically detects/processes for G_USER_INPUTS #----------------------------------------------------------------------------------- - #G_WHIP_DEFAULT_ITEM | to be set by scripts to set the default selected item. + # G_WHIP_DEFAULT_ITEM | to be set by scripts to set the default selected item. G_WHIP_DEFAULT_ITEM='' - #Scaling options: + # Scaling options: # Optional, limits X to value, if below available screen X limits G_WHIP_SIZE_X_MAX=0 # Whip size overrides | optional, will override auto detection, must be exported and unset after use. #G_WHIP_SIZE_X_OVERRIDE #G_WHIP_SIZE_Y_OVERRIDE - #G_WHIP_BUTTON_X_TEXT | Change as needed, else, defaults to Ok/Cancel + # G_WHIP_BUTTON_X_TEXT | Change as needed, else, defaults to Ok/Cancel G_WHIP_BUTTON_OK_TEXT='' G_WHIP_BUTTON_CANCEL_TEXT='' - #G_WHIP_MENU_ARRAY | to be set by scripts to set available menu/checkbox options + # G_WHIP_MENU_ARRAY | to be set by scripts to set available menu/checkbox options G_WHIP_MENU_ARRAY=('NULL' 'NULL') - #G_WHIP_CHECKLIST_ARRAY | to be set by scripts to set available checklist options + # G_WHIP_CHECKLIST_ARRAY | to be set by scripts to set available checklist options G_WHIP_CHECKLIST_ARRAY=('NULL' 'NULL' 'off') - #G_WHIP_RETURNED_VALUE | Returned value from inputbox/menu/checklist based whiptail items + # G_WHIP_RETURNED_VALUE | Returned value from inputbox/menu/checklist based whiptail items G_WHIP_RETURNED_VALUE='' - #G_WHIP_DESTROY | Clear vars after run of whiptail + # G_WHIP_DESTROY | Clear vars after run of whiptail G_WHIP_DESTROY(){ # - Delete - unset WHIP_MESSAGE unset WHIP_SIZE_X unset WHIP_SIZE_Y unset WHIP_SIZE_Z @@ -605,21 +594,21 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then } - #G_WHIP_INIT + # G_WHIP_INIT # - update target whiptail size, based on current screen dimensions. # - Used by G_WHIP_ automatically, doesn't need to be a global function, however, bash does not support local functions. # - $1 = input mode 0=no-Z 1=yes-Z (G_WHIP_MENU_ARRAY) 2=yes-Z (G_WHIP_CHECKLIST_ARRAY) 3=Force full size of Y G_WHIP_INIT(){ - #Set default button text, if not defined + # Set default button text, if not defined G_WHIP_BUTTON_OK_TEXT=${G_WHIP_BUTTON_OK_TEXT:-Ok} G_WHIP_BUTTON_CANCEL_TEXT=${G_WHIP_BUTTON_CANCEL_TEXT:-Cancel} - #Update backtitle + # Update backtitle WHIP_BACKTITLE="$G_PROGRAM_NAME | $G_HW_MODEL_DESCRIPTION" [[ -r '/DietPi/dietpi/.network' ]] && WHIP_BACKTITLE+=" | IP: $(sed -n 4p /DietPi/dietpi/.network)" - #Automaticaly set size of whiptail box and contents + # Automaticaly set size of whiptail box and contents local input_mode=$1 # - Whip margins @@ -630,7 +619,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then local lines_required_whip_y=0 local lines_required_whip_z=0 - #Set current screen dimensions ( - outside margin) + # Set current screen dimensions ( - outside margin) # - G_WHIP_SIZE_X_OVERRIDE allows to estimate and export terminal sizes outside of script/function # This is required in case both, STOUT and STERR are redirected ( e.g. 2>&1 | tee file.log ) # Until ncurses-bin v6.0 (current on Stretch repo), tput can not estimate terminal dimensions then. @@ -651,12 +640,12 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then WHIP_SIZE_Z=2 - #Force full size of Y? + # Force full size of Y? if (( $input_mode == 3 )); then lines_required_whip_y=$WHIP_SIZE_Y - #Calulate lines required for WHIP_MESSAGE, as displayed inside the whiptail box + # Calulate lines required for WHIP_MESSAGE, as displayed inside the whiptail box # - This can then be used to increase/decrease size of WHIP_SIZE_Z automatically. else @@ -674,7 +663,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then fi - #Calculate Z + # Calculate Z # - G_WHIP_MENU_ARRAY if (( $input_mode == 1 )); then @@ -684,7 +673,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then # - Requires additional line on Y ((lines_required_whip_y++)) - #Auto length for ─ + # Auto length for ─ # Get max length of all the lines in odd number array 1st | '' 'this one' local i=0 local character_count_max=0 @@ -696,17 +685,17 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then character_count_max=${#G_WHIP_MENU_ARRAY[$i]} # - cap to X | need to calculate all length of array 1st... - # if (( $character_count_max >= $WHIP_SIZE_X )); then + #if (( $character_count_max >= $WHIP_SIZE_X )); then - # character_count_max=$WHIP_SIZE_X - # break + #character_count_max=$WHIP_SIZE_X + #break - # fi + #fi fi done - ((character_count_max--)) #-1 for additional ● + ((character_count_max--)) # -1 for additional ● # Now add the additional required lines for (( i=0; i<${#G_WHIP_MENU_ARRAY[@]}; i++ )) @@ -733,7 +722,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then # - ( ${#array} + 2 ) to round up single+double array entries lines_required_whip_z=$(( ( ${#G_WHIP_CHECKLIST_ARRAY[@]} + 2 ) / 3 )) - #Auto length for ─ + # Auto length for ─ # Get max length of all the lines in array index 1 1st | '' 'this one' '' local i=0 local character_count_max=0 @@ -745,17 +734,17 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then character_count_max=${#G_WHIP_CHECKLIST_ARRAY[$i]} # - cap to X | need to calculate all length of array 1st... - # if (( $character_count_max >= $WHIP_SIZE_X )); then + #if (( $character_count_max >= $WHIP_SIZE_X )); then - # character_count_max=$WHIP_SIZE_X - # break + #character_count_max=$WHIP_SIZE_X + #break - # fi + #fi fi done - ((character_count_max--)) #-1 for additional ● + ((character_count_max--)) # -1 for additional ● # Now add the additional required lines for (( i=0; i<${#G_WHIP_CHECKLIST_ARRAY[@]}; i++ )) @@ -766,7 +755,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then while (( ${#G_WHIP_CHECKLIST_ARRAY[$i]} < $character_count_max )) do - # echo -e "${#G_WHIP_CHECKLIST_ARRAY[$i]} > $WHIP_LENGTH_AUTOLINEFILL | index=$i" + #echo -e "${#G_WHIP_CHECKLIST_ARRAY[$i]} > $WHIP_LENGTH_AUTOLINEFILL | index=$i" G_WHIP_CHECKLIST_ARRAY[$i]+='─' done @@ -779,7 +768,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then fi - #Calculate end result + # Calculate end result # - Message will not fit! if (( $lines_required_whip_y > $WHIP_SIZE_Y )); then @@ -821,16 +810,17 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then } - #G_WHIP_MSG "message" + # G_WHIP_MSG "message" # - Display a whip message G_WHIP_MSG(){ - WHIP_MESSAGE=$@ + local WHIP_MESSAGE=$@ if (( $G_USER_INPUTS )); then G_WHIP_INIT 0 whiptail --title "$G_PROGRAM_NAME" --msgbox "$WHIP_MESSAGE" --ok-button "$G_WHIP_BUTTON_OK_TEXT" --backtitle "$WHIP_BACKTITLE" $WHIP_SIZE_Y $WHIP_SIZE_X + G_WHIP_DESTROY else @@ -838,20 +828,19 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then fi - G_WHIP_DESTROY - } - #G_WHIP_SCROLLBOX "message" + # G_WHIP_SCROLLBOX "message" # - Display a whip message inside a scrollbox G_WHIP_SCROLLBOX(){ - WHIP_MESSAGE=$@ + local WHIP_MESSAGE=$@ if (( $G_USER_INPUTS )); then G_WHIP_INIT 0 whiptail --title "$G_PROGRAM_NAME" --scrolltext --msgbox "$WHIP_MESSAGE" --ok-button "$G_WHIP_BUTTON_OK_TEXT" --backtitle "$WHIP_BACKTITLE" $WHIP_SIZE_Y $WHIP_SIZE_X + G_WHIP_DESTROY else @@ -859,11 +848,9 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then fi - G_WHIP_DESTROY - } - #G_WHIP_YESNO "message" + # G_WHIP_YESNO "message" # - Prompt user for a Yes/No, return result # - returns result 0=Ok, everything else considered a user canceled result G_WHIP_YESNO(){ @@ -872,7 +859,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then if (( $G_USER_INPUTS )); then - WHIP_MESSAGE=$@ + local WHIP_MESSAGE=$@ G_WHIP_INIT 0 local option_default_no='--defaultno' [[ ${G_WHIP_DEFAULT_ITEM,,} == 'yes' || ${G_WHIP_DEFAULT_ITEM,,} == 'ok' ]] && option_default_no='' @@ -887,7 +874,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then } - #G_WHIP_INPUTBOX "message" + # G_WHIP_INPUTBOX "message" # - Prompt user to input text and save it to G_WHIP_RETURNED_VALUE # - returns result 0=Ok, everything else considered a user canceled result G_WHIP_INPUTBOX(){ @@ -896,14 +883,14 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then if (( $G_USER_INPUTS )); then - WHIP_MESSAGE=$@ + local WHIP_MESSAGE=$@ G_WHIP_INIT 0 G_WHIP_RETURNED_VALUE=$(whiptail --title "$G_PROGRAM_NAME" --inputbox "$WHIP_MESSAGE" --ok-button "$G_WHIP_BUTTON_OK_TEXT" --cancel-button "$G_WHIP_BUTTON_CANCEL_TEXT" --default-item "$G_WHIP_DEFAULT_ITEM" --backtitle "$WHIP_BACKTITLE" $WHIP_SIZE_Y $WHIP_SIZE_X "$G_WHIP_DEFAULT_ITEM" 3>&1 1>&2 2>&3; echo $? > /tmp/.G_WHIP_INPUTBOX_RESULT) result=$(&1 1>&2 2>&3; echo $? > /tmp/.WHIP_MENU_RESULT) result=$(&1 1>&2 2>&3; echo $? > /tmp/.WHIP_CHECKLIST_RESULT) G_WHIP_RETURNED_VALUE=$(echo -e "$G_WHIP_RETURNED_VALUE" | tr '\n' ' ') @@ -1002,7 +989,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then } - #G_WHIP_VIEWFILE /var/log/file.log + # G_WHIP_VIEWFILE /var/log/file.log # - Prompt user to view logfile, then display it as needed. G_WHIP_VIEWFILE(){ @@ -1010,7 +997,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then if (( $G_USER_INPUTS )); then - local log=${log:-0} #Optional yes/no prompt for viewing logs + local log=${log:-0} # Optional yes/no prompt for viewing logs local fp_file=$1 if [[ -f $fp_file ]]; then @@ -1048,25 +1035,25 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then # DietPi Error Handler # https://github.com/MichaIng/DietPi/issues/1311#issuecomment-353716344 #----------------------------------------------------------------------------------- - G_ERROR_HANDLER_EXITCODE=0 #input value to use with G_ERROR_HANDLER - G_ERROR_HANDLER_EXITCODE_RETURN=0 #Same as above, but not destroyed during G_ERROR_HANDLER_RESET, allowing us to return it in funcs - G_ERROR_HANDLER_COMMAND='' #eg: G_AGI: moooooooo + G_ERROR_HANDLER_EXITCODE=0 # input value to use with G_ERROR_HANDLER + G_ERROR_HANDLER_EXITCODE_RETURN=0 # Same as above, but not destroyed during G_ERROR_HANDLER_RESET, allowing us to return it in funcs + G_ERROR_HANDLER_COMMAND='' # eg: G_AGI: moooooooo # For export: On error, following entries will be used - G_ERROR_HANDLER_NO_FAIL=0 #Always report a success, regardless of the exit code | G_USER_INPUTS=0 is not required for this - G_ERROR_HANDLER_INFO_ONLY=0 #Only print info and retry options, no exit or bug report, sets G_ERROR_HANDLER_ONERROR_EXIT=0 automatically - G_ERROR_HANDLER_ONERROR_EXIT=1 #Do we exit the program when the error occurs? 0=no 1=yes - G_ERROR_HANDLER_ONERROR_FPLOGFILE='' #FP to logfile, if available - G_ERROR_HANDLER_RETRY=0 #Used in func with while loop to re-run func as needed + G_ERROR_HANDLER_NO_FAIL=0 # Always report a success, regardless of the exit code | G_USER_INPUTS=0 is not required for this + G_ERROR_HANDLER_INFO_ONLY=0 # Only print info and retry options, no exit or bug report, sets G_ERROR_HANDLER_ONERROR_EXIT=0 automatically + G_ERROR_HANDLER_ONERROR_EXIT=1 # Do we exit the program when the error occurs? 0=no 1=yes + G_ERROR_HANDLER_ONERROR_FPLOGFILE='' # FP to logfile, if available + G_ERROR_HANDLER_RETRY=0 # Used in func with while loop to re-run func as needed - #Runs automatically after G_ERROR_HANDLER to reset vars to default + # Runs automatically after G_ERROR_HANDLER to reset vars to default G_ERROR_HANDLER_RESET(){ G_ERROR_HANDLER_EXITCODE_RETURN=$G_ERROR_HANDLER_EXITCODE - #Delete if used: + # Delete if used: [[ $G_ERROR_HANDLER_ONERROR_FPLOGFILE && -f $G_ERROR_HANDLER_ONERROR_FPLOGFILE ]] && rm $G_ERROR_HANDLER_ONERROR_FPLOGFILE - #unset originating program + # unset originating program unset G_ERROR_HANDLER_EXITCODE unset G_ERROR_HANDLER_COMMAND @@ -1087,20 +1074,20 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then } - #Handles exit code errors, as defined by G_ERROR_HANDLER_xxxx settings + # Handles exit code errors, as defined by G_ERROR_HANDLER_xxxx settings # Usage: G_RUN_CMD dothis G_ERROR_HANDLER(){ [[ $l_message ]] || local l_message=$G_ERROR_HANDLER_COMMAND - #Ok + # Ok (( $G_ERROR_HANDLER_NO_FAIL )) && G_ERROR_HANDLER_EXITCODE=0 if (( ! $G_ERROR_HANDLER_EXITCODE )); then G_DIETPI-NOTIFY 0 "$l_message" G_ERROR_HANDLER_RESET - #Error + # Error else local send_bugreport=0 @@ -1190,7 +1177,6 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then if ! ps aux | grep -qi '[d]ietpi-config' && (( ! $G_ERROR_HANDLER_INFO_ONLY )); then - aretry_menu_options+=('DietPi-Config' ': Edit network, APT/NTP mirror settings etc'); ((retry_menu_options_count++)) fi @@ -1202,11 +1188,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then fi local no_button_text='Ignore' - if (( $G_ERROR_HANDLER_ONERROR_EXIT )); then - - no_button_text='Exit' - - fi + (( $G_ERROR_HANDLER_ONERROR_EXIT )) && no_button_text='Exit' local choice=$(whiptail --title 'DietPi Error Handler:' --menu "$whip_msg" --cancel-button "$no_button_text" --scrolltext 24 90 $retry_menu_options_count "${aretry_menu_options[@]}" 3>&1 1>&2 2>&3) if (( $? == 0 )); then @@ -1244,7 +1226,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then fi - #Github printout + # GitHub printout if (( ! $G_ERROR_HANDLER_INFO_ONLY )); then echo -e " @@ -1336,7 +1318,7 @@ $print_logfile_info } - #Run a command and send the output through the error handler. Allows for command used info, and log output/view when an error occurs + # Run a command and send the output through the error handler. Allows for command used info, and log output/view when an error occurs # NB: This command does not support inputs with redirects. For file creation, use G_FILE_EXISTS afterwards to check it exists: https://github.com/MichaIng/DietPi/issues/1311#issuecomment-354541417 # NB: automatically error handled (G_ERROR_HANDLER) # $@ = input command @@ -1360,7 +1342,7 @@ $print_logfile_info G_ERROR_HANDLER - [[ -f /tmp/G_ERROR_HANDLER_COMMAND ]] && rm /tmp/G_ERROR_HANDLER_COMMAND + [[ -f '/tmp/G_ERROR_HANDLER_COMMAND' ]] && rm /tmp/G_ERROR_HANDLER_COMMAND done @@ -1368,54 +1350,69 @@ $print_logfile_info } - #URL Connection test + # URL Connection test # - $@ = URL - # Optional inputs = timeout | retry_max | optional_cmd_inputs (eg: --no-check-certificate) - # Prompts user to configure network if $G_USER_INPUTS=1 + # Optional variables: + # - $optional_cmd_inputs (eg: --no-check-certificate) + # - G_CHECK_URL_TIMEOUT to override default and dietpi.txt set timeout + # - G_CHECK_URL_ATTEMPTS to override default and dietpi.txt set attempts + # In case of failure and $G_USER_INPUTS=1: Prompts user to configure network G_CHECK_URL(){ - local string=$@ - local timeout=${timeout:-5} - local retry_max=${retry_max:-3} - local optional_cmd_inputs=${optional_cmd_inputs:-} + local url=$@ + local timeout=5 + if disable_error=1 G_CHECK_VALIDINT "$G_CHECK_URL_TIMEOUT" 0; then + + timeout=$G_CHECK_URL_TIMEOUT + unset G_CHECK_URL_TIMEOUT + + elif [[ -f '/DietPi/dietpi.txt' ]]; then + + timeout=$(grep -m1 '^[[:blank:]]*CONFIG_G_CHECK_URL_TIMEOUT=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') + disable_error=1 G_CHECK_VALIDINT "$timeout" 0 || timeout=5 + + fi + local attempts=3 + if disable_error=1 G_CHECK_VALIDINT "$G_CHECK_URL_ATTEMPTS" 0; then + + attempts=$G_CHECK_URL_ATTEMPTS + unset G_CHECK_URL_ATTEMPTS + + elif [[ -f '/DietPi/dietpi.txt' ]]; then + + attempts=$(grep -m1 '^[[:blank:]]*CONFIG_G_CHECK_URL_ATTEMPTS=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') + disable_error=1 G_CHECK_VALIDINT "$attempts" 0 || attempts=3 + + fi while : do - G_ERROR_HANDLER_COMMAND="Connection test: $string" + G_ERROR_HANDLER_COMMAND="Connection test: $url" G_ERROR_HANDLER_ONERROR_FPLOGFILE='/tmp/G_CHECK_URL' - G_ERROR_HANDLER_RETRY=1 + G_DIETPI-NOTIFY -2 "Testing connection to $url, please wait..." + local i=0 - for ((i=1; i<=$retry_max; i++)) + for ((i=1; i<=$attempts; i++)) do - G_DIETPI-NOTIFY -2 "($i/$retry_max) Testing connection to $string, please wait..." - - wget --spider $optional_cmd_inputs --timeout=$timeout --tries=1 "$string" &> $G_ERROR_HANDLER_ONERROR_FPLOGFILE + # Since --tries/-t is not applied on "fatal" errors (resolving failed, connection refused, 404), we need to loop ourself to exclude any temporary issue + wget --spider -t 1 -T $timeout $optional_cmd_inputs "$url" &> $G_ERROR_HANDLER_ONERROR_FPLOGFILE G_ERROR_HANDLER_EXITCODE=$? - # Valid - if (( ! $G_ERROR_HANDLER_EXITCODE )); then - - break - - # Retry - else - sleep 2 - G_DIETPI-NOTIFY -2 "Failed connection attempt ($i/$retry_max), retrying..." + # Valid + (( $G_ERROR_HANDLER_EXITCODE )) || break - fi + # Retry + G_DIETPI-NOTIFY -2 "Failed connection attempt to $url ($i/$attempts), retrying..." + sleep 1 done G_ERROR_HANDLER - if (( ! $G_ERROR_HANDLER_EXITCODE )); then - - break - - fi + (( $G_ERROR_HANDLER_EXITCODE )) || break done @@ -1423,8 +1420,8 @@ $print_logfile_info } - #$1 = directory to test permissions support - #Returns 0=ok >=1=failed + # $1 = directory to test permissions support + # Returns 0=ok >=1=failed G_CHECK_FS_PERMISSION_SUPPORT(){ local input=$1 @@ -1433,8 +1430,7 @@ $print_logfile_info while : do - mkdir -p $input - if (( $? != 0 )); then + if ! mkdir -p $input; then G_WHIP_MSG "Error creating directory $input, unable to check filesystem permissions" break @@ -1442,8 +1438,7 @@ $print_logfile_info fi local fp_target="$input/.test" - > $fp_target - if (( $? != 0 )); then + if ! > $fp_target; then G_WHIP_MSG "Error creating test file $fp_target, unable to check filesystem permissions" break @@ -1461,11 +1456,7 @@ $print_logfile_info else chmod 644 $fp_target - if [[ $(stat -c "%a" $fp_target) != '644' ]]; then - - permissions_failed=1 - - fi + [[ $(stat -c "%a" $fp_target) != '644' ]] && permissions_failed=1 fi @@ -1481,15 +1472,14 @@ $print_logfile_info break - done - rm $fp_target &> /dev/null + [[ -f $fp_target ]] && rm $fp_target return $result } - #Checks if a file/folder exists + # Checks if a file/folder exists G_FILE_EXISTS(){ G_ERROR_HANDLER_COMMAND=$@ @@ -1521,7 +1511,7 @@ $print_logfile_info G_ERROR_HANDLER - rm /tmp/G_ERROR_HANDLER_COMMAND &> /dev/null + [[ -f '/tmp/G_ERROR_HANDLER_COMMAND' ]] && rm /tmp/G_ERROR_HANDLER_COMMAND } @@ -1530,7 +1520,7 @@ $print_logfile_info #----------------------------------------------------------------------------------- G_FP_LOG_APT='/var/tmp/dietpi/logs/dietpi-software_apt.log' - #apt-get install + # apt-get install # NB: automatically error handled (G_ERROR_HANDLER) G_AGI(){ @@ -1547,7 +1537,7 @@ $print_logfile_info G_ERROR_HANDLER_COMMAND="G_AGI $string" G_ERROR_HANDLER_ONERROR_FPLOGFILE=$G_FP_LOG_APT - #-qq can add a slight period of appearing nothing is happening, lets inform user + # -qq can add a slight period of appearing nothing is happening, lets inform user G_DIETPI-NOTIFY 2 "\e[0mAPT installation for: \e[33m$string\e[0m, please wait..." echo -ne '\e[90m' @@ -1562,7 +1552,7 @@ $print_logfile_info } - #apt-get purge + # apt-get purge # NB: automatically error handled (G_ERROR_HANDLER) G_AGP(){ @@ -1627,7 +1617,7 @@ $print_logfile_info } - #apt-get autoremove + # apt-get autoremove # NB: automatically error handled (G_ERROR_HANDLER) G_AGA(){ @@ -1654,7 +1644,7 @@ $print_logfile_info } - #apt-get install -f + # apt-get -f install # NB: automatically error handled (G_ERROR_HANDLER) G_AGF(){ @@ -1681,7 +1671,7 @@ $print_logfile_info } - #apt-get clean + update + # apt-get clean + update # NB: automatically error handled (G_ERROR_HANDLER) G_AGUP(){ @@ -1709,7 +1699,7 @@ $print_logfile_info } - #apt-get upgrade + # apt-get upgrade # NB: automatically error handled (G_ERROR_HANDLER) G_AGUG(){ @@ -1736,7 +1726,7 @@ $print_logfile_info } - #apt-get dist-upgrade + # apt-get dist-upgrade # NB: automatically error handled (G_ERROR_HANDLER) G_AGDUG(){ @@ -1766,7 +1756,7 @@ $print_logfile_info } - #Checks for required APT packages, installs if needed. + # Checks for required APT packages, installs if needed. # $@ = list of required packages # NB: automatically error handled (G_ERROR_HANDLER) G_AG_CHECK_INSTALL_PREREQ(){ @@ -1812,7 +1802,7 @@ $print_logfile_info #----------------------------------------------------------------------------------- # MISC: Commands #----------------------------------------------------------------------------------- - #Treesize + # Treesize # - $1 = Optional input directory (eg: G_TREESIZE /etc/apt) G_TREESIZE(){ @@ -1835,7 +1825,7 @@ $print_logfile_info ' } - #Returns current CPU temp 'C + # Returns current CPU temp 'C # print_full_info=1# optional input to print full colour text output and temp warnings. G_OBTAIN_CPU_TEMP(){ @@ -1917,7 +1907,7 @@ $print_logfile_info } - #Returns current CPU usage % + # Returns current CPU usage % G_OBTAIN_CPU_USAGE(){ # - PS (inaccurate, but fast??) @@ -1937,7 +1927,7 @@ $print_logfile_info } - #Check available free space on path, against input value (MiB) + # Check available free space on path, against input value (MiB) # - Returns 0=Ok, 1=insufficient space available # If $2 is not used, returns available space in MiB | info_autoscale=1 # Scales MiB to GiB if required and prints unit # - $1 = path @@ -1977,7 +1967,7 @@ $print_logfile_info } - #G_CHECK_VALIDINT | Simple test to verify if a variable is a valid integer. + # G_CHECK_VALIDINT | Simple test to verify if a variable is a valid integer. # $1=input # $2=Optional Min value range # $3=Optional Max value range @@ -2040,7 +2030,7 @@ $print_logfile_info } - #Verifies the integrity of the DietPi userdata folder/symlink, based on where it should be psyhically. Basically, checks if user removed the USB drive with userdata on it. + # Verifies the integrity of the DietPi userdata folder/symlink, based on where it should be psyhically. Basically, checks if user removed the USB drive with userdata on it. # NB: As this is considered a critical (if failed), current scripts will be exited automatically # 1=fail # 0=ok @@ -2075,7 +2065,7 @@ $print_logfile_info } - #Prompt user to create a backup before system changes. Exit existing scripts if failed. + # Prompt user to create a backup before system changes. Exit existing scripts if failed. G_PROMPT_BACKUP_DISABLED=${G_PROMPT_BACKUP_DISABLED:-0} G_PROMPT_BACKUP(){ @@ -2102,7 +2092,7 @@ $print_logfile_info } - #If file/folder exists, backup to *.bak_DDMMYYY + # If file/folder exists, backup to *.bak_DDMMYYY G_BACKUP_FP(){ local ainput_string=("$@") @@ -2153,7 +2143,7 @@ $print_logfile_info #----------------------------------------------------------------------------------- # Multithreading handler #----------------------------------------------------------------------------------- - #Not yet compatible with dietpi global commands. single bash commands only with no error handling. + # Not yet compatible with dietpi global commands. single bash commands only with no error handling. G_THREADING_ENABLED=${G_THREADING_ENABLED:-1} G_THREAD_COUNT=${G_THREAD_COUNT:--1} [[ $G_THREAD_COMMAND ]] || G_THREAD_COMMAND=() @@ -2184,64 +2174,61 @@ $print_logfile_info G_THREAD_WAIT(){ - # local wait_for_specific_thread_pid=0 - # if [[ -n $1 ]]; then + #local wait_for_specific_thread_pid=0 + #if [[ -n $1 ]]; then - # wait_for_specific_thread_pid=$1 + #wait_for_specific_thread_pid=$1 - # fi + #fi while : do local thread_active=0 - for (( i=0; i<${#G_THREAD_COMMAND[@]}; i++ )) + for i in ${!G_THREAD_COMMAND[@]} do - if [[ -f /tmp/.G_THREAD_EXITCODE_$i ]] && (( $( /dev/null + rm -f /tmp/.G_THREAD* - sync #Failsafe: Sync changes to disk + sync # Failsafe: Sync changes to disk G_DIETPI-NOTIFY 0 'G_THREAD: All threads finished' @@ -2284,7 +2271,7 @@ $print_logfile_info # Automatically opt in to DietPi-Survey and run + send benchmark + data G_DEV_BENCH(){ - sed -i '1s/.*/1/' /DietPi/dietpi/.dietpi-survey + echo 1 > /DietPi/dietpi/.dietpi-survey G_USER_INPUTS=0 /DietPi/dietpi/func/dietpi-benchmark 2 } @@ -2295,6 +2282,7 @@ $print_logfile_info # - $2 Target setting + value, to inject into config file: After bash string expansion (e.g. variables), everything else will be taken literally, thus no further escaping is required. # - $3 Path to config file # - Optional: $4 Line pattern after which the setting will be added instead of end of file with grep extended regular expression support + # - GCI_PASSWORD=1 G_CONFIG_INJECT, password entry, do not print raw output to screen. # - GCI_PRESERVE=1 G_CONFIG_INJECT preserves current setting, if present. # - GCI_BACKUP=1 G_CONFIG_INJECT creates a backup before editing the file, if backup does not yet exist, to: $3.bak # - GCI_NEWLINE=1 G_CONFIG_INJECT explicitly expands newlines \n within $2, which by default are taken literally @@ -2310,6 +2298,7 @@ $print_logfile_info [[ $G_PROGRAM_NAME ]] || local G_PROGRAM_NAME='G_CONFIG_INJECT' local pattern=${1//\//\\\/} + local setting_raw=$2 local setting=${2//\\/\\\\}; setting=${setting//./\\.}; setting=${setting//+/\\+}; setting=${setting//\*/\\\*}; setting=${setting//\?/\\\?}; setting=${setting//[/\\[} setting=${setting//\(/\\\(}; setting=${setting//\{/\\\{}; setting=${setting//^/\\^}; setting=${setting//&/\\&}; setting=${setting//$/\\$}; setting=${setting//|/\\|}; setting=${setting//\//\\\/} [[ $GCI_NEWLINE == 1 ]] && setting=${setting//\\\\n/\\n} @@ -2317,6 +2306,16 @@ $print_logfile_info local after=${4//\//\\\/} local error='' + # Replace password string by asterisks in output string + if [[ $GCI_PASSWORD == 1 ]]; then + + local password='' + password=$(sed -E "s/^.*$pattern[[:blank:]]*//" <<< "$setting_raw") + setting_raw="$(sed -E "s/(^.*$pattern[[:blank:]]*).*$/\1/" <<< "$setting_raw")${password//?/*}" + unset password + + fi + syntax_error(){ [[ $after ]] && after="after line \$4\n $after (raw escaped input)\n" @@ -2325,7 +2324,7 @@ $print_logfile_info G_WHIP_MSG "[FAILED] Syntax error $error Couldn't add setting \$2 - $setting (raw escaped input) + $setting (escaped input) into file \$3 $file $after @@ -2348,18 +2347,18 @@ NB: Please verify the existence of the file \$3 $file\n Retry with proper permissions or apply the setting manually: - $(sed -E "c\\$setting" <<< '')" + $setting_raw" elif error=$(grep -Eq "^[[:blank:]]*$pattern" $file 2>&1); then # As an error within the condition leads to result "false", it can be caught only in next "elif"/"else" statement. if [[ $GCI_PRESERVE == 1 ]]; then - G_DIETPI-NOTIFY 0 "Current setting in \e[33m$file\e[0m will be preserved: \e[33m$(grep -Em1 "^[[:blank:]]*$pattern" $file | sed 's|\\|\\\\|g')\e[0m" + G_DIETPI-NOTIFY 0 "Current setting in \e[33m$file\e[0m will be preserved: \e[33m$([[ $GCI_PASSWORD == 1 ]] && echo "${setting_raw//\\/\\\\}" || grep -Em1 "^[[:blank:]]*$pattern" $file | sed 's|\\|\\\\|g')\e[0m" elif error=$(grep -Eq "^[[:blank:]]*$setting([[:space:]]|$)" $file 2>&1); then - G_DIETPI-NOTIFY 0 "Desired setting in \e[33m$file\e[0m was already set: \e[33m$(grep -Em1 "^[[:blank:]]*$pattern" $file | sed 's|\\|\\\\|g')\e[0m" + G_DIETPI-NOTIFY 0 "Desired setting in \e[33m$file\e[0m was already set: \e[33m$([[ $GCI_PASSWORD == 1 ]] && echo "${setting_raw//\\/\\\\}" || grep -Em1 "^[[:blank:]]*$pattern" $file | sed 's|\\|\\\\|g')\e[0m" elif error=$( (( $(grep -Ec "^[[:blank:]]*$pattern" $file 2>&1) > 1 )) 2>&1); then [[ $error ]] && { syntax_error; return 1; } @@ -2374,14 +2373,14 @@ $(grep -En "^[[:blank:]]*$pattern" $file) ____________\n Either the pattern \$1 needs to be more specific or the desired setting can appear multiple times by design and it cannot be predicted which instance to edit. Please retry with more specific parameter \$1 or apply the setting manually: - $(sed -E "c\\$setting" <<< '')" + $setting_raw" else [[ $error ]] && { syntax_error; return 1; } [[ $GCI_BACKUP == 1 && ! -f $file.bak ]] && cp -a $file $file.bak && G_DIETPI-NOTIFY 2 "Config file backup created: \e[33m$file.bak\e[0m" error=$(sed -Ei "0,/^[[:blank:]]*$pattern.*$/s//$setting/" $file 2>&1) || { syntax_error; return 1; } - G_DIETPI-NOTIFY 0 "Setting in \e[33m$file\e[0m adjusted: \e[33m$(sed -E "c\\$setting" <<< '' | sed 's|\\|\\\\|g')\e[0m" + G_DIETPI-NOTIFY 0 "Setting in \e[33m$file\e[0m adjusted: \e[33m${setting_raw//\\/\\\\}\e[0m" fi @@ -2390,7 +2389,7 @@ Please retry with more specific parameter \$1 or apply the setting manually: [[ $GCI_BACKUP == 1 && ! -f $file.bak ]] && cp -a $file $file.bak && G_DIETPI-NOTIFY 2 "Config file backup created: \e[33m$file.bak\e[0m" error=$(sed -Ei "0,/^[[:blank:]#;]*$pattern.*$/s//$setting/" $file 2>&1) || { syntax_error; return 1; } - G_DIETPI-NOTIFY 0 "Comment in \e[33m$file\e[0m converted to setting: \e[33m$(sed -E "c\\$setting" <<< '' | sed 's|\\|\\\\|g')\e[0m" + G_DIETPI-NOTIFY 0 "Comment in \e[33m$file\e[0m converted to setting: \e[33m${setting_raw//\\/\\\\}\e[0m" else [[ $error ]] && { syntax_error; return 1; } @@ -2401,7 +2400,7 @@ Please retry with more specific parameter \$1 or apply the setting manually: [[ $GCI_BACKUP == 1 && ! -f $file.bak ]] && cp -a $file $file.bak && G_DIETPI-NOTIFY 2 "Config file backup created: \e[33m$file.bak\e[0m" error=$(sed -Ei "0,/^[[:blank:]]*$after.*$/s//&\n$setting/" $file 2>&1) || { syntax_error; return 1; } - G_DIETPI-NOTIFY 0 "Added setting \e[33m$(sed -E "c\\$setting" <<< '' | sed 's|\\|\\\\|g')\e[0m to \e[33m$file\e[0m after line \e[33m$(grep -Em1 "^[[:blank:]]*$after" $file | sed 's|\\|\\\\|g')\e[0m" + G_DIETPI-NOTIFY 0 "Added setting \e[33m${setting_raw//\\/\\\\}\e[0m to \e[33m$file\e[0m after line \e[33m$(grep -Em1 "^[[:blank:]]*$after" $file | sed 's|\\|\\\\|g')\e[0m" else [[ $error ]] && { syntax_error; return 1; } @@ -2412,7 +2411,7 @@ The pattern \$4 could not be found in file \$3 $file\n Please retry with valid parameter \$4 or apply the setting manually: - $(sed -E "c\\$setting" <<< '')" + $setting_raw" fi @@ -2422,7 +2421,7 @@ Please retry with valid parameter \$4 or apply the setting manually: # The following sed does not work on empty files: [[ ! -s $file ]] && echo '# Added by DietPi:' >> $file error=$(sed -Ei "\$a\\$setting" $file 2>&1) || { syntax_error; return 1; } - G_DIETPI-NOTIFY 0 "Added setting \e[33m$(sed -E "c\\$setting" <<< '' | sed 's|\\|\\\\|g')\e[0m to end of file \e[33m$file\e[0m" + G_DIETPI-NOTIFY 0 "Added setting \e[33m${setting_raw//\\/\\\\}\e[0m to end of file \e[33m$file\e[0m" fi @@ -2431,9 +2430,9 @@ Please retry with valid parameter \$4 or apply the setting manually: } #----------------------------------------------------------------------------------- - (( $G_DEBUG == 1 )) && G_DIETPI-NOTIFY 2 'DietPi-Globals loaded\n' + [[ $G_DEBUG == 1 ]] && G_DIETPI-NOTIFY 2 'DietPi-Globals loaded' #----------------------------------------------------------------------------------- - #return exit code 0, by triggering null as last command to output + # Return exit code 0, by triggering null as last command to output : #----------------------------------------------------------------------------------- diff --git a/dietpi/func/dietpi-obtain_hw_model b/dietpi/func/dietpi-obtain_hw_model index 22d2e4b5c0..eede515538 100644 --- a/dietpi/func/dietpi-obtain_hw_model +++ b/dietpi/func/dietpi-obtain_hw_model @@ -50,6 +50,7 @@ # G_HW_MODEL 22 Generic device (eg: unknown to DietPi) # G_HW_MODEL 21 x86_64 native (PC) # G_HW_MODEL 20 VM x64 (VMware VirtualBox) + # G_HW_MODEL 15 oDroid N2 # G_HW_MODEL 14 oDroid N1 # G_HW_MODEL 13 oDroid U3 # G_HW_MODEL 12 oDroid C2 @@ -87,6 +88,7 @@ # G_HW_CPUID 1 H3 # G_HW_CPUID 2 H5 # G_HW_CPUID 3 RK3399 + # G_HW_CPUID 4 S922X # - Line 10 - Onboard WiFi/BT Index # HW_ONBOARD_WIFI 0 Not set # HW_ONBOARD_WIFI 1 RPi3/ZeroW (BCM43438) @@ -102,35 +104,30 @@ # HW_MANUFACTURER_NAME #//////////////////////////////////// - #----------------------------------------------------------------------------------- - #Set locale for all scripts, prevents incorrect scraping - export LANG=en_GB.UTF-8 - export LC_ALL=en_GB.UTF-8 - #Ensure we are in /tmp dir: https://github.com/MichaIng/DietPi/issues/2050#issuecomment-419901350 - cd /tmp - #----------------------------------------------------------------------------------- - #Import DietPi-Globals --------------------------------------------------------------- - #. /DietPi/dietpi/func/dietpi-globals - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals -------------------------------------------------------------- + #. /DietPi/dietpi/func/dietpi-globals # Not required + #export LC_ALL=en_GB.UTF-8 # No locale dependant output scrape + #cd /tmp # No tmp file creation + # Import DietPi-Globals -------------------------------------------------------------- #///////////////////////////////////////////////////////////////////////////////////// - #Obtain Hardware Model index + # Obtain Hardware Model index #///////////////////////////////////////////////////////////////////////////////////// FP_G_HW_MODEL_INDENTIFIER='/etc/.dietpi_hw_model_identifier' - G_HW_MODEL=0 + G_HW_MODEL=-1 G_HW_MODEL_DESCRIPTION='Unknown Device' G_DISTRO=0 - ROOTFS_DEVICE_PATH=$(df | mawk '/\/$/ {print $1;exit}') + ROOTFS_DEVICE_PATH=$(df --output=source,target | mawk '/\/$/ {print $1;exit}') HW_UUID=0 G_HW_ARCH=0 - G_HW_ARCH_DESCRIPTION='unknown' + G_HW_ARCH_DESCRIPTION=$(uname -m) IMAGE_ADDITIONAL_CREDITS='' G_HW_CPUID=0 HW_ONBOARD_WIFI=0 - # RPi Extras + # RPi extras HW_REVISION_CODE=0 HW_RELEASE_DATE='Unknown' HW_PCB_REVISION_CODE='Unknown' @@ -140,7 +137,7 @@ RPi_BoardInfo(){ #----------------------------------------------------------------------------------- - #Obtain device info by revision number + # Obtain device info by revision number # *" because 10000002 then it indicates that your Raspberry Pi has been over-volted HW_REVISION_CODE=$(mawk '/Revision/ {print $3;exit}' /proc/cpuinfo) @@ -307,7 +304,6 @@ HW_MEMORY_SIZE=1024 HW_MANUFACTURER_NAME='Sony' G_HW_MODEL=3 - HW_ONBOARD_WIFI=1 elif [[ $HW_REVISION_CODE == *'a21041' ]]; then @@ -423,235 +419,242 @@ # NBB: DO NOT REORDER INDEX's. These are now fixed and will never change (due to survey results etc) Obtain_HW_Info(){ - #Systems that use /etc/.dietpi_hw_model_identifier for G_HW_MODEL + # Systems that use /etc/.dietpi_hw_model_identifier for G_HW_MODEL if [[ -f $FP_G_HW_MODEL_INDENTIFIER ]]; then G_HW_MODEL=$(sed -n 1p $FP_G_HW_MODEL_INDENTIFIER) - #Beagle Bone Black + # Beagle Bone Black if (( $G_HW_MODEL == 71 )); then G_HW_MODEL_DESCRIPTION='BBB' - #Sparky SBC + # Sparky SBC elif (( $G_HW_MODEL == 70 )); then G_HW_MODEL_DESCRIPTION='Sparky SBC' - #Firefly RK3399 + # Firefly RK3399 elif (( $G_HW_MODEL == 69 )); then G_HW_MODEL_DESCRIPTION='Firefly RK3399' G_HW_CPUID=3 - #NanoPC T4 + # NanoPC T4 elif (( $G_HW_MODEL == 68 )); then G_HW_MODEL_DESCRIPTION='NanoPC T4' G_HW_CPUID=3 - #NanoPi K1 Plus + # NanoPi K1 Plus elif (( $G_HW_MODEL == 67 )); then G_HW_MODEL_DESCRIPTION='NanoPi K1 Plus' G_HW_CPUID=2 - #NanoPi M1 Plus + # NanoPi M1 Plus elif (( $G_HW_MODEL == 66 )); then G_HW_MODEL_DESCRIPTION='NanoPi M1 Plus' G_HW_CPUID=1 - #NanoPi NEO 2 + # NanoPi NEO 2 elif (( $G_HW_MODEL == 65 )); then G_HW_MODEL_DESCRIPTION='NanoPi NEO 2' G_HW_CPUID=2 - #NanoPi NEO Air + # NanoPi NEO Air elif (( $G_HW_MODEL == 64 )); then G_HW_MODEL_DESCRIPTION='NanoPi NEO Air' G_HW_CPUID=1 - #NanoPi M1 + # NanoPi M1 elif (( $G_HW_MODEL == 63 )); then G_HW_MODEL_DESCRIPTION='NanoPi M1/T1' G_HW_CPUID=1 - #NanoPi M3 + # NanoPi M3 elif (( $G_HW_MODEL == 62 )); then G_HW_MODEL_DESCRIPTION='NanoPi M3/T3/F3' - #NanoPi M2 + # NanoPi M2 elif (( $G_HW_MODEL == 61 )); then G_HW_MODEL_DESCRIPTION='NanoPi M2/T2' - #NanoPi Neo + # NanoPi Neo elif (( $G_HW_MODEL == 60 )); then G_HW_MODEL_DESCRIPTION='NanoPi Neo' G_HW_CPUID=1 - #BananaPi (1st Gen) + # BananaPi (1st Gen) elif (( $G_HW_MODEL == 53 )); then G_HW_MODEL_DESCRIPTION='BananaPi' - #Asus Tinker Board + # Asus Tinker Board elif (( $G_HW_MODEL == 52 )); then G_HW_MODEL_DESCRIPTION='Asus Tinker Board' - #BananaPi Pro + # BananaPi Pro elif (( $G_HW_MODEL == 51 )); then G_HW_MODEL_DESCRIPTION='BananaPi Pro' - #BananaPi M2+ + # BananaPi M2+ elif (( $G_HW_MODEL == 50 )); then G_HW_MODEL_DESCRIPTION='BananaPi M2+' G_HW_CPUID=1 - #Pinebook A64 + # Pinebook A64 elif (( $G_HW_MODEL == 44 )); then G_HW_MODEL_DESCRIPTION='Pinebook A64' - #Rock64 + # Rock64 elif (( $G_HW_MODEL == 43 )); then G_HW_MODEL_DESCRIPTION='Rock64' - #RockPro64 + # RockPro64 elif (( $G_HW_MODEL == 42 )); then G_HW_MODEL_DESCRIPTION='RockPro64' G_HW_CPUID=3 - #OrangePi PC Plus + # OrangePi PC Plus elif (( $G_HW_MODEL == 41 )); then G_HW_MODEL_DESCRIPTION='OrangePi PC Plus' G_HW_CPUID=1 - #PineA64 + # PineA64 elif (( $G_HW_MODEL == 40 )); then G_HW_MODEL_DESCRIPTION='Pine A64' - #LeMaker Guitar + # LeMaker Guitar elif (( $G_HW_MODEL == 39 )); then G_HW_MODEL_DESCRIPTION='LeMaker Guitar' - #OrangePi PC 2 + # OrangePi PC 2 elif (( $G_HW_MODEL == 38 )); then G_HW_MODEL_DESCRIPTION='OPi PC2' G_HW_CPUID=2 - #OrangePi Prime + # OrangePi Prime elif (( $G_HW_MODEL == 37 )); then G_HW_MODEL_DESCRIPTION='OPi Prime' G_HW_CPUID=2 - #OrangePi Win + # OrangePi Win elif (( $G_HW_MODEL == 36 )); then G_HW_MODEL_DESCRIPTION='OPi Win' - #OrangePi Zero Plus 2 (h3/h5) + # OrangePi Zero Plus 2 (h3/h5) elif (( $G_HW_MODEL == 35 )); then G_HW_MODEL_DESCRIPTION='OPi Zero 2 Plus' G_HW_CPUID=1 - #OrangePi Plus + # OrangePi Plus elif (( $G_HW_MODEL == 34 )); then G_HW_MODEL_DESCRIPTION='OrangePi Plus' G_HW_CPUID=1 - #OrangePi Lite + # OrangePi Lite elif (( $G_HW_MODEL == 33 )); then G_HW_MODEL_DESCRIPTION='OrangePi Lite' G_HW_CPUID=1 - #OrangePi Zero + # OrangePi Zero elif (( $G_HW_MODEL == 32 )); then G_HW_MODEL_DESCRIPTION='OrangePi Zero' - #G_HW_CPUID=1 #H2+ + #G_HW_CPUID=1 # H2+ - #OrangePi One + # OrangePi One elif (( $G_HW_MODEL == 31 )); then G_HW_MODEL_DESCRIPTION='OrangePi One' G_HW_CPUID=1 - #OrangePi Pc + # OrangePi Pc elif (( $G_HW_MODEL == 30 )); then G_HW_MODEL_DESCRIPTION='OrangePi PC' G_HW_CPUID=1 - #Generic device (eg: unknown to DietPi) + # Generic device (eg: unknown to DietPi) elif (( $G_HW_MODEL == 22 )); then G_HW_MODEL_DESCRIPTION='Generic Device' IMAGE_ADDITIONAL_CREDITS='You!' - #x86_64 native PC + # x86_64 native PC elif (( $G_HW_MODEL == 21 )); then G_HW_MODEL_DESCRIPTION='Native PC' - #VM + # VM elif (( $G_HW_MODEL == 20 )); then G_HW_MODEL_DESCRIPTION='Virtual Machine' - #oDroid N1 + # Odroid N2 + elif (( $G_HW_MODEL == 15 )); then + + G_HW_MODEL_DESCRIPTION='Odroid N2' + G_HW_CPUID=4 + #IMAGE_ADDITIONAL_CREDITS='Meveric' + + # Odroid N1 elif (( $G_HW_MODEL == 14 )); then G_HW_MODEL_DESCRIPTION='Odroid N1' G_HW_CPUID=3 #IMAGE_ADDITIONAL_CREDITS='Meveric' - #oDroid U3 + # Odroid U3 elif (( $G_HW_MODEL == 13 )); then G_HW_MODEL_DESCRIPTION='Odroid U3' #IMAGE_ADDITIONAL_CREDITS='Meveric' - #Odroid C2 + # Odroid C2 elif (( $G_HW_MODEL == 12 )); then G_HW_MODEL_DESCRIPTION='Odroid C2' IMAGE_ADDITIONAL_CREDITS='Meveric' - #Odroid XU3/XU4/HC1/HC2 + # Odroid XU3/XU4/HC1/HC2 elif (( $G_HW_MODEL == 11 )); then G_HW_MODEL_DESCRIPTION='Odroid XU3/XU4/HC1/HC2' IMAGE_ADDITIONAL_CREDITS='Meveric' - #Odroid C1 + # Odroid C1 elif (( $G_HW_MODEL == 10 )); then G_HW_MODEL_DESCRIPTION='Odroid C1' - IMAGE_ADDITIONAL_CREDITS='Meveric' + #IMAGE_ADDITIONAL_CREDITS='Meveric' fi - #RPi + # RPi elif grep -qi '^ID=raspbian' /etc/os-release; then #Grab hardware description from rpi_boardinfo @@ -659,7 +662,7 @@ fi - #Get Distro Index + # Get distro index if grep -qi 'jessie' /etc/os-release; then G_DISTRO=3 @@ -674,10 +677,10 @@ fi - #Generate UUID if it does not exist + # Generate UUID if it does not exist if [[ -f '/DietPi/dietpi/.hw_model' ]]; then - HW_UUID=$(sed -n 5p /DietPi/dietpi/.hw_model) + HW_UUID=$(mawk 'NR==5 {print}' /DietPi/dietpi/.hw_model) else @@ -685,8 +688,7 @@ fi - #Obtain hardware cpu architecture - G_HW_ARCH_DESCRIPTION=$(uname -m) + # Obtain hardware CPU architecture if [[ $G_HW_ARCH_DESCRIPTION == 'armv6l' ]]; then G_HW_ARCH=1 @@ -713,7 +715,7 @@ # - Add HW arch to HW desc G_HW_MODEL_DESCRIPTION+=" ($G_HW_ARCH_DESCRIPTION)" - #Save data + # Save data echo "$G_HW_MODEL $G_HW_MODEL_DESCRIPTION $G_DISTRO @@ -726,7 +728,7 @@ $G_HW_CPUID $HW_ONBOARD_WIFI HW_MEMORY_SIZE=$HW_MEMORY_SIZE" > /DietPi/dietpi/.hw_model - # - RPi Extras + # - RPi extras (( $G_HW_MODEL < 10 )) && echo "$HW_REVISION_CODE HW_RELEASE_DATE=$HW_RELEASE_DATE HW_PCB_REVISION_CODE=$HW_PCB_REVISION_CODE diff --git a/dietpi/func/dietpi-set_hardware b/dietpi/func/dietpi-set_hardware index 0509ad6e8f..cb6831004d 100644 --- a/dietpi/func/dietpi-set_hardware +++ b/dietpi/func/dietpi-set_hardware @@ -12,27 +12,27 @@ # Usage: FP_SCRIPT='/DietPi/dietpi/func/dietpi-set_hardware' AVAIABLE_COMMANDS=" -Available commands -$FP_SCRIPT enableipv6 enable/disable -$FP_SCRIPT preferipv4 enable/disable -$FP_SCRIPT eth-forcespeed 10/100/1000/disable -$FP_SCRIPT wifimodules enable/disable/onboard_enable/onboard_disable -$FP_SCRIPT wificountrycode GB/US/DE -$FP_SCRIPT bluetooth enable/disable -$FP_SCRIPT serialconsole enable/disable -$FP_SCRIPT i2c enable/disable/khz -$FP_SCRIPT soundcard target_card (non-matching name for reset to default) add '-eq' to target_card string, enable alsa eq on card. HW:x,x (specify target card and device index eg: HW:9,1) -$FP_SCRIPT remoteir odroid_remote/justboom_ir_remote # Odroid/RPi only -$FP_SCRIPT lcdpanel target_panel (none to remove all) -$FP_SCRIPT gpumemsplit 64/128/256 # RPi only -$FP_SCRIPT headless enable/disable -$FP_SCRIPT rpi-camera enable/disable -$FP_SCRIPT rpi-opengl vc4-kms-v3d/vc4-fkms-v3d/disable -$FP_SCRIPT rpi3_usb_boot enable +Available commands: +$FP_SCRIPT enableipv6 enable/disable +$FP_SCRIPT preferipv4 enable/disable +$FP_SCRIPT eth-forcespeed 10/100/1000/disable +$FP_SCRIPT wifimodules enable/disable/onboard_enable/onboard_disable +$FP_SCRIPT wificountrycode GB/US/DE/... +$FP_SCRIPT bluetooth enable/disable +$FP_SCRIPT serialconsole enable/disable [tty(S|AMA|SAC)[0-9]] (optional Serial/UART device) +$FP_SCRIPT i2c enable/disable/khz +$FP_SCRIPT soundcard target_card (non-matching name for reset to default). Add '-eq' to target_card string to enable ALSA equalizer on card. HW:x,x (specify target card and device index eg: HW:9,1) +$FP_SCRIPT remoteir odroid_remote/justboom_ir_remote # Odroid/RPi only +$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 rpi3_usb_boot enable " #//////////////////////////////////// - #Grab Inputs + # Grab Inputs INPUT_DEVICE_NAME=${1,,} INPUT_DEVICE_VALUE=${2,,} # - Support for 1/0 inputs for enable/disable @@ -45,21 +45,37 @@ $FP_SCRIPT rpi3_usb_boot enable INPUT_DEVICE_VALUE='disable' fi + INPUT_ADDITIONAL=$3 - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals -------------------------------------------------------------- . /DietPi/dietpi/func/dietpi-globals - G_PROGRAM_NAME='DietPi-Set_Hardware' + G_PROGRAM_NAME='DietPi-Set_hardware' G_CHECK_ROOT_USER G_CHECK_ROOTFS_RW G_INIT - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals -------------------------------------------------------------- + # Semi non-RAMdisk support if (( $G_HW_MODEL < 10 )); then FP_RPI_CONFIG='/DietPi/config.txt' - #Semi support non-dietpi Raspbian [[ -f $FP_RPI_CONFIG ]] || FP_RPI_CONFIG='/boot/config.txt' + # ARMbian uses armbianEnv.txt instead which requires different syntax + elif [[ -f /boot/armbianEnv.txt ]]; then + + ARMBIAN=1 + FP_UENV='/boot/armbianEnv.txt' + [[ -f /DietPi/armbianEnv.txt ]] && FP_UENV='/DietPi/armbianEnv.txt' + + # Sparky SBC uEnv.txt has been renamed to uenv.txt which is currently not copied to RAMdisk + else + + ARMBIAN=0 + FP_UENV='/tmp/uEnv.txt' + for i in /{DietPi,boot}/u{e,E}nv.txt; do [[ -f $i ]] && FP_UENV=$i && break; done + unset i + fi EXIT_CODE=0 @@ -68,36 +84,34 @@ $FP_SCRIPT rpi3_usb_boot enable Unknown_Input_Name(){ - EXIT_CODE=1 G_DIETPI-NOTIFY 2 "Unknown input name ($INPUT_DEVICE_NAME). Nothing has been applied." echo "$AVAIABLE_COMMANDS" + EXIT_CODE=1 } Unknown_Input_Mode(){ - EXIT_CODE=1 G_DIETPI-NOTIFY 2 "Unknown input value ($INPUT_DEVICE_VALUE). Nothing has been applied." echo "$AVAIABLE_COMMANDS" + EXIT_CODE=1 } Unsupported_Input_Name(){ - EXIT_CODE=0 G_DIETPI-NOTIFY 2 "Input name ($INPUT_DEVICE_NAME) is not supported by $G_HW_MODEL_DESCRIPTION. Nothing has been applied." } Unsupported_Input_Mode(){ - EXIT_CODE=0 G_DIETPI-NOTIFY 2 "Input value ($INPUT_DEVICE_VALUE) is not supported by $G_HW_MODEL_DESCRIPTION. Nothing has been applied." } #///////////////////////////////////////////////////////////////////////////////////// - #rpi-camera + # rpi-camera #///////////////////////////////////////////////////////////////////////////////////// RPi_Camera_Main(){ @@ -121,10 +135,8 @@ $FP_SCRIPT rpi3_usb_boot enable Gpu_Memory_Split_Main INPUT_DEVICE_VALUE=$tmp - unset tmp fi - unset gpu_mem elif [[ $INPUT_DEVICE_VALUE == 'disable' ]]; then @@ -140,7 +152,7 @@ $FP_SCRIPT rpi3_usb_boot enable } #///////////////////////////////////////////////////////////////////////////////////// - #rpi3_usb_boot + # rpi3_usb_boot #///////////////////////////////////////////////////////////////////////////////////// RPi_USB_Boot_Main(){ @@ -152,26 +164,34 @@ $FP_SCRIPT rpi3_usb_boot enable cat << _EOF_ > /etc/systemd/system/dietpi-rm_program_usb_boot_mode.service [Unit] -Description=dietpi-rm_program_usb_boot_mode.service +Description=DietPi-rm_program_usb_boot_mode.service After=dietpi-boot.service [Service] -Type=simple +Type=oneshot RemainAfterExit=yes ExecStartPre=$(command -v sed) -i '/^[[:blank:]]*program_usb_boot_mode=/d' $FP_RPI_CONFIG ExecStartPre=$(command -v systemctl) disable dietpi-rm_program_usb_boot_mode -ExecStart=$(command -v systemctl) daemon-reload +ExecStart=$(command -v rm) /etc/systemd/system/dietpi-rm_program_usb_boot_mode.service [Install] WantedBy=multi-user.target _EOF_ -systemctl daemon-reload -systemctl enable dietpi-rm_program_usb_boot_mode + systemctl daemon-reload + systemctl enable dietpi-rm_program_usb_boot_mode elif [[ $INPUT_DEVICE_VALUE == 'disable' ]]; then sed -i '/^[[:blank:]]*program_usb_boot_mode=/d' $FP_RPI_CONFIG + if [[ -f /etc/systemd/system/dietpi-rm_program_usb_boot_mode.service ]]; then + + systemctl disable dietpi-rm_program_usb_boot_mode + rm /etc/systemd/system/dietpi-rm_program_usb_boot_mode.service + systemctl daemon-reload + + fi + else Unknown_Input_Mode @@ -181,22 +201,22 @@ systemctl enable dietpi-rm_program_usb_boot_mode } #///////////////////////////////////////////////////////////////////////////////////// - #gpumemsplit + # gpumemsplit #///////////////////////////////////////////////////////////////////////////////////// Gpu_Memory_Split_Main(){ (( $G_HW_MODEL > 9 )) && { Unsupported_Input_Name; return 1; } # Exit path for non-RPi # Remove overridden "gpu_mem" setting - sed -i '/^[[:blank:]]*gpu_mem=' $FP_RPI_CONFIG + sed -i '/^[[:blank:]]*gpu_mem=/d' $FP_RPI_CONFIG if disable_error=1 G_CHECK_VALIDINT "$INPUT_DEVICE_VALUE" 16 944; then G_CONFIG_INJECT 'gpu_mem_1024=' "gpu_mem_1024=$INPUT_DEVICE_VALUE" $FP_RPI_CONFIG local gpu_mem_cap=$INPUT_DEVICE_VALUE - (( $INPUT_DEVICE_VALUE >= 512 )) && gpu_mem_cap=448 + (( $INPUT_DEVICE_VALUE > 448 )) && gpu_mem_cap=448 G_CONFIG_INJECT 'gpu_mem_512=' "gpu_mem_512=$gpu_mem_cap" $FP_RPI_CONFIG - (( $INPUT_DEVICE_VALUE >= 256 )) && gpu_mem_cap=192 + (( $INPUT_DEVICE_VALUE > 192 )) && gpu_mem_cap=192 G_CONFIG_INJECT 'gpu_mem_256=' "gpu_mem_256=$gpu_mem_cap" $FP_RPI_CONFIG else @@ -208,12 +228,13 @@ systemctl enable dietpi-rm_program_usb_boot_mode } #///////////////////////////////////////////////////////////////////////////////////// - #headless + # headless #///////////////////////////////////////////////////////////////////////////////////// Headless_Main(){ if [[ $INPUT_DEVICE_VALUE == 'enable' ]]; then + # RPi if (( $G_HW_MODEL < 10 )); then # - Framebuffer dimensions should not play a role here, but @@ -223,23 +244,24 @@ systemctl enable dietpi-rm_program_usb_boot_mode G_CONFIG_INJECT 'framebuffer_height=' '#framebuffer_height=0' /DietPi/config.txt G_CONFIG_INJECT 'max_framebuffer_width=' '#max_framebuffer_width=0' /DietPi/config.txt G_CONFIG_INJECT 'max_framebuffer_height=' '#max_framebuffer_height=0' /DietPi/config.txt - # - Splash cannot be seen anyway, without video output + # - Splash cannot be seen anyway without video output G_CONFIG_INJECT 'disable_splash=' 'disable_splash=1' /DietPi/config.txt # - hdmi_blanking should not play a role, however mode 1 should be generally preferred, which on idle disables HDMI output completely instead of just blanking the screen G_CONFIG_INJECT 'hdmi_blanking=' 'hdmi_blanking=1' /DietPi/config.txt - # - Disable HDMI hotplug, which requires it to be generally responsive/active + # - Disable HDMI hotplug detection, which requires it to be generally responsive/active G_CONFIG_INJECT 'hdmi_ignore_hotplug=' 'hdmi_ignore_hotplug=1' /DietPi/config.txt # - Disable composite hotplug, which then allows to completely disable the video pipeline + framebuffer G_CONFIG_INJECT 'hdmi_ignore_composite=' 'hdmi_ignore_composite=1' /DietPi/config.txt - #odroid C1 - elif (( $G_HW_MODEL == 10 )); then + # Odroid C1 + #REMOVE v6.24 + elif (( $G_HW_MODEL == 10 && $G_DISTRO == 3 )); then - G_CONFIG_INJECT 'setenv hdmioutput ' 'setenv hdmioutput "0"' /DietPi/boot.ini + G_CONFIG_INJECT 'setenv hdmioutput ' 'setenv hdmioutput "0"' /DietPi/boot.ini G_CONFIG_INJECT 'setenv vpu ' 'setenv vpu "0"' /DietPi/boot.ini G_CONFIG_INJECT 'setenv m_bpp ' 'setenv m_bpp "32"' /DietPi/boot.ini - #Odroid C2 + # Odroid C2 elif (( $G_HW_MODEL == 12 )); then G_CONFIG_INJECT 'setenv nographics ' 'setenv nographics "1"' /DietPi/boot.ini @@ -252,20 +274,22 @@ systemctl enable dietpi-rm_program_usb_boot_mode elif [[ $INPUT_DEVICE_VALUE == 'disable' ]]; then + # RPi if (( $G_HW_MODEL < 10 )); then G_CONFIG_INJECT 'hdmi_ignore_hotplug=' '#hdmi_ignore_hotplug=0' /DietPi/config.txt G_CONFIG_INJECT 'hdmi_ignore_composite=' '#hdmi_ignore_composite=0' /DietPi/config.txt G_CONFIG_INJECT 'hdmi_blanking=' '#hdmi_blanking=0' /DietPi/config.txt - #odroid C1 - elif (( $G_HW_MODEL == 10 )); then + # Odroid C1 + #REMOVE v6.24 + elif (( $G_HW_MODEL == 10 && $G_DISTRO == 3 )); then - G_CONFIG_INJECT 'setenv hdmioutput ' 'setenv hdmioutput "1"' /DietPi/boot.ini - G_CONFIG_INJECT 'setenv vpu ' 'setenv vpu "1"' /DietPi/boot.ini - G_CONFIG_INJECT 'setenv m_bpp ' 'setenv m_bpp "32"' /DietPi/boot.ini + G_CONFIG_INJECT 'setenv hdmioutput ' 'setenv hdmioutput "1"' /DietPi/boot.ini + G_CONFIG_INJECT 'setenv vpu ' 'setenv vpu "1"' /DietPi/boot.ini + G_CONFIG_INJECT 'setenv m_bpp ' 'setenv m_bpp "32"' /DietPi/boot.ini - #Odroid C2 + # Odroid C2 elif (( $G_HW_MODEL == 12 )); then G_CONFIG_INJECT 'setenv nographics ' 'setenv nographics "0"' /DietPi/boot.ini @@ -285,32 +309,34 @@ systemctl enable dietpi-rm_program_usb_boot_mode } #///////////////////////////////////////////////////////////////////////////////////// - #remoteir + # remoteir #///////////////////////////////////////////////////////////////////////////////////// RemoteIR_Prereqs(){ G_AG_CHECK_INSTALL_PREREQ lirc; } RemoteIR_Reset_All(){ - # - Disable JustBoom + # Disable JustBoom if (( $G_HW_MODEL < 10 )); then if [[ -f /etc/systemd/system/justboom-ir-mpd.service ]]; then - systemctl stop justboom-ir-mpd.service - systemctl disable justboom-ir-mpd.service + systemctl stop justboom-ir-mpd + systemctl disable justboom-ir-mpd rm /etc/systemd/system/justboom-ir-mpd.service + systemctl daemon-reload fi sed -i '/^[[:blank:]]*dtoverlay=lirc-rpi/d' $FP_RPI_CONFIG sed -i '/^[[:blank:]]*dtparam=gpio_in_pin=25/d' $FP_RPI_CONFIG - # - Disable Odroids + # Disable Odroids elif (( $G_HW_MODEL < 20 )) && [[ -f /etc/systemd/system/odroid-remote.service ]]; then systemctl stop odroid-remote systemctl disable odroid-remote rm /etc/systemd/system/odroid-remote.service + systemctl daemon-reload fi @@ -327,47 +353,59 @@ systemctl enable dietpi-rm_program_usb_boot_mode RemoteIR_Prereqs RemoteIR_Reset_All - # - XU4 Cloudshell + # XU4 Cloudshell if (( $G_HW_MODEL == 11 )); then - # - modules + # - Modules local string='options gpioplug_ir_recv gpio_nr=24 active_low=1' G_CONFIG_INJECT "$string" "$string" /etc/modprobe.d/odroid-cloudshell.conf + G_CONFIG_INJECT 'gpio-ir-recv' 'gpio-ir-recv' /etc/modules + G_CONFIG_INJECT 'gpioplug-ir-recv' 'gpioplug-ir-recv' /etc/modules - string='gpio-ir-recv' - G_CONFIG_INJECT "$string" "$string" /etc/modules - - string='gpioplug-ir-recv' - G_CONFIG_INJECT "$string" "$string" /etc/modules - - # - C1/C2 - elif (( $G_HW_MODEL == 10 || $G_HW_MODEL == 12 )); then + # C2 + elif (( $G_HW_MODEL == 12 || + ( $G_HW_MODEL == 10 && $G_DISTRO == 3 ) )); then #REMOVE v6.24 # - Module G_CONFIG_INJECT 'meson_ir' 'meson_ir' /etc/modules fi - # - All - # - Systemd - systemctl disable lirc - [[ -f /etc/init.d/lirc ]] && rm /etc/init.d/lirc - cat << _EOF_ > /etc/systemd/system/odroid-remote.service + # All + # - systemd + if (( $G_DISTRO < 4 )); then + + if [[ -f /etc/init.d/lirc ]]; then + + systemctl disable lirc + rm /etc/init.d/lirc + systemctl daemon-reload + + fi + + cat << _EOF_ > /etc/systemd/system/odroid-remote.service [Unit] Description=Odroid Remote C1/C2/XU4 [Service] Type=forking -ExecStartPre=$(command -v mkdir) -p /var/run/lirc +ExecStartPre=$(command -v mkdir) -p /run/lirc ExecStart=$(command -v lircd) --output=/run/lirc/lircd --driver=default --device=/dev/lirc0 --uinput [Install] WantedBy=multi-user.target _EOF_ - systemctl daemon-reload - systemctl enable odroid-remote + systemctl daemon-reload + systemctl enable odroid-remote + + # Since Stretch a systemd service exists + else - # Lircd conf for Odroid Remote + systemctl enable lircd + + fi + + # - Lircd conf for Odroid Remote cat << _EOF_ > /etc/lirc/lircd.conf begin remote @@ -468,7 +506,7 @@ _EOF_ # + MPD control G_AG_CHECK_INSTALL_PREREQ mpc - cat << _EOF_ > ~/.lircrc + cat << _EOF_ > /root/.lircrc begin prog = irexec button = KEY_ENTER @@ -516,16 +554,13 @@ config = mpc repeat off end _EOF_ - # service + # - Service cat << _EOF_ > /etc/systemd/system/justboom-ir-mpd.service [Unit] Description=justboom-ir-mpd (DietPi) -After=sound.target lirc.service +After=sound.target lircd.service lirc.service [Service] -User=$USER -Type=simple - ExecStart=$(command -v irexec) [Install] @@ -548,7 +583,7 @@ _EOF_ } #///////////////////////////////////////////////////////////////////////////////////// - #Ethernet force link speed + # Ethernet force link speed #///////////////////////////////////////////////////////////////////////////////////// Eth_Force_Speed_Main(){ @@ -574,10 +609,16 @@ _EOF_ systemctl enable ethtool_force_speed systemctl start ethtool_force_speed - elif [[ $INPUT_DEVICE_VALUE == 'disable' ]]; then # 0 is converted to 'disabled' + elif [[ $INPUT_DEVICE_VALUE == 'disable' ]]; then # 0 is converted to 'disable' - [[ -f /etc/systemd/system/ethtool_force_speed.service ]] && rm /etc/systemd/system/ethtool_force_speed.service - systemctl daemon-reload + if [[ -f /etc/systemd/system/ethtool_force_speed.service ]]; then + + systemctl stop ethtool_force_speed + systemctl disable ethtool_force_speed + rm /etc/systemd/system/ethtool_force_speed.service + systemctl daemon-reload + + fi else @@ -588,13 +629,13 @@ _EOF_ } #///////////////////////////////////////////////////////////////////////////////////// - #RPi openGL + # RPi openGL #///////////////////////////////////////////////////////////////////////////////////// RPi_OpenGL_Main(){ (( $G_HW_MODEL > 9 )) && { Unsupported_Input_Name; return 1; } # Exit path for non-RPi - #Always remove previous vc4 overlay entry + # Always remove previous vc4 overlay entry sed -i '/^[[:blank:]]*dtoverlay=vc4-/d' $FP_RPI_CONFIG if [[ $INPUT_DEVICE_VALUE == 'vc4-'* ]]; then @@ -606,7 +647,7 @@ _EOF_ echo "dtoverlay=$INPUT_DEVICE_VALUE" >> $FP_RPI_CONFIG - # - set 1080p by default + # - Set 1080p by default G_CONFIG_INJECT 'framebuffer_width=' 'framebuffer_width=1920' $FP_RPI_CONFIG G_CONFIG_INJECT 'framebuffer_height=' 'framebuffer_height=1080' $FP_RPI_CONFIG @@ -641,7 +682,7 @@ _EOF_ Lcd_Panel_ESP01215E_Enable - #disable all + # Disable all elif [[ $INPUT_DEVICE_VALUE == 'none' ]]; then Lcd_Panel_Waveshare32_Disable @@ -656,7 +697,7 @@ _EOF_ fi - #Update dietpi.txt entry? + # Update dietpi.txt entry? (( $update_dietpitxt )) && G_CONFIG_INJECT 'CONFIG_LCDPANEL=' "CONFIG_LCDPANEL=$INPUT_DEVICE_VALUE" /DietPi/dietpi.txt } @@ -687,36 +728,35 @@ _EOF_ Lcd_Panel_Xorg_All_Enable(){ - #Xinput calibrator, fbset for con2fbmap + # Xinput calibrator, fbset for con2fbmap G_AG_CHECK_INSTALL_PREREQ fbset xinput-calibrator xserver-xorg-input-evdev mkdir -p /etc/X11/xorg.conf.d - # - Create desktop icon for xcalibration - # NB: libinput replaces this in start menu + # Create desktop icon for xcalibration + # - NB: libinput replaces this in start menu } - # - Waveshare32 + # Waveshare32 Lcd_Panel_Waveshare32_Enable_X11(){ cat << _EOF_ > /etc/X11/xorg.conf.d/99-waveshare32_xorg.conf Section "Device" - Identifier "Allwinner A10/A13 FBDEV" - Driver "fbdev" - Option "fbdev" "/dev/fb1" - - Option "SwapbuffersWait" "true" + Identifier "Allwinner A10/A13 FBDEV" + Driver "fbdev" + Option "fbdev" "/dev/fb1" + Option "SwapbuffersWait" "true" EndSection _EOF_ cat << _EOF_ > /etc/X11/xorg.conf.d/99-waveshare32_calibration.conf Section "InputClass" -Identifier "calibration" -MatchProduct "ADS7846 Touchscreen" -Option "Calibration" "219 3835 3984 219" -Option "SwapAxes" "1" -Driver "evdev" + Identifier "calibration" + MatchProduct "ADS7846 Touchscreen" + Option "Calibration" "219 3835 3984 219" + Option "SwapAxes" "1" + Driver "evdev" EndSection _EOF_ @@ -726,10 +766,10 @@ _EOF_ (( $G_HW_MODEL > 19 )) && { Unsupported_Input_Mode; return 1; } # Exit path for non-RPi/non-Odroid - #Disable 1st to reset any existing installations: + # Disable 1st to reset any existing installations: Lcd_Panel_Waveshare32_Disable - #RPi + # RPi if (( $G_HW_MODEL < 10 )); then # + X11 @@ -753,30 +793,29 @@ _EOF_ G_CONFIG_INJECT 'dtoverlay=waveshare32b' 'dtoverlay=waveshare32b:rotate=270' $FP_RPI_CONFIG # - Swap input axis - sed -i '/"SwapAxes"/c\ Option "SwapAxes" "1"' /etc/X11/xorg.conf.d/99-waveshare32_calibration.conf + sed -i '/"SwapAxes"/c\ Option "SwapAxes" "1"' /etc/X11/xorg.conf.d/99-waveshare32_calibration.conf # - Move fb0 xorg.conf out the way: https://github.com/MichaIng/DietPi/issues/767 - mv /usr/share/X11/xorg.conf.d/99-fbturbo.conf /usr/share/X11/99-fbturbo.conf + [[ -f /usr/share/X11/xorg.conf.d/99-fbturbo.conf ]] && mv /usr/share/X11/xorg.conf.d/99-fbturbo.conf /usr/share/X11/99-fbturbo.conf - #Odroids + # Odroids else # + X11 Lcd_Panel_Xorg_All_Enable Lcd_Panel_Waveshare32_Enable_X11 - #con2fbmap, maps console (1) to panel(2). Run during boot. + # - con2fbmap, maps console (1) to panel(2). Run during boot. cat << _EOF_ > /etc/systemd/system/con2fbmap.service [Unit] Description=con2fbmap [Service] Type=oneshot +RemainAfterExit=yes ExecStart=$(command -v con2fbmap) 1 2 ExecStop=$(command -v con2fbmap) 1 0 -RemainAfterExit=yes - [Install] WantedBy=multi-user.target _EOF_ @@ -786,35 +825,30 @@ _EOF_ G_CONFIG_INJECT 'spicc' 'spicc' /etc/modules G_CONFIG_INJECT 'fbtft_device' 'fbtft_device' /etc/modules - cat << _EOF_ > /etc/modprobe.d/waveshare32.conf -options fbtft_device name=odroidc_tft32 rotate=270 gpios=reset:116,dc:115 speed=32000000 cs=0 -_EOF_ + echo 'options fbtft_device name=odroidc_tft32 rotate=270 gpios=reset:116,dc:115 speed=32000000 cs=0' > /etc/modprobe.d/waveshare32.conf - #x11 + # - X11 cat << _EOF_ > /etc/X11/xorg.conf.d/99-waveshare32_xorg.conf Section "Device" - Identifier "FBDEV" - Driver "fbdev" - Option "fbdev" "/dev/fb2" - - #Option "SwapbuffersWait" "true" + Identifier "FBDEV" + Driver "fbdev" + Option "fbdev" "/dev/fb2" + #Option "SwapbuffersWait" "true" EndSection - _EOF_ fi - } Lcd_Panel_Waveshare32_Disable(){ - #all + # All [[ -f /etc/X11/xorg.conf.d/99-waveshare32_calibration.conf ]] && rm /etc/X11/xorg.conf.d/99-waveshare32_calibration.conf [[ -f /etc/X11/xorg.conf.d/99-waveshare32_xorg.conf ]] && rm /etc/X11/xorg.conf.d/99-waveshare32_xorg.conf [[ -f /usr/share/applications/xinput_calibrator.desktop ]] && rm /usr/share/applications/xinput_calibrator.desktop - #RPi + # RPi if (( $G_HW_MODEL < 10 )); then [[ -f /boot/overlays/waveshare32b.dtbo ]] && rm /boot/overlays/waveshare32b.dtbo @@ -825,19 +859,24 @@ _EOF_ sed -i '/^[[:blank:]]*dtoverlay=ads7846,cs=1,penirq=17/d' $FP_RPI_CONFIG sed -i '/^[[:blank:]]*dtoverlay=w1-gpio-pullup,gpiopin=4,extpullup=1/d' $FP_RPI_CONFIG - # - Leave these enabled, just incase the user has other hardware that may use them. + # - Leave these enabled, just in case the user has other hardware that may use them. #sed -i '/^[[:blank:]]*dtparam=i2c_arm=/c\dtparam=i2c_arm=on' $FP_RPI_CONFIG #sed -i '/^[[:blank:]]*dtparam=spi=/c\dtparam=spi=on' $FP_RPI_CONFIG # - Move fb0 xorg.conf back: https://github.com/MichaIng/DietPi/issues/767 - [[ -f /usr/share/X11/99-fbturbo.conf ]] && mv /usr/share/X11/99-fbturbo.conf /usr/share/X11/xorg.conf.d/99-fbturbo.conf + [[ -f /usr/share/X11/99-fbturbo.conf && ! -f /usr/share/X11/xorg.conf.d/99-fbturbo.conf ]] && mv /usr/share/X11/99-fbturbo.conf /usr/share/X11/xorg.conf.d/99-fbturbo.conf - #Odroids - elif (( $G_HW_MODEL >= 10 && $G_HW_MODEL < 20 )); then + # Odroids + elif (( $G_HW_MODEL < 20 )); then - [[ -f /etc/systemd/system/con2fbmap.service ]] && rm /etc/systemd/system/con2fbmap.service - systemctl daemon-reload + if [[ -f /etc/systemd/system/con2fbmap.service ]]; then + systemctl stop con2fbmap + systemctl disable con2fbmap + rm /etc/systemd/system/con2fbmap.service + systemctl daemon-reload + + fi [[ -f /etc/modprobe.d/waveshare32.conf ]] && rm /etc/modprobe.d/waveshare32.conf sed -i '/^[[:blank:]]*spicc/d' /etc/modules sed -i '/^[[:blank:]]*fbtft_device/d' /etc/modules @@ -846,16 +885,14 @@ _EOF_ } - # - Odroid Cloudshell + # Odroid Cloudshell Lcd_Panel_Odroidcloudshell_Enable(){ - cat << _EOF_ > /etc/modprobe.d/odroid-cloudshell.conf -options fbtft_device name=hktft9340 busnum=1 rotate=270 -_EOF_ + echo 'options fbtft_device name=hktft9340 busnum=1 rotate=270' > /etc/modprobe.d/odroid-cloudshell.conf G_CONFIG_INJECT 'spi_s3c64xx' 'spi_s3c64xx' /etc/modules G_CONFIG_INJECT 'fbtft_device' 'fbtft_device' /etc/modules - echo 'fbtft_device' >> /etc/modules #XU4 4.9 workaround: https://github.com/MichaIng/DietPi/issues/926#issuecomment-299480918 + echo 'fbtft_device' >> /etc/modules # XU4 4.9 workaround: https://github.com/MichaIng/DietPi/issues/926#issuecomment-299480918 } @@ -865,19 +902,19 @@ _EOF_ sed -i '/^[[:blank:]]*spi_s3c64xx/d' /etc/modules sed -i '/^[[:blank:]]*fbtft_device/d' /etc/modules - ##Cant run it on the fly, locks up device. + # Cant run it on the fly, locks up device. #root@DietPi-XU4:~# modprobe -rf spi_s3c64xx #root@DietPi-XU4:~# modprobe -rf fbtft_device #Segmentation fault } - # - Odroid LCD 3.5 + # Odroid LCD 3.5 Lcd_Panel_OdroidLCD35_Enable(){ (( $G_HW_MODEL >= 10 && $G_HW_MODEL < 20 )) || { Unsupported_Input_Mode; return 1; } # Exit path for non-Odroid - #Reset to disabled: + # Reset to disabled: Lcd_Panel_OdroidLCD35_Disable Lcd_Panel_Xorg_All_Enable @@ -913,9 +950,7 @@ _EOF_ done - unset amodules - - #Service + # Service # - XU4 if (( $G_HW_MODEL == 11 )); then @@ -969,25 +1004,25 @@ _EOF_ systemctl daemon-reload systemctl enable odroid-lcd35 - #XORG - [[ -f /etc/X11/xorg.conf.d/exynos.conf ]] && rm /etc/X11/xorg.conf.d/exynos.conf #XU4 + # - X.org + [[ -f /etc/X11/xorg.conf.d/exynos.conf ]] && rm /etc/X11/xorg.conf.d/exynos.conf # XU4 mkdir -p /etc/X11/xorg.conf.d cat << _EOF_ > /etc/X11/xorg.conf.d/99-odroid-lcd35.conf Section "Device" - Identifier "C fbdev" - Driver "fbdev" - Option "fbdev" "/dev/fb2" + Identifier "C fbdev" + Driver "fbdev" + Option "fbdev" "/dev/fb2" EndSection _EOF_ # - default calibration cat << _EOF_ > /etc/X11/xorg.conf.d/99-calibration.conf Section "InputClass" - Identifier "calibration" - MatchProduct "SX865X Touchscreen" - Option "Calibration" "3854 155 3880 262" - Option "SwapAxes" "0" + Identifier "calibration" + MatchProduct "SX865X Touchscreen" + Option "Calibration" "3854 155 3880 262" + Option "SwapAxes" "0" EndSection _EOF_ @@ -997,14 +1032,20 @@ _EOF_ [[ -f /etc/X11/xorg.conf.d/99-calibration.conf ]] && rm /etc/X11/xorg.conf.d/99-calibration.conf [[ -f /etc/modprobe.d/odroid-lcd35.conf ]] && rm /etc/modprobe.d/odroid-lcd35.conf - [[ -f /etc/systemd/system/odroid-lcd35.service ]] && rm /etc/systemd/system/odroid-lcd35.service + if [[ -f /etc/systemd/system/odroid-lcd35.service ]]; then + + systemctl stop odroid-lcd35 + systemctl disable odroid-lcd35 + rm /etc/systemd/system/odroid-lcd35.service + systemctl daemon-reload + + fi [[ -f /etc/X11/xorg.conf.d/99-odroid-lcd35.conf ]] && rm /etc/X11/xorg.conf.d/99-odroid-lcd35.conf - systemctl daemon-reload } #///////////////////////////////////////////////////////////////////////////////////// - # i2c + # I2C #///////////////////////////////////////////////////////////////////////////////////// I2c_Main(){ @@ -1012,18 +1053,18 @@ _EOF_ if [[ $INPUT_DEVICE_VALUE == 'enable' ]]; then - #Check/install pre-reqs + # Check/install pre-reqs G_AG_CHECK_INSTALL_PREREQ python-smbus i2c-tools - #Kernel modules + # Kernel modules G_CONFIG_INJECT 'i2c-bcm2708' 'i2c-bcm2708' /etc/modules G_CONFIG_INJECT 'i2c-dev' 'i2c-dev' /etc/modules - #config.txt + # config.txt G_CONFIG_INJECT 'dtparam=i2c_arm=' 'dtparam=i2c_arm=on' $FP_RPI_CONFIG G_CONFIG_INJECT 'dtparam=i2c1=' 'dtparam=i2c1=on' $FP_RPI_CONFIG - #DietPi-Software, set installed + # DietPi-Software, set installed sed -i '/^aSOFTWARE_INSTALL_STATE\[72\]=/c\aSOFTWARE_INSTALL_STATE\[72\]=2' /DietPi/dietpi/.installed elif [[ $INPUT_DEVICE_VALUE == 'disable' ]]; then @@ -1034,12 +1075,12 @@ _EOF_ G_CONFIG_INJECT 'dtparam=i2c1=' 'dtparam=i2c1=off' $FP_RPI_CONFIG G_CONFIG_INJECT 'i2c_arm_baudrate=' 'i2c_arm_baudrate=100000' $FP_RPI_CONFIG - #Set baudrate (khz) | valid int + # Set baudrate (khz) | valid int elif disable_error=1 G_CHECK_VALIDINT "$INPUT_DEVICE_VALUE" 2 10000000; then G_CONFIG_INJECT 'i2c_arm_baudrate=' "i2c_arm_baudrate=$(( $INPUT_DEVICE_VALUE * 1000 ))" $FP_RPI_CONFIG - #inform user + # inform user INPUT_DEVICE_VALUE+='Khz' else @@ -1051,22 +1092,21 @@ _EOF_ } #///////////////////////////////////////////////////////////////////////////////////// - # bluetooth + # Bluetooth #///////////////////////////////////////////////////////////////////////////////////// Bluetooth_Main(){ - local aBLUETOOTH_MODULES=() + local aBLUETOOTH_MODULES=( - aBLUETOOTH_MODULES=('bluetooth') - aBLUETOOTH_MODULES+=('bnep') + 'bluetooth' + 'bnep' + 'btbcm' # RPi3 Broadcom onboard + 'rfcomm' # BPi Pro/M2+ and others + 'hidp' # BPi Pro/M2+ and others + 'hci_uart' - aBLUETOOTH_MODULES+=('btbcm') # rpi3 broadcom onboard - - aBLUETOOTH_MODULES+=('rfcomm') # BPi pro/m2+ and others - aBLUETOOTH_MODULES+=('hidp') # BPi pro/m2+ and others - - aBLUETOOTH_MODULES+=('hci_uart') + ) [[ -f /etc/modprobe.d/disable_bt.conf ]] && rm /etc/modprobe.d/disable_bt.conf @@ -1080,7 +1120,7 @@ _EOF_ systemctl disable brcm_patchram_plus 2> /dev/null # + RPi 3 (apply to all, as pi-bluetooth package is default installed on all RPi's now) - # + Asus TB + # + ASUS TB elif (( $G_HW_MODEL < 10 || $G_HW_MODEL == 52 )); then systemctl stop hciuart 2> /dev/null @@ -1088,7 +1128,7 @@ _EOF_ fi - #bluetooth last + # Bluetooth last systemctl stop bluetooth 2> /dev/null systemctl disable bluetooth 2> /dev/null @@ -1100,10 +1140,10 @@ _EOF_ done - #Purge packages + # Purge packages if (( $G_DIETPI_INSTALL_STAGE >= 0 )); then - G_AGP bluetooth bluez-firmware pi-bluetooth + G_AGP bluez bluez-firmware pi-bluetooth G_AGA fi @@ -1111,23 +1151,39 @@ _EOF_ # - Enable elif [[ $INPUT_DEVICE_VALUE == 'enable' ]]; then - # + RPi - # Serial console must be disabled: https://github.com/MichaIng/DietPi/issues/2607#issuecomment-470523194 + # Pre-Reqs if (( $G_HW_MODEL < 10 )); then - INPUT_DEVICE_VALUE='disable' Serial_Main + # - Login console on ttyAMA0 must be disabled: https://github.com/MichaIng/DietPi/issues/2607#issuecomment-470523194 + if systemctl -q is-active serial-getty@ttyAMA0; then - fi + if G_WHIP_YESNO '[WARNING] A serial login console is currently active on ttyAMA0\n +Do you want to continue and disable the serial login console?'; then - #Pre-Reqs - G_AG_CHECK_INSTALL_PREREQ bluetooth bluez-firmware - (( $G_HW_MODEL < 10 )) && G_AG_CHECK_INSTALL_PREREQ pi-bluetooth + INPUT_DEVICE_VALUE='disable' INPUT_ADDITIONAL='ttyAMA0' Serial_Main + + else + + exit 0 + + fi + + fi + + G_AG_CHECK_INSTALL_PREREQ pi-bluetooth + + else - #bluetooth first - for ((i=0; i<${#aBLUETOOTH_MODULES[@]}; i++)) + # bluez-firmware: BCM203x dongles: https://packages.debian.org/stretch/bluez-firmware + G_AG_CHECK_INSTALL_PREREQ bluez bluez-firmware + + fi + + # Bluetooth first + for i in "${aBLUETOOTH_MODULES[@]}" do - modprobe "${aBLUETOOTH_MODULES[$i]}" 2> /dev/null + modprobe "$i" 2> /dev/null done @@ -1142,7 +1198,7 @@ _EOF_ systemctl enable bluetooth 2> /dev/null G_RUN_CMD systemctl start bluetooth - # + RPi + # + RPi if (( $G_HW_MODEL < 10 )); then systemctl enable hciuart @@ -1156,8 +1212,6 @@ _EOF_ fi - unset aBLUETOOTH_MODULES - } #///////////////////////////////////////////////////////////////////////////////////// @@ -1170,7 +1224,7 @@ _EOF_ G_DIETPI-NOTIFY 1 'IPv6 is not supported or disabled on kernel level. Aborting...' EXIT_CODE=1 - return + return 1 elif [[ $INPUT_DEVICE_VALUE == 'enable' ]]; then @@ -1203,17 +1257,17 @@ _EOF_ else Unknown_Input_Mode - return + return 1 fi # Failsafe: Comment "disable_ipv6" entries in all other sysctl config files local i='' - for i in /etc/sysctl.conf /etc/sysctl.d/* + for i in /etc/sysctl{,.d/*}.conf do [[ ! -f $i || $i == *'dietpi-disable_ipv6.conf' ]] && continue - sed -i 's/^[[:blank:]]*net.ipv6.conf.[^[:blank:]].disable_ipv6[[:blank:]]*=/#&/' $i + sed -i 's/^[[:blank:]]*net.ipv6.conf.[^[:blank:]]*.disable_ipv6[[:blank:]]*=/#&/' $i done @@ -1242,7 +1296,7 @@ _EOF_ else Unknown_Input_Mode - return + return 1 fi @@ -1260,21 +1314,16 @@ _EOF_ Wifi_Modules_Main(){ - local aWIFI_MODULES=() - # - All - aWIFI_MODULES=('cfg80211') + local aWIFI_MODULES=('cfg80211') - #NB: we need to start doing these device specific via $G_HW_MODEL index. This prevents unnecessary modules getting loaded. - # + RPi 3 - aWIFI_MODULES+=('brcmfmac') #onboard WiFi - aWIFI_MODULES+=('brcmutil') #onboard WiFi + # + RPi with onboard WiFi + if (( $G_HW_MODEL < 10 && $HW_ONBOARD_WIFI )); then - # + BPi Pro - aWIFI_MODULES+=('ap6211') #onboard + aWIFI_MODULES+=('brcmfmac' 'brcmutil') # + OrangePi Zero - if (( $G_HW_MODEL == 32 )); then + elif (( $G_HW_MODEL == 32 )); then aWIFI_MODULES+=('xradio_wlan') @@ -1283,28 +1332,43 @@ _EOF_ aWIFI_MODULES+=('8189es') - # + Pine A64 / PB / Asus tinker board (onboard) - elif (( $G_HW_MODEL == 40 || $G_HW_MODEL == 44 || $G_HW_MODEL == 52 )); then + # + Pine A64 / PB / ASUS Tinker Board (onboard) + elif (( $G_HW_MODEL == 40 || $G_HW_MODEL == 44 || $G_HW_MODEL == 52 )); then aWIFI_MODULES+=('8723bs') + # + BPi Pro (onboard) + elif (( $G_HW_MODEL == 51 )); then + + aWIFI_MODULES+=('ap6211') + # + NanoPi NEO Air / Zero 2+ elif (( $G_HW_MODEL == 35 || $G_HW_MODEL == 64 )); then - #4.9 uses brcm, only enable dhd for 3.x - [[ ! -d '/boot/dtb' ]] && aWIFI_MODULES+=('dhd') + # 4.9 uses brcm, only enable dhd for 3.x + if [[ -d '/boot/dtb' ]]; then - fi + aWIFI_MODULES+=('brcmfmac' 'brcmutil') + + else + + aWIFI_MODULES+=('dhd') + + fi # + NanoPi T3 - aWIFI_MODULES+=('bcmdhd') + elif (( $G_HW_MODEL == 62 )); then + + aWIFI_MODULES+=('bcmdhd') + + fi # - Disable if [[ $INPUT_DEVICE_VALUE == 'disable' ]]; then [[ -f /etc/modprobe.d/disable_wifi.conf ]] && rm /etc/modprobe.d/disable_wifi.conf - #cfg80211 last + # cfg80211 last for ((i=$(( ${#aWIFI_MODULES[@]} - 1 )); i>=0; i--)) do @@ -1326,19 +1390,19 @@ _EOF_ # - Disable known powersaving options for specific chipsets echo 'options 8192cu rtw_power_mgnt=0' > /etc/modprobe.d/8192cu.conf echo 'options 8188eu rtw_power_mgnt=0' > /etc/modprobe.d/8188eu.conf - echo 'options 8189es rtw_power_mgnt=0' > /etc/modprobe.d/8189es.conf #OPi Plus - echo 'options 8723bs rtw_power_mgnt=0' > /etc/modprobe.d/8723bs.conf #PineA64 + echo 'options 8189es rtw_power_mgnt=0' > /etc/modprobe.d/8189es.conf # OPi Plus + echo 'options 8723bs rtw_power_mgnt=0' > /etc/modprobe.d/8723bs.conf # Pine A64 echo 'options wlan_8192eu rtw_power_mgnt=0' > /etc/modprobe.d/wlan_8192eu.conf # Sparky/Allo WiFi - #cfg80211 first - for ((i=0; i<${#aWIFI_MODULES[@]}; i++)) + # cfg80211 first + for i in "${aWIFI_MODULES[@]}" do - modprobe "${aWIFI_MODULES[$i]}" 2> /dev/null + modprobe "$i" 2> /dev/null done - # - Delay. Without this, kernel reports wifi device not found with RPi 3 and Pine A64 addon board, when ran straight after this script. + # - Delay. Without this, kernel reports WiFi device not found with RPi 3 and Pine A64 addon board, when ran straight after this script. G_DIETPI-NOTIFY 2 'Please wait, enabling WiFi Modules...' # - Had to up the delay from 3 seconds to 8 seconds on WPA2-Enterprise, otherwise still get device not found error. sleep 8 @@ -1346,26 +1410,26 @@ _EOF_ # + RPi 3+, unlock scan+wifi https://github.com/MichaIng/DietPi/issues/1627 rfkill unblock wifi &> /dev/null - #Update our networking file (refresh active wlan index) + # Update our networking file (refresh active wlan index) /DietPi/dietpi/func/obtain_network_details elif [[ $INPUT_DEVICE_VALUE == 'onboard_enable' ]]; then - (( $HW_ONBOARD_WIFI )) || + (( $HW_ONBOARD_WIFI )) || { Unsupported_Input_Mode; return 1; } - #NB: Requires reboot - #NB: Do not change filenames, -f check used by DietPi-Config to obtain state + # NB: Requires reboot + # NB: Do not change filenames, -f check used by DietPi-Config to obtain state [[ -f /etc/modprobe.d/disable_wifi_rpi3_onboard.conf ]] && rm /etc/modprobe.d/disable_wifi_rpi3_onboard.conf elif [[ $INPUT_DEVICE_VALUE == 'onboard_disable' ]]; then - (( $HW_ONBOARD_WIFI )) || + (( $HW_ONBOARD_WIFI )) || { Unsupported_Input_Mode; return 1; } - #NB: Requires reboot - #NB: Do not change filenames, -f check used by DietPi-Config to obtain state + # NB: Requires reboot + # NB: Do not change filenames, -f check used by DietPi-Config to obtain state - # - RPi 3/ZeroW + # - RPi 3/Zero W echo 'blacklist brcmfmac' > /etc/modprobe.d/disable_wifi_rpi3_onboard.conf echo 'blacklist brcmutil' >> /etc/modprobe.d/disable_wifi_rpi3_onboard.conf @@ -1375,13 +1439,11 @@ _EOF_ fi - unset aWIFI_MODULES - } Wifi_Countrycode_Main(){ - #Use country code from command input. Implies new setting. + # Use country code from command input. Implies new setting. if [[ $INPUT_DEVICE_VALUE ]]; then # - Apply value to DietPi.txt @@ -1406,133 +1468,184 @@ _EOF_ # serialconsole #///////////////////////////////////////////////////////////////////////////////////// - MAX_SERIAL_CONSOLES=2 - Serial_Main(){ #------------------------------------------------------------------------------------- - #Enable - if [[ $INPUT_DEVICE_VALUE == 'enable' ]]; then + #C1 on 3.x with Jessie, causes kernel hang. + if (( $G_HW_MODEL == 10 )); then + + echo 'Not supported' + + # Enable + elif [[ $INPUT_DEVICE_VALUE == 'enable' ]]; then - #systemctl enable serial-getty@*.service # Wildcard does not work, we need to specify each possible tty device name - #systemctl enable serial-getty@ttyAMA[0-9].service # Number wildcards do not work, we need to specify each possible tty device number + # Enable for specific Serial/UART device + if [[ $INPUT_ADDITIONAL ]]; then - G_DIETPI-NOTIFY 2 'Enabling known serial-getty services, please wait...' - systemctl unmask serial-getty@tty 2> /dev/null - systemctl enable serial-getty@tty 2> /dev/null - for ((i=0; i<=$MAX_SERIAL_CONSOLES; i++)) - do + # - RPi: Warn if on RPi ttyAMA0 is about to be enabled while Bluetooth is up + if [[ $G_HW_MODEL == [0-9] && $INPUT_ADDITIONAL == 'ttyAMA0' ]] && systemctl -q is-active hciuart; then - # - unmask v6.3+ - systemctl unmask serial-getty@ttyAMA$i 2> /dev/null - systemctl unmask serial-getty@ttySAC$i 2> /dev/null - systemctl unmask serial-getty@ttyS$i 2> /dev/null - #systemctl unmask serial-getty@ttyFIQ$i 2> /dev/null #:https://github.com/MichaIng/DietPi/issues/1829#issuecomment-398302497 + if G_WHIP_YESNO '[WARNING] ttyAMA0 is currently used by Bluetooth\n +Do you want to continue and DISABLE Bluetooth now?'; then + INPUT_DEVICE_VALUE='disable' Bluetooth_Main - # - Enable v6.2- - systemctl enable serial-getty@ttyAMA$i 2> /dev/null - systemctl enable serial-getty@ttySAC$i 2> /dev/null - systemctl enable serial-getty@ttyS$i 2> /dev/null - #systemctl enable serial-getty@ttyFIQ$i 2> /dev/null #:https://github.com/MichaIng/DietPi/issues/1829#issuecomment-398302497 + else - # - Allow root login for known TTY's not in /etc/securetty by default - # NanoPC-T4 - G_CONFIG_INJECT "ttyFIQ$i" "ttyFIQ$i" /etc/securetty + exit 0 - done + fi - #Device Specific: - # - RPi - if (( $G_HW_MODEL < 10 )); then + fi - G_CONFIG_INJECT 'enable_uart=' 'enable_uart=1' /DietPi/config.txt + G_DIETPI-NOTIFY 2 "Enabling serial-getty on: /dev/$INPUT_ADDITIONAL" + G_RUN_CMD systemctl unmask serial-getty@$INPUT_ADDITIONAL + G_RUN_CMD systemctl enable serial-getty@$INPUT_ADDITIONAL + # - Start now if device (already) exists + [[ -e /dev/$INPUT_ADDITIONAL ]] && G_RUN_CMD systemctl start serial-getty@$INPUT_ADDITIONAL - # - Odroid C1 - elif (( $G_HW_MODEL == 10 )); then + # Allow root login on selected TTY if not enabled by default + G_CONFIG_INJECT "$INPUT_ADDITIONAL" "$INPUT_ADDITIONAL" /etc/securetty - sed -i '/^setenv condev/c\setenv condev "console=tty0 console=ttyS0,115200n8"' /DietPi/boot.ini + # Enable boot messages depending on device + # - RPi + if (( $G_HW_MODEL < 10 )); then - # - Odroid XU4 - elif (( $G_HW_MODEL == 11 )); then + grep -q "console=$INPUT_ADDITIONAL" /boot/cmdline.txt || sed -i "/root=/s/$/ console=$INPUT_ADDITIONAL,115200/" /boot/cmdline.txt - if ! grep -qi 'console=ttySAC2,115200n8 ' /DietPi/boot.ini; then + # - Odroid C2 + elif (( $G_HW_MODEL == 12 || + ( $G_HW_MODEL == 10 && $G_DISTRO == 3 ) )); then #REMOVE v6.24 - sed -i 's/console=tty1 /console=tty1 console=ttySAC2,115200n8 /' /DietPi/boot.ini + local old='' + [[ -f /DietPi/boot.ini ]] && old=$(grep -m1 '^setenv condev "' /DietPi/boot.ini) || return + [[ $old =~ console=$INPUT_ADDITIONAL ]] && return + old=$(cut -d \" -f 2 <<< "$old") + G_CONFIG_INJECT 'setenv condev "' "setenv condev \"$old console=$INPUT_ADDITIONAL,115200n8\"" /DietPi/boot.ini - fi + # - Odroid XU4 + elif (( $G_HW_MODEL == 11 )); then - # - Odroid C2 - elif (( $G_HW_MODEL == 12 )); then + local old='' + [[ -f /DietPi/boot.ini ]] && old=$(grep -m1 '^setenv bootrootfs "' /DietPi/boot.ini) || return + [[ $old =~ console=$INPUT_ADDITIONAL ]] && return + old=$(cut -d \" -f 2 <<< "$old") + G_CONFIG_INJECT 'setenv bootrootfs "' "setenv bootrootfs \"$old console=$INPUT_ADDITIONAL,115200n8\"" /DietPi/boot.ini + + # - ARMbian: armbianEnv.txt only allows to toggle a fixed serial console depending on device + elif (( $ARMBIAN )); then + + grep -q "console=$INPUT_ADDITIONAL" /boot/boot.cmd || return + if grep -qE 'console=(display|both)' $FP_UENV; then - sed -i '/^setenv condev/c\setenv condev "console=tty0 console=ttyS0,115200n8"' /DietPi/boot.ini + G_CONFIG_INJECT 'console=' 'console=both' $FP_UENV - # - Pine A64 - elif (( $G_HW_MODEL == 40 )); then + else - if ! grep -qi 'console=ttyS0,115200n8 ' /DietPi/uEnv.txt; then + G_CONFIG_INJECT 'console=' 'console=serial' $FP_UENV + + fi - sed -i 's/console=tty0 /console=tty0 console=ttyS0,115200n8 /' /DietPi/uEnv.txt + # - Pine A64: On ARMbian ttyS0 boot output is forced and custom console is not possible via armbianEnv.txt + elif (( $G_HW_MODEL == 40 )); then + + [[ ! -f $FP_UENV ]] || grep -q "console=$INPUT_ADDITIONAL" $FP_UENV && return + echo "console=$INPUT_ADDITIONAL,115200n8" >> $FP_UENV + + #elif (( $G_HW_MODEL == 70 )); then + + # grep -q "console=$INPUT_ADDITIONAL" $FP_UENV || sed -i "/bootargs=/s/$/ console=$INPUT_ADDITIONAL,115200n8/" $FP_UENV fi - fi + # Enable for all detected Serial/UART devices + else + + # ttyFIQ[0-9]: https://github.com/MichaIng/DietPi/issues/1829#issuecomment-398302497 + for i in /dev/tty{S,AMA,SAC}[0-9] + do + + [[ -e $i ]] || continue + INPUT_ADDITIONAL=${i/\/dev\/} Serial_Main + + done + + # On RPi enable primary UART device + (( $G_HW_MODEL < 10 )) && G_CONFIG_INJECT 'enable_uart=' 'enable_uart=1' $FP_RPI_CONFIG - # - Update dietpi.txt global var - G_CONFIG_INJECT 'CONFIG_SERIAL_CONSOLE_ENABLE=' 'CONFIG_SERIAL_CONSOLE_ENABLE=1' /DietPi/dietpi.txt + # Update dietpi.txt global var + G_CONFIG_INJECT 'CONFIG_SERIAL_CONSOLE_ENABLE=' 'CONFIG_SERIAL_CONSOLE_ENABLE=1' /DietPi/dietpi.txt + fi #------------------------------------------------------------------------------------- - #Disable + # Disable elif [[ $INPUT_DEVICE_VALUE == 'disable' ]]; then - #Disable services. Although, this seems to have no effect on the cmdline.txt boot.ini etc serial console entries. They run regardless. But lets do it for consistency. - G_DIETPI-NOTIFY 2 'Disabling known serial-getty services, please wait...' - systemctl disable serial-getty@tty 2> /dev/null - systemctl mask serial-getty@tty 2> /dev/null - for ((i=0; i<=$MAX_SERIAL_CONSOLES; i++)) - do + # Disable for specific Serial/UART device + if [[ $INPUT_ADDITIONAL ]]; then - # Disable first, to remove symlink from /etc/systemd/system/getty.target.wants/ - systemctl disable serial-getty@ttyAMA$i 2> /dev/null - systemctl disable serial-getty@ttySAC$i 2> /dev/null - systemctl disable serial-getty@ttyS$i 2> /dev/null - #systemctl disable serial-getty@ttyFIQ$i 2> /dev/null #:https://github.com/MichaIng/DietPi/issues/1829#issuecomment-398302497 + G_DIETPI-NOTIFY 2 "Disabling serial-getty on: /dev/$INPUT_ADDITIONAL" + systemctl stop serial-getty@$INPUT_ADDITIONAL + systemctl disable serial-getty@$INPUT_ADDITIONAL + # - Place a mask only if device exists + [[ -e /dev/$INPUT_ADDITIONAL ]] && systemctl mask serial-getty@$INPUT_ADDITIONAL - systemctl mask serial-getty@ttyAMA$i 2> /dev/null - systemctl mask serial-getty@ttySAC$i 2> /dev/null - systemctl mask serial-getty@ttyS$i 2> /dev/null - #systemctl mask serial-getty@ttyFIQ$i 2> /dev/null #:https://github.com/MichaIng/DietPi/issues/1829#issuecomment-398302497 + # Disable boot messages depending on device + # - RPi + if (( $G_HW_MODEL < 10 )); then - done + sed -i "s/[[:blank:]]*console=$INPUT_ADDITIONAL[^\"[:blank:]]*//" /boot/cmdline.txt - #Device Specific: - # - RPi - if (( $G_HW_MODEL < 10 )); then + # - Odroid C1/C2/XU4 + elif (( $G_HW_MODEL < 12 )); then - sed -i 's/console=ttyAMA0,115200 //' /boot/cmdline.txt #Replaced by enable_uart= + sed -i "s/[[:blank:]]*console=$INPUT_ADDITIONAL[^\"[:blank:]]*//" /DietPi/boot.ini - G_CONFIG_INJECT 'enable_uart=' 'enable_uart=0' /DietPi/config.txt + elif (( $ARMBIAN )); then - # - Odroid C1/C2 - elif (( $G_HW_MODEL == 10 || $G_HW_MODEL == 12 )); then + grep -q "console=$INPUT_ADDITIONAL" /boot/boot.cmd || return + if grep -qE 'console=(display|both)' $FP_UENV; then - G_CONFIG_INJECT 'setenv condev' 'setenv condev "console=tty0"' /DietPi/boot.ini + G_CONFIG_INJECT 'console=' 'console=display' $FP_UENV - # - Odroid XU4 - elif (( $G_HW_MODEL == 11 )); then + else - sed -i 's/console=ttySAC2,115200n8 //' /DietPi/boot.ini + G_CONFIG_INJECT 'console=' 'console=none' $FP_UENV - # - Pine A64 - elif (( $G_HW_MODEL == 40 )); then + fi - sed -i 's/console=ttyS0,115200n8 //' /DietPi/uEnv.txt + # - Pine A64: On ARMbian ttyS0 boot output is forced and custom console is not possible via armbianEnv.txt + elif (( $G_HW_MODEL == 40 )); then - fi + sed -i "/^[[:blank:]]*console=$INPUT_ADDITIONAL[^\"[:blank:]]*$/d" $FP_UENV # New style: One variable each line + sed -i "s/[[:blank:]]*console=$INPUT_ADDITIONAL[^\"[:blank:]]*//" $FP_UENV # Old style: Multiple variables possible each line + + #elif (( $G_HW_MODEL == 70 )); then + + # sed -i "s/[[:blank:]]*console=$INPUT_ADDITIONAL[^\"[:blank:]]*//" $FP_UENV + + fi + + # Disable for all detected Serial/UART devices + else + + # ttyFIQ[0-9]: https://github.com/MichaIng/DietPi/issues/1829#issuecomment-398302497 + for i in /dev/tty{S,AMA,SAC}[0-9] + do + + [[ -e $i ]] || continue + INPUT_ADDITIONAL=${i/\/dev\/} Serial_Main - # - Update dietpi.txt global var - G_CONFIG_INJECT 'CONFIG_SERIAL_CONSOLE_ENABLE=' 'CONFIG_SERIAL_CONSOLE_ENABLE=0' /DietPi/dietpi.txt + done + + # On RPi disable primary UART device + (( $G_HW_MODEL < 10 )) && G_CONFIG_INJECT 'enable_uart=' 'enable_uart=0' $FP_RPI_CONFIG + + # Update dietpi.txt global var + G_CONFIG_INJECT 'CONFIG_SERIAL_CONSOLE_ENABLE=' 'CONFIG_SERIAL_CONSOLE_ENABLE=0' /DietPi/dietpi.txt + + fi else @@ -1545,32 +1658,28 @@ _EOF_ #///////////////////////////////////////////////////////////////////////////////////// # soundcard #///////////////////////////////////////////////////////////////////////////////////// - #NB: When adding a new dtoverlay soundcard, we must add the dtoverlay name for deletion in Soundcard_Reset_RPi() + # NB: When adding a new dtoverlay soundcard, we must add the dtoverlay name for deletion in Soundcard_Reset_RPi() SOUNDCARD_TARGET_CARD=0 SOUNDCARD_TARGET_DEVICE=0 ALSA_EQ_ENABLED=0 - #Disable all soundcards and revert back to default output if available. + # Disable all soundcards and revert back to default output if available. Soundcard_Reset_All(){ SOUNDCARD_TARGET_CARD=0 SOUNDCARD_TARGET_DEVICE=0 ALSA_EQ_ENABLED=0 - #Remove previous asound.conf + # Remove previous asound.conf [[ -f /etc/asound.conf ]] && rm /etc/asound.conf # - Pre-Reqs for any soundcard G_AG_CHECK_INSTALL_PREREQ alsa-utils # Intel sound firmware - if grep -qi 'vendor_id.*intel' /proc/cpuinfo; then - - G_AG_CHECK_INSTALL_PREREQ firmware-intel-sound + grep -qi 'vendor_id.*intel' /proc/cpuinfo && G_AG_CHECK_INSTALL_PREREQ firmware-intel-sound - fi - - #HW specific + # HW specific # - RPi if (( $G_HW_MODEL < 10 )); then @@ -1640,8 +1749,10 @@ _EOF_ # - Disable forced analogue out if [[ -f /etc/systemd/system/rpi-bcm2835_forced_3.5mm.service ]]; then + systemctl stop rpi-bcm2835_forced_3.5mm systemctl disable rpi-bcm2835_forced_3.5mm rm /etc/systemd/system/rpi-bcm2835_forced_3.5mm.service + systemctl daemon-reload fi @@ -1654,19 +1765,21 @@ _EOF_ [[ -f /var/lib/dietpi/postboot.d/c2_smp.sh ]] && rm /var/lib/dietpi/postboot.d/c2_smp.sh - # - hifi shield plus + # - HiFi shield plus sed -i '/^[[:blank:]]*snd-soc-pcm5102/d' /etc/modules sed -i '/^[[:blank:]]*snd-soc-odroid-dac/d' /etc/modules - # - hifi shield 2 + # - HiFi shield 2 sed -i '/^[[:blank:]]*snd-soc-pcm512x/d' /etc/modules sed -i '/^[[:blank:]]*snd-soc-pcm512x-i2c/d' /etc/modules sed -i '/^[[:blank:]]*snd-soc-odroid-dac2/d' /etc/modules if [[ -f '/etc/systemd/system/odroid-hifishield2.service' ]]; then + systemctl stop odroid-hifishield2 systemctl disable odroid-hifishield2 rm /etc/systemd/system/odroid-hifishield2.service + systemctl daemon-reload fi @@ -1674,23 +1787,22 @@ _EOF_ Soundcard_Reset_H2(){ - #set 3.5mm + # Set 3.5mm amixer set -c 0 'Audio lineout' unmute &> /dev/null } Soundcard_Reset_H3(){ - #set hdmi + # Set HDMI amixer set -c 0 'Audio lineout' mute &> /dev/null - SOUNDCARD_TARGET_CARD=1 } Soundcard_Reset_Asus(){ - #set hdmi + # Set HDMI SOUNDCARD_TARGET_CARD=1 } @@ -1699,21 +1811,21 @@ _EOF_ sed -i '/^[[:blank:]]*snd-soc-allo-piano-dac/d' /etc/modules - # - HDMI + # Set HDMI SOUNDCARD_TARGET_DEVICE=1 amixer -c 0 sset 'audio output mode switch' 'hdmi' # Disable USB 1.1 compat - sed -i 's/aotg.aotg1_speed=1/aotg.aotg1_speed=0/' /DietPi/uEnv.txt + sed -i 's/aotg.aotg1_speed=1/aotg.aotg1_speed=0/' $FP_UENV - # - auto unmute + # Auto unmute [[ -f /var/lib/dietpi/postboot.d/sparky_unmute.sh ]] && rm /var/lib/dietpi/postboot.d/sparky_unmute.sh } Soundcard_Reset_BPi_Pro(){ - #3.5mm: https://github.com/MichaIng/DietPi/issues/732#issuecomment-275915919 + # Set 3.5mm: https://github.com/MichaIng/DietPi/issues/732#issuecomment-275915919 SOUNDCARD_TARGET_CARD=0 amixer sset 'Left Mixer Left DAC' off @@ -1729,10 +1841,10 @@ _EOF_ Soundcard_Main(){ #----------------------------------------------------------------------------- - #Always reset soundcards and revert back to HDMI + # Always reset soundcards and revert back to HDMI Soundcard_Reset_All #----------------------------------------------------------------------------- - #Apply specific asound.confs and additional settings + # Apply specific asound.confs and additional settings # - ALSA EQ enabled? if [[ $INPUT_DEVICE_VALUE == *'-eq' ]]; then @@ -1750,12 +1862,12 @@ _EOF_ # - RPi: Enable DTPARAM audio setting (( $G_HW_MODEL < 10 )) && G_CONFIG_INJECT 'dtparam=audio=' 'dtparam=audio=on' $FP_RPI_CONFIG - #Cards + # Cards case "$INPUT_DEVICE_VALUE" in - #ALL: ---------------------------------------------------------------------- + # ALL: ---------------------------------------------------------------------- - #Specify card + device indexs + # Specify card + device indexs hw:*) echo "$INPUT_DEVICE_VALUE" @@ -1779,7 +1891,7 @@ _EOF_ # USB 1.1 compat mode (Sparky currently) if [[ $INPUT_DEVICE_VALUE == 'usb-dac-1.1' ]]; then - sed -i 's/aotg.aotg1_speed=0/aotg.aotg1_speed=1/' /DietPi/uEnv.txt + sed -i 's/aotg.aotg1_speed=0/aotg.aotg1_speed=1/' $FP_UENV fi @@ -1788,7 +1900,7 @@ _EOF_ for x in \$(amixer controls | grep layback) do - amixer cset "\$x" 100% &> /dev/null + amixer cset "\$x" 100% &> /dev/null done alsactl store &> /dev/null @@ -1798,7 +1910,7 @@ _EOF_ elif (( $G_HW_MODEL == 12 )); then cat << _EOF_ > /var/lib/dietpi/postboot.d/c2_smp.sh -#!/bin/bash +#!/bin/dash echo 4 > /proc/irq/63/smp_affinity echo 8 > /proc/irq/62/smp_affinity _EOF_ @@ -1820,7 +1932,7 @@ _EOF_ ;; - #RPi (dtoverlay) + # RPi (dtoverlay) # rpi-bcm2835 # rpi-bcm2835-ultrahq # rpi-bcm2835-3.5mm @@ -1837,12 +1949,11 @@ _EOF_ [Unit] Description=Forces sound through 3.5mm analogue Before=sound.target -After=dietpi-boot.service dietpi-ramdisk.service dietpi-ramlog.service +After=dietpi-boot.service [Service] Type=simple RemainAfterExit=yes - ExecStart=/usr/bin/amixer -c 0 cset numid=3 1 [Install] @@ -1856,7 +1967,7 @@ _EOF_ ;; - #RPi (dtoverlay) + # RPi (dtoverlay) # hifiberry-dac # hifiberry-dacplus # hifiberry-digi @@ -1869,7 +1980,7 @@ _EOF_ ;; - #RPi (dtoverlay) + # RPi (dtoverlay) # googlevoicehat-soundcard googlevoicehat-soundcard*) @@ -1882,7 +1993,7 @@ _EOF_ ;; - #RPi (dtoverlay) + # RPi (dtoverlay) # JustBoom-dac: DAC HAT, Amp HAT, DAC Zero and Amp Zero # JustBoom-digi: Digi HAT and Digi Zero justboom-*) @@ -1892,7 +2003,7 @@ _EOF_ ;; - #RPi (dtoverlay) + # RPi (dtoverlay) # allo-piano-dac-pcm512x-audio # allo-piano-dac-plus-pcm512x-audio (2.1) allo-piano-dac*) @@ -1913,7 +2024,7 @@ _EOF_ ;; - #Sparky SBC (module) + # Sparky SBC (module) # snd-soc-allo-piano-dac # snd-soc-allo-piano-dac-plus (2.1) snd-soc-allo-piano-dac*) @@ -1936,7 +2047,7 @@ _EOF_ ;; - #Sparky SBC + # Sparky SBC # allo-cheapo-analogue #3.5mm/RCA # allo-cheapo-optical #Optical out allo-cheapo*) @@ -1960,7 +2071,7 @@ _EOF_ ;; - #RPi (dtoverlay) + # RPi (dtoverlay) # allo-boss-dac-pcm512x-audio # allo-digione # allo-katana-dac-audio @@ -1980,7 +2091,7 @@ _EOF_ ;; - #RPi (dtoverlay) + # RPi (dtoverlay) # rpi-dac rpi-dac) @@ -1989,7 +2100,7 @@ _EOF_ ;; - #AudioPhonics I-Sabre-K2M (dtoverlay) + # AudioPhonics I-Sabre-K2M (dtoverlay) # i-sabre-k2m i-sabre-k2m) @@ -2047,7 +2158,7 @@ NB: The module must be rebuilt each time the kernel is upgraded. For this, simpl ;; - #RPi (dtoverlay) + # RPi (dtoverlay) # applepi-dac applepi*) @@ -2063,8 +2174,8 @@ NB: The module must be rebuilt each time the kernel is upgraded. For this, simpl ;; - #dionaudio-loco - #dionaudio-loco-v2 + # dionaudio-loco + # dionaudio-loco-v2 dionaudio-loco*) # - enable dtoverlay @@ -2072,7 +2183,7 @@ NB: The module must be rebuilt each time the kernel is upgraded. For this, simpl ;; - #Odroid ------------------------------------------------------------------------------- + # Odroid ------------------------------------------------------------------------------- odroid-hifishield-plus) G_CONFIG_INJECT 'snd-soc-pcm5102' 'snd-soc-pcm5102' /etc/modules @@ -2099,8 +2210,7 @@ After=local-fs.target [Service] Type=oneshot RemainAfterExit=yes - -ExecStart=/bin/bash -c 'echo pcm5242 0x4c > /sys/class/i2c-adapter/i2c-1/new_device' +ExecStart=/bin/dash -c 'echo pcm5242 0x4c > /sys/class/i2c-adapter/i2c-1/new_device' ExecStart=$(command -v amixer) -c 1 sset Analogue 0 ExecStart=$(command -v amixer) -c 1 sset Digital 201 ExecStart=$(command -v amixer) -c 1 sset Deemphasis on @@ -2113,7 +2223,7 @@ _EOF_ ;; - #H2 ------------------------------------------------------------------------------- + # H2 ------------------------------------------------------------------------------- h2-hdmi) amixer set -c 0 'Audio lineout' mute &> /dev/null @@ -2121,7 +2231,7 @@ _EOF_ ;; - #H3 ------------------------------------------------------------------------------- + # H3 ------------------------------------------------------------------------------- h3-analogue) amixer set -c 0 'Audio lineout' unmute &> /dev/null @@ -2129,7 +2239,7 @@ _EOF_ ;; - #Pine A64 ------------------------------------------------------------------------------- + # Pine A64 ------------------------------------------------------------------------------- pine64-analogue) cat << _EOF_ > /etc/modules-load.d/pine64-audiojack.conf @@ -2142,14 +2252,14 @@ _EOF_ ;; - #NanoPi M2/M3 ------------------------------------------------------------------------------- + # NanoPi M2/M3 ------------------------------------------------------------------------------- s5pxx18-hdmi) SOUNDCARD_TARGET_CARD=1 ;; - #Asus tinker ------------------------------------------------------------------------------- + # Asus tinker ------------------------------------------------------------------------------- asus-tb-analogue) SOUNDCARD_TARGET_CARD=0 @@ -2164,32 +2274,32 @@ _EOF_ cat << _EOF_ > /etc/asound.conf pcm.softvol { - type softvol - slave.pcm dmix - control { - name Master - card 0 - } + type softvol + slave.pcm dmix + control { + name Master + card 0 + } } pcm.micboost { - type route - slave.pcm dsnoop - ttable { - 0.0 30.0 - 1.1 30.0 - } + type route + slave.pcm dsnoop + ttable { + 0.0 30.0 + 1.1 30.0 + } } pcm.!default { - type asym - playback.pcm "plug:softvol" - capture.pcm "plug:micboost" + type asym + playback.pcm "plug:softvol" + capture.pcm "plug:micboost" } ctl.!default { - type hw - card 0 + type hw + card 0 } _EOF_ @@ -2197,25 +2307,25 @@ _EOF_ cat << _EOF_ > /etc/asound.conf ctl.eq { - type equal - controls "$HOME/.alsaequal.bin" + type equal + controls "/root/.alsaequal.bin" } pcm.plugequal { - type equal - slave.pcm "plughw:$SOUNDCARD_TARGET_CARD,$SOUNDCARD_TARGET_DEVICE" - controls "$HOME/.alsaequal.bin" + type equal + slave.pcm "plughw:$SOUNDCARD_TARGET_CARD,$SOUNDCARD_TARGET_DEVICE" + controls "/root/.alsaequal.bin" } pcm.!default { - type plug - slave.pcm plugequal - slave.channels 2 + type plug + slave.pcm plugequal + slave.channels 2 } ctl.!default { - type hw - card $SOUNDCARD_TARGET_CARD + type hw + card $SOUNDCARD_TARGET_CARD } _EOF_ @@ -2225,13 +2335,13 @@ _EOF_ cat << _EOF_ > /etc/asound.conf pcm.!default { - type hw - card $SOUNDCARD_TARGET_CARD - device $SOUNDCARD_TARGET_DEVICE + type hw + card $SOUNDCARD_TARGET_CARD + device $SOUNDCARD_TARGET_DEVICE } ctl.!default { - type hw - card $SOUNDCARD_TARGET_CARD + type hw + card $SOUNDCARD_TARGET_CARD } _EOF_ @@ -2239,13 +2349,11 @@ _EOF_ } - #///////////////////////////////////////////////////////////////////////////////////// # Main Loop #///////////////////////////////////////////////////////////////////////////////////// #----------------------------------------------------------------------------------- - #info - + # info G_DIETPI-NOTIFY 3 "$G_PROGRAM_NAME" "$INPUT_DEVICE_NAME ($INPUT_DEVICE_VALUE)" #----------------------------------------------------------------------------------- diff --git a/dietpi/func/dietpi-set_software b/dietpi/func/dietpi-set_software index b409c056a7..36754e3c8e 100644 --- a/dietpi/func/dietpi-set_software +++ b/dietpi/func/dietpi-set_software @@ -10,7 +10,6 @@ #//////////////////////////////////// # # Usage: - # FP_SCRIPT='/DietPi/dietpi/func/dietpi-set_software' AVAIABLE_COMMANDS=" Available commands: @@ -23,10 +22,9 @@ $FP_SCRIPT ntpd-mode [0-4] configures time sync mode (eg: daily/hourly/daemon) $FP_SCRIPT verify_dietpi.txt Verifies dietpi.txt entries, adds missing entries if required $FP_SCRIPT passwords NULL=Prompt user to change DietPi related passwords | X=optional set X as global password for future dietpi-software installations and \"root\" + \"dietpi\" login passwords. $FP_SCRIPT setpermissions Applies required filesystem permissions to DietPi specific content, and, DietPi userdata directory for software installs -" - #//////////////////////////////////// +" #//////////////////////////////////// - #Grab inputs + # Grab inputs INPUT_MODE_NAME=$1 INPUT_MODE_VALUE=$2 @@ -35,13 +33,13 @@ $FP_SCRIPT setpermissions Applies required filesystem permissions to DietPi spe INPUT_ADDITIONAL_3=$5 INPUT_ADDITIONAL_4=$6 - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals -------------------------------------------------------------- . /DietPi/dietpi/func/dietpi-globals G_PROGRAM_NAME='DietPi-Set_software' G_CHECK_ROOT_USER G_CHECK_ROOTFS_RW G_INIT - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals -------------------------------------------------------------- EXIT_CODE=0 @@ -100,14 +98,19 @@ $FP_SCRIPT setpermissions Applies required filesystem permissions to DietPi spe } #///////////////////////////////////////////////////////////////////////////////////// - # Set Apt Mirror + # Set APT Mirror #///////////////////////////////////////////////////////////////////////////////////// AptMirror_Main(){ if [[ $INPUT_MODE_VALUE ]]; then - # - Set defaults? - if [[ $INPUT_MODE_VALUE == 'default' ]]; then + # Jessie ARMv8: https://github.com/MichaIng/DietPi/issues/2665#issuecomment-477348864 + if (( $G_HW_ARCH == 3 && $G_DISTRO < 4 )); then + + INPUT_MODE_VALUE='http://archive.debian.org/debian/' + + # Set defaults? + elif [[ $INPUT_MODE_VALUE == 'default' ]]; then if (( $G_HW_MODEL < 10 )); then @@ -121,17 +124,16 @@ $FP_SCRIPT setpermissions Applies required filesystem permissions to DietPi spe fi - # - Set raspbian + # Set Raspbian if (( $G_HW_MODEL < 10 )); then echo "deb $INPUT_MODE_VALUE $G_DISTRO_NAME main contrib non-free rpi" > /etc/apt/sources.list - echo "deb https://archive.raspberrypi.org/debian/ $G_DISTRO_NAME main ui" > /etc/apt/sources.list.d/raspi.list - # Update dietpi.txt entry + # - Update dietpi.txt entry G_CONFIG_INJECT 'CONFIG_APT_RASPBIAN_MIRROR=' "CONFIG_APT_RASPBIAN_MIRROR=$INPUT_MODE_VALUE" /DietPi/dietpi.txt - # - Set debian + # Set Debian else cat << _EOF_ > /etc/apt/sources.list @@ -141,22 +143,24 @@ deb https://deb.debian.org/debian-security/ $G_DISTRO_NAME/updates main contrib deb $INPUT_MODE_VALUE $G_DISTRO_NAME-backports main contrib non-free _EOF_ - # Jessie, switch deb.debian.org to http: https://github.com/MichaIng/DietPi/issues/1285#issuecomment-351830101 + # - Jessie: https://github.com/MichaIng/DietPi/issues/2665#issuecomment-477348864 if (( $G_DISTRO < 4 )); then - sed -i 's/https:/http:/g' /etc/apt/sources.list - - # - ARM64 packages no longer available: https://github.com/MichaIng/DietPi/issues/1915 + # - Jessie APT reports warning on httpS://deb.debian.org + sed -i 's|https://deb.debian.org|http://deb.debian.org|g' /etc/apt/sources.list + # - backports and updates have been dropped + sed -Ei '/jessie-(backports|updates)/d' /etc/apt/sources.list + # - ARMv8 has been dropped from security repo (( $G_HW_ARCH == 3 )) && sed -i '/debian-security/d' /etc/apt/sources.list - # Buster, remove backports: https://github.com/MichaIng/DietPi/issues/1285#issuecomment-351830101 + # - Buster, remove backports: https://github.com/MichaIng/DietPi/issues/1285#issuecomment-351830101 elif (( $G_DISTRO > 4 )); then sed -i '/backports/d' /etc/apt/sources.list fi - # Update dietpi.txt entry + # - Update dietpi.txt entry G_CONFIG_INJECT 'CONFIG_APT_DEBIAN_MIRROR=' "CONFIG_APT_DEBIAN_MIRROR=$INPUT_MODE_VALUE" /DietPi/dietpi.txt fi @@ -187,12 +191,12 @@ _EOF_ local ntp_mirror_entry='Servers='$ntp_mirror # - Default, lets timesyncd use DHCP server (Stretch+ only) or fallback to debian.pool.ntp.org. - if [[ ${ntp_mirror,,} == default ]]; then + if [[ ${ntp_mirror,,} == 'default' ]]; then ntp_mirror_entry='#Servers=0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org 3.debian.pool.ntp.org' # - Gateway, auto detect local gateway(s) (router) to use as NTP server. - elif [[ ${ntp_mirror,,} == gateway ]]; then + elif [[ ${ntp_mirror,,} == 'gateway' ]]; then # NB: Turn output output into single line string via echo local gateway=$(echo $(ip r | mawk '/^default/ {print $3}')) @@ -264,7 +268,7 @@ _EOF_ } #///////////////////////////////////////////////////////////////////////////////////// - # allo + # Allo #///////////////////////////////////////////////////////////////////////////////////// Allo_Main(){ @@ -322,9 +326,9 @@ _EOF_ chmod +x /root/Desktop/* # - O!MPD, requires write permissions - chmod -R 777 /var/www/ompd/tmp #(required for database update) - chmod -R 777 /var/www/ompd/stream #(required for streaming files) - chmod -R 777 /var/www/ompd/cache #(required for downloading files) + chmod -R 777 /var/www/ompd/tmp # Required for database update + chmod -R 777 /var/www/ompd/stream # Required for streaming files + chmod -R 777 /var/www/ompd/cache # Required for downloading files # - MPD chmod 0664 /var/log/mpd/mpd.log /etc/mpd.conf @@ -395,7 +399,7 @@ _EOF_ # - sickrage # pre-v6.20 compatibility [[ -d $G_FP_DIETPI_USERDATA/sickrage ]] && chown -R sickrage:dietpi $G_FP_DIETPI_USERDATA/sickrage - [[ -f /var/log/sickrage.log ]] && chown sickrage:dietpi /var/log/sickrage.log + [[ -f '/var/log/sickrage.log' ]] && chown sickrage:dietpi /var/log/sickrage.log # - Medusa chown -R medusa:dietpi $G_FP_DIETPI_USERDATA/medusa @@ -448,14 +452,15 @@ _EOF_ chown -R fahclient:dietpi $G_FP_DIETPI_USERDATA/fahclient /var/log/fahclient.log # - Sabnzbd - chown -R sabnzbd:dietpi /etc/sabnzbd /var/log/sabnzbd + chown -R sabnzbd:sabnzbd /etc/sabnzbd /var/log/sabnzbd $G_FP_DIETPI_USERDATA/downloads/sabnzbd* + chown -R sabnzbd:dietpi $G_FP_DIETPI_USERDATA/downloads/{,in}complete # - Blynk - chown -R blynk:dietpi $G_FP_DIETPI_USERDATA/blynk + chown -R blynk:dietpi $G_FP_DIETPI_USERDATA/blynk /var/log/blynk # - Pi-hole # - NB: Git requies special permissions to allow "pihole -up". - if [[ -d /var/www/html/pihole ]]; then + if [[ -d '/var/www/html/pihole' ]]; then cd /var/www/html/admin && git reset --hard HEAD cd /tmp/$G_PROGRAM_NAME @@ -474,22 +479,20 @@ _EOF_ mkdir -p /home useradd -m -s /bin/bash "$INPUT_MODE_VALUE" -p "$(grep -m1 '^[[:blank:]]*AUTO_SETUP_GLOBAL_PASSWORD=' /DietPi/dietpi.txt | sed 's/^[^=]*=//')" - # Copy existing profile/bashrc + # Copy existing profile/bashrc cp /root/.profile /home/"$INPUT_MODE_VALUE"/ cp /root/.bashrc /home/"$INPUT_MODE_VALUE"/ chown -R "$INPUT_MODE_VALUE":"$INPUT_MODE_VALUE" /home/"$INPUT_MODE_VALUE" - # Allow sudo without pw + # Allow sudo without pw if ! grep -q "^$INPUT_MODE_VALUE[[:space:]]" /etc/sudoers.d/dietpi; then - cat << _EOF_ >> /etc/sudoers.d/dietpi -$INPUT_MODE_VALUE ALL=NOPASSWD: ALL -_EOF_ + echo "$INPUT_MODE_VALUE ALL=NOPASSWD: ALL" >> /etc/sudoers.d/dietpi fi - # Same groups as user pi + # Same groups as user pi local group_array=() group_array+=('input') group_array+=('netdev') @@ -507,13 +510,13 @@ _EOF_ group_array+=('dialout') group_array+=('adm') - # + allow access to www-data + # Allow access to www-data group_array+=('www-data') - for ((i=0; i<${#group_array[@]}; i++)) + for i in ${group_array[@]} do - usermod -a -G "${group_array[$i]}" "$INPUT_MODE_VALUE" + usermod -a -G $i "$INPUT_MODE_VALUE" done @@ -531,12 +534,11 @@ _EOF_ if [[ $INPUT_MODE_VALUE ]]; then - # - Delete $INPUT_MODE_VALUE - userdel -f "$INPUT_MODE_VALUE" - rm -R "/home/$INPUT_MODE_VALUE" + # Delete $INPUT_MODE_VALUE + userdel -rf "$INPUT_MODE_VALUE" - # - Remove from sudoers - sed -i "/^$INPUT_MODE_VALUE[[:space:]]/d" /etc/sudoers.d/dietpi + # Remove from sudoers + sed -i "/^$INPUT_MODE_VALUE[[:blank:]]/d" /etc/sudoers.d/dietpi else @@ -553,8 +555,7 @@ _EOF_ [[ $gitbranch ]] || gitbranch='master' INSTALL_URL="https://raw.githubusercontent.com/MichaIng/DietPi/$gitbranch/dietpi.txt" - G_CHECK_URL "$INSTALL_URL" - if (( ! $? )); then + if G_CHECK_URL "$INSTALL_URL"; then G_DIETPI-NOTIFY 0 'Patching dietpi.txt' l_message='Downloading current dietpi.txt' G_RUN_CMD wget "$INSTALL_URL" -O /tmp/dietpi.txt_patch @@ -603,16 +604,16 @@ _EOF_ local pw_dietpi_software='' local pw_root_dietpi_users='' - #Automation/input mode, set and then apply input password to both dietpi-software and root/dietpi user passwords. + # Automation/input mode, set and then apply input password to both dietpi-software and root/dietpi user passwords. if [[ $INPUT_MODE_VALUE ]]; then pw_dietpi_software=$INPUT_MODE_VALUE pw_root_dietpi_users=$INPUT_MODE_VALUE - #Prompt to change + # Prompt to change else - #DietPi-Software PW + # DietPi-Software PW G_WHIP_YESNO 'Do you want to adjust the default global password for DietPi-Software installations and new unix users? We especially recommend to change the default password "dietpi". This does not affect any existing unix user login.\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 adjust all passwords for web services and new unix users independently afterwards.' if (( ! $? )); then @@ -623,7 +624,7 @@ NB: This password will be saved and encrypted within /var/lib/dietpi/dietpi-soft fi - #Root/DietPi user PW + # Root/DietPi user PW G_WHIP_YESNO 'Change 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 DietPi-Software password.\n\nWould you like to change the login passwords for "root" and "dietpi"?' if (( ! $? )); then @@ -636,7 +637,7 @@ It is highly recommended to change this password, ideally, it should be differen fi - #Apply | dietpi-software PW + # Apply | dietpi-software PW if [[ $pw_dietpi_software ]]; then # - Nullify automated PW @@ -655,7 +656,7 @@ It is highly recommended to change this password, ideally, it should be differen fi - #Apply | Root/DietPi users PW + # Apply | Root/DietPi users PW if [[ $pw_root_dietpi_users ]]; then chpasswd <<< "root:$pw_root_dietpi_users" @@ -670,8 +671,7 @@ It is highly recommended to change this password, ideally, it should be differen # Main Loop #///////////////////////////////////////////////////////////////////////////////////// #----------------------------------------------------------------------------------- - #info - + # Info G_DIETPI-NOTIFY 3 "$G_PROGRAM_NAME" "$INPUT_MODE_NAME ($INPUT_MODE_VALUE)" #----------------------------------------------------------------------------------- diff --git a/dietpi/func/dietpi-set_dphys-swapfile b/dietpi/func/dietpi-set_swapfile similarity index 52% rename from dietpi/func/dietpi-set_dphys-swapfile rename to dietpi/func/dietpi-set_swapfile index 778f3a8463..f6747eb501 100644 --- a/dietpi/func/dietpi-set_dphys-swapfile +++ b/dietpi/func/dietpi-set_swapfile @@ -14,38 +14,24 @@ # Usage: # - $1 = 0=disable, 1=enable+autosize, >=2=enable+size # - $2 = optional location - # - /DietPi/dietpi/func/dietpi-set_dphys-swapfile = Print current swap size and location + # - /DietPi/dietpi/func/dietpi-set_swapfile = Print current swap size and location #//////////////////////////////////// - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals -------------------------------------------------------------- . /DietPi/dietpi/func/dietpi-globals - G_PROGRAM_NAME='DietPi-Swapfile' + G_PROGRAM_NAME='DietPi-Set_swapfile' G_CHECK_ROOT_USER G_INIT - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals -------------------------------------------------------------- SWAP_SIZE=$(grep -m1 '^[[:blank:]]*AUTO_SETUP_SWAPFILE_SIZE=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') - SWAP_LOCATION="$(grep -m1 '^[[:blank:]]*AUTO_SETUP_SWAPFILE_LOCATION=' /DietPi/dietpi.txt | sed 's/^[^=]*=//')" + SWAP_LOCATION=$(grep -m1 '^[[:blank:]]*AUTO_SETUP_SWAPFILE_LOCATION=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') - SWAP_SIZE_TARGET=$SWAP_SIZE - disable_error=1 G_CHECK_VALIDINT "$1" && SWAP_SIZE_TARGET=$1 - - SWAP_LOCATION_TARGET="$SWAP_LOCATION" - [[ $2 ]] && SWAP_LOCATION_TARGET=$2 - - Delete_Swapfile(){ - - G_RUN_CMD swapoff -a - G_DIETPI-NOTIFY 2 "Deleting existing swapfile ($SWAP_LOCATION)" - [[ -f $SWAP_LOCATION ]] && rm "$SWAP_LOCATION" - sed -i '/[[:blank:]]swap[[:blank:]]/d' /etc/fstab - systemctl daemon-reload - - } + disable_error=1 G_CHECK_VALIDINT "$1" && SWAP_SIZE_TARGET=$1 || SWAP_SIZE_TARGET=$SWAP_SIZE + [[ $2 ]] && SWAP_LOCATION_TARGET=$2 || SWAP_LOCATION_TARGET=$SWAP_LOCATION Update_DietPi_Conf(){ - # DietPi.txt G_CONFIG_INJECT 'AUTO_SETUP_SWAPFILE_SIZE=' "AUTO_SETUP_SWAPFILE_SIZE=$SWAP_SIZE" /DietPi/dietpi.txt G_CONFIG_INJECT 'AUTO_SETUP_SWAPFILE_LOCATION=' "AUTO_SETUP_SWAPFILE_LOCATION=$SWAP_LOCATION" /DietPi/dietpi.txt @@ -53,17 +39,17 @@ Update_Tmp(){ - #Set /tmp to 50% of RAM+SWAP: https://github.com/MichaIng/DietPi/issues/1027#issuecomment-369373082 + # Set /tmp to 50% of RAM+SWAP: https://github.com/MichaIng/DietPi/issues/1027#issuecomment-369373082 local mem_total=$(free -m | mawk '/Mem:/ {print $2;exit}') local swap_size=$(free -m | mawk '/Swap:/ {print $2;exit}') local tmp_target_size="$(( ( $mem_total + $swap_size ) / 2 ))M" G_DIETPI-NOTIFY 2 "Setting /tmp tmpfs size: $tmp_target_size" - sed -i -e "/[[:blank:]]\/tmp[[:blank:]]/ctmpfs \/tmp tmpfs defaults,size=$tmp_target_size,noatime,nodev,nosuid,mode=1777 0 0" /etc/fstab + sed -i "/[[:blank:]]\/tmp[[:blank:]]/ctmpfs \/tmp tmpfs defaults,size=$tmp_target_size,noatime,nodev,nosuid,mode=1777 0 0" /etc/fstab systemctl daemon-reload - mount -a - G_RUN_CMD mount -o remount,size=$tmp_target_size tmpfs /tmp + mount -a # Required if /tmp was somehow not mounted before. Will be skipped if already mounted + G_RUN_CMD mount -o remount /tmp # Required to apply new settings/size. "remount" required to preserve current content, or, doubled mount } @@ -71,66 +57,67 @@ G_DIETPI-NOTIFY 0 'Disable swapfile' - Delete_Swapfile + G_RUN_CMD swapoff -a + if [[ -f $SWAP_LOCATION ]]; then + + G_DIETPI-NOTIFY 2 "Deleting existing swapfile: $SWAP_LOCATION" + rm "$SWAP_LOCATION" + + fi + sed -i '/[[:blank:]]swap[[:blank:]]/d' /etc/fstab SWAP_SIZE=0 SWAP_LOCATION='/var/swap' - Update_DietPi_Conf - Update_Tmp - } Swap_Enable(){ - # - Create temp file for freespace check, and, fs_type scrape - > "$SWAP_LOCATION_TARGET" + local swap_dir="${SWAP_LOCATION_TARGET%/*}/" + local fs_type=$(findmnt -n -o FSTYPE -T "$swap_dir") - #Free spacey, checkey weckey - if ! G_CHECK_FREESPACE "$SWAP_LOCATION_TARGET" $SWAP_SIZE_TARGET; then + # Exclude devices + # - BBB + if (( $G_HW_MODEL == 71 )); then - G_DIETPI-NOTIFY 1 'Unable to generate swapfile due to insufficient disk space. Swap has be disabled.' + G_DIETPI-NOTIFY 1 "Disabled swapfile generation for: $G_HW_MODEL_DESCRIPTION" - #Exclude devices - # - BBB - elif (( $G_HW_MODEL == 71 )); then + # Exclude file systems + elif [[ $fs_type == 'btrfs' ]]; then + + G_DIETPI-NOTIFY 1 "Swapfile not supported on file system: $fs_type" + + # Free spacey, checkey weckey + elif ! G_CHECK_FREESPACE "$swap_dir" $SWAP_SIZE_TARGET; then - G_DIETPI-NOTIFY 2 "Disabled swapfile generation for $G_HW_MODEL_DESCRIPTION" + G_DIETPI-NOTIFY 1 'Unable to generate swapfile due to insufficient disk space. Swap has been disabled.' - #Create new swappey whappey + # Create new swappey whappey else SWAP_SIZE=$SWAP_SIZE_TARGET - SWAP_LOCATION="$SWAP_LOCATION_TARGET" + SWAP_LOCATION=$SWAP_LOCATION_TARGET G_DIETPI-NOTIFY 0 'Generating new swapfile' G_DIETPI-NOTIFY 2 "Size = $SWAP_SIZE MB" G_DIETPI-NOTIFY 2 "Location = $SWAP_LOCATION" - local fs_type="$(findmnt -n -o FSTYPE -T $SWAP_LOCATION)" - - #Pre-allocate for filesystems which do no support quick-allocate with fallocate + # - Pre-allocate for filesystems which do no support quick-allocate with fallocate if [[ $fs_type == 'f2fs' || $fs_type == 'xfs' || $fs_type == 'vfat' ]]; then - G_RUN_CMD dd if=/dev/zero of=$SWAP_LOCATION bs=4K count=$(( $SWAP_SIZE * 1024 / 4 )) + G_RUN_CMD dd if=/dev/zero of="$SWAP_LOCATION" bs=4K count=$(( $SWAP_SIZE * 1024 / 4 )) else - G_RUN_CMD fallocate -l $SWAP_SIZE'M' $SWAP_LOCATION + G_RUN_CMD fallocate -l $SWAP_SIZE'M' "$SWAP_LOCATION" fi - G_RUN_CMD mkswap $SWAP_LOCATION + G_RUN_CMD mkswap "$SWAP_LOCATION" chmod 600 "$SWAP_LOCATION" + G_RUN_CMD swapon "$SWAP_LOCATION" - G_RUN_CMD swapon $SWAP_LOCATION - - cat << _EOF_ >> /etc/fstab -$SWAP_LOCATION none swap sw 0 0 -_EOF_ - - Update_DietPi_Conf - Update_Tmp + echo "$SWAP_LOCATION none swap sw 0 0" >> /etc/fstab fi @@ -139,25 +126,28 @@ _EOF_ #///////////////////////////////////////////////////////////////////////////////////// # Main Loop #///////////////////////////////////////////////////////////////////////////////////// - #Info mode - Print Size / Location + # Info mode - Print Size / Location if [[ ! $1 ]]; then - echo -e "$SWAP_SIZE $SWAP_LOCATION" + echo "$SWAP_SIZE $SWAP_LOCATION" - #Remove/Create swap + # Remove/Create swap else G_DIETPI-NOTIFY 3 "$G_PROGRAM_NAME" 'Apply' - #Always reset/remove existing swap + # - Always reset/remove existing swap Swap_Disable - #Auto size? + # - Auto size? (( $SWAP_SIZE_TARGET == 1 )) && SWAP_SIZE_TARGET=$(( 2048 - $(free -m | mawk '/Mem:/ {print $2;exit}') )) - #Configure new swapfile? + # - Configure new swapfile? (( $SWAP_SIZE_TARGET > 0 )) && Swap_Enable + Update_DietPi_Conf + Update_Tmp + fi #----------------------------------------------------------------------------------- exit 0 diff --git a/dietpi/misc/dietpi-arr_to_RAM b/dietpi/misc/dietpi-arr_to_RAM index d66fd41070..88b9aa146b 100644 --- a/dietpi/misc/dietpi-arr_to_RAM +++ b/dietpi/misc/dietpi-arr_to_RAM @@ -1,8 +1,7 @@ #!/bin/bash { - #//////////////////////////////////// - # DietPi Move Arr to RAM + # DietPi Link Arr to RAM # #//////////////////////////////////// # Created by Daniel Knight / daniel.knight@dietpi.com / dietpi.com @@ -10,124 +9,287 @@ #//////////////////////////////////// # # Info: - # - Moves arr program database files to RAM (/tmp) with symlink, and, back to disk + # - Moves Sonarr, Radarr and Lidarr database files to RAM, leaving symlinks on disk + # - Reduces disk I/O and enhances database I/O performance + # - Creates a backup first and automatically restores from backup on next start in case of system crash + # NB: Not supported on Jessie: https://github.com/MichaIng/DietPi/issues/2689#issuecomment-487306241 # - # Usage: - # - dietpi-arr_to_RAM 1 = Move to RAM - # - dietpi-arr_to_RAM 0 = Move to Disk - #//////////////////////////////////// - - #Import DietPi-Globals --------------------------------------------------------------- - . /DietPi/dietpi/func/dietpi-globals - G_PROGRAM_NAME='DietPi-Arr_to_RAM' - G_INIT - G_CHECK_ROOT_USER - #Import DietPi-Globals --------------------------------------------------------------- - + USAGE=' +Usage: dietpi-arr_to_RAM [] +Available commands: + 1 [] Link (program) database(s) to RAM + 2 [] Update (program) database backup(s) + 0 [] Store (program) database(s) back to disk + enable Enable Link to RAM on boot + disable Disable Link to RAM on boot +Supported programs: + Apply to all supported and installed programs + sonarr Apply to Sonarr database only + radarr Apply to Radarr database only + lidarr Apply to Lidarr database only +' #//////////////////////////////////// + + # Import DietPi-Globals -------------------------------------------------------------- + #. /DietPi/dietpi/func/dietpi-globals # Skip globals for faster execution on early boot stage + PROGRAM_NAME='DietPi-Arr_to_RAM' + # Import DietPi-Globals -------------------------------------------------------------- + + # Grab input INPUT=$1 - if [[ ! $INPUT ]]; then + INPUT_PROG=$2 - exit 1 + EXIT_CODE=0 - fi - - aFP_FILES=( + # Print output + # - In case of error, sets EXIT_CODE as well + unset error + Print(){ - 'nzbdrone.db' - 'nzbdrone.db-shm' - 'nzbdrone.db-wal' + local message=$@ + [[ $error ]] && { message="[ERROR] $message"; EXIT_CODE=$error; } + unset error + echo "$(date '+%Y-%m-%d %T') | $PROGRAM_NAME: $message" - # - Lidarr - 'lidarr.db' - 'lidarr.db-shm' - 'lidarr.db-wal' + } - ) + # Check for required root or program specific permissions permissions + # - Handling systemd service always requires root permissions + # - Database backup updates can be done as program user when defined via $2 + (( $UID )) && [[ $INPUT != 2 || $USER != $INPUT_PROG ]] && { error=1 Print 'This script must run as root user. Please use: "sudo"'; exit 1; } - aFP_PROGRAM=( + # Boot service log file + FP_LOG='/var/tmp/dietpi/logs/dietpi-arr_to_RAM.log' - 'sonarr' - 'radarr' - 'lidarr' + # Program files array + declare -A aFILES=() + # - Sonarr/Radarr: Both use the same file names + [[ ${INPUT_PROG:-sonarr} == 'sonarr' ]] && aFILES[sonarr]='nzbdrone.db nzbdrone.db-shm nzbdrone.db-wal' + [[ ${INPUT_PROG:-radarr} == 'radarr' ]] && aFILES[radarr]='nzbdrone.db nzbdrone.db-shm nzbdrone.db-wal' + # - Lidarr + [[ ${INPUT_PROG:-lidarr} == 'lidarr' ]] && aFILES[lidarr]='lidarr.db lidarr.db-shm lidarr.db-wal' - ) + # Check for valid input program + (( ${#aFILES[@]} )) || { error=1 Print "Invalid input program ($INPUT_PROG). Aborting... +$USAGE"; exit 1; } - FP_SOURCE='' - FP_TARGET='' + FP_DISK='' + FP_RAM='' - Copy_To_Ram(){ + Link_To_Ram(){ - G_ERROR_HANDLER_INFO_ONLY=1 G_RUN_CMD cp $FP_SOURCE ${FP_SOURCE}.bak - G_ERROR_HANDLER_INFO_ONLY=1 G_RUN_CMD cp $FP_SOURCE $FP_TARGET - G_ERROR_HANDLER_INFO_ONLY=1 G_RUN_CMD rm $FP_SOURCE - G_ERROR_HANDLER_INFO_ONLY=1 G_RUN_CMD ln -sf $FP_TARGET $FP_SOURCE + Print "Linking $FP_DISK to RAM ($FP_RAM)..." + mv $FP_DISK ${FP_DISK}.bak || { error=$? Print "Creating backup failed for $FP_DISK. Skipping this file..."; return; } + ln -s $FP_RAM $FP_DISK || EXIT_CODE=$? + # chown link in case created by root but program user wants to store back to disk + chown -h $i $FP_DISK || EXIT_CODE=$? + cp -a --no-preserve=timestamps ${FP_DISK}.bak $FP_RAM || EXIT_CODE=$? } - for i in ${!aFP_PROGRAM[@]} - do + Toggle_Link_To_Ram(){ - systemctl stop ${aFP_PROGRAM[$i]} + local start_services='' - for j in ${!aFP_FILES[@]} + for i in ${!aFILES[@]} do - FP_SOURCE="$G_FP_DIETPI_USERDATA/${aFP_PROGRAM[$i]}/${aFP_FILES[$j]}" - FP_TARGET="/tmp/${aFP_PROGRAM[$i]}/${aFP_FILES[$j]}" + FP_DISK="/mnt/dietpi_userdata/$i" + FP_RAM="/tmp/${i}_db_link" - # - Copy to RAM + backup - if (( $INPUT == 1 )); then + # Skip non-installed program + [[ -d $FP_DISK ]] || continue - if [[ ! -d /tmp/${aFP_PROGRAM[$i]} ]]; then + Print "${i^} detected" + + # Update backup + if (( $INPUT == 2 )); then + + if [[ -d $FP_RAM ]]; then + + Print "Updating ${i^} database backups..." + for j in ${aFILES[$i]} + do + + FP_RAM="/tmp/${i}_db_link/$j" + [[ -f $FP_RAM ]] || { Print "$FP_RAM not found. Skipping this file..."; continue; } + cp -a $FP_RAM $FP_DISK/$j.bak || EXIT_CODE=$? + + done + Print "Updated ${i^} database backups." + + else - G_RUN_CMD mkdir -p /tmp/${aFP_PROGRAM[$i]} + Print "${i^} database is not in RAM. Skipping this program..." fi + continue - if [[ -f $FP_TARGET ]]; then + fi - G_DIETPI-NOTIFY 2 "$FP_SOURCE already at location ($FP_TARGET)" + # If active, stop program before handling database and restart afterwards + if pgrep -f $i &> /dev/null; then - elif [[ ! -L $FP_SOURCE && -f $FP_SOURCE ]]; then + Print "Stopping ${i^} service..." + start_services+=" $i" + systemctl stop $i || { error=$? Print "Stopping ${i^} service failed. Skipping this program..."; continue; } - Copy_To_Ram + fi - # - recover + copy to RAM - elif [[ -f ${FP_SOURCE}.bak ]]; then + # Link to RAM + backup + if (( $INPUT == 1 )); then - rm $FP_SOURCE &> /dev/null + Print "Linking ${i^} database to RAM..." + # - Pre-create RAM dir + [[ -d $FP_RAM ]] || mkdir -p $FP_RAM || { error=$? Print "Pre-creating RAM directory for ${i^} failed ($FP_RAM). Skipping this program..."; continue; } + # - chown dir in case created by root but program user wants to store back to disk + chown $i $FP_RAM || EXIT_CODE=$? - G_ERROR_HANDLER_INFO_ONLY=1 G_RUN_CMD cp ${FP_SOURCE}.bak $FP_SOURCE - Copy_To_Ram + for j in ${aFILES[$i]} + do - fi + FP_DISK="/mnt/dietpi_userdata/$i/$j" + FP_RAM="/tmp/${i}_db_link/$j" + local fp_target='' + + # - Source exists and is no symlink, expected situation + if [[ -f $FP_DISK && ! -L $FP_DISK ]]; then + + Link_To_Ram + + # - Link + target exists, should only happen when running the script two times in same session + elif [[ -L $FP_DISK ]] && fp_target=$(readlink -e $FP_DISK); then + + if [[ $fp_target == $FP_RAM ]]; then + + Print "$FP_DISK already linked to RAM ($FP_RAM). Skipping this file..." + + # - Failsafe: Restore file from wrong symlink, should never occur but required for this script to function + else + + Print "$FP_DISK already linked to $fp_target. Restoring original file location before linking to RAM..." + rm $FP_DISK || { error=$? Print "Removing symlink failed ($FP_DISK). Skipping this file..."; continue; } + mv $fp_target $FP_DISK || { error=$? Print "Restoring original file failed ($fp_target). Skipping this file..."; continue; } + Link_To_Ram + + fi + + # - Source does not exist or is orphaned link, should only happen after crash + elif [[ -f ${FP_DISK}.bak ]]; then + + Print "$FP_DISK not found. Recovering from backup first (${FP_DISK}.bak)..." + # - Remove possible orphaned symlink + [[ ! -L $FP_DISK ]] || rm $FP_DISK || { error=$? Print "Removing orphaned symlink failed ($FP_DISK). Skipping this file..."; continue; } + # - Recover from backup + mv ${FP_DISK}.bak $FP_DISK || { error=$? Print "Recovering file from backup failed (${FP_DISK}.bak). Skipping this file..."; continue; } + Link_To_Ram - systemctl start ${aFP_PROGRAM[$i]} + else - # - Save to disk + Print "$FP_DISK not found. Skipping this file..." + + fi + + done + + Print "Linked ${i^} database to RAM." + + # Store back to disk elif (( $INPUT == 0 )); then - if [[ ! -f $FP_TARGET ]]; then + if [[ -d $FP_RAM ]]; then - G_DIETPI-NOTIFY 2 "$FP_TARGET does not exist." + Print "Storing database from RAM ($FP_RAM) back to disk ($FP_DISK)..." + # - "-u" will only copy newer files, thus actually used by program. + # - "--remove-destination" will remove expected existing symlinks. + cp -au --remove-destination $FP_RAM/. $FP_DISK || { error=$? Print "Storing ${i^} database from RAM back to disk failed."; continue; } + rm -R $FP_RAM + Print "Stored ${i^} database from RAM back to disk." else - G_ERROR_HANDLER_INFO_ONLY=1 G_RUN_CMD rm $FP_SOURCE - G_ERROR_HANDLER_INFO_ONLY=1 G_RUN_CMD cp $FP_TARGET $FP_SOURCE - G_ERROR_HANDLER_INFO_ONLY=1 G_RUN_CMD rm $FP_TARGET + Print "${i^} database is not in RAM. Skipping this program..." fi fi - chown -R ${aFP_PROGRAM[$i]}:dietpi $FP_TARGET $FP_SOURCE &> /dev/null - done - done + # Failsafe: When restoring to disk, "sync" now to prevent async issues! + (( $INPUT == 0 )) && sync + + # Start programs we stopped before + # - NB: Due to Before=, *arr.service waits for dietpi-arr_to_RAM.service to finish, timing it out. + # - "--no-block" allows dietpi-arr_to_RAM.service to only enqueue *arr.service starts and finish, to allow them starting afterwards. + if [[ $start_services ]]; then + + Print "Enqueuing$start_services service start(s)..." + systemctl --no-block start $start_services + systemctl -q is-active dietpi-postboot && /DietPi/dietpi/dietpi-process_tool 1 + + fi - unset aFP_FILES - unset aFP_PROGRAM + } + + Enable_On_Boot(){ + + cat << _EOF_ > /etc/systemd/system/dietpi-arr_to_RAM.service +[Unit] +Description=DietPi-Arr_to_RAM +Requisite=dietpi-ramdisk.service tmp.mount +After=dietpi-ramdisk.service tmp.mount +Before=dietpi-preboot.service sonarr.service radarr.service lidarr.service + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=-/bin/dash -c '/DietPi/dietpi/misc/dietpi-arr_to_RAM 1 2>&1 >> $FP_LOG' +ExecStop=/bin/dash -c '/DietPi/dietpi/misc/dietpi-arr_to_RAM 0 2>&1 > $FP_LOG' + +[Install] +WantedBy=multi-user.target +_EOF_ + systemctl daemon-reload + systemctl enable dietpi-arr_to_RAM || EXIT_CODE=$? + systemctl start dietpi-arr_to_RAM || EXIT_CODE=$? + + } + + Disable_On_Boot(){ + + if [[ -f /etc/systemd/system/dietpi-arr_to_RAM.service ]]; then + + systemctl stop dietpi-arr_to_RAM || EXIT_CODE=$? + systemctl disable dietpi-arr_to_RAM || EXIT_CODE=$? + rm /etc/systemd/system/dietpi-arr_to_RAM.service || EXIT_CODE=$? + + fi + + } + + #///////////////////////////////////////////////////////////////////////////////////// + # Main Loop + #///////////////////////////////////////////////////////////////////////////////////// + # - Toggle Link to RAM + if [[ $INPUT == [012] ]]; then + + Toggle_Link_To_Ram + (( $EXIT_CODE )) && Print '[ERROR] An issue has occurred. Please check the above output for details.' + + # - Enable/Disable Link to RAM on boot + elif [[ $INPUT == 'enable' || $INPUT == 'disable' ]]; then + + ${INPUT^}_On_Boot + (( $EXIT_CODE )) && Print "[ERROR] An issue has occurred. Please check the log for details: $FP_LOG" + + else + + error=1 Print "Invalid input command (${INPUT:-}). Aborting... +$USAGE" + + fi + #----------------------------------------------------------------------------------- + exit $EXIT_CODE + #----------------------------------------------------------------------------------- } diff --git a/dietpi/misc/dietpi-nordvpn b/dietpi/misc/dietpi-nordvpn index e03808127d..0963e2ba22 100644 --- a/dietpi/misc/dietpi-nordvpn +++ b/dietpi/misc/dietpi-nordvpn @@ -15,13 +15,13 @@ # - /DietPi/dietpi/misc/dietpi-nordvpn #//////////////////////////////////// - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals -------------------------------------------------------------- . /DietPi/dietpi/func/dietpi-globals G_PROGRAM_NAME='DietPi-NordVPN' G_CHECK_ROOT_USER G_CHECK_ROOTFS_RW G_INIT - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals -------------------------------------------------------------- FP_SETTINGS_DIETPI='/var/lib/dietpi/dietpi-software/installed/dietpi-nordvpn/settings_dietpi.conf' FP_SETTINGS_OVPN='/var/lib/dietpi/dietpi-software/installed/dietpi-nordvpn/settings_ovpn.conf' @@ -31,12 +31,20 @@ PROTOCOL='udp' NET_DEV='tun0' + NORDVPN_SERVICE=0 NORDVPN_CONNECTED=0 MAX_WAIT_FOR_CONNECTION=5 + WAN_IP='' + + Update_Wan_Ip(){ + + WAN_IP=$(curl -sLm 2 https://dietpi.com/myip.php 2>&1) + + } Init(){ - #Check installed + # Check installed until grep -q 'aSOFTWARE_INSTALL_STATE\[171\]=2' /DietPi/dietpi/.installed do @@ -46,13 +54,16 @@ else - TARGETMENUID=-1 + TARGETMENUID=-1 #Exit path without save. break fi done + # Check service exists + [[ -f '/lib/systemd/system/dietpi-nordvpn.service' ]] && NORDVPN_SERVICE=1 + Read_Settings } @@ -60,16 +71,10 @@ Check_Connected(){ NORDVPN_CONNECTED=0 - local status=1 #if systemctl status dietpi-nordvpn | grep -qi 'initialization sequence completed'; then - if ip r | grep -q $NET_DEV; then - - status=0 - NORDVPN_CONNECTED=1 + ip r s dev $NET_DEV &>/dev/null && NORDVPN_CONNECTED=1 - fi - - return $status + return $(( ! $NORDVPN_CONNECTED )) } @@ -77,7 +82,7 @@ Save_Settings(){ - systemctl stop dietpi-nordvpn + (( $NORDVPN_SERVICE )) && systemctl stop dietpi-nordvpn cat << _EOF_ > $FP_SETTINGS_OVPN ${NORDVPN_USERNAME//\'/\'\\\'\'} @@ -90,7 +95,7 @@ NORDVPN_PASSWORD='${NORDVPN_PASSWORD//\'/\'\\\'\'}' NORDVPN_SERVER='$NORDVPN_SERVER' PROTOCOL='$PROTOCOL' _EOF_ - G_CONFIG_INJECT 'auth-user-pass[[:blank:]]' "auth-user-pass $FP_SETTINGS_OVPN" /etc/openvpn/ovpn_$PROTOCOL/$NORDVPN_SERVER + G_CONFIG_INJECT 'auth-user-pass' "auth-user-pass $FP_SETTINGS_OVPN" /etc/openvpn/ovpn_$PROTOCOL/$NORDVPN_SERVER chmod 600 $FP_SETTINGS_OVPN $FP_SETTINGS_DIETPI /etc/openvpn/ovpn_$PROTOCOL/$NORDVPN_SERVER chown root:root $FP_SETTINGS_OVPN $FP_SETTINGS_DIETPI /etc/openvpn/ovpn_$PROTOCOL/$NORDVPN_SERVER @@ -101,16 +106,13 @@ Description=NordVPN (DietPi) After=network.target dietpi-boot.service [Service] -User=root -Type=simple ExecStart=$(which openvpn) /etc/openvpn/ovpn_$PROTOCOL/$NORDVPN_SERVER [Install] WantedBy=multi-user.target _EOF_ - systemctl daemon-reload - G_RUN_CMD systemctl enable dietpi-nordvpn + NORDVPN_SERVICE=1 G_RUN_CMD systemctl restart dietpi-nordvpn for (( i=1; i<=$MAX_WAIT_FOR_CONNECTION; i++ )) @@ -137,30 +139,22 @@ _EOF_ # Whip #///////////////////////////////////////////////////////////////////////////////////// TARGETMENUID=0 - LAST_SELECTED_NAME=0 + LAST_SELECTED_NAME='Username' Menu_Exit(){ G_WHIP_SIZE_X_MAX=50 - if G_WHIP_YESNO "Exit $G_PROGRAM_NAME?"; then - - #exit - TARGETMENUID=-1 - - else - - #Return to Main Menu - TARGETMENUID=0 - - fi + G_WHIP_YESNO "Exit $G_PROGRAM_NAME?" && TARGETMENUID=-1 # Exit } - #TARGETMENUID=0 + # TARGETMENUID=0 Menu_Main(){ - local text_status='Status:\n' - if Check_Connected; then + Update_Wan_Ip + + local text_status="Status:\n - WAN IP: $WAN_IP\n" + if (( $NORDVPN_SERVICE )) && Check_Connected; then text_status+=" - Connected : $NORDVPN_SERVER\n" @@ -172,20 +166,12 @@ _EOF_ if [[ -f /sys/class/net/$NET_DEV/statistics/rx_bytes && -f /sys/class/net/$NET_DEV/statistics/tx_bytes ]]; then net_rx_byte=$( 0 )); then - - net_rx_mb="$(( $net_rx_byte / 1024 / 1024 ))MB" - - fi + disable_error=1 G_CHECK_VALIDINT "$net_rx_byte" 1 && net_rx_mb="$(( $net_rx_byte / 1024 / 1024 ))MB" + net_tx_byte=$( 0 )); then - - net_tx_mb="$(( $net_tx_byte / 1024 / 1024 ))MB" - - fi + disable_error=1 G_CHECK_VALIDINT "$net_tx_byte" 1 && net_tx_mb="$(( $net_tx_byte / 1024 / 1024 ))MB" fi @@ -193,17 +179,25 @@ _EOF_ else - text_status+=' - Disconnected\n' - text_status+=' - NordVPN subscription: https://go.nordvpn.net/aff_c?offer_id=15&aff_id=5305&url_id=902' + (( $NORDVPN_SERVICE )) && text_status+=' - Disconnected' || text_status+=' - Not configured' + text_status+='\n - NordVPN subscription: https://go.nordvpn.net/aff_c?offer_id=15&aff_id=5305&url_id=902' fi G_WHIP_MENU_ARRAY=('' '●─ Global Options ') G_WHIP_MENU_ARRAY+=('Username' ": [$NORDVPN_USERNAME]") - G_WHIP_MENU_ARRAY+=('Password' ": [$NORDVPN_PASSWORD]") + G_WHIP_MENU_ARRAY+=('Password' ": [${NORDVPN_PASSWORD//?/*}]") G_WHIP_MENU_ARRAY+=('Server' ": [$NORDVPN_SERVER]") - G_WHIP_MENU_ARRAY+=('Refresh' ': Update VPN connection status') - (( $NORDVPN_CONNECTED )) && G_WHIP_MENU_ARRAY+=('Disconnect' '') + if (( $NORDVPN_SERVICE )); then + + local autostart_enabled=0 autostart_text='Off' + systemctl -q is-enabled dietpi-nordvpn && { autostart_enabled=1 autostart_text='On'; } + G_WHIP_MENU_ARRAY+=('Auto start' ": [$autostart_text]") + + G_WHIP_MENU_ARRAY+=('Refresh' ': Update VPN connection status') + (( $NORDVPN_CONNECTED )) && G_WHIP_MENU_ARRAY+=('Disconnect' '') + + fi G_WHIP_MENU_ARRAY+=('' '●─ Save Settings ') G_WHIP_MENU_ARRAY+=('Apply' ': Save settings and restart VPN connection') @@ -211,37 +205,42 @@ _EOF_ G_WHIP_BUTTON_CANCEL_TEXT='Exit' if G_WHIP_MENU "$text_status"; then - LAST_SELECTED_NAME="$G_WHIP_RETURNED_VALUE" + LAST_SELECTED_NAME=$G_WHIP_RETURNED_VALUE if [[ $G_WHIP_RETURNED_VALUE == 'Apply' ]]; then Save_Settings - elif [[ $G_WHIP_RETURNED_VALUE == 'Username' ]]; then + elif [[ $G_WHIP_RETURNED_VALUE == 'Auto start' ]]; then - G_WHIP_DEFAULT_ITEM=$NORDVPN_USERNAME - if G_WHIP_INPUTBOX 'Please enter your NordVPN username:'; then + if (( $autostart_enabled )); then + + G_RUN_CMD systemctl disable dietpi-nordvpn + + else - NORDVPN_USERNAME=$G_WHIP_RETURNED_VALUE + G_RUN_CMD systemctl enable dietpi-nordvpn fi - elif [[ $G_WHIP_RETURNED_VALUE == 'Password' ]]; then + elif [[ $G_WHIP_RETURNED_VALUE == 'Username' ]]; then - if G_WHIP_PASSWORD 'Please enter your NordVPN password:'; then + G_WHIP_DEFAULT_ITEM=$NORDVPN_USERNAME + G_WHIP_INPUTBOX 'Please enter your NordVPN username:' && NORDVPN_USERNAME=$G_WHIP_RETURNED_VALUE - NORDVPN_PASSWORD=$result - unset result + elif [[ $G_WHIP_RETURNED_VALUE == 'Password' ]]; then - fi + G_WHIP_PASSWORD 'Please enter your NordVPN password:' && NORDVPN_PASSWORD=$result + unset result elif [[ $G_WHIP_RETURNED_VALUE == 'Disconnect' ]]; then G_RUN_CMD systemctl stop dietpi-nordvpn + LAST_SELECTED_NAME='Refresh' elif [[ $G_WHIP_RETURNED_VALUE == 'Server' ]]; then - # Select protocol + # - Select protocol G_WHIP_MENU_ARRAY=( 'UDP' ': Recommended' @@ -250,31 +249,22 @@ _EOF_ ) G_WHIP_DEFAULT_ITEM=$PROTOCOL - if G_WHIP_MENU 'Please select the connection protocol type:'; then - - PROTOCOL=${G_WHIP_RETURNED_VALUE,,} + G_WHIP_MENU 'Please select the connection protocol type:' && PROTOCOL=${G_WHIP_RETURNED_VALUE,,} - fi - - # Select server - G_WHIP_MENU_ARRAY=() + # - Select server G_DIETPI-NOTIFY 2 'Populating NordVPN server list, please wait...' cd /etc/openvpn/ovpn_$PROTOCOL + G_WHIP_MENU_ARRAY=() for i in * do G_WHIP_MENU_ARRAY+=("$i" '') done - cd /tmp/$G_PROGRAM_NAME G_WHIP_DEFAULT_ITEM=$NORDVPN_SERVER - if G_WHIP_MENU 'Please select a NordVPN server to use'; then - - NORDVPN_SERVER=$G_WHIP_RETURNED_VALUE - - fi + G_WHIP_MENU 'Please select a NordVPN server to use' && NORDVPN_SERVER=$G_WHIP_RETURNED_VALUE fi diff --git a/dietpi/patch_file b/dietpi/patch_file index 70de9646b2..55fac42155 100644 --- a/dietpi/patch_file +++ b/dietpi/patch_file @@ -29,6 +29,9 @@ # Prevent backup prompts during patching e.g. from DietPi-Software reinstalls export G_PROMPT_BACKUP_DISABLED=1 + # Prevent initial and final service crontrol during DietPi-Software reinstalls + export G_SERVICE_CONTROL=0 + # Export subversion, required for pre-v6.14 export G_DIETPI_VERSION_SUB=$INPUT @@ -71,6 +74,15 @@ } + # Move Jessie systems to "jessie-support" branch: https://github.com/MichaIng/DietPi/issues/2332 + # - We check/apply this already via pre-patches but do as well here since older DietPi version do not yet run pre-patches. + if (( $G_DISTRO < 4 )) && ! grep -q '^[[:blank:]]*DEV_GITBRANCH=jessie-support' /DietPi/dietpi.txt; then + + G_CONFIG_INJECT 'DEV_GITBRANCH=' 'DEV_GITBRANCH=jessie-support' /DietPi/dietpi.txt + Restart_DietPi_Update + + fi + # Pre-v6.17: New ".version" system # - As loaded pre-v6.17 dietpi-update will overwrite ".version" to previous 2 line system, we need to rerun dietpi-update. # Pre-v6.20: New $G_DIETPI_INSTALL_STAGE system @@ -102,7 +114,7 @@ #------------------------------------------------------------------------------- #Asus TB G_HW_MODEL change - if [[ -f /etc/.dietpi_hw_model_identifier && $(sed -n 1p /etc/.dietpi_hw_model_identifier) == 100 ]]; then + if [[ -f '/etc/.dietpi_hw_model_identifier' && $(sed -n 1p /etc/.dietpi_hw_model_identifier) == 100 ]]; then G_HW_MODEL=52 echo $G_HW_MODEL > /etc/.dietpi_hw_model_identifier @@ -116,12 +128,12 @@ sed -i '/#DietPi Additions/Q' /etc/bash.bashrc #------------------------------------------------------------------------------- #Fix doubled and renamed config files: https://github.com/MichaIng/DietPi/commit/68148cec6b49afc787deca638456e1c4689e1cab#diff-8370b86e635383d521462994afe04a2d - [[ -f /etc/apt/apt.conf.d/99force-ipv ]] && rm /etc/apt/apt.conf.d/99force-ipv - [[ -f /etc/sysctl.d/97-dietpi.conf ]] && rm /etc/sysctl.d/97-dietpi.conf + [[ -f '/etc/apt/apt.conf.d/99force-ipv' ]] && rm /etc/apt/apt.conf.d/99force-ipv + [[ -f '/etc/sysctl.d/97-dietpi.conf' ]] && rm /etc/sysctl.d/97-dietpi.conf #------------------------------------------------------------------------------- #Core_ENV update: https://github.com/MichaIng/DietPi/pull/1419 # - consoleblank disable x86_64 - if [[ -f /etc/default/grub ]]; then + if [[ -f '/etc/default/grub' ]]; then G_CONFIG_INJECT 'GRUB_CMDLINE_LINUX_DEFAULT=' 'GRUB_CMDLINE_LINUX_DEFAULT="consoleblank=0 quiet"' /etc/default/grub G_CONFIG_INJECT 'GRUB_CMDLINE_LINUX=' 'GRUB_CMDLINE_LINUX="net.ifnames=0"' /etc/default/grub @@ -148,7 +160,7 @@ #------------------------------------------------------------------------------- #locale rework/reset: https://github.com/MichaIng/DietPi/issues/1430#issuecomment-364763302 - [[ -f /etc/environment ]] && mv /etc/environment /mnt/dietpi_userdata/environment.bak + [[ -f '/etc/environment' ]] && mv /etc/environment /mnt/dietpi_userdata/environment.bak > /etc/environment /DietPi/dietpi/func/dietpi-set_software locale en_GB.UTF-8 @@ -160,7 +172,7 @@ systemctl enable openvpn &> /dev/null; systemctl start openvpn &> /dev/null #------------------------------------------------------------------------------- #https://dietpi.com/phpbb/viewtopic.php?f=11&t=2772&p=10646#p10646 - [[ -f /etc/apt/sources.list.d/openmediavault.list ]] && rm /etc/apt/sources.list.d/openmediavault.list + [[ -f '/etc/apt/sources.list.d/openmediavault.list' ]] && rm /etc/apt/sources.list.d/openmediavault.list #------------------------------------------------------------------------------- #DietPi-Software removals: https://github.com/MichaIng/DietPi/issues/1491 if [[ -f /DietPi/dietpi/.installed ]]; then @@ -177,7 +189,7 @@ fi #------------------------------------------------------------------------------- #Nodered lacks homedir, create it: https://github.com/MichaIng/DietPi/issues/1446#issuecomment-366370800 - if getent passwd nodered &> /dev/null && [[ ! -d /home/nodered ]]; then + if getent passwd nodered &> /dev/null && [[ ! -d '/home/nodered' ]]; then mkdir -p /home/nodered chown -R nodered:nodered /home/nodered @@ -193,7 +205,7 @@ #------------------------------------------------------------------------------- #Switch from rc.local to own postboot script: https://github.com/MichaIng/DietPi/issues/1376 G_WHIP_MSG 'DietPi will not use "/etc/rc.local" for its own scripts anymore.\n\nHowever, in case you manually added something, we safe a backup to "/mnt/dietpi_userdata/rc.local.bak", from where you can copy & paste back to the cleaned "/etc/rc.local".\n\nIt will work as before.' - [[ -f /etc/rc.local ]] && mv /etc/rc.local /mnt/dietpi_userdata/rc.local.bak + [[ -f '/etc/rc.local' ]] && mv /etc/rc.local /mnt/dietpi_userdata/rc.local.bak cat << _EOF_ > /etc/rc.local #!/bin/sh -e # @@ -216,7 +228,7 @@ _EOF_ if (( $G_DIETPI_INSTALL_STAGE == 2 )) && grep -q '^aSOFTWARE_INSTALL_STATE\[168\]=2' /DietPi/dietpi/.installed; then - [[ -d /var/lib/dietpi/postboot.d ]] || mkdir /var/lib/dietpi/postboot.d + [[ -d '/var/lib/dietpi/postboot.d' ]] || mkdir /var/lib/dietpi/postboot.d cat << _EOF_ > /var/lib/dietpi/postboot.d/moode #!/bin/bash #moOde additions @@ -259,16 +271,16 @@ _EOF_ if (( $G_DIETPI_INSTALL_STAGE == 2 )); then # - RPi cam pre-patch - [[ -d /var/www/dietpicam ]] && mv /var/www/dietpicam /var/www/rpicam + [[ -d '/var/www/dietpicam' ]] && mv /var/www/dietpicam /var/www/rpicam [[ -d $G_FP_DIETPI_USERDATA/dietpicam ]] && mv $G_FP_DIETPI_USERDATA/dietpicam $G_FP_DIETPI_USERDATA/rpicam - [[ -e /var/www/rpicam/media ]] && rm /var/www/rpicam/media + [[ -e '/var/www/rpicam/media' ]] && rm /var/www/rpicam/media /DietPi/dietpi/dietpi-software reinstall 59 132 fi #------------------------------------------------------------------------------- #Add certificate combining for Lighttpd to CertBot auto renewal: https://github.com/MichaIng/DietPi/pull/1553 - if [[ -f /DietPi/dietpi/.dietpi-letsencrypt ]]; then + if [[ -f '/DietPi/dietpi/.dietpi-letsencrypt' ]]; then # - Switch Minio to new certbot.service.d/ hook: if (( $G_DISTRO > 3 )) && grep -q '^aSOFTWARE_INSTALL_STATE\[158\]=2' /DietPi/dietpi/.installed; then @@ -355,7 +367,7 @@ _EOF_ sed -i '/[[:space:]]dphys-swapfile[[:space:]]/d' /etc/fstab local swap_size=0 local swap_location='/var/swap' - if [[ -f /etc/dphys-swapfile ]]; then + if [[ -f '/etc/dphys-swapfile' ]]; then swap_size=$(grep -m1 '^[[:blank:]]*CONF_SWAPSIZE=' /etc/dphys-swapfile | sed 's/^[^=]*=//') swap_location=$(grep -m1 '^[[:blank:]]*CONF_SWAPFILE=' /etc/dphys-swapfile | sed 's/^[^=]*=//') @@ -367,13 +379,13 @@ _EOF_ #Re-Apply swap to set /tmp tmpfs size: https://github.com/MichaIng/DietPi/issues/1027#issuecomment-369435049 # + Force auto swapfile size https://github.com/MichaIng/DietPi/issues/1593#issuecomment-371516418 - /DietPi/dietpi/func/dietpi-set_dphys-swapfile 1 + /DietPi/dietpi/func/dietpi-set_swapfile 1 G_AGP dphys-swapfile #------------------------------------------------------------------------------- #Reinstalls # v6.20 Shairport-sync: https://github.com/MichaIng/DietPi/issues/1620#issuecomment-373086888 - # Squeezebox server: + # v6.23 Squeezebox server: # v6.20 AmiBerry 2.18: https://github.com/MichaIng/DietPi/issues/1410#issuecomment-374060452 # Mopidy: https://github.com/MichaIng/DietPi/issues/1625 # v6.17 MPD: https://github.com/MichaIng/DietPi/issues/1614 @@ -382,7 +394,7 @@ _EOF_ killall -qw squeezeboxserver [[ -f /var/lib/dietpi/dietpi-software/services/squeezeboxserver.service ]] && rm /var/lib/dietpi/dietpi-software/services/squeezeboxserver.service - /DietPi/dietpi/dietpi-software reinstall 35 118 + /DietPi/dietpi/dietpi-software reinstall 118 fi #------------------------------------------------------------------------------- @@ -399,10 +411,10 @@ _EOF_ sed -i '/dietpi/d' /etc/sudoers #Our config must not start with '99-' to assure priority higher than '99-sysctl.conf' # - New config is installed automatically via v6.9 update system. - [[ -f /etc/sysctl.d/99-dietpi.conf ]] && rm /etc/sysctl.d/99-dietpi.conf + [[ -f '/etc/sysctl.d/99-dietpi.conf' ]] && rm /etc/sysctl.d/99-dietpi.conf #------------------------------------------------------------------------------- # - RPi resolve gettext error: https://github.com/MichaIng/DietPi/issues/1631#issuecomment-373965406 - [[ -f /etc/profile.d/wifi-country.sh ]] && rm /etc/profile.d/wifi-country.sh + [[ -f '/etc/profile.d/wifi-country.sh' ]] && rm /etc/profile.d/wifi-country.sh #------------------------------------------------------------------------------- elif (( $G_DIETPI_VERSION_SUB == 5 )); then @@ -418,13 +430,13 @@ _EOF_ fi #------------------------------------------------------------------------------- #Remove minutely running "make_nas_processes_faster" cron job, present on images with preinstalled OMV: https://github.com/MichaIng/DietPi/issues/1654 - [[ -f /etc/cron.d/make_nas_processes_faster ]] && rm /etc/cron.d/make_nas_processes_faster + [[ -f '/etc/cron.d/make_nas_processes_faster' ]] && rm /etc/cron.d/make_nas_processes_faster #------------------------------------------------------------------------------- #Add Dropbear ecdsa and dss host keys, if missing: https://github.com/MichaIng/DietPi/issues/1670 if (( $G_DIETPI_INSTALL_STAGE == 2 )) && grep -q '^aSOFTWARE_INSTALL_STATE\[104\]=2' /DietPi/dietpi/.installed; then - [[ -f /etc/dropbear/dropbear_ecdsa_host_key ]] || dropbearkey -t ecdsa -f /etc/dropbear/dropbear_ecdsa_host_key &> /dev/null - [[ -f /etc/dropbear/dropbear_dss_host_key ]] || dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key &> /dev/null + [[ -f '/etc/dropbear/dropbear_ecdsa_host_key' ]] || dropbearkey -t ecdsa -f /etc/dropbear/dropbear_ecdsa_host_key &> /dev/null + [[ -f '/etc/dropbear/dropbear_dss_host_key' ]] || dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key &> /dev/null fi #------------------------------------------------------------------------------- @@ -457,7 +469,7 @@ _EOF_ #Deluge systemd service update: https://github.com/MichaIng/DietPi/issues/1658 # + Service fix for in v6.6 https://github.com/MichaIng/DietPi/issues/1689#issuecomment-379024795 # => Fixed with reinstall on v6.21 => v6.22 - [[ -f /var/lib/dietpi/dietpi-software/services/deluge.service ]] && rm /var/lib/dietpi/dietpi-software/services/deluge.service + [[ -f '/var/lib/dietpi/dietpi-software/services/deluge.service' ]] && rm /var/lib/dietpi/dietpi-software/services/deluge.service #------------------------------------------------------------------------------- elif (( $G_DIETPI_VERSION_SUB == 7 )); then @@ -480,12 +492,12 @@ _EOF_ if { (( $G_HW_MODEL < 10 )) && ! grep -q 'allo-piano-dac' /DietPi/config.txt; } || { (( $G_HW_MODEL == 70 )) && ! grep -q 'allo-piano-dac' /etc/modules; }; then - [[ -d /lib/firmware/allo ]] && rm -R /lib/firmware/allo + [[ -d '/lib/firmware/allo' ]] && rm -R /lib/firmware/allo fi #------------------------------------------------------------------------------- #RPi UART: https://github.com/MichaIng/DietPi/issues/1759 - if [[ -f /DietPi/config.txt ]]; then + if [[ -f '/DietPi/config.txt' ]]; then local serial_state=$(grep -m1 '^[[:blank:]]*CONFIG_SERIAL_CONSOLE_ENABLE=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') G_CONFIG_INJECT 'enable_uart=' "enable_uart=$serial_state" /DietPi/config.txt @@ -525,7 +537,7 @@ _EOF_ rm -f /etc/profile.d/99-dietpi* # - Enable bash-completion for non-login shells: # - NB: It is called twice on login shells then, but breaks directly if called already once. - [[ -f /etc/profile.d/bash_completion.sh ]] && ln -sf /etc/profile.d/bash_completion.sh /etc/bashrc.d/dietpi-bash_completion.sh + [[ -f '/etc/profile.d/bash_completion.sh' ]] && ln -sf /etc/profile.d/bash_completion.sh /etc/bashrc.d/dietpi-bash_completion.sh #------------------------------------------------------------------------------- #Sparky unmute fix (re: @sudeep) # v2: https://github.com/MichaIng/DietPi/pull/1779 @@ -547,12 +559,12 @@ _EOF_ #Reinstalls # RPi (apply to all) LXDE missing icons under pcmanfm reinstall: https://github.com/MichaIng/DietPi/issues/1558#issuecomment-390328173 # v6.12 AirSonic - # SubSonic + # v6.23 SubSonic # Cava # CloudPrint # TightVNC/VNC4/RealVNC: https://github.com/MichaIng/DietPi/pull/1798#issuecomment-392594878 # v6.19 Xserver: https://github.com/MichaIng/DietPi/issues/1823 - (( $G_DIETPI_INSTALL_STAGE == 2 )) && /DietPi/dietpi/dietpi-software reinstall 23 27 28 34 119 120 137 + (( $G_DIETPI_INSTALL_STAGE == 2 )) && /DietPi/dietpi/dietpi-software reinstall 23 27 28 119 120 137 #------------------------------------------------------------------------------- #Initially allow non-root users to obtain network details as well: https://github.com/MichaIng/DietPi/commit/15c0d495c33d3091e219c87bb2d09a22f8d27e9c chmod -f 666 /{DietPi,boot}/dietpi/.network @@ -595,7 +607,7 @@ _EOF_ fi #------------------------------------------------------------------------------- #Fix Apache2 logging to "/error.log" instead of "/var/log/apache2/error.log": https://github.com/MichaIng/DietPi/commit/c991bd7dc579dbdc7c239e4c887b0962fa204006 - if [[ -d /etc/apache2/sites-available ]]; then + if [[ -d '/etc/apache2/sites-available' ]]; then for vhost in /etc/apache2/sites-available/*.conf do @@ -607,7 +619,7 @@ _EOF_ fi #------------------------------------------------------------------------------- #Disable "initial_turbo" option for RPi within config.txt, as it currently prevents CPU throttle down: https://github.com/MichaIng/DietPi/issues/1836 - if [[ -f /DietPi/config.txt ]] && grep -q '^[[:blank:]]*initial_turbo' /DietPi/config.txt; then + if [[ -f '/DietPi/config.txt' ]] && grep -q '^[[:blank:]]*initial_turbo' /DietPi/config.txt; then sed -i '/^[[:blank:]]*initial_turbo/d' /DietPi/config.txt echo -e '\n# Initial turbo currently leads to CPU not being throttled down by CPU governor: https://github.com/MichaIng/DietPi/issues/1836\n#initial_turbo=20' >> /DietPi/config.txt @@ -889,7 +901,7 @@ _EOF_ fi #------------------------------------------------------------------------------- #Reinstalls: - # # => v6.20 NAA: https://dietpi.com/phpbb/viewtopic.php?f=11&t=4420&p=13914#p13914 + # # => v6.20 NAA: https://dietpi.com/phpbb/viewtopic.php?p=13914#p13914 #------------------------------------------------------------------------------- elif (( $G_DIETPI_VERSION_SUB == 14 )); then @@ -927,7 +939,7 @@ _EOF_ (( $G_DIETPI_INSTALL_STAGE == 2 )) && /DietPi/dietpi/dietpi-software reinstall 146 #------------------------------------------------------------------------------- #Update DietPi-Sync save file to new format - if [[ -f /DietPi/dietpi/.dietpi-sync_settings ]] && ! grep -q '^FP_SOURCE=' /DietPi/dietpi/.dietpi-sync_settings; then + if [[ -f '/DietPi/dietpi/.dietpi-sync_settings' ]] && ! grep -q '^FP_SOURCE=' /DietPi/dietpi/.dietpi-sync_settings; then cp /DietPi/dietpi/.dietpi-sync_settings /DietPi/dietpi/.dietpi-sync_settings_bk cat << _EOF_ > /DietPi/dietpi/.dietpi-sync_settings @@ -947,7 +959,7 @@ _EOF_ #------------------------------------------------------------------------------- #Move to new WiFi cred array system and db store: https://github.com/MichaIng/DietPi/issues/368 - if [[ ! -f /var/lib/dietpi/dietpi-wifi.db ]]; then + if [[ ! -f '/var/lib/dietpi/dietpi-wifi.db' ]]; then cat << _EOF_ > /var/lib/dietpi/dietpi-wifi.db aWIFI_SSID[0]='$(grep -m1 '^[[:blank:]]*AUTO_SETUP_NET_WIFI_SSID=' /DietPi/dietpi.txt | sed 's/^[^=]*=//')' @@ -998,7 +1010,7 @@ _EOF_ #------------------------------------------------------------------------------- #Update IPv6 handling: https://github.com/MichaIng/DietPi/issues/2027 # - Advice user to re-enable IPv6 on kernel level - if [[ ! -d /proc/sys/net/ipv6 ]]; then + if [[ ! -d '/proc/sys/net/ipv6' ]]; then G_WHIP_MENU_ARRAY=( @@ -1151,7 +1163,7 @@ _EOF_ #------------------------------------------------------------------------------- # - Remove mysql.service as we use mariadb.service, both cannot exist: https://github.com/MichaIng/DietPi/issues/1913#issuecomment-441343798 - if [[ -f /etc/init.d/mysql ]] && (( $G_DISTRO >= 4 )); then + if [[ -f '/etc/init.d/mysql' ]] && (( $G_DISTRO >= 4 )); then G_DIETPI-NOTIFY 2 'Switching from /etc/init.d/mysql to mariadb.service' @@ -1176,11 +1188,11 @@ _EOF_ # OMPD: https://github.com/MichaIng/DietPi/issues/2156#issue-372201367 # MyMPD: https://github.com/MichaIng/DietPi/issues/2156#issue-372201367 # RoonBridge: https://community.roonlabs.com/t/dietpi-allo-units-not-getting-the-roonbridge-b167-update-from-b164/52503/10?u=dan_knight - # Radarr/lidarr/sonarr/jacket: https://github.com/MichaIng/DietPi/issues/2219 + # Radarr/Lidarr/Sonarr: https://github.com/MichaIng/DietPi/issues/2219 # Mosquitto: https://github.com/MichaIng/DietPi/issues/2243#issuecomment-439492463 if (( $G_DIETPI_INSTALL_STAGE == 2 )); then - /DietPi/dietpi/dietpi-software reinstall 106 121 123 129 144 145 147 148 + /DietPi/dietpi/dietpi-software reinstall 106 121 123 129 144 145 148 # - Switch to "mariadb" systemd service on Stretch+: https://github.com/MichaIng/DietPi/pull/2196 if (( $G_DISTRO > 3 )) && grep -q '^aSOFTWARE_INSTALL_STATE\[88\]=2' /DietPi/dietpi/.installed; then @@ -1212,19 +1224,19 @@ You will not face any practical differences, since both services start the same #------------------------------------------------------------------------------- #conf renaming: https://github.com/MichaIng/DietPi/pull/2312/files # - Apache - if [[ -f /etc/apache2/sites-available/owncloud.conf ]]; then + if [[ -f '/etc/apache2/sites-available/owncloud.conf' ]]; then a2dissite owncloud mv /etc/apache2/sites-available/owncloud.conf /etc/apache2/sites-available/dietpi-owncloud.conf fi - if [[ -f /etc/apache2/sites-available/nextcloud.conf ]]; then + if [[ -f '/etc/apache2/sites-available/nextcloud.conf' ]]; then a2dissite nextcloud mv /etc/apache2/sites-available/nextcloud.conf /etc/apache2/sites-available/dietpi-nextcloud.conf fi - if [[ -f /etc/apache2/sites-available/rutorrent.conf ]]; then + if [[ -f '/etc/apache2/sites-available/rutorrent.conf' ]]; then a2dissite rutorrent mv /etc/apache2/sites-available/rutorrent.conf /etc/apache2/sites-available/dietpi-rutorrent.conf @@ -1232,9 +1244,9 @@ You will not face any practical differences, since both services start the same fi # - Nginx - [[ -f /etc/nginx/sites-dietpi/owncloud.config ]] && mv /etc/nginx/sites-dietpi/owncloud.config /etc/nginx/sites-dietpi/dietpi-owncloud.conf - [[ -f /etc/nginx/sites-dietpi/nextcloud.config ]] && mv /etc/nginx/sites-dietpi/nextcloud.config /etc/nginx/sites-dietpi/dietpi-nextcloud.conf - [[ -f /etc/nginx/sites-dietpi/rutorrent.config ]] && mv /etc/nginx/sites-dietpi/rutorrent.config /etc/nginx/sites-dietpi/dietpi-rutorrent.conf + [[ -f '/etc/nginx/sites-dietpi/owncloud.config' ]] && mv /etc/nginx/sites-dietpi/owncloud.config /etc/nginx/sites-dietpi/dietpi-owncloud.conf + [[ -f '/etc/nginx/sites-dietpi/nextcloud.config' ]] && mv /etc/nginx/sites-dietpi/nextcloud.config /etc/nginx/sites-dietpi/dietpi-nextcloud.conf + [[ -f '/etc/nginx/sites-dietpi/rutorrent.config' ]] && mv /etc/nginx/sites-dietpi/rutorrent.config /etc/nginx/sites-dietpi/dietpi-rutorrent.conf # - Failsafe and custom entries for i in /etc/nginx/sites-dietpi/*.config do @@ -1274,7 +1286,7 @@ You will not face any practical differences, since both services start the same #------------------------------------------------------------------------------- #PB, fix kernel upgrades, switch from dev to stable and enable auto upgrades. - if (( $G_HW_MODEL == 44 )) && [[ ! -f /etc/armbian-release ]]; then + if (( $G_HW_MODEL == 44 )) && [[ ! -f '/etc/armbian-release' ]]; then cat << _EOF_ > /etc/armbian-release # PLEASE DO NOT EDIT THIS FILE @@ -1345,7 +1357,7 @@ _EOF_ # - Samba: Link disk cache to RAM: https://github.com/MichaIng/DietPi/issues/2396 if grep -q '^aSOFTWARE_INSTALL_STATE\[96\]=2' /DietPi/dietpi/.installed; then - [[ -e /var/cache/samba ]] && rm -R /var/cache/samba + [[ -e '/var/cache/samba' ]] && rm -R /var/cache/samba mkdir -p /var/run/samba-cache ln -s /var/run/samba-cache /var/cache/samba echo 'd /var/run/samba-cache - - - - -' > /etc/tmpfiles.d/dietpi-samba_cache.conf @@ -1374,24 +1386,24 @@ Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix #------------------------------------------------------------------------------- #DietPi file renaming/removal: # - autologin.conf: https://github.com/MichaIng/DietPi/pull/2343 - [[ -f /etc/systemd/system/getty@tty1.service.d/autologin.conf ]] && mv /etc/systemd/system/getty@tty1.service.d/autologin.conf /etc/systemd/system/getty@tty1.service.d/dietpi-autologin.conf + [[ -f '/etc/systemd/system/getty@tty1.service.d/autologin.conf' ]] && mv /etc/systemd/system/getty@tty1.service.d/autologin.conf /etc/systemd/system/getty@tty1.service.d/dietpi-autologin.conf # - README.md: https://github.com/MichaIng/DietPi/pull/2341 - [[ -f /boot/README.md ]] && mv /boot/README.md /boot/dietpi-README.md + [[ -f '/boot/README.md' ]] && mv /boot/README.md /boot/dietpi-README.md # - kill-ssh-user-sessions-before-network: https://github.com/MichaIng/DietPi/pull/2357/commits/c8eb15c169cfaba69fec0b3e631e2241e0bdb7d5 systemctl disable kill-ssh-user-sessions-before-network 2> /dev/null - [[ -f /etc/systemd/system/kill-ssh-user-sessions-before-network.service ]] && rm /etc/systemd/system/kill-ssh-user-sessions-before-network.service - [[ -f /var/lib/dietpi/services/kill-ssh-user-sessions-before-network.sh ]] && rm /var/lib/dietpi/services/kill-ssh-user-sessions-before-network.sh + [[ -f '/etc/systemd/system/kill-ssh-user-sessions-before-network.service' ]] && rm /etc/systemd/system/kill-ssh-user-sessions-before-network.service + [[ -f '/var/lib/dietpi/services/kill-ssh-user-sessions-before-network.sh' ]] && rm /var/lib/dietpi/services/kill-ssh-user-sessions-before-network.sh systemctl daemon-reload systemctl enable dietpi-kill_ssh # - dietpi-unsupported_terminal.sh: https://github.com/MichaIng/DietPi/issues/2347 - [[ -f /etc/profile.d/dietpi-unsupported_terminal.sh ]] && rm /etc/profile.d/dietpi-unsupported_terminal.sh + [[ -f '/etc/profile.d/dietpi-unsupported_terminal.sh' ]] && rm /etc/profile.d/dietpi-unsupported_terminal.sh # - Possible leftover from PREP: rm -f /{DietPi,boot}/dietpi/pre-patch_file # - dietpi/conf removal from RAMdisk: https://github.com/MichaIng/DietPi/pull/2393 rm -Rf /{DietPi,boot}/dietpi/conf #------------------------------------------------------------------------------- #.dietpi-autostart_index removal, if zero: https://github.com/MichaIng/DietPi/pull/2343 - [[ -f /DietPi/dietpi/.dietpi-autostart_index ]] && (( $( /etc/apt/preferences.d/dietpi-docker_fix systemctl daemon-reload #------------------------------------------------------------------------------- #Re-enable owncloud/Nextcloud Apache configs, to fix faulty v6.19 installs: https://github.com/MichaIng/DietPi/pull/2361/commits/e33ca150cf29a4f278f5df2defc495053700a91e - [[ -f /etc/apache2/sites-available/dietpi-owncloud.conf ]] && a2ensite dietpi-owncloud - [[ -f /etc/apache2/sites-available/dietpi-nextcloud.conf ]] && a2ensite dietpi-nextcloud + [[ -f '/etc/apache2/sites-available/dietpi-owncloud.conf' ]] && a2ensite dietpi-owncloud + [[ -f '/etc/apache2/sites-available/dietpi-nextcloud.conf' ]] && a2ensite dietpi-nextcloud #------------------------------------------------------------------------------- #Clear install state for Medusa (( $G_DIETPI_INSTALL_STAGE == 2 )) && [[ ! -d $G_FP_DIETPI_USERDATA/medusa ]] && G_CONFIG_INJECT 'aSOFTWARE_INSTALL_STATE\[116\]=' 'aSOFTWARE_INSTALL_STATE[116]=0' /DietPi/dietpi/.installed # - Inform user about SickRage being replaced by Medusa - if [[ -d /etc/sickrage || -d $G_FP_DIETPI_USERDATA/sickrage ]]; then + if [[ -d '/etc/sickrage' || -d $G_FP_DIETPI_USERDATA/sickrage ]]; then G_WHIP_MSG '[WARNING] We found an existing SickRage install on your system\n We already dropped SickRage from DietPi-Software install options with v6.18, now it has been fully replaced with "Medusa", an older stabilized fork. @@ -1428,9 +1440,9 @@ Also have a look at "Sonarr", another alternative TV show manager, available for fi #------------------------------------------------------------------------------- #Remove obsolete flags: https://github.com/MichaIng/DietPi/pull/2398#issuecomment-452398770 - [[ -f /var/lib/dietpi/.G_RPI_UPDATE ]] && rm /var/lib/dietpi/.G_RPI_UPDATE + [[ -f '/var/lib/dietpi/.G_RPI_UPDATE' ]] && rm /var/lib/dietpi/.G_RPI_UPDATE #https://github.com/MichaIng/DietPi/pull/2407/commits/5b7ad8bddc9dd5ffe89a2614615eb936333c8d41 - [[ -f /var/lib/dietpi/.compiled_i-sabre-k2m ]] && rm /var/lib/dietpi/.compiled_i-sabre-k2m + [[ -f '/var/lib/dietpi/.compiled_i-sabre-k2m' ]] && rm /var/lib/dietpi/.compiled_i-sabre-k2m #------------------------------------------------------------------------------- #RPi changes: https://github.com/MichaIng/DietPi/pull/2402 if (( $G_HW_MODEL < 10 )); then @@ -1469,7 +1481,7 @@ Also have a look at "Sonarr", another alternative TV show manager, available for iwconfig wlan$(sed -n 2p /DietPi/dietpi/.network) power off &> /dev/null || sed -i '/^wireless-power/d' /etc/network/interfaces #------------------------------------------------------------------------------- #Grafana port change - [[ -f /etc/grafana/grafana.ini ]] && G_WHIP_MSG '[INFO]:\nGrafana port has changed to 3001 (previously 3000).' + [[ -f '/etc/grafana/grafana.ini' ]] && G_WHIP_MSG '[INFO]:\nGrafana port has changed to 3001 (previously 3000).' #------------------------------------------------------------------------------- #Remove armbian banner/profiles left on ASUS TB image rm -f /etc/profile.d/armbian-* @@ -1480,7 +1492,7 @@ Also have a look at "Sonarr", another alternative TV show manager, available for #------------------------------------------------------------------------------- #Image updates if (( $G_HW_MODEL == 40 || $G_HW_MODEL == 42 || $G_HW_MODEL == 43 )) && #$G_HW_MODEL == 42 || #Kernel panic... - [[ ! -f /etc/armbian-release ]]; then + [[ ! -f '/etc/armbian-release' ]]; then G_WHIP_MSG "[INFO]:\nThe base image for $G_HW_MODEL_DESCRIPTION has been updated.\nPlease reinstall your system with the latest image from https://dietpi.com/download.\n\nYou can continue to use this existing installation, however, some kernel features may not be available." @@ -1518,7 +1530,7 @@ Do you still want to keep "p7zip-full"?'; then fi #------------------------------------------------------------------------------- #Fix Pi-hole permissions to allow "pihole -up" - if [[ -d /var/www/html/pihole ]]; then + if [[ -d '/var/www/html/pihole' ]]; then cd /var/www/html/admin && git reset --hard HEAD cd /tmp/$G_PROGRAM_NAME @@ -1526,7 +1538,7 @@ Do you still want to keep "p7zip-full"?'; then fi #------------------------------------------------------------------------------- #WireGuard: Harden "sid" repo handling and on RPi, catch up on installing the Debian keyring: https://github.com/MichaIng/DietPi/pull/2571 - if [[ -f /etc/apt/preferences.d/dietpi-wireguard ]]; then + if [[ -f '/etc/apt/preferences.d/dietpi-wireguard' ]]; then if (( $G_HW_MODEL < 10 )); then @@ -1542,7 +1554,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior fi #------------------------------------------------------------------------------- #MPD: Fix permissions issue: https://github.com/MichaIng/DietPi/issues/2462 - if [[ -f /etc/mpd.conf ]]; then + if [[ -f '/etc/mpd.conf' ]]; then sed -Ei '/^(user|group)[[:blank:]]/d' /etc/mpd.conf sed -i '/^Group=/d' /lib/systemd/system/mpd.service @@ -1586,10 +1598,10 @@ _EOF_ systemctl daemon-reload #------------------------------------------------------------------------------- #Remove obsolete DietPi-Sync log: https://github.com/MichaIng/DietPi/pull/2606 - [[ -f /var/log/dietpi-sync.log ]] && rm /var/log/dietpi-sync.log + [[ -f '/var/log/dietpi-sync.log' ]] && rm /var/log/dietpi-sync.log #------------------------------------------------------------------------------- #XU4, use Meveric's xorg.conf which detects 3.x and 4.x kernel configuration requirments: - if (( $G_HW_MODEL == 11 )) && [[ -f /etc/X11/xorg.conf ]]; then + if (( $G_HW_MODEL == 11 )) && [[ -f '/etc/X11/xorg.conf' ]]; then rm /etc/X11/xorg.conf G_AGI --reinstall firmware-samsung xf86-video-armsoc-odroid malit628-odroid @@ -1597,7 +1609,7 @@ _EOF_ fi #------------------------------------------------------------------------------- #DietPi-Survey: Remove survey sent count from settings file: https://github.com/MichaIng/DietPi/pull/2626 - if [[ -f /DietPi/dietpi/.dietpi-survey ]]; then + if [[ -f '/DietPi/dietpi/.dietpi-survey' ]]; then local survey_opted_in=$(sed -n 1p /DietPi/dietpi/.dietpi-survey) echo $survey_opted_in > /DietPi/dietpi/.dietpi-survey @@ -1617,14 +1629,14 @@ _EOF_ fi #------------------------------------------------------------------------------- #Nextcloud: Add OCM/OCS provider redirects as this is checked and printed as warning on admin panel: https://github.com/MichaIng/DietPi/issues/2638 - if [[ -f /etc/apache2/sites-available/dietpi-nextcloud.conf ]] && + if [[ -f '/etc/apache2/sites-available/dietpi-nextcloud.conf' ]] && ! grep -q 'oc[ms]-provider' /etc/apache2/sites-available/dietpi-nextcloud.conf; then echo 'Redirect permanent /ocm-provider /nextcloud/ocm-provider Redirect permanent /ocs-provider /nextcloud/ocs-provider' >> /etc/apache2/sites-available/dietpi-nextcloud.conf fi - if [[ -f /etc/lighttpd/conf-available/99-dietpi-nextcloud.conf ]] && + if [[ -f '/etc/lighttpd/conf-available/99-dietpi-nextcloud.conf' ]] && ! grep -q 'oc[ms]-provider' /etc/lighttpd/conf-available/99-dietpi-nextcloud.conf; then echo 'url.redirect += ( @@ -1633,7 +1645,7 @@ Redirect permanent /ocs-provider /nextcloud/ocs-provider' >> /etc/apache2/sites- )' >> /etc/lighttpd/conf-available/99-dietpi-nextcloud.conf fi - if [[ -f /etc/nginx/sites-dietpi/dietpi-nextcloud.conf ]] && + if [[ -f '/etc/nginx/sites-dietpi/dietpi-nextcloud.conf' ]] && ! grep -q 'oc[ms]-provider' /etc/nginx/sites-dietpi/dietpi-nextcloud.conf; then echo 'location ~ ^\/(?:ocm-provider|ocs-provider).* { @@ -1692,6 +1704,275 @@ NB: When accessing "deluge-console" you need to do that as user "debian-deluged" fi #------------------------------------------------------------------------------- + elif (( $G_DIETPI_VERSION_SUB == 22 )); then + + #------------------------------------------------------------------------------- + # Apply Serial/UART rework: https://github.com/MichaIng/DietPi/pull/2678 + # - Cleanup: Remove serial-getty masks for all non-existent serial devices + for i in /etc/systemd/system/serial-getty@tty{S,AMA,SAC}[0-9].service + do + + [[ -L $i && $(readlink $i) == '/dev/null' ]] || continue + local tty=${i##*serial-getty@} + tty=${tty%.service} + [[ -e /dev/$tty ]] || systemctl unmask serial-getty@$tty + + done + # - Fix: Disable serial-getty instances for all non-existent serial devices + for i in /etc/systemd/system/getty.target.wants/serial-getty@tty{S,AMA,SAC}[0-9].service + do + + [[ -L $i ]] || continue + local tty=${i##*serial-getty@} + tty=${tty%.service} + [[ -e /dev/$tty ]] || systemctl disable serial-getty@$tty + + done + #------------------------------------------------------------------------------- + # Patch proxy settings changes: https://github.com/MichaIng/DietPi/pull/2716 + sed -i '/^[[:blank:]]*CONFIG_PROXY_ENABLED=/d' /DietPi/dietpi.txt + local proxy='' + if proxy=$(grep '^[[:blank:]]*export {http,https,ftp}_proxy=' /etc/bash.bashrc); then + + [[ -f '/etc/bashrc.d/dietpi-proxy.sh' ]] || echo "$proxy" > /etc/bashrc.d/dietpi-proxy.sh + sed -i '/^[[:blank:]]*export {http,https,ftp}_proxy=/d' /etc/bash.bashrc + + fi + #------------------------------------------------------------------------------- + # dietpi-set_dphys-swapfile renamed to: "dietpi-set_swapfile": https://github.com/MichaIng/DietPi/pull/2720 + rm -f /{DietPi,boot}/dietpi/func/dietpi-set_dphys-swapfile + #------------------------------------------------------------------------------- + # Remove obsolete OpenJDK APT preferences on Jessie: https://github.com/MichaIng/DietPi/pull/2753 + [[ -f '/etc/apt/preferences.d/99-dietpi-openjdk-8-jdk' ]] && rm /etc/apt/preferences.d/99-dietpi-openjdk-8-jdk + #------------------------------------------------------------------------------- + if (( $G_DIETPI_INSTALL_STAGE == 2 )); then + + # Infom Sonarr/Radarr/Lidarr users about DietPi-Arr_to_RAM: https://github.com/MichaIng/DietPi/pull/2698 + # - Skip on Jessie: https://github.com/MichaIng/DietPi/issues/2689#issuecomment-487306241 + if (( $G_DISTRO > 3 )) && grep -qE '^aSOFTWARE_INSTALL_STATE\[(106|144|145)\]=2' /DietPi/dietpi/.installed; then + + G_WHIP_MSG 'DietPi-Arr_to_RAM | Link Sonarr/Radarr/Lidarr database files to RAM\n +With v6.18 we silently added a new script that allows linking Sonarr/Radarr/Lidarr database files to RAM, increasing access performance, reducing disk I/O and avoiding constant external HDD spinning due to the very regular access to these files.\n +This script has gone through some rework and polishing with v6.23 and can now be enabled to automatically link those databases to RAM on boot and store them back to disk on shutdown.\n +Further info and usage: https://dietpi.com/phpbb/viewtopic.php?f=8&t=5828' + #----------------------------------------------------------------------- + # Jessie C1 switch to Stretch | should not occur for pre-patch compatible versions and auto switch over to jessie-support for existing installs. + elif (( $G_HW_MODEL == 10 )); then + + G_WHIP_MSG '[INFO] Odroid C1 image has been updated to Stretch. Please upgrade to continue limited support for this device:\nhttps://github.com/MichaIng/DietPi/issues/2561#issuecomment-488685121' + + fi + #----------------------------------------------------------------------- + # Fix IPv6 connections with WireGuard: https://github.com/MichaIng/DietPi/issues/2691 + if [[ -f '/etc/wireguard/wg0.conf' ]] && ! grep -q 'sysctl' /etc/wireguard/wg0.conf; then + + [[ -f '/etc/sysctl.d/dietpi-wireguard.conf' ]] && rm /etc/sysctl.d/dietpi-wireguard.conf + sed -i '/^ListenPort/a\PostUp = sysctl net.ipv4.conf.%i.forwarding=1 net.ipv4.conf.$(sed -n 3p /DietPi/dietpi/.network).forwarding=1' /etc/wireguard/wg0.conf + sed -i '/^ListenPort/a\PostUp = sysctl net.ipv6.conf.$(sed -n 3p /DietPi/dietpi/.network).accept_ra=2' /etc/wireguard/wg0.conf + sed -i '/^ListenPort/a\PostUp = sysctl net.ipv6.conf.%i.forwarding=1 net.ipv6.conf.$(sed -n 3p /DietPi/dietpi/.network).forwarding=1' /etc/wireguard/wg0.conf + sed -i '/^ListenPort/a\PostUp = ip6tables -A FORWARD -i %i -j ACCEPT; ip6tables -t nat -A POSTROUTING -o $(sed -n 3p /DietPi/dietpi/.network) -j MASQUERADE' /etc/wireguard/wg0.conf + sed -i '/^ListenPort/a\PostDown = ip6tables -D FORWARD -i %i -j ACCEPT; ip6tables -t nat -D POSTROUTING -o $(sed -n 3p /DietPi/dietpi/.network) -j MASQUERADE' /etc/wireguard/wg0.conf + + fi + #----------------------------------------------------------------------- + # NordVPN: Tiny fix for doubled auth-user-pass entry: https://github.com/MichaIng/DietPi/commit/847a016638c6929153dc16e7ce054d3dce5e4c60 + if [[ -f '/var/lib/dietpi/dietpi-software/installed/dietpi-nordvpn/settings_dietpi.conf' ]]; then + + . /var/lib/dietpi/dietpi-software/installed/dietpi-nordvpn/settings_dietpi.conf + if [[ -f /etc/openvpn/ovpn_$PROTOCOL/$NORDVPN_SERVER && $(grep -c '^auth-user-pass' /etc/openvpn/ovpn_$PROTOCOL/$NORDVPN_SERVER) == 2 ]]; then + + sed -i '/^auth-user-pass$/d' /etc/openvpn/ovpn_$PROTOCOL/$NORDVPN_SERVER + + fi + unset NORDVPN_USERNAME NORDVPN_PASSWORD NORDVPN_SERVER PROTOCOL + + fi + #----------------------------------------------------------------------- + # Remove obsolete "bluetooth" meta package and mark bluez instead + if dpkg-query -s bluetooth &> /dev/null; then + + apt-mark manual bluez + apt-mark auto bluetooth + G_AGA + + fi + #----------------------------------------------------------------------- + # Add /etc/network/interfaces.d/ drop-in config support + grep -q 'interfaces\.d' /etc/network/interfaces || sed -i '1i\source interfaces.d/*' /etc/network/interfaces + #----------------------------------------------------------------------- + # Blynk: Fix logging and move to RAMlog: https://github.com/MichaIng/DietPi/pull/2779 + if [[ -f '/etc/systemd/system/blynkserver.service' && -f $G_FP_DIETPI_USERDATA/blynk/server.properties ]]; then + + G_CONFIG_INJECT 'WorkingDirectory=' "WorkingDirectory=$G_FP_DIETPI_USERDATA/blynk" /etc/systemd/system/blynkserver.service '\[Service\]' + mkdir -p /var/log/blynk + chown -R blynk:dietpi /var/log/blynk + G_CONFIG_INJECT 'logs.folder=' 'logs.folder=/var/log/blynk' $G_FP_DIETPI_USERDATA/blynk/server.properties + + fi + #----------------------------------------------------------------------- + # PHP7.3 migration: https://github.com/MichaIng/DietPi/issues/2367 + local reinstall_ids='' + local upgrade_php=0 + if grep -q '^aSOFTWARE_INSTALL_STATE\[89\]=2' /DietPi/dietpi/.installed; then + + # ownCloud (up to v10.2) does not yet support PHP7.3, so install PHP7.2 for now + # phpBB 3.2.X: https://github.com/phpbb/phpbb/blob/3.2.x/phpBB/install/app.php#L23 + local PHP_NAME='php7.3' + [[ -f '/var/www/owncloud/occ' || -f '/var/www/phpBB3/config.php' ]] && PHP_NAME='php7.2' + + if ! command -v $PHP_NAME &> /dev/null; then + + reinstall_ids+=' 89' + G_WHIP_MSG "[ INFO ] PHP upgrade\n +Your PHP instance will be upgraded to ${PHP_NAME^^}. This enhances security and performance of your web applications and is required to run some of the latest web application versions, e.g. Nextcloud 16, ownCloud 10.2 and others.\n +We will update webserver configurations and backup the whole /etc/php(5) directory to /mnt/dietpi_userdata/php(5)_bak, so you can recover custom settings.\n +NB: For any custom PHP-dependent web applications, which you have installed manually (outside of DietPi-Software), you might need to adjust the used socket to: /run/php/$PHP_NAME-fpm.sock +NBB: Reinstall manually installed PHP modules via: G_AGI $PHP_NAME-" + upgrade_php=1 + + # We need to upgrade Jessie Nextcloud users since NC13 does not support PHP7.3 yet. Check for NC < 14 in general and do incremental upgrading in case. + local upgrade_nextcloud=0 + while [[ -f '/var/www/nextcloud/version.php' ]] + do + + # - Estimate Nextcloud version, skip if higher than 13 or invalid + local nextcloud_version=$(grep '$OC_VersionString' /var/www/nextcloud/version.php | sed "s/^.*= '//" | sed 's/\..*$//g') + disable_error=1 G_CHECK_VALIDINT "$nextcloud_version" 9 13 || break + + # - Inform user + G_WHIP_MSG '[ INFO ] Nextcloud will be upgraded\n +Your Nextcloud version does not yet support PHP7.3. On Jessie systems this is expected where Nextcloud 14+ was not supported.\n +We will upgrade your Nextcloud version to Nextcloud 14 now to allow the PHP upgrade, which on the other hand enables you to further upgrade Nextcloud to its current major version.\n +We will create a full backup of your Nextcloud install directory and database to: /mnt/dietpi_userdata/nextcloud_data/ +Your Nextcloud data are not touched.' + upgrade_nextcloud=1 + + # - Backup database and install dir: Use our cloud migration script + # In case of failure, exit to not create any damage + local GITOWNER=$(grep -m1 '^[[:blank:]]*DEV_GITOWNER=' /DietPi/dietpi.txt | sed 's/^[^=]*=//'); GITOWNER=${GITOWNER:-MichaIng} + local GITBRANCH=$(grep -m1 '^[[:blank:]]*DEV_GITBRANCH=' /DietPi/dietpi.txt | sed 's/^[^=]*=//'); GITBRANCH=${GITBRANCH:-master} + local url="https://raw.githubusercontent.com/$GITOWNER/DietPi/$GITBRANCH/.meta/dietpi-cloud-migration" + G_CHECK_URL "$url" + curl -sSL "$url" | bash + G_ERROR_HANDLER_EXITCODE=$? + G_ERROR_HANDLER_COMMAND='Nextcloud backup' + G_ERROR_HANDLER_RETRY=0 + G_ERROR_HANDLER + + # - Incremental upgrade since skipping major versions is not supported. There should be no installs < NC13 but let's be failsafe. + until (( $nextcloud_version > 13 )) + do + + ((nextcloud_version++)) + G_CHECK_URL https://download.nextcloud.com/server/releases/latest-$nextcloud_version.tar.bz2 + G_RUN_CMD wget https://download.nextcloud.com/server/releases/latest-$nextcloud_version.tar.bz2 + G_RUN_CMD rm -R /var/www/nextcloud + G_RUN_CMD tar xf latest-$nextcloud_version.tar.bz2 -C /var/www + G_RUN_CMD cp -a /mnt/dietpi_userdata/nextcloud_data/dietpi-nextcloud-installation-backup/config/config.php /var/www/nextcloud/config/config.php + # - Restore custom apps but prevent overwriting upgraded ones or adding obsolete files + for i in /mnt/dietpi_userdata/nextcloud_data/dietpi-nextcloud-installation-backup/apps/* + do + + [[ -d /var/www/nextcloud/apps/${i##*/} ]] || G_RUN_CMD cp -a $i /var/www/nextcloud/apps/ + + done + # - Permissions + G_RUN_CMD chown -R www-data:www-data /var/www/nextcloud + G_RUN_CMD find /var/www/nextcloud/ -type d -exec chmod 750 {} \; + G_RUN_CMD find /var/www/nextcloud/ -type f -exec chmod 640 {} \; + # - Upgrade until NC13, then upgrade after PHP7.3 has been installed, since NC13 does not support PHP5.6 anymore + (( $nextcloud_version < 14 )) && { ncc upgrade || exit 1; } + + done + break + + done + + [[ -d '/etc/php' ]] && G_RUN_CMD cp -a /etc/php /mnt/dietpi_userdata/php_bak + [[ -d '/etc/php5' ]] && G_RUN_CMD cp -a /etc/php5 /mnt/dietpi_userdata/php5_bak + + # - Lighttpd + [[ -f '/etc/lighttpd/conf-available/15-fastcgi-php.conf' ]] && sed -i "s@\"socket\".*\$@\"socket\" => \"/run/php/$PHP_NAME-fpm.sock\",@" /etc/lighttpd/conf-available/15-fastcgi-php.conf + # - Nginx + [[ -f '/etc/nginx/nginx.conf' ]] && sed -i "s#/run/php.*-fpm.sock#/run/php/$PHP_NAME-fpm.sock#g" /etc/nginx/nginx.conf + + fi + + fi + #----------------------------------------------------------------------- + # Re-create /etc/sysctl.d/99-sysctl.conf -> ../sysctl.conf symlink if not existent: https://github.com/MichaIng/DietPi/issues/2505 + if [[ ! -L '/etc/sysctl.d/99-sysctl.conf' ]]; then + + [[ -e '/etc/sysctl.d/99-sysctl.conf' ]] && mv /etc/sysctl.d/99-sysctl.conf /etc/sysctl.conf + ln -sf ../sysctl.conf /etc/sysctl.d/99-sysctl.conf + + fi + #----------------------------------------------------------------------- + # Reinstalls + # Subsonic: https://github.com/MichaIng/DietPi/pull/2705 + [[ -L '/var/subsonic/transcode' ]] && rm /var/subsonic/transcode + # Plex Media Server: https://github.com/MichaIng/DietPi/pull/2722 + dpkg-query -s plexmediaserver-installer &> /dev/null && dpkg -r plexmediaserver-installer + [[ -f '/etc/apt/sources.list.d/plex.list' ]] && rm /etc/apt/sources.list.d/plex.list + # Logitech Media Server: https://github.com/MichaIng/DietPi/commit/eccef6700381c3f044ec4d435beb167736db0bb4 + if [[ -f '/etc/systemd/system/squeezeboxserver.service' ]]; then + + systemctl disable squeezeboxserver + mv /etc/systemd/system/squeezeboxserver.service /etc/systemd/system/logitechmediaserver.service + + fi + # SABnzbd: https://github.com/MichaIng/DietPi/pull/2768 + # Jackett: https://github.com/MichaIng/DietPi/pull/2773 + if [[ -d '/opt/jackett/.config' ]]; then + + cp -a /opt/jackett/.config/. /opt/jackett/ + rm -R /opt/jackett/.config + + fi + /DietPi/dietpi/dietpi-software reinstall 34 35 42 139 147 $reinstall_ids + #----------------------------------------------------------------------- + # Remove old PHP version + if (( $upgrade_php )); then + + G_AGP php{5,7.0,7.1}-* libapache2-mod-php{5,7.0,7.1} + [[ $PHP_NAME = 'php7.3' ]] && G_AGP php7.2-* libapache2-mod-php7.2 + # New mod-php must be enabled manually since this is skipped by APT as long as prior version is active + command -v a2enmod &> /dev/null && a2enmod $PHP_NAME + + # Recover ownCloud, Nextcloud and Pydio PHP modules + if grep -q '^aSOFTWARE_INSTALL_STATE\[47\]=2' /DietPi/dietpi/.installed; then + + G_AGI $PHP_NAME-intl + echo -e '; ownCloud PHP settngs\n; priority=99\napc.enable_cli=1' > /etc/php/${PHP_NAME#php}/mods-available/dietpi-owncloud.ini + phpenmod dietpi-owncloud + + fi + if grep -q '^aSOFTWARE_INSTALL_STATE\[114\]=2' /DietPi/dietpi/.installed; then + + G_AGI $PHP_NAME-intl + echo -e '; Nextcloud PHP settngs\n; priority=99\napc.enable_cli=1\nopcache.enable=1\nopcache.interned_strings_buffer=8 +opcache.max_accelerated_files=10000\nopcache.memory_consumption=128\nopcache.save_comments=1\nopcache.revalidate_freq=1' > /etc/php/${PHP_NAME#php}/mods-available/dietpi-nextcloud.ini + phpenmod dietpi-nextcloud + + fi + grep -q '^aSOFTWARE_INSTALL_STATE\[48\]=2' /DietPi/dietpi/.installed && G_AGI $PHP_NAME-intl + + # Upgrade Nextcloud + if (( $upgrade_nextcloud )); then + + local mariadb='mariadb'; (( $G_DISTRO < 4 )) && mariadb='mysql' + G_RUN_CMD systemctl start $mariadb redis-server + ncc upgrade + ncc db:add-missing-indices + ncc db:convert-filecache-bigint + + fi + + fi + + fi + #------------------------------------------------------------------------------- + fi #------------------------------------------------------------------------------- diff --git a/dietpi/pre-patch_file b/dietpi/pre-patch_file index 30f092fe95..f0ed8ac6c4 100644 --- a/dietpi/pre-patch_file +++ b/dietpi/pre-patch_file @@ -9,10 +9,10 @@ #//////////////////////////////////// # # Info: - # - Online pre-patching for client system for changes made to update system and critical bug fixes + # - Patches changes made to update system, critical bug fixes and changes that need to be applied before APT and patch_file to run without error # - Runs from dietpi-update as very first update step # - In case of failure, returns related pre-patch ID as exit code - # - NB: Keep this script as simple as possible, do not load/call dietpi-globals, to allow fixing most kinds of DietPi code issues! + # - NB: Keep this script as simple as possible, do not load/call dietpi-globals, to allow adjusting/fixing most kinds of DietPi code first! # # Usage: # - ./pre-patch_file $G_DIETPI_VERSION_SUB @@ -22,7 +22,7 @@ echo -e '\n \e[38;5;154mDietPi-Pre-patch\e[0m \e[90m───────────────────────────────────────────────────── - Mode: \e[0mApplying critical pre-patches\n' + Mode: \e[0mApplying pre-patches\n' # Grab input, being failsafe when applying to $G_DIETPI_VERSION_SUB if [[ $1 =~ ^-?[0-9]+$ ]]; then @@ -40,51 +40,104 @@ # Main loop #/////////////////////////////////////////////////////////////////////////////// - while (( $EXIT_CODE == 0 )) + until (( $EXIT_CODE )) do #------------------------------------------------------------------------------- # Pre-patch 1: RAMlog 0 free space check due to issues with failing DietPi cron jobs in v6.11 if (( $G_DIETPI_VERSION_SUB < 12 && $(df -B1M --output=avail /var/log | sed -n 2p) < 2 )); then - echo -e '\e[90m[\e[0m \e[33mWARN\e[0m \e[90m]\e[0m Pre-patch 1 | Clearing /var/log files to free up RAMlog space (<2MB) before update will continue' + echo -e '\e[90m[\e[0m INFO \e[90m]\e[0m Pre-patch 1 | Clearing /var/log files to free up RAMlog space (<2MB) before update will continue' /DietPi/dietpi/func/dietpi-logclear 1 || { EXIT_CODE=1; break; } fi #------------------------------------------------------------------------------- # Pre-patch 2: https://github.com/MichaIng/DietPi/pull/2490 - if (( $G_DIETPI_VERSION_SUB < 21 )) && [[ -f /etc/mysql/mariadb.conf.d/99-dietpi-4byte.cnf ]] && + if (( $G_DIETPI_VERSION_SUB < 21 )) && [[ -f '/etc/mysql/mariadb.conf.d/99-dietpi-4byte.cnf' ]] && grep -qi 'buster' /etc/os-release; then - echo -e '\e[90m[\e[0m \e[33mWARN\e[0m \e[90m]\e[0m Pre-patch 2 | Patching /etc/mysql/mariadb.conf.d/99-dietpi-4byte.cnf for MariaDB v10.3/Buster support' + echo -e '\e[90m[\e[0m INFO \e[90m]\e[0m Pre-patch 2 | Patching /etc/mysql/mariadb.conf.d/99-dietpi-4byte.cnf for MariaDB v10.3/Buster support' sed -i '/innodb_large_prefix/d' /etc/mysql/mariadb.conf.d/99-dietpi-4byte.cnf || { EXIT_CODE=2; break; } sed -i '/innodb_file_format/d' /etc/mysql/mariadb.conf.d/99-dietpi-4byte.cnf || { EXIT_CODE=2; break; } fi #------------------------------------------------------------------------------- # Pre-patch 3: https://github.com/MichaIng/DietPi/issues/2213 + if (( $G_DIETPI_VERSION_SUB < 22 )) && + GLOBAL_PW=$(openssl enc -d -a -aes-256-cbc -nosalt -pass pass:'DietPiRocks!' -in /var/lib/dietpi/dietpi-software/.GLOBAL_PW.bin 2> /dev/null); then + + echo -e '\e[90m[\e[0m INFO \e[90m]\e[0m Pre-patch 3 | Storing global DietPi-Software password with enhanced security' + grep -qi 'buster' /etc/os-release && pbkdf2='-iter 10000' || pbkdf2='' + openssl enc -e -a -md sha256 -aes-256-cbc $pbkdf2 -salt -pass pass:'DietPiRocks!' -out /var/lib/dietpi/dietpi-software/.GLOBAL_PW.bin <<< $GLOBAL_PW || { EXIT_CODE=3; break; } + + fi + #------------------------------------------------------------------------------- # Pre-patch 4: https://github.com/MichaIng/DietPi/issues/2656 - if (( $G_DIETPI_VERSION_SUB < 22 )); then + # Pre-patch 5: Add new G_CHECK_URL dietpi.txt settings + if (( $G_DIETPI_VERSION_SUB < 23 )); then - if GLOBAL_PW=$(openssl enc -d -a -aes-256-cbc -nosalt -pass pass:'DietPiRocks!' -in /var/lib/dietpi/dietpi-software/.GLOBAL_PW.bin 2> /dev/null); then + if [[ -f '/etc/apt/preferences.d/dietpi-wireguard' ]]; then - echo -e '\e[90m[\e[0m \e[33mWARN\e[0m \e[90m]\e[0m Pre-patch 3 | Storing global DietPi-Software password with enhanced security' - grep -qi 'buster' /etc/os-release && pbkdf2='-iter 10000' || pbkdf2='' - openssl enc -e -a -md sha256 -aes-256-cbc $pbkdf2 -salt -pass pass:'DietPiRocks!' -out /var/lib/dietpi/dietpi-software/.GLOBAL_PW.bin <<< $GLOBAL_PW || { EXIT_CODE=3; break; } + echo -e '\e[90m[\e[0m INFO \e[90m]\e[0m Pre-patch 4 | Hardening Debian Sid repo usage to prevent accidental distro upgrades but allow auto-upgrades for WireGuard packages' + echo -e 'Package: *\nPin: release n=sid\nPin-Priority: -1\n +Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Priority: 100' > /etc/apt/preferences.d/dietpi-wireguard || { EXIT_CODE=4; break; } fi - if [[ -f /etc/apt/preferences.d/dietpi-wireguard ]]; then - echo -e '\e[90m[\e[0m \e[33mWARN\e[0m \e[90m]\e[0m Pre-patch 4 | Hardening Debian Sid repo usage to prevent accidental distro upgrades' - echo -e 'Package: *\nPin: release n=sid\nPin-Priority: -1\n -Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Priority: 99' > /etc/apt/preferences.d/dietpi-wireguard || { EXIT_CODE=4; break; } + grep -q 'CONFIG_G_CHECK_URL_TIMEOUT' /DietPi/dietpi.txt || echo 'CONFIG_G_CHECK_URL_TIMEOUT=5' >> /DietPi/dietpi.txt || { EXIT_CODE=5; break; } + grep -q 'CONFIG_G_CHECK_URL_ATTEMPTS' /DietPi/dietpi.txt || echo 'CONFIG_G_CHECK_URL_ATTEMPTS=3' >> /DietPi/dietpi.txt || { EXIT_CODE=5; break; } + + fi + #------------------------------------------------------------------------------- + # Pre-patch 6: Move Jessie systems to "jessie-support" branch: https://github.com/MichaIng/DietPi/issues/2332 + # Pre-patch 7: https://github.com/MichaIng/DietPi/pull/2728 + if grep -qi 'jessie' /etc/os-release; then + + if ! grep -q '^[[:blank:]]*DEV_GITBRANCH=jessie-support' /DietPi/dietpi.txt; then + + echo -e '\e[90m[\e[0m INFO \e[90m]\e[0m Pre-patch 7 | Migrating Jessie systems to "jessie-support" update branch' + if grep -q '^[[:blank:]]*DEV_GITBRANCH=' /DietPi/dietpi.txt; then + + sed -i '/^[[:blank:]]*DEV_GITBRANCH=/c\DEV_GITBRANCH=jessie-support' /DietPi/dietpi.txt + + else + + echo 'DEV_GITBRANCH=jessie-support' >> /DietPi/dietpi.txt + + fi + + # Remove DietPi-Update working directory to allow concurrent execution. + cd /tmp + [[ -d '/tmp/DietPi-Update' ]] && rm -R /tmp/DietPi-Update + + # Apply update forcefully, since user has already chosen to do so. + /DietPi/dietpi/dietpi-update 1 + + # Kill parental dietpi-update instance and exit this script to avoid deprecated update finish. + kill $PPID + exit + + fi + + if (( $G_DIETPI_VERSION_SUB < 23 && $(sed -n 1p /DietPi/dietpi/.hw_model) > 9 )); then + + echo -e '\e[90m[\e[0m INFO \e[90m]\e[0m Pre-patch 7 | Applying changes to APT sources.list since Debian dropped support for Jessie systems' + if [[ $(uname -m) == 'aarch64' ]]; then + + echo 'deb http://archive.debian.org/debian/ main contrib non-free' > /etc/apt/sources.list || { EXIT_CODE=7; break; } + + else + + sed -Ei '/jessie-(backports|updates)/d' /etc/apt/sources.list || { EXIT_CODE=7; break; } + + fi fi fi #------------------------------------------------------------------------------- # Finished - echo -e '\e[90m[\e[0m \e[32mOK\e[0m \e[90m]\e[0m Successfully applied critical pre-patches\n' + echo -e '\e[90m[\e[0m \e[32mOK\e[0m \e[90m]\e[0m Successfully applied pre-patches\n' break #------------------------------------------------------------------------------- diff --git a/dietpi/preboot b/dietpi/preboot index 718a35db10..4c401ff52e 100644 --- a/dietpi/preboot +++ b/dietpi/preboot @@ -83,7 +83,7 @@ # Automation #---------------------------------------------------------------- # - Generate Swapfile - /DietPi/dietpi/func/dietpi-set_dphys-swapfile $(grep -m1 '^[[:blank:]]*AUTO_SETUP_SWAPFILE_SIZE=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') "$(grep -m1 '^[[:blank:]]*AUTO_SETUP_SWAPFILE_LOCATION=' /DietPi/dietpi.txt | sed 's/^[^=]*=//')" + /DietPi/dietpi/func/dietpi-set_swapfile $(grep -m1 '^[[:blank:]]*AUTO_SETUP_SWAPFILE_SIZE=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') "$(grep -m1 '^[[:blank:]]*AUTO_SETUP_SWAPFILE_LOCATION=' /DietPi/dietpi.txt | sed 's/^[^=]*=//')" # - Apply Timezone local autoinstall_timezone=$(grep -m1 '^[[:blank:]]*AUTO_SETUP_TIMEZONE=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') diff --git a/dietpi/server_version-6 b/dietpi/server_version-6 index 467a39c6e9..506a7b65b9 100644 --- a/dietpi/server_version-6 +++ b/dietpi/server_version-6 @@ -1,3 +1,3 @@ 6 -22 +23 3 diff --git a/rootfs/etc/bashrc.d/dietpi.bash b/rootfs/etc/bashrc.d/dietpi.bash index bfdcb905bb..b71dd589f1 100644 --- a/rootfs/etc/bashrc.d/dietpi.bash +++ b/rootfs/etc/bashrc.d/dietpi.bash @@ -15,7 +15,7 @@ #//////////////////////////////////// # - DietPi-Globals: dietpi-* aliases, G_* functions and variables - . /DietPi/dietpi/func/dietpi-globals + . /DietPi/dietpi/func/dietpi-globals || { echo -e '[\e[31mFAILED\e[0m] DietPi-Login | DietPi boot scripts failed. Skipping DietPi login scripts...'; exit 1; } # - "G_DIETPI-NOFITY -2 message" starts a process animation. # If scripts fail to kill the animation, e.g. cancelled by user, terminal bash prompt has to do it as last resort: @@ -53,8 +53,7 @@ As a workaround we fooled the server by setting: TERM=$TERM. This is not the cleanest solution, since commands might expect colours or formats, that are not supported by the actual terminal.\n Please change your SSH clients terminal, respectively the passed \$TERM string$ncurses_term." && (( $G_WHIP_RETURNED_VALUE )) && G_AGI ncurses-term - unset TERM_old - unset ncurses_term + unset TERM_old ncurses_term fi diff --git a/rootfs/etc/cron.daily/dietpi b/rootfs/etc/cron.daily/dietpi index 532e7745fa..85aa1213dc 100644 --- a/rootfs/etc/cron.daily/dietpi +++ b/rootfs/etc/cron.daily/dietpi @@ -13,20 +13,20 @@ #---------------------------------------------------------------- # Main Loop #---------------------------------------------------------------- - #Time sync update, if mode 2 (daily) is detected + # Time sync update, if mode 2 (daily) is detected if grep -qi '^[[:blank:]]*CONFIG_NTP_MODE=2' /DietPi/dietpi.txt; then /DietPi/dietpi/func/run_ntpd 1 &> /dev/null & fi #---------------------------------------------------------------- - #Check/Update DietPi + # Check/Update DietPi if grep -qi '^[[:blank:]]*CONFIG_CHECK_DIETPI_UPDATES=1' /DietPi/dietpi.txt; then # - Check and update if grep -qi '^[[:blank:]]*CONFIG_AUTO_DIETPI_UPDATES=1' /DietPi/dietpi.txt; then - /DietPi/dietpi/dietpi-update 1 + /DietPi/dietpi/dietpi-update 1 &> /dev/null # - Check only else @@ -37,12 +37,18 @@ fi #---------------------------------------------------------------- - #DietPi-Sync daily - if [[ -f /DietPi/dietpi/.dietpi-sync_settings ]] && - grep -qi 'SYNC_CRONDAILY=1' /DietPi/dietpi/.dietpi-sync_settings; then + # DietPi-Sync daily + if [[ -f '/DietPi/dietpi/.dietpi-sync_settings' ]] && grep -q 'SYNC_CRONDAILY=1' /DietPi/dietpi/.dietpi-sync_settings; then /DietPi/dietpi/dietpi-sync 1 &> /dev/null & + fi + #---------------------------------------------------------------- + # Refresh DietPi MOTD + if [[ -f '/DietPi/dietpi/.dietpi-banner' ]] && grep -q 'aENABLED[12]=1' /DietPi/dietpi/.dietpi-banner; then + + curl -sL https://dietpi.com/motd > /tmp/.dietpi_motd & + fi #---------------------------------------------------------------- exit diff --git a/rootfs/etc/systemd/system/dietpi-boot.service b/rootfs/etc/systemd/system/dietpi-boot.service index e90a1b3bb5..652928c9fa 100644 --- a/rootfs/etc/systemd/system/dietpi-boot.service +++ b/rootfs/etc/systemd/system/dietpi-boot.service @@ -1,15 +1,15 @@ [Unit] Description=DietPi-Boot # Order 3 -Requires=dietpi-preboot.service -After=dietpi-preboot.service network.target networking.service +Requisite=dietpi-preboot.service +After=dietpi-preboot.service network.target Before=getty-pre.target getty@tty1.service getty.target ssh.service dropbear.service [Service] Type=oneshot RemainAfterExit=yes StandardOutput=tty -ExecStart=/bin/bash -c '/DietPi/dietpi/boot 2>&1 | tee /tmp/dietpi-boot.log' +ExecStart=/bin/dash -c '/DietPi/dietpi/boot 2>&1 | tee /tmp/dietpi-boot.log' [Install] WantedBy=multi-user.target diff --git a/rootfs/etc/systemd/system/dietpi-fs_partition_resize.service b/rootfs/etc/systemd/system/dietpi-fs_partition_resize.service index 74830cb128..af4a8dee69 100644 --- a/rootfs/etc/systemd/system/dietpi-fs_partition_resize.service +++ b/rootfs/etc/systemd/system/dietpi-fs_partition_resize.service @@ -10,7 +10,7 @@ Before=var-swap.swap swap.target local-fs-pre.target Type=oneshot StandardOutput=tty ExecStartPre=/bin/mkdir -p /var/tmp/dietpi/logs -ExecStart=/bin/bash -c '/var/lib/dietpi/services/fs_partition_resize.sh 2>&1 | tee /var/tmp/dietpi/logs/fs_partition_resize.log' +ExecStart=/bin/dash -c '/var/lib/dietpi/services/fs_partition_resize.sh 2>&1 | tee /var/tmp/dietpi/logs/fs_partition_resize.log' [Install] WantedBy=local-fs.target diff --git a/rootfs/etc/systemd/system/dietpi-postboot.service b/rootfs/etc/systemd/system/dietpi-postboot.service index 204dc67008..9cade037fb 100644 --- a/rootfs/etc/systemd/system/dietpi-postboot.service +++ b/rootfs/etc/systemd/system/dietpi-postboot.service @@ -1,7 +1,7 @@ [Unit] Description=DietPi-PostBoot # Order 4 -Requires=dietpi-boot.service +Requisite=dietpi-boot.service After=dietpi-boot.service [Service] diff --git a/rootfs/etc/systemd/system/dietpi-preboot.service b/rootfs/etc/systemd/system/dietpi-preboot.service index 7421b66bb6..a31023035c 100644 --- a/rootfs/etc/systemd/system/dietpi-preboot.service +++ b/rootfs/etc/systemd/system/dietpi-preboot.service @@ -1,16 +1,16 @@ [Unit] Description=DietPi-PreBoot # Order 2 -Requires=dietpi-ramdisk.service +Requisite=dietpi-ramdisk.service Wants=network-pre.target After=dietpi-ramdisk.service dietpi-ramlog.service -Before=network-pre.target dropbear.service ssh.service +Before=network-pre.target [Service] Type=oneshot RemainAfterExit=yes StandardOutput=tty -ExecStart=/bin/bash -c '/DietPi/dietpi/preboot 2>&1 | tee /tmp/dietpi-preboot.log' +ExecStart=/bin/dash -c '/DietPi/dietpi/preboot 2>&1 | tee /tmp/dietpi-preboot.log' [Install] -WantedBy=local-fs.target +WantedBy=multi-user.target diff --git a/rootfs/etc/systemd/system/dietpi-ramdisk.service b/rootfs/etc/systemd/system/dietpi-ramdisk.service index 541c342f30..88769bc211 100644 --- a/rootfs/etc/systemd/system/dietpi-ramdisk.service +++ b/rootfs/etc/systemd/system/dietpi-ramdisk.service @@ -5,11 +5,11 @@ After=local-fs.target DietPi.mount boot.mount -.mount Before=syslog.service rsyslog.service [Service] -Type=forking +Type=oneshot RemainAfterExit=yes ExecStartPre=/bin/mkdir -p /var/tmp/dietpi/logs -ExecStart=/bin/bash -c '/boot/dietpi/func/dietpi-ramdisk 0 &>> /var/tmp/dietpi/logs/dietpi-ramdisk.log' -ExecStop=/bin/bash -c '/DietPi/dietpi/func/dietpi-ramdisk 1 &>> /var/tmp/dietpi/logs/dietpi-ramdisk.log' +ExecStart=/bin/dash -c '/boot/dietpi/func/dietpi-ramdisk 0 2>&1 >> /var/tmp/dietpi/logs/dietpi-ramdisk.log' +ExecStop=/bin/dash -c '/DietPi/dietpi/func/dietpi-ramdisk 1 2>&1 >> /var/tmp/dietpi/logs/dietpi-ramdisk.log' [Install] -WantedBy=local-fs.target +WantedBy=multi-user.target diff --git a/rootfs/etc/systemd/system/dietpi-ramlog.service b/rootfs/etc/systemd/system/dietpi-ramlog.service index 3c4dcb4fe1..bdeaff9669 100644 --- a/rootfs/etc/systemd/system/dietpi-ramlog.service +++ b/rootfs/etc/systemd/system/dietpi-ramlog.service @@ -5,11 +5,11 @@ After=local-fs.target DietPi.mount var-log.mount -.mount Before=syslog.service rsyslog.service [Service] -Type=forking +Type=oneshot RemainAfterExit=yes ExecStartPre=/bin/mkdir -p /var/tmp/dietpi/logs -ExecStart=/bin/bash -c '/boot/dietpi/func/dietpi-ramlog 0 &>> /var/tmp/dietpi/logs/dietpi-ramlog.log' -ExecStop=/bin/bash -c '/DietPi/dietpi/func/dietpi-ramlog 1 &>> /var/tmp/dietpi/logs/dietpi-ramlog.log' +ExecStart=/bin/dash -c '/boot/dietpi/func/dietpi-ramlog 0 2>&1 >> /var/tmp/dietpi/logs/dietpi-ramlog.log' +ExecStop=/bin/dash -c '/DietPi/dietpi/func/dietpi-ramlog 1 2>&1 >> /var/tmp/dietpi/logs/dietpi-ramlog.log' [Install] -WantedBy=local-fs.target +WantedBy=multi-user.target diff --git a/rootfs/etc/systemd/system/dietpi-wifi-monitor.service b/rootfs/etc/systemd/system/dietpi-wifi-monitor.service index 1cba3633d0..9525341f79 100644 --- a/rootfs/etc/systemd/system/dietpi-wifi-monitor.service +++ b/rootfs/etc/systemd/system/dietpi-wifi-monitor.service @@ -1,13 +1,13 @@ # Monitors loss of WiFi connection and automatically reconnects [Unit] Description=DietPi-WiFi-Monitor -Requires=dietpi-ramdisk.service +Requisite=dietpi-ramdisk.service Wants=network-online.target After=dietpi-boot.service network-online.target network.target [Service] ExecStartPre=/DietPi/dietpi/func/obtain_network_details -ExecStartPre=/bin/bash -c '[[ -e /sys/class/net/wlan$(sed -n 2p /DietPi/dietpi/.network) ]]' +ExecStartPre=/bin/dash -c '[ -e /sys/class/net/wlan$(sed -n 2p /DietPi/dietpi/.network) ]' ExecStart=/var/lib/dietpi/services/dietpi-wifi-monitor.sh [Install] diff --git a/rootfs/var/lib/dietpi/services/dietpi-wifi-monitor.sh b/rootfs/var/lib/dietpi/services/dietpi-wifi-monitor.sh index c950605f1a..bdf0f54b0b 100644 --- a/rootfs/var/lib/dietpi/services/dietpi-wifi-monitor.sh +++ b/rootfs/var/lib/dietpi/services/dietpi-wifi-monitor.sh @@ -1,23 +1,21 @@ #!/bin/bash { - #Import DietPi-Globals --------------------------------------------------------------- - . /DietPi/dietpi/func/dietpi-globals - G_PROGRAM_NAME='DietPi-WiFi-Monitor' - G_CHECK_ROOT_USER - G_CHECK_ROOTFS_RW - G_INIT - #Import DietPi-Globals --------------------------------------------------------------- - - #Update network info + # Check for root permissions + (( $UID )) && { echo 'ERROR: Root permissions required. Please run this script with "sudo". Exiting...'; exit 1; } + + # Check for concurrent execution + pgrep -f 'dietpi-wifi-monitor.sh' &> /dev/null && { echo 'ERROR: Concurrent execution detected. Please exit the running instance of DietPi-WiFi-Monitor first. Exiting...'; exit 1; } + + # Update network info /DietPi/dietpi/func/obtain_network_details URL_PING='' ADAPTER="wlan$(sed -n 2p /DietPi/dietpi/.network)" - TICKRATE=10 + TICKRATE={TICKRATE:-10} #------------------------------------------------------------------------------------- - #Main + # Main #------------------------------------------------------------------------------------- # Check for valid WiFi adapter [[ -e /sys/class/net/$ADAPTER ]] || { echo "ERROR: No valid WiFi adapter found on interface: $ADAPTER. Exiting..."; exit 1; } diff --git a/rootfs/var/lib/dietpi/services/fs_partition_resize.sh b/rootfs/var/lib/dietpi/services/fs_partition_resize.sh index b0b1749c9f..9c97873159 100644 --- a/rootfs/var/lib/dietpi/services/fs_partition_resize.sh +++ b/rootfs/var/lib/dietpi/services/fs_partition_resize.sh @@ -1,54 +1,60 @@ #!/bin/bash +{ + # Disable this service + systemctl disable dietpi-fs_partition_resize -systemctl disable dietpi-fs_partition_resize + # Grab root device + # Naming scheme: https://askubuntu.com/questions/56929/what-is-the-linux-drive-naming-scheme + # - SCSI/SATA: /dev/sd[a-z][0-9] + # - IDE: /dev/hd[a-z][0-9] + # - eMMC: /dev/mmcblk[0-9]p[0-9] + # - NVMe: /dev/nvme[0-9]n[0-9]p[0-9] + TARGET_DEV=$(findmnt / -o source -n) + if [[ $TARGET_DEV == '/dev/mmcblk'* || $TARGET_DEV == '/dev/nvme'* ]]; then -sync + TARGET_PARTITION=${TARGET_DEV##*p} # /dev/mmcblk0p1 => 1 + TARGET_DRIVE=${TARGET_DEV%p[0-9]} # /dev/mmcblk0p1 => /dev/mmcblk0 -# Naming scheme: https://askubuntu.com/questions/56929/what-is-the-linux-drive-naming-scheme -# - SCSI/SATA: /dev/sd[a-z][0-9] -# - IDE: /dev/hd[a-z][0-9] -# - eMMC: /dev/mmcblk[0-9]p[0-9] -# - NVMe: /dev/nvme[0-9]n[0-9]p[0-9] -TARGET_DEV=$(findmnt / -o source -n) -if [[ $TARGET_DEV =~ /mmcblk || $TARGET_DEV =~ /nvme ]]; then + elif [[ $TARGET_DEV == /dev/[sh]d[a-z]* ]]; then - TARGET_PARTITION=${TARGET_DEV##*p} # /dev/mmcblk0p1 => 1 - TARGET_DRIVE=${TARGET_DEV%p[0-9]} # /dev/mmcblk0p1 => /dev/mmcblk0 + TARGET_PARTITION=${TARGET_DEV##*[a-z]} # /dev/sda1 => 1 + TARGET_DRIVE=${TARGET_DEV%[0-9]} # /dev/sda1 => /dev/sda -elif [[ $TARGET_DEV =~ /[sh]d[a-z] ]]; then + else - TARGET_PARTITION=${TARGET_DEV##*[a-z]} # /dev/sda1 => 1 - TARGET_DRIVE=${TARGET_DEV%[0-9]} # /dev/sda1 => /dev/sda + echo "[FAILED] Unsupported block device naming scheme ($TARGET_DEV). Aborting..." + exit 1 -else - - echo "[FAILED] Unsupported drive naming scheme: $TARGET_DEV. Aborting..." - exit 1 + fi -fi + # Resize partition, only if drive actually contains a partition table + if [[ $TARGET_PARTITION == [0-9] ]]; then -# Only redo partitions, if drive actually contains a partition table. -if [[ $TARGET_PARTITION == [0-9] ]]; then + # - Failsafe: Sync changes to disk before touching partitions + sync - # - GPT detection | modified version of ayufan-rock64 resize script. - if sfdisk $TARGET_DRIVE -l | grep -qi 'disklabel type: gpt'; then + # - GPT detection | Modified version of ayufan-rock64 resize script + if sfdisk $TARGET_DRIVE -l | grep -qi 'disklabel type: gpt'; then - # move GPT alternate header to end of disk - sgdisk -e $TARGET_DRIVE + # Move GPT alternate header to end of disk + sgdisk -e $TARGET_DRIVE - fi + fi - # - Maximize partition size - sfdisk $TARGET_DRIVE -fN$TARGET_PARTITION --no-reread <<< ',+,,,' + # - Maximize partition size + sfdisk $TARGET_DRIVE -fN$TARGET_PARTITION --no-reread <<< ',+,,,' - partprobe $TARGET_DRIVE + # - Reread partition table + partprobe $TARGET_DRIVE -else + else - echo "[ INFO ] No valid root partition found: $TARGET_PARTITION. Skipping partition resize..." + echo "[ INFO ] No (valid) root partition found ($TARGET_PARTITION). Most likely the drive does not contain a partition table. Skipping partition resize..." -fi + fi -resize2fs $TARGET_DEV + # Resize file system + resize2fs $TARGET_DEV -exit 0 + exit 0 +}