Commit 86eeec28 authored by Igor Pecovnik's avatar Igor Pecovnik
Browse files

Code cleanup and some cosmetic fixes

parent 129a6887
#!/bin/bash #!/bin/bash
# #
# Copyright (c) 2018 Igor Pecovnik, igor.pecovnik@gma**.com # Copyright (c) Authors: http://www.armbian.com/authors, info@armbian.com
# #
# This file is licensed under the terms of the GNU General Public # This file is licensed under the terms of the GNU General Public
# License version 2. This program is licensed "as is" without any # License version 2. This program is licensed "as is" without any
...@@ -9,14 +9,8 @@ ...@@ -9,14 +9,8 @@
# define sane $PATH
export PATH=/usr/sbin:/usr/bin:/sbin:/bin
# #
# check for root # check for root priveleges
# #
if [[ $EUID != 0 ]]; then if [[ $EUID != 0 ]]; then
echo "This tool requires root privileges. Try again with \"sudo \" please ..." >&2 echo "This tool requires root privileges. Try again with \"sudo \" please ..." >&2
...@@ -28,7 +22,7 @@ fi ...@@ -28,7 +22,7 @@ fi
# #
# check if we have internet connection to install dependencies # check for internet connection to install dependencies
# #
echo -e "GET http://github.com HTTP/1.0\n\n" | nc github.com 80 > /dev/null 2>&1 echo -e "GET http://github.com HTTP/1.0\n\n" | nc github.com 80 > /dev/null 2>&1
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
...@@ -87,8 +81,8 @@ do ...@@ -87,8 +81,8 @@ do
# count number of menu items to adjust window size # count number of menu items to adjust window size
LISTLENGHT="$((11+${#LIST[@]}/2))" LISTLENGHT="$((11+${#LIST[@]}/2))"
BOXLENGHT=${#LIST[@]} BOXLENGHT=${#LIST[@]}
MENUTITLE="Configure $DISTRO $DISTROID based \Z1Armbian\Z0 " MENUTITLE="Configure $DISTRO $DISTROID "
[[ -n "${BOARD_NAME/ /}" ]] && MENUTITLE=$MENUTITLE"for the \Z1${BOARD_NAME}\Z0 " [[ -n "${BOARD_NAME/ /}" ]] && MENUTITLE=$MENUTITLE" based \Z1Armbian\Z0 for the \Z1${BOARD_NAME}\Z0 "
# main dialog routine # main dialog routine
DIALOG_CANCEL=1 DIALOG_CANCEL=1
...@@ -99,14 +93,15 @@ do ...@@ -99,14 +93,15 @@ do
exec 3>&1 exec 3>&1
selection=$(dialog --colors --backtitle "$BACKTITLE" --title " armbian-config " --clear \ selection=$(dialog --colors --backtitle "$BACKTITLE" --title " armbian-config " --clear \
--cancel-label "Cancel" --menu "\n$MENUTITLE \n \nSupport: \Z1https://www.armbian.com\Z0\n " \ --cancel-label "Cancel" --menu "\n$MENUTITLE \n \nSupport: \Z1https://forum.armbian.com\Z0\n " \
$LISTLENGHT ${TITLELENGHT} $BOXLENGHT "${LIST[@]}" 2>&1 1>&3) $LISTLENGHT ${TITLELENGHT} $BOXLENGHT "${LIST[@]}" 2>&1 1>&3)
exit_status=$? exit_status=$?
exec 3>&- exec 3>&-
[[ $exit_status == $DIALOG_CANCEL || $exit_status == $DIALOG_ESC ]] && clear && exit [[ $exit_status == $DIALOG_CANCEL || $exit_status == $DIALOG_ESC ]] && clear && exit
dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nLoading ${selection,,} submodule ... " 5 $((26+${#selection})) dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox \
"\nLoading ${selection,,} submodule ... " 5 $((26+${#selection}))
case $selection in case $selection in
...@@ -127,10 +122,13 @@ do ...@@ -127,10 +122,13 @@ do
;; ;;
"Help" ) "Help" )
show_box "Info" "This tool provides a straightforward way of configuring. \ t="This tool provides a straightforward way of configuring."
\n \nAlthough it can be run at any time, some of the options may have difficulties if you alter system settings manually.\n\ t=$t"\n \nAlthough it can be run at any time, some of the"
\n\Z1Documentation:\Z0 https://docs.armbian.com\n\n\Z1Support:\Z0 https://forum.armbian.com\n t=$t" options may have difficulties if you alter system settings manually.\n"
\n\Z1Sources:\Z0 https://git.armbian.com" "18" t=$t"\n\Z1Documentation:\Z0 https://docs.armbian.com"
t=$t"\n\n\Z1Support:\Z0 https://forum.armbian.com\n"
t=$t"\n\Z1Sources:\Z0 https://github.com/armbian/config"
show_box "Info" "$t" "18"
;; ;;
esac esac
done done
\ No newline at end of file
#!/bin/bash #!/bin/bash
# #
# Copyright (c) 2017 Igor Pecovnik, igor.pecovnik@gma**.com # Copyright (c) Authors: http://www.armbian.com/authors, info@armbian.com
# #
# This file is licensed under the terms of the GNU General Public # This file is licensed under the terms of the GNU General Public
# License version 2. This program is licensed "as is" without any # License version 2. This program is licensed "as is" without any
...@@ -38,7 +38,8 @@ function main(){ ...@@ -38,7 +38,8 @@ function main(){
[[ -z "${ARMBIAN// }" ]] && ARMBIAN="$DISTRO $DISTROID" [[ -z "${ARMBIAN// }" ]] && ARMBIAN="$DISTRO $DISTROID"
DEFAULT_ADAPTER=$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)') DEFAULT_ADAPTER=$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)')
LOCALIPADD=$(ip -4 addr show dev $DEFAULT_ADAPTER | awk '/inet/ {print $2}' | cut -d'/' -f1) LOCALIPADD=$(ip -4 addr show dev $DEFAULT_ADAPTER | awk '/inet/ {print $2}' | cut -d'/' -f1)
BACKTITLE="Configuration utility, $ARMBIAN, $LOCALIPADD" BACKTITLE="Configuration utility, $ARMBIAN"
[[ -n "$LOCALIPADD" ]] && BACKTITLE=$BACKTITLE", "$LOCALIPADD
TITLE="$BOARD_NAME " TITLE="$BOARD_NAME "
[[ -z "${DEFAULT_ADAPTER// }" ]] && DEFAULT_ADAPTER="lo" [[ -z "${DEFAULT_ADAPTER// }" ]] && DEFAULT_ADAPTER="lo"
OVERLAYDIR="/boot/dtb/overlay"; OVERLAYDIR="/boot/dtb/overlay";
...@@ -118,11 +119,15 @@ function check_desktop() ...@@ -118,11 +119,15 @@ function check_desktop()
DISPLAY_MANAGER=""; DESKTOP_INSTALLED="" DISPLAY_MANAGER=""; DESKTOP_INSTALLED=""
check_if_installed nodm && DESKTOP_INSTALLED="nodm"; check_if_installed nodm && DESKTOP_INSTALLED="nodm";
check_if_installed lightdm && DESKTOP_INSTALLED="lightdm"; check_if_installed lightdm && DESKTOP_INSTALLED="lightdm";
check_if_installed lightdm && DESKTOP_INSTALLED="gnome";
[[ -n $(service lightdm status 2> /dev/null | grep -w active) ]] && DISPLAY_MANAGER="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" [[ -n $(service nodm status 2> /dev/null | grep -w active) ]] && DISPLAY_MANAGER="nodm"
[[ -n $(service gdm status 2> /dev/null | grep -w active) ]] && DISPLAY_MANAGER="gdm"
} }
# #
# naming exceptions for packages # naming exceptions for packages
# #
...@@ -241,7 +246,6 @@ function show_box () ...@@ -241,7 +246,6 @@ function show_box ()
#-----------------------------------------------------------------------------------------------------------------------------------------#
# #
# show description for MOTD files # show description for MOTD files
# #
......
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