forked from armbian/config
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebian-config
More file actions
executable file
·137 lines (96 loc) · 3.43 KB
/
debian-config
File metadata and controls
executable file
·137 lines (96 loc) · 3.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/bin/bash
#
# Copyright (c) 2018 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.
# define sane $PATH
export PATH=/usr/sbin:/usr/bin:/sbin:/bin
#
# check for root
#
if [[ $EUID != 0 ]]; then
echo "This tool requires root privileges. Try again with \"sudo \" please ..." >&2
sleep 2
exit 1
fi
#
# check if we have internet connection to install dependencies
#
echo -e "GET http://github.com HTTP/1.0\n\n" | nc github.com 80 > /dev/null 2>&1
if [[ $? -ne 0 ]]; then
read -n 1 -s -p "Warning. Configurator can't work properly without internet connection. \
Press CTRL C to stop to stop or any key to ignore and continue."
fi
#
# load functions, local first
#
if [[ -f ${BASH_SOURCE}-jobs ]]; then source ${BASH_SOURCE}-jobs;
elif [[ -f /usr/lib/armbian-config/jobs.sh ]]; then source /usr/lib/armbian-config/jobs.sh;
else exit 1;
fi
if [[ -f ${BASH_SOURCE}-submenu ]]; then source ${BASH_SOURCE}-submenu;
elif [[ -f /usr/lib/armbian-config/submenu.sh ]]; then source /usr/lib/armbian-config/submenu.sh;
else exit 1;
fi
if [[ -f ${BASH_SOURCE}-functions ]]; then source ${BASH_SOURCE}-functions;
elif [[ -f /usr/lib/armbian-config/functions.sh ]]; then source /usr/lib/armbian-config/functions.sh;
else exit 1;
fi
if [[ -f ${BASH_SOURCE}-functions-network ]]; then source ${BASH_SOURCE}-functions-network;
elif [[ -f /usr/lib/armbian-config/functions-network.sh ]]; then source /usr/lib/armbian-config/functions-network.sh;
else exit 1;
fi
# collect info
main "$@"
#
# Main menu
#
while true
do
LIST=()
LIST+=( "System" "System and security settings" )
LIST+=( "Network" "Wired, wireless, Bluetooth, access point" )
LIST+=( "Personal" "Timezone, language, hostname" )
#LIST+=( "Software" "System and 3rd party software install" )
LIST+=( "Help" "Documentation, support, sources" )
# count number of menu items to adjust window size
LISTLENGHT="$((11+${#LIST[@]}/2))"
BOXLENGHT=${#LIST[@]}
MENUTITLE="Configure \Z1$DISTRO $DISTROID\Z0 "
[[ -n "${BOARD_NAME/ /}" ]] && MENUTITLE=$MENUTITLE"for the \Z1${BOARD_NAME}\Z0 "
# main dialog routine
DIALOG_CANCEL=1
DIALOG_ESC=255
TITLELENGHT=${#MENUTITLE}
[[ "$TITLELENGHT" -lt 60 ]] && TITLELENGHT="60"
exec 3>&1
selection=$(dialog --colors --backtitle "$BACKTITLE" --title " os-config " --clear \
--cancel-label "Cancel" --menu "\n$MENUTITLE \n \nSupport: \Z1http://seeedstudio.com/forum/ \Z0\n " \
$LISTLENGHT ${TITLELENGHT} $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
"System" )
submenu_settings
;;
"Network" )
submenu_networking
;;
"Personal" )
submenu_personal
;;
"Software" )
submenu_software
;;
"Help" )
show_box "Info" "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\
\n\Z1Documentation:\Z0 http://wiki.seeedstudio.com/ReSpeaker_Core_v2.0\Z0 http://seeedstudio.com/forum/\n
\n\Z1Sources:\Z0 https://github.com/respeaker/os-config" "18"
;;
esac
done