diff options
| author | user <ekhvalov@gmail.com> | 2020-10-08 19:40:18 +0900 |
|---|---|---|
| committer | user <ekhvalov@gmail.com> | 2020-10-08 19:40:18 +0900 |
| commit | d116432775854c8929aef2f8379d503aa774c478 (patch) | |
| tree | 7050668c2c264fce7ee84b31628746049909b401 /docker/entrypoint.sh | |
| parent | eed492b73b67fe761a95b8752ba369fbc44587b9 (diff) | |
| download | seaweedfs-d116432775854c8929aef2f8379d503aa774c478.tar.xz seaweedfs-d116432775854c8929aef2f8379d503aa774c478.zip | |
POSIX shell compatibility
Diffstat (limited to 'docker/entrypoint.sh')
| -rwxr-xr-x | docker/entrypoint.sh | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 05db7a672..427576bcf 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -1,5 +1,24 @@ #!/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 'master') @@ -9,7 +28,7 @@ case "$1" in 'volume') ARGS="-dir=/data -max=0" - if [[ $@ == *"-max="* ]]; then + if isArgPassed "-max" "$@"; then ARGS="-dir=/data" fi exec /usr/bin/weed $@ $ARGS @@ -17,7 +36,7 @@ case "$1" in 'server') 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" fi exec /usr/bin/weed $@ $ARGS |
