summaryrefslogtreecommitdiff
path: root/tools/Z99-cloud-locale-test.sh
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2018-08-03 22:29:40 +0000
committerServer Team CI Bot <josh.powers+server-team-bot@canonical.com>2018-08-03 22:29:40 +0000
commit538af8e64facb7df55c759d9ca82a0fb3a6ce325 (patch)
tree9c7ab3984f1d7420ec64b4a82f4f217db59e0607 /tools/Z99-cloud-locale-test.sh
parent01cfa711bcf31c6c0019d1e936b5b07aa6abc2bc (diff)
downloadvyos-cloud-init-538af8e64facb7df55c759d9ca82a0fb3a6ce325.tar.gz
vyos-cloud-init-538af8e64facb7df55c759d9ca82a0fb3a6ce325.zip
Use typeset or local in profile.d scripts.
Bash and most other "bourne-like" shells allow declaring function local variables via 'local'. ksh does not. Instead of using 'local' always, use 'typeset' when the KSH_VERSION variable is present in environment. LP: #1784713
Diffstat (limited to 'tools/Z99-cloud-locale-test.sh')
-rw-r--r--tools/Z99-cloud-locale-test.sh13
1 files changed, 8 insertions, 5 deletions
diff --git a/tools/Z99-cloud-locale-test.sh b/tools/Z99-cloud-locale-test.sh
index 4978d87e..9ee44bd2 100644
--- a/tools/Z99-cloud-locale-test.sh
+++ b/tools/Z99-cloud-locale-test.sh
@@ -11,8 +11,11 @@
# of how to fix them.
locale_warn() {
- local bad_names="" bad_lcs="" key="" val="" var="" vars="" bad_kv=""
- local w1 w2 w3 w4 remain
+ command -v local >/dev/null && local _local="local" ||
+ typeset _local="typeset"
+
+ $_local bad_names="" bad_lcs="" key="" val="" var="" vars="" bad_kv=""
+ $_local w1 w2 w3 w4 remain
# if shell is zsh, act like sh only for this function (-L).
# The behavior change will not permenently affect user's shell.
@@ -53,8 +56,8 @@ locale_warn() {
printf " This can affect your user experience significantly, including the\n"
printf " ability to manage packages. You may install the locales by running:\n\n"
- local bad invalid="" to_gen="" sfile="/usr/share/i18n/SUPPORTED"
- local pkgs=""
+ $_local bad invalid="" to_gen="" sfile="/usr/share/i18n/SUPPORTED"
+ $_local local pkgs=""
if [ -e "$sfile" ]; then
for bad in ${bad_lcs}; do
grep -q -i "${bad}" "$sfile" &&
@@ -67,7 +70,7 @@ locale_warn() {
fi
to_gen=${to_gen# }
- local pkgs=""
+ $_local pkgs=""
for bad in ${to_gen}; do
pkgs="${pkgs} language-pack-${bad%%_*}"
done