TT#82051 Shellcheck v0.8 fixes

shellcheck v0.8 has new check, known as SC2295 ("Warn about "${x#$y}"
treating $y as a pattern when not quoted").

Fixes:

| In scripts/build line 117:
|      build_file="${build_file%%.${host}}"
|                                 ^-----^ SC2295 (info): Expansions inside ${..} need to be quoted separately, otherwise they match as patterns.

| In scripts/encrypt line 24:
|       x=${file##${NGCPCTL_MAIN}/templates/}  # drop leading /etc/ngcp-config
|                 ^-------------^ SC2295 (info): Expansions inside ${..} need to be quoted separately, otherwise they match as patterns.

... as reported by our Github actions at
https://github.com/sipwise/ngcpcfg

Change-Id: I3371388ecf445905cca0bc4681276151aceb43ae
mr10.2
Michael Prokop 5 years ago
parent 744458aa96
commit 3e8814205a

@ -114,7 +114,7 @@ else
# drop HA file suffix of all registered nodes
if [ -r /etc/ngcp-config/systems.cfg ] ; then
while IFS= read -r host ; do
build_file="${build_file%%.${host}}"
build_file="${build_file%%."${host}"}"
done < /etc/ngcp-config/systems.cfg
fi

@ -21,12 +21,12 @@ get_config_file_list() {
for dir in ${CONFIG_POOL} ; do
# shellcheck disable=SC2044
for file in $(find "${TEMPLATE_POOL_BASE}/${dir}" -name \*.tt2 -o -name \*.tt2"${HA_FILE:-}") ; do
x=${file##${NGCPCTL_MAIN}/templates/} # drop leading /etc/ngcp-config
y=${x%%.tt2} # drop trailing suffix '.tt2'
y=${y%%.tt2.sp1} # drop trailing suffix '.tt2.sp1'
y=${y%%.tt2.sp2} # drop trailing suffix '.tt2.sp2'
y=${y%%.customtt} # drop trailing suffix '.customtt'
y=${y%%.patchtt} # drop trailing suffix '.patchtt'
x=${file##"${NGCPCTL_MAIN}"/templates/} # drop leading /etc/ngcp-config
y=${x%%.tt2} # drop trailing suffix '.tt2'
y=${y%%.tt2.sp1} # drop trailing suffix '.tt2.sp1'
y=${y%%.tt2.sp2} # drop trailing suffix '.tt2.sp2'
y=${y%%.customtt} # drop trailing suffix '.customtt'
y=${y%%.patchtt} # drop trailing suffix '.patchtt'
# if the file does not exist (e.g. because "ngcpcfg apply"
# hasn't been executed yet for whatever reason, then don't
# report missing files, otherwise tar will complain

Loading…
Cancel
Save