Skip to content

Commit 917acd9

Browse files
committed
Switch to pure bash yaml parsing
1 parent 6657b24 commit 917acd9

File tree

3 files changed

+12
-17
lines changed

3 files changed

+12
-17
lines changed

install.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,13 @@ case "$kernel" in
1313
;;
1414
*"azure"*) # github action
1515
export CI=true
16-
sudo apt-get update
17-
sudo apt-get install -y yq
1816
if [[ $DEV_WORKSPACE != "" ]]; then
1917
base_install "devcontainer"
2018
else
2119
base_install "ubuntu"
2220
fi
2321
;;
2422
*"generic"*)
25-
sudo apt-get update
26-
sudo apt-get install -y yq
2723
if [[ $DEV_WORKSPACE != "" ]]; then
2824
base_install "devcontainer"
2925
else
@@ -36,8 +32,6 @@ case "$kernel" in
3632
;;
3733
*)
3834
if [[ $DEV_WORKSPACE != "" ]]; then
39-
sudo apt-get update
40-
sudo apt-get install -y yq
4135
base_install "devcontainer"
4236
else
4337
echo \

scripts/base_install.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ function base_install() {
2323
name="${categories[$i]}"
2424
orig="${orig_keys[$i]}"
2525

26-
# materialize the dynamically-named array into pkgs[]
27-
eval 'pkgs=( "${'"$name"'[@]}" )'
26+
# pull the list items from YAML into pkgs[] (no eval, no mutation)
27+
mapfile -t pkgs < <(collect_yaml_lists "$name" "$CONFIG_YAML")
2828

29-
[ ${#pkgs[@]} -eq 0 ] && continue
29+
((${#pkgs[@]})) || continue
3030

3131
case "$orig" in
3232
base-ubuntu)
@@ -36,7 +36,7 @@ function base_install() {
3636
_do pac_install "${pkgs[@]}"
3737
;;
3838
base-phone)
39-
_do pkg_install "${pkg[@]}"
39+
_do pkg_install "${pkgs[@]}"
4040
;;
4141
esac
4242
done
@@ -54,10 +54,10 @@ function base_install() {
5454
name="${categories[$i]}"
5555
orig="${orig_keys[$i]}"
5656

57-
# materialize the dynamically-named array into pkgs[]
58-
eval 'pkgs=( "${'"$name"'[@]}" )'
57+
# pull the list items from YAML into pkgs[] (no eval, no mutation)
58+
mapfile -t pkgs < <(collect_yaml_lists "$name" "$CONFIG_YAML")
5959

60-
[ ${#pkgs[@]} -eq 0 ] && continue
60+
((${#pkgs[@]})) || continue
6161

6262
case "$orig" in
6363
pacstall)
@@ -103,10 +103,10 @@ function base_install() {
103103
name="${categories[$i]}"
104104
orig="${orig_keys[$i]}"
105105

106-
# materialize the dynamically-named array into pkgs[]
107-
eval 'pkgs=( "${'"$name"'[@]}" )'
106+
# pull the list items from YAML into pkgs[] (no eval, no mutation)
107+
mapfile -t pkgs < <(collect_yaml_lists "$name" "$CONFIG_YAML")
108108

109-
[ ${#pkgs[@]} -eq 0 ] && continue
109+
((${#pkgs[@]})) || continue
110110

111111
case "$orig" in
112112
final-ubuntu)
@@ -116,7 +116,7 @@ function base_install() {
116116
_do pac_install "${pkgs[@]}"
117117
;;
118118
final-phone)
119-
_do pkg_install "${pkg[@]}"
119+
_do pkg_install "${pkgs[@]}"
120120
;;
121121
final-extras)
122122
local x

scripts/read_yaml.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,4 @@ collect_yaml_lists() {
113113
fi
114114
}
115115

116+

0 commit comments

Comments
 (0)