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

Rearange items here and there + bugfixing in network area

parent 930a40c7
...@@ -34,6 +34,8 @@ fi ...@@ -34,6 +34,8 @@ fi
source "$0""-submenu" source "$0""-submenu"
source "$0""-jobs" source "$0""-jobs"
#-----------------------------------------------------------------------------------------------------------------------------------------# #-----------------------------------------------------------------------------------------------------------------------------------------#
# Main menu # Main menu
# #
...@@ -41,25 +43,24 @@ while true ...@@ -41,25 +43,24 @@ while true
do do
LIST=() LIST=()
LIST+=( "System" "General system settings" ) LIST+=( "System" "System and security settings" )
LIST+=( "Networking" "Wired, Wireless, Bluetooth, Access point" ) LIST+=( "Network" "Wired, wireless, Bluetooth, access point" )
LIST+=( "Armbian" "Armbian specific: overlays, MOTD, loglevel" ) LIST+=( "Personal" "Timezone, language, hostname" )
LIST+=( "Software" "System and 3rd party software install" ) LIST+=( "Software" "System and 3rd party software install" )
LIST+=( "Help" "Documentation, support, sources" ) LIST+=( "Help" "Documentation, support, sources" )
# 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="Configuration tool " MENUTITLE="Configure $DISTRO $DISTROID based \Z1Armbian\Z0 "
[[ -n "${BOARD_NAME/ /}" ]] && MENUTITLE=$MENUTITLE"for the \Z1${BOARD_NAME}\Z0" [[ -n "${BOARD_NAME/ /}" ]] && MENUTITLE=$MENUTITLE"for the \Z1${BOARD_NAME}\Z0 "
MENUTITLE=$MENUTITLE"running \Z1$DISTRO $DISTROID\Z0"
# main dialog routine # main dialog routine
DIALOG_CANCEL=1 DIALOG_CANCEL=1
DIALOG_ESC=255 DIALOG_ESC=255
TITLELENGHT=${#MENUTITLE} TITLELENGHT=${#MENUTITLE}
[[ "$TITLELENGHT" -lt 50 ]] && TITLELENGHT="70" [[ "$TITLELENGHT" -lt 50 ]] && TITLELENGHT="50"
exec 3>&1 exec 3>&1
selection=$(dialog --colors --backtitle "$BACKTITLE" --title " armbian-config " --clear \ selection=$(dialog --colors --backtitle "$BACKTITLE" --title " armbian-config " --clear \
...@@ -74,18 +75,22 @@ do ...@@ -74,18 +75,22 @@ do
case $selection in case $selection in
"Software" ) "System" )
submenu_software submenu_settings
;; ;;
"Networking" )
"Network" )
submenu_networking submenu_networking
;; ;;
"System" )
submenu_settings "Personal" )
submenu_personal
;; ;;
"Armbian" )
submenu_hardware "Software" )
submenu_software
;; ;;
"Help" ) "Help" )
show_box "Info" "This tool provides a straightforward way of configuring the \Z4${BOARD_NAME}\Z0. \ show_box "Info" "This tool provides a straightforward way of configuring the \Z4${BOARD_NAME}\Z0. \
\n \nAlthough it can be run at any time, some of the options may have difficulties if you alter system settings manually.\n\ \n \nAlthough it can be run at any time, some of the options may have difficulties if you alter system settings manually.\n\
......
...@@ -26,7 +26,7 @@ function jobs () ...@@ -26,7 +26,7 @@ function jobs ()
# Remove BT # Remove BT
# #
"Remove BT" ) "BT remove" )
debconf-apt-progress -- apt-get -y remove bluetooth bluez bluez-tools debconf-apt-progress -- apt-get -y remove bluetooth bluez bluez-tools
check_if_installed xserver-xorg && debconf-apt-progress -- apt-get -y remove pulseaudio-module-bluetooth blueman check_if_installed xserver-xorg && debconf-apt-progress -- apt-get -y remove pulseaudio-module-bluetooth blueman
debconf-apt-progress -- apt -y -qq autoremove debconf-apt-progress -- apt -y -qq autoremove
...@@ -34,7 +34,7 @@ function jobs () ...@@ -34,7 +34,7 @@ function jobs ()
# Enabling BT # Enabling BT
# #
"Bluetooth" ) "BT install" )
debconf-apt-progress -- apt-get -y install bluetooth bluez bluez-tools debconf-apt-progress -- apt-get -y install bluetooth bluez bluez-tools
check_if_installed xserver-xorg && debconf-apt-progress -- apt-get -y --no-install-recommends install pulseaudio-module-bluetooth blueman check_if_installed xserver-xorg && debconf-apt-progress -- apt-get -y --no-install-recommends install pulseaudio-module-bluetooth blueman
;; ;;
...@@ -146,7 +146,7 @@ function jobs () ...@@ -146,7 +146,7 @@ function jobs ()
if [[ -f /usr/bin/h3disp ]]; then if [[ -f /usr/bin/h3disp ]]; then
# h3 boards # h3 boards
get_h3modes get_h3modes
dialog --title " Display output type " --colors --help-button --help-label "Back" --no-label "DVI" --yes-label "HDMI" \ dialog --title " Display output type " --colors --help-button --help-label "Cancel" --no-label "DVI" --yes-label "HDMI" \
--backtitle "$BACKTITLE" --yesno "\nIn case you use an HDMI-to-DVI converter choose DVI!" 7 57 --backtitle "$BACKTITLE" --yesno "\nIn case you use an HDMI-to-DVI converter choose DVI!" 7 57
output_type=$? output_type=$?
if [[ $output_type = 0 || $output_type = 1 ]]; then if [[ $output_type = 0 || $output_type = 1 ]]; then
...@@ -164,7 +164,7 @@ function jobs () ...@@ -164,7 +164,7 @@ function jobs ()
display_cmd="sed -i \"s/^disp_mode=.*/disp_mode=$SCREEN_RESOLUTION/\" /boot/armbianEnv.txt"; display_cmd="sed -i \"s/^disp_mode=.*/disp_mode=$SCREEN_RESOLUTION/\" /boot/armbianEnv.txt";
fi fi
dialog --title " Display resolution " --colors --no-label "Back" --backtitle "$BACKTITLE" --yesno \ dialog --title " Display resolution " --colors --no-label "Cancel" --backtitle "$BACKTITLE" --yesno \
"\nSwitching to \Z1$SCREEN_RESOLUTION\Z0 and reboot?" 7 42 "\nSwitching to \Z1$SCREEN_RESOLUTION\Z0 and reboot?" 7 42
if [[ $? = 0 ]]; then if [[ $? = 0 ]]; then
eval $display_cmd > /dev/null eval $display_cmd > /dev/null
...@@ -239,12 +239,12 @@ function jobs () ...@@ -239,12 +239,12 @@ function jobs ()
if [[ -n $(service hostapd status | grep -w active | grep -w running) ]]; then if [[ -n $(service hostapd status | grep -w active | grep -w running) ]]; then
if [[ -n $HOSTAPDBRIDGE ]]; then if [[ -n $HOSTAPDBRIDGE ]]; then
dialog --title " Hostapd service is running " --colors --backtitle "$BACKTITLE" --help-button \ dialog --title " Hostapd service is running " --colors --backtitle "$BACKTITLE" --help-button \
--help-label "Back" --yes-label "Stop and reboot" --no-label "Edit" --yesno \ --help-label "Cancel" --yes-label "Stop and reboot" --no-label "Edit" --yesno \
"\n\Z1Stop:\Z0 stop and reboot\n\n\Z1Edit:\Z0 change basic parameters: SSID, password and channel" 9 70 "\n\Z1Stop:\Z0 stop and reboot\n\n\Z1Edit:\Z0 change basic parameters: SSID, password and channel" 9 70
else else
dialog --title " Hostapd service is running " --colors --backtitle "$BACKTITLE" --help-button \ dialog --title " Hostapd service is running " --colors --backtitle "$BACKTITLE" --help-button \
--help-label "Back" --yes-label "Stop" --no-label "Edit" --yesno \ --help-label "Cancel" --yes-label "Stop" --no-label "Edit" --yesno \
"\n\Z1Stop:\Z0 stop providing Access Point\n\n\Z1Edit:\Z0 change basic parameters: SSID, password and channel" 9 70 "\n\Z1Stop:\Z0 stop providing Access Point\n\n\Z1Edit:\Z0 change basic parameters: SSID, password and channel" 9 70
fi fi
exitstatus=$?; exitstatus=$?;
...@@ -282,7 +282,7 @@ function jobs () ...@@ -282,7 +282,7 @@ function jobs ()
if grep -q "^## IEEE 802.11n" /etc/hostapd.conf; then sed '/## IEEE 802.11n/,/^## IEEE 802.11n/ s/.*/#&/' -i /etc/hostapd.conf; fi if grep -q "^## IEEE 802.11n" /etc/hostapd.conf; then sed '/## IEEE 802.11n/,/^## IEEE 802.11n/ s/.*/#&/' -i /etc/hostapd.conf; fi
sed -i "s/^channel=.*/channel=5/" /etc/hostapd.conf sed -i "s/^channel=.*/channel=5/" /etc/hostapd.conf
service network-manager restart; sleep 3 service network-manager reload
# change special adapters to AP mode # change special adapters to AP mode
wlan_exceptions "on" wlan_exceptions "on"
# check for WLAN interfaces # check for WLAN interfaces
...@@ -295,7 +295,7 @@ function jobs () ...@@ -295,7 +295,7 @@ function jobs ()
echo "[keyfile]" > /etc/NetworkManager/conf.d/10-ignore-interfaces.conf echo "[keyfile]" > /etc/NetworkManager/conf.d/10-ignore-interfaces.conf
echo "unmanaged-devices=interface-name:$WIRELESS_ADAPTER" >> /etc/NetworkManager/conf.d/10-ignore-interfaces.conf echo "unmanaged-devices=interface-name:$WIRELESS_ADAPTER" >> /etc/NetworkManager/conf.d/10-ignore-interfaces.conf
fi fi
service network-manager restart; sleep 3 service network-manager reload
# display dialog # display dialog
dialog --colors --backtitle "$BACKTITLE" --title "Please wait" --infobox \ dialog --colors --backtitle "$BACKTITLE" --title "Please wait" --infobox \
"\nWireless adapter: \Z1${WIRELESS_ADAPTER}\Z0\n\nProbing nl80211 hostapd driver compatibility." 7 50 "\nWireless adapter: \Z1${WIRELESS_ADAPTER}\Z0\n\nProbing nl80211 hostapd driver compatibility." 7 50
...@@ -490,7 +490,7 @@ function jobs () ...@@ -490,7 +490,7 @@ function jobs ()
${VPNDIR}vpncmd /client localhost /cmd niccreate se >/dev/null 2>&1 ${VPNDIR}vpncmd /client localhost /cmd niccreate se >/dev/null 2>&1
fi fi
if [[ -z $(${VPNDIR}vpncmd /client localhost /cmd accountlist | grep "VPN Server") ]]; then if [[ -z $(${VPNDIR}vpncmd /client localhost /cmd accountlist | grep "VPN Server") ]]; then
dialog --backtitle "$BACKTITLE" --no-label " Back " --yes-label " Import " --title " VPN " --yesno "\nVPN configuration was not found.\n\nPlace file to /etc/server.vpn" 9 45 dialog --backtitle "$BACKTITLE" --no-label " Cancel " --yes-label " Import " --title " VPN " --yesno "\nVPN configuration was not found.\n\nPlace file to /etc/server.vpn" 9 45
if [[ $? = 0 && -f /etc/server.vpn ]]; then if [[ $? = 0 && -f /etc/server.vpn ]]; then
${VPNDIR}vpncmd /client localhost /cmd accountimport //etc//server.vpn >/dev/null 2>&1 ${VPNDIR}vpncmd /client localhost /cmd accountimport //etc//server.vpn >/dev/null 2>&1
${VPNDIR}vpnclient stop >/dev/null 2>&1 ${VPNDIR}vpnclient stop >/dev/null 2>&1
...@@ -508,7 +508,7 @@ function jobs () ...@@ -508,7 +508,7 @@ function jobs ()
echo "ip route del default" echo "ip route del default"
echo "ip route add default via $GW dev vpn_se" echo "ip route add default via $GW dev vpn_se"
read read
dialog --title "VPN client is connected to $VPNSERVERIP" --colors --backtitle "$BACKTITLE" --help-button --help-label "Back" --yes-label "Stop" --no-label " Import " --yesno "\n\Z1Stop: \Z0 stop\n\n\Z1Import:\Z0 import new config from /etc/armbian.vpn" 9 70 dialog --title "VPN client is connected to $VPNSERVERIP" --colors --backtitle "$BACKTITLE" --help-button --help-label "Cancel" --yes-label "Stop" --no-label " Import " --yesno "\n\Z1Stop: \Z0 stop\n\n\Z1Import:\Z0 import new config from /etc/armbian.vpn" 9 70
fi fi
response=$? response=$?
if [[ $response = 0 ]]; then if [[ $response = 0 ]]; then
...@@ -521,7 +521,7 @@ function jobs () ...@@ -521,7 +521,7 @@ function jobs ()
${VPNDIR}vpnclient stop >/dev/null 2>&1 ${VPNDIR}vpnclient stop >/dev/null 2>&1
fi fi
else else
dialog --title "VPN client is disconnected" --colors --backtitle "$BACKTITLE" --help-button --help-label "Back" --yes-label "Connect" --no-label " Import " --yesno "\n\Z1Connect:\Z0 Connect with your VPN server \n\n\Z1Import:\Z0 import new config from /etc/armbian.vpn" 9 70 dialog --title "VPN client is disconnected" --colors --backtitle "$BACKTITLE" --help-button --help-label "Cancel" --yes-label "Connect" --no-label " Import " --yesno "\n\Z1Connect:\Z0 Connect with your VPN server \n\n\Z1Import:\Z0 import new config from /etc/armbian.vpn" 9 70
response=$? response=$?
if [[ $response = 0 ]]; then if [[ $response = 0 ]]; then
${VPNDIR}vpnclient start >/dev/null 2>&1 ${VPNDIR}vpnclient start >/dev/null 2>&1
...@@ -542,7 +542,7 @@ function jobs () ...@@ -542,7 +542,7 @@ function jobs ()
# Connect to Bluetooth # Connect to Bluetooth
# #
"Discover" ) "BT discover" )
dialog --backtitle "$BACKTITLE" --title " Bluetooth " --msgbox "\nMake sure your Bluetooth devices are discoverable!" 7 54 dialog --backtitle "$BACKTITLE" --title " Bluetooth " --msgbox "\nMake sure your Bluetooth devices are discoverable!" 7 54
connect_bt_interface connect_bt_interface
;; ;;
...@@ -617,7 +617,7 @@ function jobs () ...@@ -617,7 +617,7 @@ function jobs ()
if [[ $? = 0 ]]; then if [[ $? = 0 ]]; then
debconf-apt-progress -- apt-get update debconf-apt-progress -- apt-get update
debconf-apt-progress -- apt-get -y upgrade debconf-apt-progress -- apt-get -y upgrade
dialog --title " Firmware update " --colors --no-label "Back" --backtitle "$BACKTITLE" --yesno \ dialog --title " Firmware update " --colors --no-label "Cancel" --backtitle "$BACKTITLE" --yesno \
"\nFirmware has been updated. Reboot? " 7 39 "\nFirmware has been updated. Reboot? " 7 39
if [[ $? = 0 ]]; then reboot; fi if [[ $? = 0 ]]; then reboot; fi
fi fi
...@@ -634,7 +634,7 @@ function jobs () ...@@ -634,7 +634,7 @@ function jobs ()
# Freeze and unfreeze kernel and board support packages # Freeze and unfreeze kernel and board support packages
# #
"Freeze" | "Defreeze" ) "Freeze" | "Defreeze" )
dialog --title " Updating " --backtitle "$BACKTITLE" --yes-label "$1" --no-label "Back" --yesno \ dialog --title " Updating " --backtitle "$BACKTITLE" --yes-label "$1" --no-label "Cancel" --yesno \
"\nDo you want to ${1,,} kernel updates?" 7 44 "\nDo you want to ${1,,} kernel updates?" 7 44
if [[ $? = 0 ]]; then if [[ $? = 0 ]]; then
TARGET_BRANCH=$BRANCH TARGET_BRANCH=$BRANCH
...@@ -656,12 +656,12 @@ function jobs () ...@@ -656,12 +656,12 @@ function jobs ()
"Desktop" ) "Desktop" )
if [[ -n $(service lightdm status 2> /dev/null | grep -w active | grep -w running) || -n $(service nodm status | grep -w active | grep -w running) ]]; then if [[ -n $(service lightdm status 2> /dev/null | grep -w active | grep -w running) || -n $(service nodm status | grep -w active | grep -w running) ]]; then
dialog --title " Desktop is enabled and running " --backtitle "$BACKTITLE" \ dialog --title " Desktop is enabled and running " --backtitle "$BACKTITLE" \
--yes-label "Stop" --no-label "Back" --yesno "\nDo you want to stop and disable this service?" 7 50 --yes-label "Stop" --no-label "Cancel" --yesno "\nDo you want to stop and disable this service?" 7 50
exitstatus=$?; exitstatus=$?;
[[ $exitstatus = 0 ]] && service nodm stop && service lightdm stop && \ [[ $exitstatus = 0 ]] && service nodm stop && service lightdm stop && \
sed -i "s/^NODM_ENABLED=.*/NODM_ENABLED=false/" /etc/default/nodm sed -i "s/^NODM_ENABLED=.*/NODM_ENABLED=false/" /etc/default/nodm
else else
dialog --colors --title " Choose a display manager " --backtitle "$BACKTITLE" --help-button --help-label "Back" --yes-label "Lightdm" \ dialog --colors --title " Choose a display manager " --backtitle "$BACKTITLE" --help-button --help-label "Cancel" --yes-label "Lightdm" \
--no-label "Nodm" --yesno "\n\Z1Lightdm\Z0 = full featured login display manager\n\Z1Nodm\Z0 = autoloading into desktop" 8 70 --no-label "Nodm" --yesno "\n\Z1Lightdm\Z0 = full featured login display manager\n\Z1Nodm\Z0 = autoloading into desktop" 8 70
exitstatus=$?; exitstatus=$?;
[[ $exitstatus = 0 ]] && [[ -f /etc/X11/default-display-manager ]] && \ [[ $exitstatus = 0 ]] && [[ -f /etc/X11/default-display-manager ]] && \
...@@ -746,7 +746,7 @@ function jobs () ...@@ -746,7 +746,7 @@ function jobs ()
# Toggle overlay items # Toggle overlay items
# #
"Overlays" ) "Hardware" )
# check if user agree to enter this area # check if user agree to enter this area
CHANGES="false" CHANGES="false"
while true; do while true; do
...@@ -773,7 +773,7 @@ function jobs () ...@@ -773,7 +773,7 @@ function jobs ()
exec 3>&1 exec 3>&1
selection=$(dialog --backtitle "$BACKTITLE" --title "Toggle hardware config" --clear --cancel-label \ selection=$(dialog --backtitle "$BACKTITLE" --title "Toggle hardware config" --clear --cancel-label \
"Back" --ok-label "Save" --checklist "\nChoose what you want to enable or disable:\n " \ "Cancel" --ok-label "Save" --checklist "\nChoose what you want to enable or disable:\n " \
$LISTLENGHT 70 $LISTLENGHT "${MOTD[@]}" 2>&1 1>&3) $LISTLENGHT 70 $LISTLENGHT "${MOTD[@]}" 2>&1 1>&3)
exit_status=$? exit_status=$?
exec 3>&- exec 3>&-
...@@ -825,7 +825,7 @@ function jobs () ...@@ -825,7 +825,7 @@ function jobs ()
dialog --backtitle "$BACKTITLE" --title "Please wait" --colors --msgbox "\nThere are no mirrors available!" 7 35 dialog --backtitle "$BACKTITLE" --title "Please wait" --colors --msgbox "\nThere are no mirrors available!" 7 35
else else
exec 3>&1 exec 3>&1
TARGET_MIRROR=$(dialog --cancel-label "Back" --backtitle "$BACKTITLE" --no-collapse \ TARGET_MIRROR=$(dialog --cancel-label "Cancel" --backtitle "$BACKTITLE" --no-collapse \
--title "Change repository location" --colors --clear --menu "\nfrom \Z1$BEFORE\Z0 to:\n " $((6+${LIST_LENGHT})) 60 15 "${LIST[@]}" 2>&1 1>&3) --title "Change repository location" --colors --clear --menu "\nfrom \Z1$BEFORE\Z0 to:\n " $((6+${LIST_LENGHT})) 60 15 "${LIST[@]}" 2>&1 1>&3)
exitstatus=$?; exitstatus=$?;
exec 3>&- exec 3>&-
...@@ -904,7 +904,7 @@ function jobs () ...@@ -904,7 +904,7 @@ function jobs ()
exec 3>&1 exec 3>&1
selection=$(dialog --backtitle "$BACKTITLE" --title " Toggle sshd options " --clear --cancel-label \ selection=$(dialog --backtitle "$BACKTITLE" --title " Toggle sshd options " --clear --cancel-label \
"Back" --ok-label "Save" --checklist "\nChoose what you want to enable or disable:\n " \ "Cancel" --ok-label "Save" --checklist "\nChoose what you want to enable or disable:\n " \
$LISTLENGHT 74 21 "${MOTD[@]}" 2>&1 1>&3) $LISTLENGHT 74 21 "${MOTD[@]}" 2>&1 1>&3)
exit_status=$? exit_status=$?
exec 3>&- exec 3>&-
...@@ -936,7 +936,7 @@ function jobs () ...@@ -936,7 +936,7 @@ function jobs ()
# Switch to daily builds # Switch to daily builds
# #
"Nightly" ) "Nightly" )
dialog --title " Warning " --backtitle "$BACKTITLE" --yes-label "OK" --no-label "Back" \ dialog --colors --title " \Z1Warning\Z0 " --backtitle "$BACKTITLE" --yes-label "OK" --no-label "Cancel" \
--yesno "\nYou are switching to automated nightly repository which is untested and might break your system.\ --yesno "\nYou are switching to automated nightly repository which is untested and might break your system.\
Are you fine with that?" 9 48 Are you fine with that?" 9 48
if [[ $? = 0 ]]; then if [[ $? = 0 ]]; then
...@@ -944,7 +944,7 @@ function jobs () ...@@ -944,7 +944,7 @@ function jobs ()
debconf-apt-progress -- apt-get update debconf-apt-progress -- apt-get update
debconf-apt-progress -- apt-get -y upgrade debconf-apt-progress -- apt-get -y upgrade
dialog --title "Switching to nightly" --backtitle "$BACKTITLE" --yes-label "Reboot" \ dialog --title "Switching to nightly" --backtitle "$BACKTITLE" --yes-label "Reboot" \
--no-label "Back" --yesno "\nReboot to apply new settings?" 7 34 --no-label "Cancel" --yesno "\nReboot to apply new settings?" 7 34
if [[ $? = 0 ]]; then reboot; fi if [[ $? = 0 ]]; then reboot; fi
fi fi
;; ;;
...@@ -953,13 +953,13 @@ function jobs () ...@@ -953,13 +953,13 @@ function jobs ()
# Switch to stable builds # Switch to stable builds
# #
"Stable" ) "Stable" )
dialog --title " Warning " --backtitle "$BACKTITLE" --yes-label "OK" --no-label "Back" \ dialog --colors --title " \Z1Warning\Z0 " --backtitle "$BACKTITLE" --yes-label "OK" --no-label "Cancel" \
--yesno "\nYou are switching back to stable respository where you are going to get future updates. Are you fine with that?" 9 44 --yesno "\nYou are switching back to stable respository where you are going to get future updates. Are you fine with that?" 9 44
if [[ $? = 0 ]]; then if [[ $? = 0 ]]; then
sed -i 's/beta.armbian.com/apt.armbian.com/' /etc/apt/sources.list.d/armbian.list sed -i 's/beta.armbian.com/apt.armbian.com/' /etc/apt/sources.list.d/armbian.list
debconf-apt-progress -- apt-get update debconf-apt-progress -- apt-get update
debconf-apt-progress -- apt-get -y upgrade debconf-apt-progress -- apt-get -y upgrade
dialog --title "Switching to stable" --backtitle "$BACKTITLE" --yes-label "Reboot" --no-label "Back" --yesno \ dialog --title "Switching to stable" --backtitle "$BACKTITLE" --yes-label "Reboot" --no-label "Cancel" --yesno \
"\nReboot to apply new settings?" 7 34 "\nReboot to apply new settings?" 7 34
if [[ $? = 0 ]]; then reboot; fi if [[ $? = 0 ]]; then reboot; fi
fi fi
...@@ -972,7 +972,7 @@ function jobs () ...@@ -972,7 +972,7 @@ function jobs ()
aval_kernel aval_kernel
if [[ $exitstatus = 0 ]]; then if [[ $exitstatus = 0 ]]; then
exceptions "$INSTALL_KERNEL" exceptions "$INSTALL_KERNEL"
dialog --title " Install and reboot " --colors --backtitle "$BACKTITLE" --yes-label "OK" --no-label "Back" \ dialog --title " Install and reboot " --colors --backtitle "$BACKTITLE" --yes-label "OK" --no-label "Cancel" \
--yesno "\nSwitching to \Z1linux-image${TARGET_BRANCH}-${TARGET_FAMILY}\Z0 \n\nMake sure you know what you are doing! \ --yesno "\nSwitching to \Z1linux-image${TARGET_BRANCH}-${TARGET_FAMILY}\Z0 \n\nMake sure you know what you are doing! \
\n\nBoard config will be reverted to defaults." 11 46 \n\nBoard config will be reverted to defaults." 11 46
if [[ $? = 0 ]]; then if [[ $? = 0 ]]; then
......
...@@ -7,27 +7,6 @@ ...@@ -7,27 +7,6 @@
# warranty of any kind, whether express or implied. # warranty of any kind, whether express or implied.
DIALOG_CANCEL=1
DIALOG_ESC=255
#-----------------------------------------------------------------------------------------------------------------------------------------#
# gather info about the board and start with loading menu
#
[[ -f /etc/armbian-release ]] && source /etc/armbian-release && ARMBIAN="Armbian $VERSION $IMAGE_TYPE";
DISTRO=$(lsb_release -is)
DISTROID=$(lsb_release -sc)
KERNELID=$(uname -r)
[[ -z "${ARMBIAN// }" ]] && ARMBIAN=$KERNELID
BACKTITLE="Configuration utility, $ARMBIAN, https://www.armbian.com"
TITLE="$BOARD_NAME "
DEFAULT_ADAPTER=$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)')
[[ -z "${DEFAULT_ADAPTER// }" ]] && DEFAULT_ADAPTER="lo"
dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nLoading Armbian configuration utility ... " 5 45
sleep 1
check_if_installed (){ check_if_installed (){
#------------------------------------------------------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------------------------------------------------------
# check dpkg status of $1 -- currently only 'not installed at all' case catched # check dpkg status of $1 -- currently only 'not installed at all' case catched
...@@ -349,7 +328,7 @@ function aval_kernel () ...@@ -349,7 +328,7 @@ function aval_kernel ()
TARGET_BRANCH=${AVAL_KERNEL[0]} TARGET_BRANCH=${AVAL_KERNEL[0]}
else else
exec 3>&1 exec 3>&1
TARGET_BRANCH=$(dialog --cancel-label "Back" --backtitle "$BACKTITLE" --no-collapse \ TARGET_BRANCH=$(dialog --cancel-label "Cancel" --backtitle "$BACKTITLE" --no-collapse \
--title "Upgrade from $BRANCH to:" --clear --menu "" $((6+${LIST_LENGHT})) 40 15 "${LIST[@]}" 2>&1 1>&3) --title "Upgrade from $BRANCH to:" --clear --menu "" $((6+${LIST_LENGHT})) 40 15 "${LIST[@]}" 2>&1 1>&3)
exitstatus=$?; exitstatus=$?;
exec 3>&- exec 3>&-
...@@ -418,8 +397,8 @@ function get_wlan_interface () ...@@ -418,8 +397,8 @@ function get_wlan_interface ()
{ {
IFS=$'\r\n' IFS=$'\r\n'
GLOBIGNORE='*' GLOBIGNORE='*'
WLAN_INTERFACES=($(nmcli dev status | grep wifi | grep disconnected |awk '{print $1}'))
WLAN_INTERFACES=($(nmcli --wait 10 dev status | grep wifi | grep disconnected |awk '{print $1}'))
local LIST=() local LIST=()
for i in "${WLAN_INTERFACES[@]}" for i in "${WLAN_INTERFACES[@]}"
do do
...@@ -432,7 +411,7 @@ function get_wlan_interface () ...@@ -432,7 +411,7 @@ function get_wlan_interface ()
else else
exec 3>&1 exec 3>&1
WIRELESS_ADAPTER=$(dialog --nocancel --backtitle "$BACKTITLE" --no-collapse \ WIRELESS_ADAPTER=$(dialog --nocancel --backtitle "$BACKTITLE" --no-collapse \
--title "Select interface" --clear --menu "" $((6+${LIST_LENGHT})) 30 15 "${LIST[@]}" 2>&1 1>&3) --title "Select interface" --clear --menu "" $((6+${LIST_LENGHT})) 40 15 "${LIST[@]}" 2>&1 1>&3)
exec 3>&- exec 3>&-
fi fi
} }
...@@ -459,7 +438,7 @@ function select_default_interface () ...@@ -459,7 +438,7 @@ function select_default_interface ()
else else
exec 3>&1 exec 3>&1
DEFAULT_ADAPTER=$(dialog --nocancel --backtitle "$BACKTITLE" --no-collapse \ DEFAULT_ADAPTER=$(dialog --nocancel --backtitle "$BACKTITLE" --no-collapse \
--title "Select default interface" --clear --menu "" $((6+${LIST_LENGHT})) 30 15 "${LIST[@]}" 2>&1 1>&3) --title "Select default interface" --clear --menu "" $((6+${LIST_LENGHT})) 40 15 "${LIST[@]}" 2>&1 1>&3)
exec 3>&- exec 3>&-
fi fi
} }
...@@ -511,6 +490,12 @@ function connect_bt_interface () ...@@ -511,6 +490,12 @@ function connect_bt_interface ()
} }
#-----------------------------------------------------------------------------------------------------------------------------------------# #-----------------------------------------------------------------------------------------------------------------------------------------#
# system # system
# #
...@@ -520,18 +505,35 @@ while true; do ...@@ -520,18 +505,35 @@ while true; do
LIST=() LIST=()
LIST+=( "Timezone" "Change timezone \Z5($(date +%Z))\Z0" ) [[ $(sed -n 's/^DEVNAME=//p' /sys/dev/block/$(mountpoint -d /)/uevent 2> /dev/null) == mmcblk* && -f /usr/sbin/nand-sata-install ]] \
LIST+=( "Locales" "Reconfigure language \Z5($(locale | grep LANGUAGE | cut -d= -f2 | cut -d_ -f1))\Z0 and character set" ) && LIST+=( "Install" "Install to SATA, eMMC, NAND or USB" )
LIST+=( "Hostname" "Change your hostname \Z5($(cat /etc/hostname))\Z0" ) if [[ -n $(apt-mark showhold | grep -w "$BOARD") ]]; then
LIST+=( "Defreeze" "Defreeze firmware - enable kernel upgrade" )
else
LIST+=( "Freeze" "Freeze firmware - disable kernel upgrade" )
fi
if [[ -z $(apt-mark showhold | grep -w "$BOARD") ]]; then
[[ -f /etc/apt/sources.list.d/armbian.list ]] && [[ -n $(grep -w apt /etc/apt/sources.list.d/armbian.list) ]] \
&& LIST+=( "Nightly" "Switch to nightly automated builds" )
[[ -f /etc/apt/sources.list.d/armbian.list ]] && [[ -n $(grep -w beta /etc/apt/sources.list.d/armbian.list) ]] \
&& LIST+=( "Stable" "Switch to stable builds" )
fi
[[ -n $(grep -w "#kernel.printk" /etc/sysctl.conf ) ]] && LIST+=( "Lowlevel" "Stop low-level messages on console" )
[[ -f /boot/armbianEnv.txt ]] && LIST+=( "Bootenv" "Edit boot environment" )
[[ -f /boot/boot.ini ]] && LIST+=( "Bootscript" "Edit boot script" )
[[ -d /boot/dtb/overlay && $LINUXFAMILY == sun*i && $BRANCH != default ]] && \
LIST+=( "Hardware" "Toggle hardware configuration: UART, I2C, etc." )
[[ -f /usr/bin/bin2fex && "$LINUXFAMILY" = sun*i && "$BRANCH" = "default" ]] && LIST+=( "Fexedit" "Board (fex) settings editor" )
[[ $(apt-cache search --names-only '^linux-'$(lsb_release -cs)'-root.*.'$BOARD'' | sed 's/.*(\(.*\))/\1/' | awk '{print $1}' \
| wc -l) -gt 1 ]] && LIST+=( "Switch" "Switch to alternative kernels" )
LIST+=( "SSH" "Reconfigure SSH daemon" ) LIST+=( "SSH" "Reconfigure SSH daemon" )
LIST+=( "Firmware" "Upgrade board firmware" ) LIST+=( "Firmware" "Upgrade board firmware" )
[[ "$LINUXFAMILY" = sun*i && "$BRANCH" = "default" && \
-n $(bin2fex </boot/script.bin 2>/dev/null | grep -w "hdmi_used = 1") ]] && LIST+=( "Display" "set the display resolution" )
# detect desktop
DISPLAY_MANAGER=""; DESKTOP_INSTALLED=""
if [ $(dpkg-query -W -f='${db:Status-Abbrev}\n' nodm 2>/dev/null) <> "*ii*" ]; then DESKTOP_INSTALLED="nodm"; fi
if [ $(dpkg-query -W -f='${db:Status-Abbrev}\n' lightdm 2>/dev/null) <> "*ii*" ]; then DESKTOP_INSTALLED="lightdm"; fi
[[ -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"
if [[ -n $DISPLAY_MANAGER ]]; then if [[ -n $DISPLAY_MANAGER ]]; then
LIST+=( "Desktop" "Disable desktop" ) LIST+=( "Desktop" "Disable desktop" )
...@@ -541,13 +543,7 @@ while true; do ...@@ -541,13 +543,7 @@ while true; do
LIST+=( "Desktop" "Enable desktop" ) LIST+=( "Desktop" "Enable desktop" )
fi fi
if [[ -n $DISPLAY_MANAGER ]]; then
if [[ $(service xrdp status 2> /dev/null | grep -w active) ]]; then
LIST+=( "RDP" "Disable remote desktop access from Windows" )
else
LIST+=( "RDP" "Enable remote desktop access from Windows" )
fi
fi
LIST+=( "Services" "Toggle running services" ) LIST+=( "Services" "Toggle running services" )
if [[ "$DISTRO" == "Ubuntu" && "$(modinfo overlay > /dev/null 2>&1; echo $?)" == "0" ]]; then if [[ "$DISTRO" == "Ubuntu" && "$(modinfo overlay > /dev/null 2>&1; echo $?)" == "0" ]]; then
if [ -n "$(mount | grep -w tmpfs-root)" ]; then if [ -n "$(mount | grep -w tmpfs-root)" ]; then
...@@ -563,7 +559,7 @@ while true; do ...@@ -563,7 +559,7 @@ while true; do
exec 3>&1 exec 3>&1
selection=$(dialog --colors --backtitle "$BACKTITLE" --title " System settings " --clear \ selection=$(dialog --colors --backtitle "$BACKTITLE" --title " System settings " --clear \
--cancel-label "Back" --menu "$disclaimer" $LISTLENGHT 70 $BOXLENGHT \ --cancel-label "Cancel" --menu "$disclaimer" $LISTLENGHT 70 $BOXLENGHT \
"${LIST[@]}" 2>&1 1>&3) "${LIST[@]}" 2>&1 1>&3)
exit_status=$? exit_status=$?
exec 3>&- exec 3>&-
...@@ -613,10 +609,17 @@ while true; do ...@@ -613,10 +609,17 @@ while true; do
else else
LIST+=( "Clear" "Clear possible blocked interfaces" ) LIST+=( "Clear" "Clear possible blocked interfaces" )
fi fi
check_if_installed lirc && LIST+=( "Remove IR" "Remove IR support" ) || LIST+=( "IR" "Install IR support" )
if check_if_installed bluetooth then ; then
LIST+=( "BT remove" "Remove Bluetooth support" )
if [[ -n $(service bluetooth status | grep -w active | grep -w running) ]]; then if [[ -n $(service bluetooth status | grep -w active | grep -w running) ]]; then
[[ $(hcitool dev | sed '1d') != "" ]] && LIST+=( "Discover" "Discover and connect Bluetooth devices" ) [[ $(hcitool dev | sed '1d') != "" ]] && LIST+=( "BT discover" "Discover and connect Bluetooth devices" )
fi fi
else
LIST+=( "BT install" "Install Bluetooth support" )
fi
[[ -d /usr/local/vpnclient ]] && LIST+=( "VPN" "Manage Softether VPN client" ) && VPNSERVERIP=$(/usr/local/vpnclient/vpncmd /client localhost /cmd accountlist | grep "VPN Server" |grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' | head -1) [[ -d /usr/local/vpnclient ]] && LIST+=( "VPN" "Manage Softether VPN client" ) && VPNSERVERIP=$(/usr/local/vpnclient/vpncmd /client localhost /cmd accountlist | grep "VPN Server" |grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' | head -1)
...@@ -670,7 +673,7 @@ while true; do ...@@ -670,7 +673,7 @@ while true; do
exec 3>&1 exec 3>&1
selection=$(dialog --backtitle "$BACKTITLE" --colors --title " Wired, Wireless, Bluetooth, Hotspot " --clear \ selection=$(dialog --backtitle "$BACKTITLE" --colors --title " Wired, Wireless, Bluetooth, Hotspot " --clear \
--cancel-label "Back" --menu "${disclaimer}" $LISTLENGHT 70 $BOXLENGHT \ --cancel-label "Cancel" --menu "${disclaimer}" $LISTLENGHT 70 $BOXLENGHT \
"${LIST[@]}" 2>&1 1>&3) "${LIST[@]}" 2>&1 1>&3)
exit_status=$? exit_status=$?
exec 3>&- exec 3>&-
...@@ -678,49 +681,32 @@ while true; do ...@@ -678,49 +681,32 @@ while true; do
# run main function # run main function
jobs "$selection" jobs "$selection"
done done
} }
#-----------------------------------------------------------------------------------------------------------------------------------------# #-----------------------------------------------------------------------------------------------------------------------------------------#
# armbian # personal
# #
function submenu_hardware () function submenu_personal ()
{ {
while true; do while true; do
LIST=() LIST=()
LIST+=( "Timezone" "Change timezone \Z5($(date +%Z))\Z0" )
[[ $(sed -n 's/^DEVNAME=//p' /sys/dev/block/$(mountpoint -d /)/uevent 2> /dev/null) == mmcblk* && -f /usr/sbin/nand-sata-install ]] \ LIST+=( "Locales" "Reconfigure language \Z5($(locale | grep LANGUAGE | cut -d= -f2 | cut -d_ -f1))\Z0 and character set" )
&& LIST+=( "Install" "Install to SATA, eMMC, NAND or USB" ) LIST+=( "Hostname" "Change your hostname \Z5($(cat /etc/hostname))\Z0" )
if [[ -n $(apt-mark showhold | grep -w "$BOARD") ]]; then
LIST+=( "Defreeze" "Defreeze firmware upgrade" )
else
LIST+=( "Freeze" "Freeze firmware upgrade" )
fi
[[ -n $(grep -w "#kernel.printk" /etc/sysctl.conf ) ]] && LIST+=( "Lowlevel" "Stop low-level messages on console" )
[[ -f /boot/armbianEnv.txt ]] && LIST+=( "Bootenv" "Edit boot environment" )
[[ -f /boot/boot.ini ]] && LIST+=( "Bootscript" "Edit boot script" )
[[ -f /etc/apt/sources.list.d/armbian.list ]] && LIST+=( "Mirror" "Change repository server" ) [[ -f /etc/apt/sources.list.d/armbian.list ]] && LIST+=( "Mirror" "Change repository server" )
LIST+=( "Welcome" "Toggle welcome screen items" ) LIST+=( "Welcome" "Toggle welcome screen items" )
if [[ -z $(apt-mark showhold | grep -w "$BOARD") ]]; then
[[ -f /etc/apt/sources.list.d/armbian.list ]] && [[ -n $(grep -w apt /etc/apt/sources.list.d/armbian.list) ]] \
&& LIST+=( "Nightly" "Switch to nightly builds" )
[[ -f /etc/apt/sources.list.d/armbian.list ]] && [[ -n $(grep -w beta /etc/apt/sources.list.d/armbian.list) ]] \
&& LIST+=( "Stable" "Switch to stable builds" )
fi
[[ -d /boot/dtb/overlay && $LINUXFAMILY == sun*i && $BRANCH != default ]] && \
LIST+=( "Overlays" "Toggle board functions: UART, I2C, SPI, ..." )
[[ $(apt-cache search --names-only '^linux-'$(lsb_release -cs)'-root.*.'$BOARD'' | sed 's/.*(\(.*\))/\1/' | awk '{print $1}' \
| wc -l) -gt 1 ]] && LIST+=( "Switch" "Switch to alternative kernels" )
# count number of menu items to adjust window sizee # count number of menu items to adjust window sizee
LISTLENGHT="$((6+${#LIST[@]}/2))" LISTLENGHT="$((6+${#LIST[@]}/2))"
BOXLENGHT=${#LIST[@]} BOXLENGHT=${#LIST[@]}
exec 3>&1 exec 3>&1
selection=$(dialog --backtitle "$BACKTITLE" --title " Armbian specific settings " --clear \ selection=$(dialog --colors --backtitle "$BACKTITLE" --title "Personal settings" --clear \
--cancel-label "Back" --menu "$disclaimer" $LISTLENGHT 70 $BOXLENGHT \ --cancel-label "Cancel" --menu "$disclaimer" $LISTLENGHT 70 $BOXLENGHT \
"${LIST[@]}" 2>&1 1>&3) "${LIST[@]}" 2>&1 1>&3)
exit_status=$? exit_status=$?
exec 3>&- exec 3>&-
...@@ -744,18 +730,18 @@ while true; do ...@@ -744,18 +730,18 @@ while true; do
[[ -f /usr/bin/softy ]] && LIST+=( "Softy" "3rd party applications installer" ) [[ -f /usr/bin/softy ]] && LIST+=( "Softy" "3rd party applications installer" )
[[ -f /usr/bin/h3consumption && "$LINUXFAMILY" = "sun8i" && "$BRANCH" = "default" ]] && \ [[ -f /usr/bin/h3consumption && "$LINUXFAMILY" = "sun8i" && "$BRANCH" = "default" ]] && \
LIST+=( "Consumption" "Control board consumption" ) LIST+=( "Consumption" "Control board consumption" )
check_if_installed bluetooth && LIST+=( "Remove BT" "Remove Bluetooth support" ) || LIST+=( "Bluetooth" "Install Bluetooth support" )
check_if_installed lirc && LIST+=( "Remove IR" "Remove IR support" ) || LIST+=( "IR" "Install IR support" )
[[ -f /usr/bin/armbianmonitor ]] && LIST+=( "Monitor" "Simple CLI board monitoring" ) [[ -f /usr/bin/armbianmonitor ]] && LIST+=( "Monitor" "Simple CLI board 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" )
if [[ -n $(dpkg -l | grep linux-headers) ]]; then LIST+=( "Headers" "Remove kernel headers" ); else \ if [[ -n $(dpkg -l | grep linux-headers) ]]; then LIST+=( "Headers" "Remove kernel headers" ); else \
LIST+=( "Headers" "Install kernel headers" ); fi LIST+=( "Headers" "Install kernel headers" ); fi
[[ "$LINUXFAMILY" = sun*i && "$BRANCH" = "default" && \ if [[ -n $DISPLAY_MANAGER ]]; then
-n $(bin2fex </boot/script.bin 2>/dev/null | grep -w "hdmi_used = 1") ]] && LIST+=( "Display" "set the display resolution" ) if [[ $(service xrdp status 2> /dev/null | grep -w active) ]]; then
LIST+=( "RDP" "Disable remote desktop access from Windows" )
else
LIST+=( "RDP" "Enable remote desktop access from Windows" )
fi
fi
# count number of menu items to adjust window sizee # count number of menu items to adjust window sizee
LISTLENGHT="$((6+${#LIST[@]}/2))" LISTLENGHT="$((6+${#LIST[@]}/2))"
...@@ -763,7 +749,7 @@ while true; do ...@@ -763,7 +749,7 @@ while true; do
exec 3>&1 exec 3>&1
selection=$(dialog --backtitle "$BACKTITLE" --title "System and 3rd party software" --clear \ selection=$(dialog --backtitle "$BACKTITLE" --title "System and 3rd party software" --clear \
--cancel-label "Back" --menu "$disclaimer" $LISTLENGHT 70 $BOXLENGHT \ --cancel-label "Cancel" --menu "$disclaimer" $LISTLENGHT 70 $BOXLENGHT \
"${LIST[@]}" 2>&1 1>&3) "${LIST[@]}" 2>&1 1>&3)
exit_status=$? exit_status=$?
exec 3>&- exec 3>&-
...@@ -771,5 +757,34 @@ while true; do ...@@ -771,5 +757,34 @@ while true; do
# run main function # run main function
jobs "$selection" jobs "$selection"
done done
} }
DIALOG_CANCEL=1
DIALOG_ESC=255
#-----------------------------------------------------------------------------------------------------------------------------------------#
# gather info about the board and start with loading menu
#
[[ -f /etc/armbian-release ]] && source /etc/armbian-release && ARMBIAN="Armbian $VERSION $IMAGE_TYPE";
DISTRO=$(lsb_release -is)
DISTROID=$(lsb_release -sc)
KERNELID=$(uname -r)
[[ -z "${ARMBIAN// }" ]] && ARMBIAN=$KERNELID
BACKTITLE="Configuration utility, $ARMBIAN, https://www.armbian.com"
TITLE="$BOARD_NAME "
DEFAULT_ADAPTER=$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)')
[[ -z "${DEFAULT_ADAPTER// }" ]] && DEFAULT_ADAPTER="lo"
# detect desktop
DISPLAY_MANAGER=""; DESKTOP_INSTALLED=""
check_if_installed bluetooth nodm && DESKTOP_INSTALLED="nodm";
check_if_installed bluetooth 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
sleep 1
\ No newline at end of file
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