diff options
author | Scott Moser <smoser@ubuntu.com> | 2018-08-03 22:29:40 +0000 |
---|---|---|
committer | Server Team CI Bot <josh.powers+server-team-bot@canonical.com> | 2018-08-03 22:29:40 +0000 |
commit | 538af8e64facb7df55c759d9ca82a0fb3a6ce325 (patch) | |
tree | 9c7ab3984f1d7420ec64b4a82f4f217db59e0607 /tools/Z99-cloudinit-warnings.sh | |
parent | 01cfa711bcf31c6c0019d1e936b5b07aa6abc2bc (diff) | |
download | vyos-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-cloudinit-warnings.sh')
-rw-r--r-- | tools/Z99-cloudinit-warnings.sh | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/Z99-cloudinit-warnings.sh b/tools/Z99-cloudinit-warnings.sh index 1d413374..cb8b4638 100644 --- a/tools/Z99-cloudinit-warnings.sh +++ b/tools/Z99-cloudinit-warnings.sh @@ -4,9 +4,11 @@ # Purpose: show user warnings on login. cloud_init_warnings() { - local warning="" idir="/var/lib/cloud/instance" n=0 - local warndir="$idir/warnings" - local ufile="$HOME/.cloud-warnings.skip" sfile="$warndir/.skip" + command -v local >/dev/null && local _local="local" || + typeset _local="typeset" + $_local warning="" idir="/var/lib/cloud/instance" n=0 + $_local warndir="$idir/warnings" + $_local ufile="$HOME/.cloud-warnings.skip" sfile="$warndir/.skip" [ -d "$warndir" ] || return 0 [ ! -f "$ufile" ] || return 0 [ ! -f "$sfile" ] || return 0 |