summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntonio Barone <syntonyze@gmail.com>2021-06-30 16:56:50 +0200
committerAntonio Barone <syntonyze@gmail.com>2021-07-01 11:09:51 +0200
commitdf8b68b6036a0f1f3c6b6e1faf849bc6e7876a78 (patch)
tree81d527ce013ec98855d47977dc451fda99893214
parentfc8e4ea1f19934d4a1f1d1120e421359ac7c6f0d (diff)
Make gracefulStopTimeout match /bin/sh compliant
Change Id3cb96f5ace introduced the ability to read {httpd,sshd}.gracefulStopTimeout values from gerrit.config and to convert them into seconds. However the implementation was relying on bash syntax. Make gerrit.sh compliant to Bourne Shell again, by removing bash specific pattern matching and by delegating to grep instead. Bug: Issue 14723 Change-Id: I8c1dc5cebd30eb7e9d639bc60d459ad8b154b3c9
-rwxr-xr-xresources/com/google/gerrit/pgm/init/gerrit.sh10
1 files changed, 5 insertions, 5 deletions
diff --git a/resources/com/google/gerrit/pgm/init/gerrit.sh b/resources/com/google/gerrit/pgm/init/gerrit.sh
index 61eb5294f1..7dcd4410f3 100755
--- a/resources/com/google/gerrit/pgm/init/gerrit.sh
+++ b/resources/com/google/gerrit/pgm/init/gerrit.sh
@@ -101,19 +101,19 @@ get_config() {
# not make so much sense.
get_time_unit_sec() {
TIME_LC=`echo $1 | tr '[:upper:]' '[:lower:]'`
- if [[ "$TIME_LC" =~ ^(0|[1-9][0-9]*)$ ]]
+ if echo "$TIME_LC" | grep -qE '^(0|[1-9][0-9]*)$'
then
echo $TIME_LC
- elif [[ "$TIME_LC" =~ ^[1-9][0-9]*\ *(s|sec|second|seconds)$ ]]
+ elif echo "$TIME_LC" | grep -qE '^[1-9][0-9]*\ *(s|sec|second|seconds)$'
then
echo "$TIME_LC" | tr -d -c 0-9
- elif [[ "$TIME_LC" =~ ^[1-9][0-9]*\ *(m|min|minute|minutes)$ ]]
+ elif echo "$TIME_LC" | grep -qE '^[1-9][0-9]*\ *(m|min|minute|minutes)$'
then
expr `echo "$TIME_LC" | tr -d -c 0-9` '*' 60
- elif [[ "$TIME_LC" =~ ^[1-9][0-9]*\ *(h|hr|hour|hours)$ ]]
+ elif echo "$TIME_LC" | grep -qE '^[1-9][0-9]*\ *(h|hr|hour|hours)$'
then
expr `echo "$TIME_LC" | tr -d -c 0-9` '*' 3600
- elif [[ "$TIME_LC" =~ ^[1-9][0-9]*\ *(d|day|days)$ ]]
+ elif echo "$TIME_LC" | grep -qE '^[1-9][0-9]*\ *(d|day|days)$'
then
expr `echo "$TIME_LC" | tr -d -c 0-9` '*' 86400
else