-
Notifications
You must be signed in to change notification settings - Fork 25
/
menu
executable file
·276 lines (236 loc) · 7.43 KB
/
menu
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
#!/bin/bash
# (C) 2017 Yedino team, on BSD 2-clause licence and also licences on same licence as Galaxy main project (you can pick)
[ -r "toplevel" ] || {
# search up: usually we are simply too deep e.g. inside build/ or src/
while true ; do
# can not go further and didn't found toplevel yet - can't find it
cd .. || { echo "ERROR: Can't find root file 'toplevel'. (Searched, now PWD=$PWD)."; exit 1; }
[ -r "toplevel" ] && break # found it, done
done ;
}
# we are now in the top level directory
dir_base_of_source="./" # path to reach the root of source code (from starting location of this script)
source gettext.sh || { echo "Gettext is not installed, please install it." ; exit 1 ; }
export TEXTDOMAIN="galaxy42_installer"
# share/locale/pl/LC_MESSAGES/galaxy42_installer.mo
export TEXTDOMAINDIR="${dir_base_of_source}share/locale/"
programname="Galaxy42-developer-menu" # shellcheck disable=SC2034
lib='abdialog.sh'; source "${dir_base_of_source}/share/script/lib/${lib}" || {\
eval_gettext "Can not find script library $lib (dir_base_of_source=$dir_base_of_source)" ; exit 1; }
lib='utils.sh'; source "${dir_base_of_source}/share/script/lib/${lib}" || {\
eval_gettext "Can not find script library $lib (dir_base_of_source=$dir_base_of_source)" ; exit 1; }
dialog_h=$(tput lines)
dialog_h=$((dialog_h - 2))
dialog_h2=$((dialog_h - 7 ))
dialog_w=$(tput cols)
dialog_w=$((dialog_w - 2))
dialog_h=$(( dialog_h>30 ? dialog_h-5 : dialog_h ))
dialog_w=$(( dialog_w>100 ? dialog_w-5 : dialog_w ))
dialog_h=$(( dialog_h>200 ? 200 : dialog_h ))
dialog_w=$(( dialog_w>200 ? 200 : dialog_w ))
# ------------------------------------------------------------------------
# start
init_platforminfo || { printf "%s\n" "$(gettext "error_init_platforminfo")" ; exit 1; }
if (( ! platforminfo[family_detected] )) ; then printf "%s\n" "$(gettext "error_init_platforminfo_unknown")" ; exit 1 ; fi
# platforminfo_install_packages 'vim' 'mc' || { echo "Test install failed." ; exit 1; } ; echo "Test seems ok." ; exit 0 # debug
[[ -z "$EDITOR" ]] && {
export EDITOR="nano"
}
response="$*" # get commands from cmd line
if [[ -z "$response" ]] ;
then
# shellcheck disable=SC2069
response=$( abdialog --menu "$(eval_gettext "\$programname:")" "$dialog_h" "$dialog_w" "$dialog_h2" \
"i" "Install ./install.sh (with --sudo if not root)" \
"icfg" "Install rundevel configure (e.g. default commandline for rundevel.sh)" \
"d" "Build: with ./do" \
"r" "Run the program (in build/ directory - in devel mode)" \
"rh" "Read (edit) doc/hacking" \
"rm" "Read (edit) main README" \
"-" "" \
"d10" "Build: with ./do extlevel 10" \
"d20" "Build: with ./do extlevel 20 - slow?" \
"d30" "Build: with ./do extlevel 30 - slow! insecure!" \
"-" "--- Benchmarks ---" \
"ball" "Benchmarks: run all" \
"-" "--- Gitian ---" \
"gli" "Build: Gitian for Linux (image) - slow!" \
"gwi" "Build: Gitian for Windows (image) - slow!" \
"gai" "Build: Gitian for all (image) - slow!" \
"-" "" \
"glf" "Build: Gitian for Linux (fast)" \
"gwf" "Build: Gitian for Windows (fast)" \
"-" "" \
"gt" "Hack: Gitian: on-target (alias: o-t)" \
"gr" "Hack: Gitian: on-target-root (alias: o-t-r)" \
"-" "--- Language ---" \
"lc" "Language: update: re-COMPILE .po --> .mo" \
"lui" "Language: update: Scripts: INSTALLER" \
"luu" "Language: update: Scripts: UTILS (g42bashutils)" \
"lus" "Language: update: Scripts: other SCRIPT (e.g. gitian-build)" \
"lum" "Language: update: C++: MAIN-program strings" \
"-" "" \
"tut" "Tests: run Unit Tests" \
"tutr" "Tests: run Unit Tests (release version)" \
"til" "Tests: run Installer - in all Languages" \
"tid" "Tests: run Installer - in all Dialog menu types" \
"-" "" \
"-" "--- Git/Security ---" \
"GS" "Git Security: check git history integrity" \
"GSk" "Git Security: as above (GS) but first import all keys from here TO YOUR GPG" \
"-" "" \
"info" "INFO about this menu: run it from cmd as: ./m do10 to run given action instantly" \
2>&1 >/dev/tty ) || abdialog_exit
[[ -z "$response" ]] && exit
fi
#"gaf" "Build Gitian for all (fast)" \
response_menu_task="$response"
[[ -z "$response_menu_task" ]] && exit
read -r -a tab <<< "$response_menu_task" ; for item in "${tab[@]}" ; do
echo "" ; echo "Running menu command '$item'." ; echo ""
case "$item" in
i)
if [[ $EUID -ne 0 ]]; then
bash ./install.sh --sudo
else
bash ./install.sh
fi
;;
icfg)
cd doc/cmdline/
./install-one.sh
;;
r)
cd build || abdialog_fail "Can not enter build directory. Build the project first"
./rundevel.sh
;;
ball)
cd src-tools/netutils/
# src-tools/netutils/allbench.sh
./allbench.sh
;;
d)
EXTLEVEL=0 ./do --go
;;
d10)
EXTLEVEL=10 ./do --go
;;
d20)
EXTLEVEL=20 ./do --go
;;
do30)
EXTLEVEL=30 ./do --go
;;
gaf)
./build-gitian -W -L fast
;;
glf)
./build-gitian -L fast
;;
gwf)
./build-gitian -W fast
;;
gai)
./build-gitian -W -L image
;;
gli)
./build-gitian -L image
;;
gwi)
./build-gitian -W image
;;
gt)
./build-gitian o-t
;;
'o-t')
./build-gitian o-t
;;
o-t-r)
./build-gitian o-t-r
;;
gr)
./build-gitian o-t-r
;;
lc)
contrib/tools/galaxy42-lang-update-all
;;
lui)
contrib/tools/lang-updater -t -u galaxy42_installer shell install.sh
;;
luu)
contrib/tools/lang-updater -t -u g42bashutils shell share/script/lib/*.sh
;;
lus)
contrib/tools/lang-updater -t -u galaxy42_scripts shell build-gitian share/script/*.sh
;;
lum)
contrib/tools/lang-updater -t -u galaxy42_main c++ src/*.?pp src/*/*.?pp
;;
tut)
./test-debug.elf
;;
tutr)
./test-release.elf
;;
tid)
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
if [[ $EUID -ne 0 ]]; then
printf "Will add --sudo\n"
flag="--sudo"
else
flag=""
fi
sleep 0.2
for iii in dialog whiptail ; do
FORCE_DIALOG="$iii" ./install.sh "$flag"
done
;;
til)
echo -e "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
if [[ $EUID -ne 0 ]]; then
printf "Will add --sudo\n"
flag="--sudo"
else
flag=""
fi
sleep 0.2
for iii in 'en_US.UTF-8' 'pl_PL.UTF-8' 'uk_UA.UTF-8' 'ru_RU.UTF-8' 'de_DE.UTF-8' ; do
echo -e "\n\n\n===============================================\nLANG: - $iii - (press ENTER)\n\n\n"
read _
#LANG="$iii" LANGUAGE= LC_ALL= strace -e open -f ./install.sh --test-lang "$flag"
LANG="$iii" LANGUAGE= LC_ALL= ./install.sh "$flag"
sleep 0.2
done
if false ;
then
echo -e "\n\n\n\n\nNow will change variable LANGUAGE (the language-only option)\n\n\n\n\n";
read _
for iii in 'en_US.UTF-8' 'pl_PL.UTF-8' 'uk_UK.UTF-8' 'ru_RU.UTF-8' 'de_DE.UTF-8' ; do
echo -e "\n\n\n===============================================\nLANGUAGE: - $iii - (press ENTER)\n\n\n"
read _
LANG= LANGUAGE="$iii" LC_ALL= ./install.sh "$flag"
sleep 0.2
done
else
echo -e "\n\n\n\n\nSkipping the tests about LANGUAGE with unset LC_ALL and LANG, we assume they are not needed\n\n\n\n\n";
read _
fi
;;
rm)
$EDITOR README.md
;;
rh)
$EDITOR doc/hacking.md
;;
GS)
python3 contrib/devtools/git-hist-check.py
;;
GSk)
gpg --import doc/pubkey/*
python3 contrib/devtools/git-hist-check.py
;;
esac
done
printf "\n\n\n"
printf "End of the developer menu program."
printf "\n\n"