Desktop checking into separate function

This commit is contained in:
Igor Pecovnik
2018-05-09 11:11:33 +02:00
parent 869ac57e27
commit c61d71a3c4
2 changed files with 24 additions and 5 deletions

View File

@@ -8,6 +8,7 @@
# Functions:
# main
# check_desktop
# exceptions
# check_if_installed
# is_package_manager_running
@@ -43,11 +44,7 @@ function main(){
OVERLAYDIR="/boot/dtb/overlay";
[[ "$LINUXFAMILY" == "sunxi64" ]] && OVERLAYDIR="/boot/dtb/allwinner/overlay";
# detect 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"
check_desktop
dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nLoading Armbian configuration utility ... " 5 45
sleep 1
@@ -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
#

View File

@@ -26,6 +26,9 @@ while true; do
DIALOG_CANCEL=1
DIALOG_ESC=255
# detect desktop
check_desktop
# check update status of BSP packages
local mark=$(apt-mark showhold | grep -w "$BOARD")
@@ -73,6 +76,9 @@ while true; do
# desktop
if [[ -n $DISPLAY_MANAGER ]]; then
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 == 'lightdm' ]] && LIST+=( "Nodm" "Switch to simple auto login manager" )
else
@@ -286,6 +292,9 @@ function submenu_software ()
{
while true; do
# detect desktop
check_desktop
LIST=()
[[ -f /usr/bin/softy || -f softy ]] && LIST+=( "Softy" "3rd party applications installer" )
[[ -f /usr/bin/h3consumption && "$LINUXFAMILY" = "sun8i" && "$BRANCH" = "default" ]] && \