debian-config 1.27 KB
Newer Older
Igor Pecovnik's avatar
RFC #2    
Igor Pecovnik committed
1
2
3
4
5
6
7
8
#!/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.

Igor Pecovnik's avatar
Igor Pecovnik committed
9

Igor Pecovnik's avatar
Igor Pecovnik committed
10
11
12
# load functions
source "$0""-submenu"
source "$0""-jobs"
13

Igor Pecovnik's avatar
Igor Pecovnik committed
14
# Main menu
Igor Pecovnik's avatar
Igor Pecovnik committed
15
16
while true; do
	LIST=()
17

Igor Pecovnik's avatar
Igor Pecovnik committed
18
19
20
	LIST+=( "Software" "System and 3rd party" )
	LIST+=( "Networking" "WiFI, BT, Hotspot" )
	LIST+=( "Settings" "Board and system settings" )
21

Igor Pecovnik's avatar
Igor Pecovnik committed
22
	# count number of menu items to adjust window sizee
Igor Pecovnik's avatar
Igor Pecovnik committed
23
	LISTLENGHT="$((9+${#LIST[@]}/2))"
Igor Pecovnik's avatar
Igor Pecovnik committed
24
	BOXLENGHT=${#LIST[@]}
Igor Pecovnik's avatar
RFC #2    
Igor Pecovnik committed
25

Igor Pecovnik's avatar
Igor Pecovnik committed
26
27
28
	# main dialog routine
	DIALOG_CANCEL=1
	DIALOG_ESC=255
29

Igor Pecovnik's avatar
RFC #2    
Igor Pecovnik committed
30
	exec 3>&1
Igor Pecovnik's avatar
Igor Pecovnik committed
31
32
	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 \
Igor Pecovnik's avatar
RFC #2    
Igor Pecovnik committed
33
34
35
	"${LIST[@]}" 2>&1 1>&3)
	exit_status=$?
	exec 3>&-
Igor Pecovnik's avatar
Igor Pecovnik committed
36
	[[ $exit_status == $DIALOG_CANCEL || $exit_status == $DIALOG_ESC ]] && clear && exit
Igor Pecovnik's avatar
Igor Pecovnik committed
37

Igor Pecovnik's avatar
Igor Pecovnik committed
38
	dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nLoading ${selection,,} submodule ... " 5 $((26+${#selection}))
Igor Pecovnik's avatar
RFC #2    
Igor Pecovnik committed
39
40
	case $selection in

Igor Pecovnik's avatar
Igor Pecovnik committed
41
42
	"Software" )
		submenu_software
43
	;;
Igor Pecovnik's avatar
Igor Pecovnik committed
44
45
	"Networking" )
		submenu_networking
46
	;;
Igor Pecovnik's avatar
Igor Pecovnik committed
47
48
	"Settings" )
		submenu_settings
Igor Pecovnik's avatar
Igor Pecovnik committed
49
	;;
Igor Pecovnik's avatar
RFC #2    
Igor Pecovnik committed
50
	esac
Igor Pecovnik's avatar
Igor Pecovnik committed
51
done