#!/bin/bash # # Copyright (c) 2017 Igor Pecovnik, igor.pecovnik@gma**.com # # This file is licensed under the terms of the GNU General Public # License version 2. This program is licensed "as is" without any # warranty of any kind, whether express or implied. # load functions source "$0""-submenu" source "$0""-jobs" # Main menu while true; do LIST=() LIST+=( "Software" "System and 3rd party" ) LIST+=( "Networking" "WiFI, BT, Hotspot" ) LIST+=( "Settings" "Board and system settings" ) # count number of menu items to adjust window sizee LISTLENGHT="$((9+${#LIST[@]}/2))" BOXLENGHT=${#LIST[@]} # main dialog routine DIALOG_CANCEL=1 DIALOG_ESC=255 exec 3>&1 selection=$(dialog --backtitle "$BACKTITLE" --title "armbian-config" --clear \ --cancel-label "Exit to shell" --menu "\n$BOARD_NAME $IPADDRESS running $DISTRO $DISTROID \n " $LISTLENGHT 70 $BOXLENGHT \ "${LIST[@]}" 2>&1 1>&3) exit_status=$? exec 3>&- [[ $exit_status == $DIALOG_CANCEL || $exit_status == $DIALOG_ESC ]] && clear && exit dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nLoading ${selection,,} submodule ... " 5 $((26+${#selection})) case $selection in "Software" ) submenu_software ;; "Networking" ) submenu_networking ;; "Settings" ) submenu_settings ;; esac done