summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@oath.com>2018-03-13 15:04:54 +0000
committerTor Egge <Tor.Egge@oath.com>2018-03-13 15:11:13 +0000
commit319ed3f9435d1dc4d530f0e3ae4ff4df66185411 (patch)
tree26486ef0ebbe63f1cae7d4e1891e6569eb285fd4
parent410933939a74e42874dd580bfe0051b3222185a5 (diff)
Change new tests to use square bracket style.
Collapse nested if statements.
-rwxr-xr-xconfigserver/src/main/sh/start-configserver12
-rwxr-xr-xvespabase/src/common-env.sh2
-rwxr-xr-xvespabase/src/rhel-prestart.sh4
3 files changed, 7 insertions, 11 deletions
diff --git a/configserver/src/main/sh/start-configserver b/configserver/src/main/sh/start-configserver
index f9ba6a4f56f..eed616cfe35 100755
--- a/configserver/src/main/sh/start-configserver
+++ b/configserver/src/main/sh/start-configserver
@@ -62,10 +62,8 @@ cd ${VESPA_HOME} || { echo "Cannot cd to ${VESPA_HOME}" 1>&2; exit 1; }
fixfile () {
if [ -f $1 ]; then
- if [ "${VESPA_USER}" ]; then
- if test "${VESPA_UNPRIVILEGED}" != yes; then
- chown ${VESPA_USER} $1
- fi
+ if [ "${VESPA_USER}" ] && [ "${VESPA_UNPRIVILEGED}" != yes ]; then
+ chown ${VESPA_USER} $1
fi
chmod 644 $1
fi
@@ -76,10 +74,8 @@ fixddir () {
echo "Creating data directory $1"
mkdir -p $1 || exit 1
fi
- if [ "${VESPA_USER}" ]; then
- if test "${VESPA_UNPRIVILEGED}" != yes; then
- chown ${VESPA_USER} $1
- fi
+ if [ "${VESPA_USER}" ] && [ "${VESPA_UNPRIVILEGED}" != yes ]; then
+ chown ${VESPA_USER} $1
fi
chmod 755 $1
}
diff --git a/vespabase/src/common-env.sh b/vespabase/src/common-env.sh
index 550e902cb55..8dfcf8d2c4c 100755
--- a/vespabase/src/common-env.sh
+++ b/vespabase/src/common-env.sh
@@ -146,7 +146,7 @@ consider_fallback VESPA_USE_NO_VESPAMALLOC $(get_var "no_vespamalloc_list")
fixlimits () {
# Cannot bump limits when not root (for testing)
- if test "${VESPA_UNPRIVILEGED}" = yes; then
+ if [ "${VESPA_UNPRIVILEGED}" = yes ]; then
return 0
fi
# number of open files:
diff --git a/vespabase/src/rhel-prestart.sh b/vespabase/src/rhel-prestart.sh
index b51a7b4e3b6..2523446639b 100755
--- a/vespabase/src/rhel-prestart.sh
+++ b/vespabase/src/rhel-prestart.sh
@@ -71,7 +71,7 @@ fixdir () {
exit 1
fi
mkdir -p "$4"
- if test "${VESPA_UNPRIVILEGED}" != yes; then
+ if [ "${VESPA_UNPRIVILEGED}" != yes ]; then
chown $1 "$4"
chgrp $2 "$4"
fi
@@ -105,7 +105,7 @@ fixdir ${VESPA_USER} wheel 755 var/vespa/bundlecache
fixdir ${VESPA_USER} wheel 755 var/vespa/bundlecache/configserver
fixdir ${VESPA_USER} wheel 755 var/vespa/cache/config/
-if test "${VESPA_UNPRIVILEGED}" != yes; then
+if [ "${VESPA_UNPRIVILEGED}" != yes ]; then
chown -hR ${VESPA_USER} logs/vespa
chown -hR ${VESPA_USER} var/db/vespa
fi