This repository has been archived by the owner on Apr 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
launch.sh
55 lines (45 loc) · 1.51 KB
/
launch.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
55
#!/usr/bin/env bash
export CONF_FILE
ROOT_DIR="$(dirname "$0")"
x=0
#shellcheck disable=SC1091
source "${ROOT_DIR}"/functions.sh
# depencies check
depends_on "whiptail jq"
# get distribution choice
CONF_FILE="$ROOT_DIR/distro_prop.json"
distributions=$(jq ".distributions.variants[]" "${CONF_FILE}" | cut -d "\"" -f -2 | cut -d "\"" -f 2-)
x=0
for distribution in $distributions; do
if [[ "$(jq ".distributions.${distribution}.enabled" "$CONF_FILE")" == true ]]; then
enabled_distributions="$distribution $enabled_distributions"
((x=x+1))
fi
done
if (( x > 1 )); then
generate_menu "UBUNTU VERSION" "choose a ubuntu version(bigger is best)" "$enabled_distributions"
elif (( x == 1 )); then
DIS_CHOICE="$enabled_distributions"
else
die "No ubuntu versions is enabled"
fi
# get enabled variants with description
variants=""
choice=$(jq .distributions.variants[$((DIS_CHOICE-1))] "$CONF_FILE" | cut -d "\"" -f -2 | cut -d "\"" -f 2-)
variants=$(jq ".distributions.$choice.de.variants[]" "$CONF_FILE" | cut -d "\"" -f -2 | cut -d "\"" -f 2-)
x=0
for variant in $variants; do
if [[ "$(jq ".distributions.$choice.de.${variant}.enabled" "$CONF_FILE")" == true ]]; then
enabled_variants="$enabled_variants $variant"
((x=x+1))
fi
done
if (( x > 1 )); then
generate_de_menu "Desktop Environment" "choose Desktop environment.." $enabled_variants
elif (( x == 1 )); then
DE_CHOICE="$enabled_variants"
else
die "No ubuntu variants is enabled"
fi
echo $DIS_CHOICE
echo $DE_CHOICE