Browse Source

Merge pull request #1513 from ekhvalov/master

POSIX shell compatibility
pull/1516/head
Chris Lu 4 years ago
committed by GitHub
parent
commit
4882972478
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 23
      docker/entrypoint.sh

23
docker/entrypoint.sh

@ -1,5 +1,24 @@
#!/bin/sh #!/bin/sh
isArgPassed() {
arg="$1"
argWithEqualSign="$1="
shift
while [ $# -gt 0 ]; do
passedArg="$1"
shift
case $passedArg in
$arg)
return 0
;;
$argWithEqualSign*)
return 0
;;
esac
done
return 1
}
case "$1" in case "$1" in
'master') 'master')
@ -9,7 +28,7 @@ case "$1" in
'volume') 'volume')
ARGS="-dir=/data -max=0" ARGS="-dir=/data -max=0"
if [[ $@ == *"-max="* ]]; then
if isArgPassed "-max" "$@"; then
ARGS="-dir=/data" ARGS="-dir=/data"
fi fi
exec /usr/bin/weed $@ $ARGS exec /usr/bin/weed $@ $ARGS
@ -17,7 +36,7 @@ case "$1" in
'server') 'server')
ARGS="-dir=/data -volume.max=0 -master.volumePreallocate -master.volumeSizeLimitMB=1024" ARGS="-dir=/data -volume.max=0 -master.volumePreallocate -master.volumeSizeLimitMB=1024"
if [[ $@ == *"-volume.max="* ]]; then
if isArgPassed "-volume.max" "$@"; then
ARGS="-dir=/data -master.volumePreallocate -master.volumeSizeLimitMB=1024" ARGS="-dir=/data -master.volumePreallocate -master.volumeSizeLimitMB=1024"
fi fi
exec /usr/bin/weed $@ $ARGS exec /usr/bin/weed $@ $ARGS

Loading…
Cancel
Save