whitespace cleanup on functions & lib/config

fix some of the bash8 issues found in functions and lib/config,
part of the long march towards fixing all the bash8 issues.

Change-Id: Ia131f64870acb0f9d196fe1a9a45d633abb6fc4d
This commit is contained in:
Sean Dague 2013-10-22 07:43:22 -04:00
parent 8d3beb673c
commit 537d4025c5
2 changed files with 32 additions and 32 deletions

View File

@ -1372,9 +1372,9 @@ function upload_image() {
IMAGE="$FILES/${IMAGE_FNAME}"
IMAGE_NAME="${IMAGE_FNAME%.xen-raw.tgz}"
glance \
--os-auth-token $token \
--os-image-url http://$GLANCE_HOSTPORT \
image-create \
--os-auth-token $token \
--os-image-url http://$GLANCE_HOSTPORT \
image-create \
--name "$IMAGE_NAME" --is-public=True \
--container-format=tgz --disk-format=raw \
--property vm_mode=xen < "${IMAGE}"
@ -1397,11 +1397,11 @@ function upload_image() {
mkdir "$xdir"
tar -zxf $FILES/$IMAGE_FNAME -C "$xdir"
KERNEL=$(for f in "$xdir/"*-vmlinuz* "$xdir/"aki-*/image; do
[ -f "$f" ] && echo "$f" && break; done; true)
[ -f "$f" ] && echo "$f" && break; done; true)
RAMDISK=$(for f in "$xdir/"*-initrd* "$xdir/"ari-*/image; do
[ -f "$f" ] && echo "$f" && break; done; true)
[ -f "$f" ] && echo "$f" && break; done; true)
IMAGE=$(for f in "$xdir/"*.img "$xdir/"ami-*/image; do
[ -f "$f" ] && echo "$f" && break; done; true)
[ -f "$f" ] && echo "$f" && break; done; true)
if [[ -z "$IMAGE_NAME" ]]; then
IMAGE_NAME=$(basename "$IMAGE" ".img")
fi
@ -1692,23 +1692,23 @@ function check_path_perm_sanity() {
#
# _vercmp_r sep ver1 ver2
function _vercmp_r {
typeset sep
typeset -a ver1=() ver2=()
sep=$1; shift
ver1=("${@:1:sep}")
ver2=("${@:sep+1}")
typeset sep
typeset -a ver1=() ver2=()
sep=$1; shift
ver1=("${@:1:sep}")
ver2=("${@:sep+1}")
if ((ver1 > ver2)); then
echo 1; return 0
elif ((ver2 > ver1)); then
echo -1; return 0
fi
if ((ver1 > ver2)); then
echo 1; return 0
elif ((ver2 > ver1)); then
echo -1; return 0
fi
if ((sep <= 1)); then
echo 0; return 0
fi
if ((sep <= 1)); then
echo 0; return 0
fi
_vercmp_r $((sep-1)) "${ver1[@]:1}" "${ver2[@]:1}"
_vercmp_r $((sep-1)) "${ver1[@]:1}" "${ver2[@]:1}"
}
@ -1730,13 +1730,13 @@ function _vercmp_r {
#
# vercmp_numbers ver1 ver2
vercmp_numbers() {
typeset v1=$1 v2=$2 sep
typeset -a ver1 ver2
typeset v1=$1 v2=$2 sep
typeset -a ver1 ver2
IFS=. read -ra ver1 <<< "$v1"
IFS=. read -ra ver2 <<< "$v2"
IFS=. read -ra ver1 <<< "$v1"
IFS=. read -ra ver2 <<< "$v2"
_vercmp_r "${#ver1[@]}" "${ver1[@]}" "${ver2[@]}"
_vercmp_r "${#ver1[@]}" "${ver1[@]}" "${ver2[@]}"
}

View File

@ -64,12 +64,12 @@ function get_meta_section_files() {
[[ -r $file ]] || return 0
$CONFIG_AWK_CMD -v matchgroup=$matchgroup '
/^\[\[.+\|.*\]\]/ {
gsub("[][]", "", $1);
split($1, a, "|");
if (a[1] == matchgroup)
print a[2]
}
/^\[\[.+\|.*\]\]/ {
gsub("[][]", "", $1);
split($1, a, "|");
if (a[1] == matchgroup)
print a[2]
}
' $file
}