Commit b47b0515 authored by Igor Pecovnik's avatar Igor Pecovnik
Browse files

Toogle desktop on desktop images

parent f6b5fc5a
...@@ -139,12 +139,13 @@ LIST=() ...@@ -139,12 +139,13 @@ LIST=()
[[ -n $(nmcli -f DEVICE,TYPE device status | grep wifi) ]] && LIST+=( "WiFi" "Connect to wireless access point" ) [[ -n $(nmcli -f DEVICE,TYPE device status | grep wifi) ]] && LIST+=( "WiFi" "Connect to wireless access point" )
[[ -n $(nmcli -f DEVICE,TYPE device status | grep wifi) ]] && LIST+=( "Hotspot" "Create or manage WiFi access point" ) [[ -n $(nmcli -f DEVICE,TYPE device status | grep wifi) ]] && LIST+=( "Hotspot" "Create or manage WiFi access point" )
[[ -f /usr/bin/h3disp && "$LINUXFAMILY" = "sun8i" && "$BRANCH" = "default" && -n $(bin2fex </boot/script.bin 2>/dev/null | grep -w "hdmi_used = 1") ]] && LIST+=( "Display" "set the display resolution" ) [[ -f /usr/bin/h3disp && "$LINUXFAMILY" = "sun8i" && "$BRANCH" = "default" && -n $(bin2fex </boot/script.bin 2>/dev/null | grep -w "hdmi_used = 1") ]] && LIST+=( "Display" "set the display resolution" )
[[ -f /usr/sbin/nodm && -n $(service nodm status | grep -w active | grep -w running) ]] && LIST+=( "Desktop" "Disable desktop" )
[[ -f /usr/sbin/nodm && -n $(service nodm status | grep -w inactive) ]] && LIST+=( "Desktop" "Enable desktop" )
[[ -f /usr/bin/softy ]] && LIST+=( "Softy" "Application installer" ) [[ -f /usr/bin/softy ]] && LIST+=( "Softy" "Application installer" )
LIST+=( "-" "" ) [[ ${#LIST[@]} > 0 ]] && LIST+=( "-" "" )
[[ -f /usr/bin/h3consumption && "$LINUXFAMILY" = "sun8i" && "$BRANCH" = "default" ]] && LIST+=( "Consumption" "Control board consumption" ) [[ -f /usr/bin/h3consumption && "$LINUXFAMILY" = "sun8i" && "$BRANCH" = "default" ]] && LIST+=( "Consumption" "Control board consumption" )
[[ -f /usr/bin/armbianmonitor ]] && LIST+=( "Monitor" "Simple CLI monitoring" ) [[ -f /usr/bin/armbianmonitor ]] && LIST+=( "Monitor" "Simple CLI monitoring" )
[[ -f /usr/bin/armbianmonitor ]] && LIST+=( "Diagnostics" "Send diagnostics" ) [[ -f /usr/bin/armbianmonitor ]] && LIST+=( "Diagnostics" "Send diagnostics" )
[[ -f /usr/bin/bin2fex && "$LINUXFAMILY" = sun*i && "$BRANCH" = "default" ]] && LIST+=( "Fexedit" "Board (fex) settings editor" ) [[ -f /usr/bin/bin2fex && "$LINUXFAMILY" = sun*i && "$BRANCH" = "default" ]] && LIST+=( "Fexedit" "Board (fex) settings editor" )
[[ -n $(grep -w "#kernel.printk" /etc/sysctl.conf ) ]] && LIST+=( "Lowlevel" "Stop low-level messages on console" ) [[ -n $(grep -w "#kernel.printk" /etc/sysctl.conf ) ]] && LIST+=( "Lowlevel" "Stop low-level messages on console" )
[[ -f /boot/armbianEnv.txt ]] && LIST+=( "Booting" "Edit boot environment" ) [[ -f /boot/armbianEnv.txt ]] && LIST+=( "Booting" "Edit boot environment" )
...@@ -161,7 +162,7 @@ fi ...@@ -161,7 +162,7 @@ fi
########################################################################################################################################### ###########################################################################################################################################
LISTLENGHT="$((7+${#LIST[@]}/2))" LISTLENGHT="$((7+${#LIST[@]}/2))"
BOXLENGHT=${#LIST[@]}
# main dialog routine # main dialog routine
DIALOG_CANCEL=1 DIALOG_CANCEL=1
...@@ -169,7 +170,7 @@ DIALOG_ESC=255 ...@@ -169,7 +170,7 @@ DIALOG_ESC=255
exec 3>&1 exec 3>&1
selection=$(dialog --backtitle "$BACKTITLE" --title "$TITLE" --clear --cancel-label "Exit to shell" --menu "Please select:" $LISTLENGHT 70 15 \ selection=$(dialog --backtitle "$BACKTITLE" --title "$TITLE" --clear --cancel-label "Exit to shell" --menu "Please select:" $LISTLENGHT 70 $BOXLENGHT \
"${LIST[@]}" 2>&1 1>&3) "${LIST[@]}" 2>&1 1>&3)
exit_status=$? exit_status=$?
exec 3>&- exec 3>&-
...@@ -201,6 +202,19 @@ DIALOG_ESC=255 ...@@ -201,6 +202,19 @@ DIALOG_ESC=255
h3disp h3disp
exit exit
;; ;;
"Desktop" )
if [[ -f /usr/sbin/nodm && -n $(service nodm status | grep -w active | grep -w running) ]]; then
dialog --title "Desktop is enabled and running" --backtitle "$BACKTITLE" --yes-label "Stop" --no-label "Cancel" --yesno "\nDo you want to stop and disable this service?" 7 50
exitstatus=$?;
[[ $exitstatus = 0 ]] && service nodm stop && sed -i "s/^NODM_ENABLED=.*/NODM_ENABLED=false/" /etc/default/nodm
else
dialog --title "Desktop is disabled" --backtitle "$BACKTITLE" --yes-label "Start" --no-label "Cancel" --yesno "\nDo you want to enable and start this service?" 7 50
exitstatus=$?;
[[ $exitstatus = 0 ]] && sed -i "s/^NODM_ENABLED=.*/NODM_ENABLED=true/" /etc/default/nodm && service nodm start
fi
;;
"Consumption" ) "Consumption" )
h3consumption h3consumption
exit exit
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment