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

Desktop checking into separate function

parent 869ac57e
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
# Functions: # Functions:
# main # main
# check_desktop
# exceptions # exceptions
# check_if_installed # check_if_installed
# is_package_manager_running # is_package_manager_running
...@@ -43,11 +44,7 @@ function main(){ ...@@ -43,11 +44,7 @@ function main(){
OVERLAYDIR="/boot/dtb/overlay"; OVERLAYDIR="/boot/dtb/overlay";
[[ "$LINUXFAMILY" == "sunxi64" ]] && OVERLAYDIR="/boot/dtb/allwinner/overlay"; [[ "$LINUXFAMILY" == "sunxi64" ]] && OVERLAYDIR="/boot/dtb/allwinner/overlay";
# detect desktop # detect desktop
DISPLAY_MANAGER=""; DESKTOP_INSTALLED="" check_desktop
check_if_installed nodm && DESKTOP_INSTALLED="nodm";
check_if_installed lightdm && DESKTOP_INSTALLED="lightdm";
[[ -n $(service lightdm status 2> /dev/null | grep -w active) ]] && DISPLAY_MANAGER="lightdm"
[[ -n $(service nodm status 2> /dev/null | grep -w active) ]] && DISPLAY_MANAGER="nodm"
dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nLoading Armbian configuration utility ... " 5 45 dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nLoading Armbian configuration utility ... " 5 45
sleep 1 sleep 1
...@@ -56,6 +53,19 @@ function main(){ ...@@ -56,6 +53,19 @@ function main(){
#
# read desktop parameters
#
function check_desktop()
{
DISPLAY_MANAGER=""; DESKTOP_INSTALLED=""
check_if_installed nodm && DESKTOP_INSTALLED="nodm";
check_if_installed lightdm && DESKTOP_INSTALLED="lightdm";
[[ -n $(service lightdm status 2> /dev/null | grep -w active) ]] && DISPLAY_MANAGER="lightdm"
[[ -n $(service nodm status 2> /dev/null | grep -w active) ]] && DISPLAY_MANAGER="nodm"
}
# #
# naming exceptions for packages # naming exceptions for packages
# #
......
...@@ -26,6 +26,9 @@ while true; do ...@@ -26,6 +26,9 @@ while true; do
DIALOG_CANCEL=1 DIALOG_CANCEL=1
DIALOG_ESC=255 DIALOG_ESC=255
# detect desktop
check_desktop
# check update status of BSP packages # check update status of BSP packages
local mark=$(apt-mark showhold | grep -w "$BOARD") local mark=$(apt-mark showhold | grep -w "$BOARD")
...@@ -73,6 +76,9 @@ while true; do ...@@ -73,6 +76,9 @@ while true; do
# desktop # desktop
if [[ -n $DISPLAY_MANAGER ]]; then if [[ -n $DISPLAY_MANAGER ]]; then
LIST+=( "Desktop" "Disable desktop" ) LIST+=( "Desktop" "Disable desktop" )
if ! check_if_installed mpv ; then
LIST+=( "Default" "Install desktop with browser and extras" )
fi
[[ $DISPLAY_MANAGER == 'nodm' ]] && LIST+=( "Lightdm" "Switch to standard login manager" ) [[ $DISPLAY_MANAGER == 'nodm' ]] && LIST+=( "Lightdm" "Switch to standard login manager" )
[[ $DISPLAY_MANAGER == 'lightdm' ]] && LIST+=( "Nodm" "Switch to simple auto login manager" ) [[ $DISPLAY_MANAGER == 'lightdm' ]] && LIST+=( "Nodm" "Switch to simple auto login manager" )
else else
...@@ -286,6 +292,9 @@ function submenu_software () ...@@ -286,6 +292,9 @@ function submenu_software ()
{ {
while true; do while true; do
# detect desktop
check_desktop
LIST=() LIST=()
[[ -f /usr/bin/softy || -f softy ]] && LIST+=( "Softy" "3rd party applications installer" ) [[ -f /usr/bin/softy || -f softy ]] && LIST+=( "Softy" "3rd party applications installer" )
[[ -f /usr/bin/h3consumption && "$LINUXFAMILY" = "sun8i" && "$BRANCH" = "default" ]] && \ [[ -f /usr/bin/h3consumption && "$LINUXFAMILY" = "sun8i" && "$BRANCH" = "default" ]] && \
......
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