diff --git a/.meta/dietpi-survey_report b/.meta/dietpi-survey_report index cc1736a9b1..6b574e8c99 100644 --- a/.meta/dietpi-survey_report +++ b/.meta/dietpi-survey_report @@ -575,6 +575,7 @@ shopt -s extglob done unset -v 'aSOFTWARE_NAME7_8[34]' # Subsonic unset -v 'aSOFTWARE_NAME7_8[99]' # emonHub + aSOFTWARE_NAME7_8[200]='DietPi-Dashboard' # Pre-create software counter array so that we can see also software (available in newest version) with 0 installs for i in "${aSOFTWARE_NAME7_8[@]}" diff --git a/CHANGELOG.txt b/CHANGELOG.txt index edd0e4bc99..6917f3db1f 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -5,6 +5,9 @@ New SBC support: - Radxa Zero | Initial support for this Raspberry Pi Zero form factored (but way more powerful) SBC has been added to DietPi with the hardware ID 74. Many thanks to @almirus and @dhry for helping with testing and debugging an early image: https://github.com/MichaIng/DietPi/issues/4831 - Raspberry Pi Zero 2 W | Initial support for this Raspberry Pi Zero/Zero W successor has been added, using hardware ID 3 for now (shared with RPi 3/3+), including overclocking profiles. Many thank to @CassTG for providing early hardware information and doing intensive overclocking tests: https://dietpi.com/phpbb/viewtopic.php?t=9599 +New software: +- DietPi-Dashboard | Thanks to the great work of @ravenclaw900, we are proud to announce our own official DietPi web interface for monitoring and managing your DietPi system using your web browser. It is still in beta phase as we test and gradually implement more features. We would be happy if you would try it out via "dietpi-software install 200" and give us feedback: https://github.com/MichaIng/DietPi/issues/448 + Removed software: - Subsonic | Since it is not developed anymore and due to shared library dependencies only compatible with Debian Stretch, we removed Subsonic from DietPi-Software. With Airsonic-Advanced, we'll provide a well maintained and Bullseye-compatible alternative. If you currently have Subsonic installed, it will remain. If you want to uninstall it, follow the instructions here: https://github.com/MichaIng/DietPi/pull/4895 - emonHub | Since we do not have a single reported installation, we removed emonHub from DietPi-Software. If you currently have emonHub installed, it will remain. If you want to keep using and updating it, have a look at the official repository: https://github.com/openenergymonitor/emonhub. If you want to uninstall it, follow the instructions here: https://github.com/MichaIng/DietPi/pull/4895 diff --git a/README.md b/README.md index b0577fb335..f85931b5a3 100644 --- a/README.md +++ b/README.md @@ -315,6 +315,7 @@ Links to hardware and software manufacturers, sources and build instructions use - [Blynk Server](https://github.com/Peterkn2001/blynk-server) - [File Browser](https://github.com/filebrowser/filebrowser) - [Spotifyd](https://github.com/Spotifyd/spotifyd) +- [DietPi-Dashboard](https://github.com/ravenclaw900/dietpi-dashboard) --- diff --git a/dietpi.txt b/dietpi.txt index 03eaab7c17..600288b84e 100644 --- a/dietpi.txt +++ b/dietpi.txt @@ -269,6 +269,12 @@ SOFTWARE_HOMEASSISTANT_PIP_DEPS= # https://rancher.com/docs/k3s/latest/en/installation/install-options/#configuration-file SOFTWARE_K3S_EXEC= +# DietPi-Dashboard +# Version to use +# - Stable = Use release version of DietPi-Dashboard. +# - Nightly = Use unstable version DietPi-Dashboard. Might have bugs, but will probably have more features. +SOFTWARE_DIETPI_DASHBOARD_VERSION=Stable + #------------------------------------------------------------------------------------------------------ ##### Dev settings ##### #------------------------------------------------------------------------------------------------------ diff --git a/dietpi/dietpi-services b/dietpi/dietpi-services index 311116c2a4..975e508de0 100644 --- a/dietpi/dietpi-services +++ b/dietpi/dietpi-services @@ -234,6 +234,7 @@ Available services: # DietPi aSERVICE_NAME+=('dietpi-vpn') # NordVPN install + client + aSERVICE_NAME+=('dietpi-dashboard') # Web Dashboard if [[ $INPUT_CMD == 'status' ]]; then aSERVICE_NAME+=('dietpi-ramlog') @@ -275,7 +276,6 @@ _EOF_ while read -r line do - # Include if [[ $line == '+ '* ]]; then @@ -284,9 +284,7 @@ _EOF_ # - Skip known services for i in "${aSERVICE_NAME[@]}" do - [[ $line == "$i" ]] && continue 2 - done [[ $G_DEBUG == 1 ]] && G_DIETPI-NOTIFY 2 "Including custom service: $line" @@ -299,7 +297,6 @@ _EOF_ for i in "${!aSERVICE_NAME[@]}" do - [[ $line == "${aSERVICE_NAME[$i]}" ]] || continue # Show in menu, but mark as excluded @@ -315,7 +312,6 @@ _EOF_ fi break - done fi @@ -339,13 +335,11 @@ _EOF_ local i j for i in "${!aSERVICE_NAME[@]}" do - [[ ${aSERVICE_NAME[$i]} ]] || { unset -v "aSERVICE_NAME[$i]"; continue; } # Failsafe # Check for sysvinit services from systemd-sysv-generator dir: /run/systemd/generator.late/ for j in /{{etc,usr/local/lib,lib,usr/lib}/systemd/system,run/systemd/generator.late}/"${aSERVICE_NAME[$i]}.service" do - [[ -e $j ]] || continue # Check masked state, in case continue to catch real file @@ -353,12 +347,10 @@ _EOF_ aFP_SERVICE[$i]=$j break - done # Remove non-available services from array [[ ${aFP_SERVICE[$i]} ]] || unset -v "aSERVICE_NAME[$i]" - done } @@ -387,9 +379,7 @@ _EOF_ for i in "${!aSERVICE_NAME[@]}" do - services="$i $services" - done # - start/restart: Standard service order @@ -410,12 +400,10 @@ _EOF_ # Apply command for i in $services do - [[ ${aSERVICE_MODE[$i]} == 'masked' ]] && { G_DIETPI-NOTIFY 2 "skip : ${aSERVICE_NAME[$i]} (due to mask)"; continue; } G_DIETPI-NOTIFY -2 "${aSERVICE_NAME[$i]}" systemctl "$command" "${aSERVICE_NAME[$i]}" &> /dev/null Print_Status "$command" "${aSERVICE_NAME[$i]}" $? - done # Disable ownCloud and Nextcloud maintenance mode after all services being started or restarted @@ -449,12 +437,11 @@ _EOF_ local status_full space status for i in $services do - status_full=$(systemctl -l --no-pager status "${aSERVICE_NAME[$i]}") # Align status output space='\t' (( ${#aSERVICE_NAME[$i]} < 13 )) && space+='\t'; (( ${#aSERVICE_NAME[$i]} < 5 )) && space+='\t' - status="${aSERVICE_NAME[$i]}${space}$(mawk '/Active/{print substr($0,12);exit}' <<< "$status_full")" + status="${aSERVICE_NAME[$i]}${space}$(mawk '/Active:/{$1="";print;exit}' <<< "$status_full")"; status=${status# } if [[ $status == *'failed'* ]]; then G_DIETPI-NOTIFY 1 "$status_full" @@ -468,7 +455,6 @@ _EOF_ G_DIETPI-NOTIFY 0 "$status" fi - done # dietpi_controlled/systemd_controlled/mask/unmask/enable/disable @@ -504,12 +490,10 @@ _EOF_ # Apply command for i in $services do - # Skip masked services, if not to be unmasked [[ ${aSERVICE_MODE[$i]} == 'masked' && $systemctl_cmd != 'unmask' ]] && { G_DIETPI-NOTIFY 2 "skip : ${aSERVICE_NAME[$i]} (due to mask)"; continue; } systemctl $systemctl_cmd "${aSERVICE_NAME[$i]}" &> /dev/null Print_Status "$command" "${aSERVICE_NAME[$i]}" $? - done fi @@ -620,10 +604,8 @@ _EOF_ for i in "${!aSERVICE_NAME[@]}" do - aSERVICE_MODE[$i]=$(systemctl is-enabled "${aSERVICE_NAME[$i]}" 2> /dev/null) Load_Process_Tool "$i" - done } @@ -648,7 +630,6 @@ _EOF_ local service_restart_list_menu aservice_restart_list_systemd=() i for i in "${!aSERVICE_RESTART_REQUIRED[@]}" do - service_restart_list_menu+="\n - ${aSERVICE_NAME[$i]}: " [[ ${aCPU_AFFINITY[$i]} ]] && service_restart_list_menu+="Affinity=${aCPU_AFFINITY[$i]} | " [[ ${aCPU_POLICY[$i]} ]] && service_restart_list_menu+="CPU Scheduling Policy=${aCPU_POLICY[$i]} | " @@ -657,7 +638,6 @@ _EOF_ [[ ${aIO_CLASS[$i]} ]] && service_restart_list_menu+="I/O Scheduling Class=${aIO_CLASS[$i]} | " [[ ${aIO_PRIORITY[$i]} ]] && service_restart_list_menu+="I/O Scheduling Priority=${aIO_PRIORITY[$i]} | " aservice_restart_list_systemd+=("${aSERVICE_NAME[$i]}") - done if [[ ${aservice_restart_list_systemd[0]} ]] && G_WHIP_YESNO "[ INFO ] The following services require a restart, in order to apply your chosen settings:${service_restart_list_menu%[|:] } @@ -685,9 +665,7 @@ _EOF_ G_WHIP_MENU_ARRAY=('' '●─ Single Service Options ') for i in "${!aSERVICE_NAME[@]}" do - G_WHIP_MENU_ARRAY+=("${aSERVICE_NAME[$i]}" ": $(systemctl is-active "${aSERVICE_NAME[$i]}") | Affinity ${aCPU_AFFINITY[$i]:-0-$(( $G_HW_CPU_CORES - 1 ))}") - done G_WHIP_MENU_ARRAY+=( @@ -710,29 +688,23 @@ _EOF_ # Find first empty index for ((i=0;i<=${#aSERVICE_MODE[@]};i++)) do - [[ ${aSERVICE_NAME[$i]} ]] || { new_index=$i; break; } - done while G_WHIP_INPUTBOX "${not_found}Please add the name of the service to be added, without the \".service\" file ending:" do - if [[ $G_WHIP_RETURNED_VALUE ]]; then # Check for known services for i in "${aSERVICE_NAME[@]}" do - [[ $G_WHIP_RETURNED_VALUE == "$i" ]] || continue not_found="[FAILED] The service name you entered ($G_WHIP_RETURNED_VALUE) is already handled by DietPi-Services. Please retry or cancel.\n\n" continue 2 - done for i in /{{etc,usr/local/lib,lib,usr/lib}/systemd/system,run/systemd/generator.late}/"$G_WHIP_RETURNED_VALUE.service" do - [[ -f $i ]] || continue aSERVICE_NAME[$new_index]=$G_WHIP_RETURNED_VALUE @@ -741,13 +713,11 @@ _EOF_ Load_Process_Tool "$new_index" G_CONFIG_INJECT "+ ${aSERVICE_NAME[$new_index]}" "+ ${aSERVICE_NAME[$new_index]}" $FP_INCLUDE_EXCLUDE break 2 - done fi not_found="[FAILED] Could not find a service file that matches your input ($G_WHIP_RETURNED_VALUE). Please retry or cancel.\n\n" - done elif [[ $G_WHIP_RETURNED_VALUE == 'Restart' || $G_WHIP_RETURNED_VALUE == 'Stop' ]]; then @@ -763,11 +733,9 @@ _EOF_ MENU_SERVICE_INDEX=-1 for i in "${!aSERVICE_NAME[@]}" do - [[ ${aSERVICE_NAME[$i]} == "$G_WHIP_RETURNED_VALUE" ]] || continue MENU_SERVICE_INDEX=$i break - done (( $MENU_SERVICE_INDEX >= 0 )) && MENU_TARGETID=1 @@ -974,9 +942,7 @@ Please uncomment and edit only the lines that you need to change.\n\nTo undo cha G_WHIP_CHECKLIST_ARRAY=() for ((i=0; i<$G_HW_CPU_CORES; i++)) do - G_WHIP_CHECKLIST_ARRAY+=("$i" 'CPU ' 'on') - done if G_WHIP_CHECKLIST "Please select the desired CPU Affinity for: ${aSERVICE_NAME[$MENU_SERVICE_INDEX]}\n @@ -985,10 +951,8 @@ Please uncomment and edit only the lines that you need to change.\n\nTo undo cha local new_affinity= for i in $G_WHIP_RETURNED_VALUE do - # taskset requires comma-seperated CPU indices [[ $new_affinity ]] && new_affinity+=",$i" || new_affinity=$i - done # Update affinity array with new value, if at least 1 item was selected, otherwise reset @@ -1003,9 +967,7 @@ Please uncomment and edit only the lines that you need to change.\n\nTo undo cha G_WHIP_MENU_ARRAY=('Reset' ': Reset CPU Scheduling Policy to system defaults') for i in "${!aCPU_POLICY_TYPE[@]}" do - G_WHIP_MENU_ARRAY+=("${aCPU_POLICY_TYPE[$i]}" ": ${aCPU_POLICY_DESC[$i]}" ) - done G_WHIP_DEFAULT_ITEM=$cpu_policy @@ -1086,7 +1048,6 @@ Info:\n - Negative values have a higher priority (eg: -10).\n - Positive values G_WHIP_MENU_ARRAY=('Reset' ': Reset CPU Scheduling Priority to system defaults') for ((i=$scale_value_highest; i>=$scale_value_lowest; i--)) do - if (( $i == $scale_value_lowest )); then desc='(Lowest priority)' @@ -1122,7 +1083,6 @@ Info:\n - Negative values have a higher priority (eg: -10).\n - Positive values fi G_WHIP_MENU_ARRAY+=("$i" ": $desc") - done G_WHIP_DEFAULT_ITEM=$cpu_priority @@ -1140,9 +1100,7 @@ Info:\n - Negative values have a higher priority (eg: -10).\n - Positive values G_WHIP_MENU_ARRAY=('Reset' ': Reset I/O Scheduling Class to system defaults') for i in "${!aIO_CLASS_TYPE[@]}" do - G_WHIP_MENU_ARRAY+=("${aIO_CLASS_TYPE[$i]}" ": ${aIO_CLASS_DESC[$i]}" ) - done G_WHIP_DEFAULT_ITEM=$io_class @@ -1179,7 +1137,6 @@ NB: This only has an effect on drives handled by the CFQ scheduler.\nRead about fi G_WHIP_MENU_ARRAY+=("$i" ": $desc") - done G_WHIP_DEFAULT_ITEM=$io_priority @@ -1263,7 +1220,6 @@ NB: This only has an effect on drives handled by the CFQ scheduler."; then until (( $MENU_TARGETID < 0 )) do - if (( $MENU_TARGETID == 1 )); then Menu_Service @@ -1273,7 +1229,6 @@ NB: This only has an effect on drives handled by the CFQ scheduler."; then Menu_Main fi - done fi diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index ffd395075f..eabe110333 100644 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -1199,6 +1199,14 @@ INDEX_BROWSER_TARGET=$INDEX_BROWSER_TARGET" aSOFTWARE_CATX[$software_id]=8 aSOFTWARE_DOCS[$software_id]='https://dietpi.com/docs/software/cloud/#k3s' + #------------------ + software_id=200 + + aSOFTWARE_NAME[$software_id]='DietPi-Dashboard (beta)' + aSOFTWARE_DESC[$software_id]='Official DietPi web dashboard' + aSOFTWARE_CATX[$software_id]=8 + aSOFTWARE_DOCS[$software_id]='https://dietpi.com/docs/dietpi_tools/#dietpi-dashboard' + # Remote Access #-------------------------------------------------------------------------------- software_id=68 @@ -3503,6 +3511,62 @@ _EOF_ fi + software_id=200 # DietPi-Dashboard + if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then + + Banner_Installing + + # Stable release or nightly? + local version=$(sed -n '/^[[:blank:]]*SOFTWARE_DIETPI_DASHBOARD_VERSION=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) + [[ $version == 'Nightly' ]] || version='Stable' + + G_WHIP_MENU_ARRAY=( + 'Stable' ': Use a release version of DietPi-Dashboard.' + 'Nightly' ': Use an unstable version of DietPi-Dashboard.' + ) + + G_WHIP_BUTTON_CANCEL_TEXT=$version + G_WHIP_DEFAULT_ITEM=$version + G_WHIP_MENU "Please choose which version of DietPi-Dashboard should be installed." && version=$G_WHIP_RETURNED_VALUE + + if [[ $version == 'Stable' ]] + then + Download_Install "$(curl -sSfL 'https://api.github.com/repos/ravenclaw900/dietpi-dashboard/releases/latest' | mawk -F\" "/\"browser_download_url\": \".*dietpi-dashboard-$G_HW_ARCH_NAME\"/{print \$4}")" /opt/dietpi-dashboard/dietpi-dashboard + + elif [[ $version == 'Nightly' ]] + then + no_check_url=1 Download_Install "https://nightly.link/ravenclaw900/DietPi-Dashboard/workflows/push-build/main/dietpi-dashboard-$G_HW_ARCH_NAME.zip" /opt/dietpi-dashboard + fi + + G_EXEC chmod +x /opt/dietpi-dashboard/dietpi-dashboard + + [[ -f '/opt/dietpi-dashboard/config.toml' ]] || cat << '_EOF_' > /opt/dietpi-dashboard/config.toml +# TCP network port +port = 8088 + +# TLS for HTTPS +tls = false +cert = "/path/to/cert" +key = "/path/to/key" +_EOF_ + cat << '_EOF_' > /etc/systemd/system/dietpi-dashboard.service +[Unit] +Description=Web Dashboard (DietPi) +Wants=network-online.target +After=network-online.target + +[Service] +ExecStart=/opt/dietpi-dashboard/dietpi-dashboard + +[Install] +WantedBy=multi-user.target +_EOF_ + # Dashboard service needs to be started by systemd, as dietpi-services must not control it to prevent it from stopping during software installs. + G_EXEC systemctl enable dietpi-dashboard + aSTART_SERVICES+=('dietpi-dashboard') + + fi + software_id=44 # Transmission if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then @@ -13648,6 +13712,20 @@ _EOF_ fi + software_id=200 # DietPi-Dashboard + if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then + + Banner_Uninstalling + if [[ -f '/etc/systemd/system/dietpi-dashboard.service' ]] + then + G_EXEC systemctl disable --now dietpi-dashboard + G_EXEC rm /etc/systemd/system/dietpi-dashboard.service + fi + [[ -d '/etc/systemd/system/dietpi-dashboard.service.d' ]] && G_EXEC rm -R /etc/systemd/system/dietpi-dashboard.service.d + [[ -d '/opt/dietpi-dashboard' ]] && G_EXEC rm -R /opt/dietpi-dashboard + + fi + software_id=146 # Tautulli if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then