-
Notifications
You must be signed in to change notification settings - Fork 1
/
install-optional.sh
executable file
·55 lines (46 loc) · 1.4 KB
/
install-optional.sh
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
#!/usr/bin/env bash
# source and export helper functions to be used by the rest of this script
set -a
source ./load-zsh-autoload-as-functions.sh
set +a
PS3='Choose script to execute: '
function prompt_and_execute() {
local options=("$@")
echo_green "========== Scripts ============="
select opt in "${options[@]}"
do
echo_yellow "================================"
local index=$((REPLY-1))
if [ $index -lt 0 ]; then
echo_red "=== Invalid option ${REPLY}"
elif [ "$opt" = 'Quit' ]; then
echo_yellow "=== Quitting"
break
else
local script="${options[${index}]}"
echo_yellow "=== Executing script ${script}"
${script} || echo_red "=== Failed to execute ${script}"
echo_yellow "=== Done executing script ${script}"
fi;
echo ""
echo ""
echo_green "========== Scripts ============="
REPLY=''
done
}
macos_only_options=(
'./scripts/macos-haskell.sh'
)
ubuntu_only_options=(
'./scripts/ubuntu-haskell.sh'
'./scripts/ubuntu-net-core.sh'
'./scripts/ubuntu-tilix.sh'
)
common_options=(
'./scripts/common-krew.sh'
'./scripts/common-rust.sh'
'./scripts/common-istio.sh'
'Quit'
)
is_macos && (macos_options=("${macos_only_options[@]}" "${common_options[@]}") && prompt_and_execute "${macos_options[@]}")
is_ubuntu && (ubuntu_options=("${ubuntu_only_options[@]}" "${common_options[@]}") && prompt_and_execute "${ubuntu_options[@]}")