Skip to content

Commit b515466

Browse files
committed
Unquote variables mistakenly quoted by PR awalsh128#177.
* In several places, the variable containing the list of packages was mistakenly double-quoted which caused the package list to be treated as one long single package name. * The regex in get_install_script_filepath contained an errant pair of single quotes which caused the test to always fail.
1 parent 2da29a2 commit b515466

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

install_and_cache_pkgs.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ log "Clean installing ${package_count} packages..."
7474
# Note: sudo doesn't affect redirects, but we want the output in the file anyway
7575
# shellcheck disable=SC2024
7676
# We intentionally redirect output here; the redirect happens as the current user which is fine
77-
sudo DEBIAN_FRONTEND=noninteractive apt-fast --yes install "${packages}" > "${install_log_filepath}"
77+
#
78+
# If packages is quoted, it'll be interpreted as a single long package name
79+
# instead of a list of packages.
80+
# shellcheck disable=SC2086
81+
sudo DEBIAN_FRONTEND=noninteractive apt-fast --yes install ${packages} > "${install_log_filepath}"
7882
log "done"
7983
log "Installation log written to ${install_log_filepath}"
8084

lib.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function get_install_script_filepath {
4747
# Use nullglob to prevent literal match when no files found
4848
shopt -s nullglob
4949
for f in "${1}"var/lib/dpkg/info/"${2}"*."${3}"; do
50-
if [[ -f "${f}" ]] && [[ "${f}" =~ ${2}'(:.*)?.'"${3}" ]]; then
50+
if [[ -f "${f}" ]] && [[ "${f}" =~ ${2}(:.*)?."${3}" ]]; then
5151
filepath="${f}"
5252
break
5353
fi
@@ -125,9 +125,15 @@ function get_normalized_package_list {
125125
local architecture
126126
architecture=$(dpkg --print-architecture)
127127
if [[ "${architecture}" == "arm64" ]]; then
128-
"${script_dir}"/apt_query-arm64 normalized-list "${packages}"
128+
# If packages is quoted, it'll be interpreted as a single long package name
129+
# instead of a list of packages.
130+
# shellcheck disable=SC2086
131+
"${script_dir}"/apt_query-arm64 normalized-list ${packages}
129132
else
130-
"${script_dir}"/apt_query-x86 normalized-list "${packages}"
133+
# If packages is quoted, it'll be interpreted as a single long package name
134+
# instead of a list of packages.
135+
# shellcheck disable=SC2086
136+
"${script_dir}"/apt_query-x86 normalized-list ${packages}
131137
fi
132138
}
133139

0 commit comments

Comments
 (0)