Skip to content

Commit 091936c

Browse files
committed
fix script errors
Signed-off-by: Corey Hemminger <hemminger@hotmail.com>
1 parent 5848c45 commit 091936c

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

lib/mixlib/install/generator/bourne/scripts/fetch_metadata.sh.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ normalize_platform_name() {
5757
esac
5858
}
5959

60-
if [ -n "$download_url_override" ]; then
60+
if [ -z "$download_url_override" ]; then
6161
echo "Getting information for $project $channel $version for $platform..."
6262

6363
metadata_filename="$tmp_dir/metadata.txt"
@@ -94,7 +94,7 @@ if [ -n "$download_url_override" ]; then
9494
metadata_url="$base_api_url/$channel/$project/metadata?license_id=$license_id&v=$version&p=$platform&pv=$platform_version&m=$machine"
9595
fi
9696
else
97-
# Omnitruck URL parameters
97+
# Omnitruck URL parameters without license_id
9898
metadata_url="$base_api_url/$channel/$project/metadata?v=$version&p=$platform&pv=$platform_version&m=$machine"
9999
fi
100100

lib/mixlib/install/generator/bourne/scripts/helpers.sh.erb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,8 @@ do_download() {
250250
echo " to file $2"
251251

252252
url=`echo $1`
253-
if [ "x$platform" = "xsolaris2" ]; then
254-
if [ "x$platform_version" = "x5.9" ] || [ "x$platform_version" = "x5.10" ]; then
253+
if [ "$platform" = "solaris2" ]; then
254+
if [ "$platform_version" = "5.9" ] || [ "$platform_version" = "5.10" ]; then
255255
# solaris 9 lacks openssl, solaris 10 lacks recent enough credentials - your base O/S is completely insecure, please upgrade
256256
url=`echo $url | sed -e 's/https/http/'`
257257
fi
@@ -289,7 +289,7 @@ install_file() {
289289
echo "Installing $project $version"
290290
case "$1" in
291291
"rpm")
292-
if [ "x$platform" = "xnexus" ] || [ "x$platform" = "xios_xr" ]; then
292+
if [ "$platform" = "nexus" ] || [ "$platform" = "ios_xr" ]; then
293293
echo "installing with yum..."
294294
yum install -yv "$2"
295295
else
@@ -345,10 +345,10 @@ install_file() {
345345
fi
346346
}
347347

348-
if [ -n "$TMPDIR" ]; then
349-
tmp=$TMPDIR
350-
else
348+
if [ -z "$TMPDIR" ]; then
351349
tmp="/tmp"
350+
else
351+
tmp=$TMPDIR
352352
fi
353353
# secure-ish temp dir creation without having mktemp available (DDoS-able but not exploitable)
354354
tmp_dir="$tmp/install.sh.$$"

lib/mixlib/install/generator/bourne/scripts/install_package.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# $version: The version requested. Used only for warning user if not set.
99
############
1010

11-
if [ "x$version" = "x" ] && [ "x$CI" != "xtrue" ]; then
11+
if [ -z "$version" ] && [ "$CI" != "true" ]; then
1212
echo
1313
echo "WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING"
1414
echo

lib/mixlib/install/generator/bourne/scripts/platform_detection.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,31 +110,31 @@ elif [ -f "/etc/SuSE-release" ]; then
110110
platform="opensuseleap"
111111
platform_version=`awk '/^VERSION =/ { print $3 }' /etc/SuSE-release`
112112
fi
113-
elif [ "x$os" = "xFreeBSD" ]; then
113+
elif [ "$os" = "FreeBSD" ]; then
114114
platform="freebsd"
115115
platform_version=`uname -r | sed 's/-.*//'`
116-
elif [ "x$os" = "xAIX" ]; then
116+
elif [ "$os" = "AIX" ]; then
117117
platform="aix"
118118
platform_version="`uname -v`.`uname -r`"
119119
machine="powerpc"
120120
elif [ -f "/etc/os-release" ]; then
121121
. /etc/os-release
122-
if [ "x$CISCO_RELEASE_INFO" != "x" ]; then
122+
if [ -n "$CISCO_RELEASE_INFO" ]; then
123123
. $CISCO_RELEASE_INFO
124124
fi
125125

126126
platform=$ID
127127

128128
# VERSION_ID is always the preferred variable to use, but not
129129
# every distro has it so fallback to VERSION
130-
if [ "x$VERSION_ID" != "x" ]; then
130+
if [ -n "$VERSION_ID" ]; then
131131
platform_version=$VERSION_ID
132132
else
133133
platform_version=$VERSION
134134
fi
135135
fi
136136

137-
if [ "x$platform" = "x" ]; then
137+
if [ -z "$platform" ]; then
138138
echo "Unable to determine platform version!"
139139
report_bug
140140
exit 1
@@ -194,7 +194,7 @@ case $machine in
194194
;;
195195
esac
196196

197-
if [ -n "$platform_version" ]; then
197+
if [ -z "$platform_version" ]; then
198198
echo "Unable to determine platform version!"
199199
report_bug
200200
exit 1

0 commit comments

Comments
 (0)