diff options
author | iphydf <iphydf@users.noreply.github.com> | 2020-05-04 02:19:14 +0100 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2020-05-05 01:53:01 +0100 |
commit | c1a2ea3309969608a5553c34fa4199b05f20abc2 (patch) | |
tree | 1ad836defd832a87085ec7c717203d5414742784 /other/bootstrap_daemon/docker | |
parent | f8ab7218f0eb752b4f936b4686be313921be1da6 (diff) |
Use bash arrays instead of strings for static analysis scripts.
These are more robust wrt. spaces in names.
Diffstat (limited to 'other/bootstrap_daemon/docker')
-rwxr-xr-x | other/bootstrap_daemon/docker/update-sha256 | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/other/bootstrap_daemon/docker/update-sha256 b/other/bootstrap_daemon/docker/update-sha256 index 78aa656f..32eb4e32 100755 --- a/other/bootstrap_daemon/docker/update-sha256 +++ b/other/bootstrap_daemon/docker/update-sha256 | |||
@@ -1,9 +1,10 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/bash |
2 | 2 | ||
3 | set -eux | 3 | set -eux |
4 | 4 | ||
5 | docker_build() { | 5 | docker_build() { |
6 | tar c $(git ls-files) | docker build -f other/bootstrap_daemon/docker/Dockerfile -t toxchat/bootstrap-node - | 6 | readarray -t FILES <<<"$(git ls-files)" |
7 | tar c "${FILES[@]}" | docker build -f other/bootstrap_daemon/docker/Dockerfile -t toxchat/bootstrap-node - | ||
7 | } | 8 | } |
8 | 9 | ||
9 | # Run Docker build once. If it succeeds, we're good. | 10 | # Run Docker build once. If it succeeds, we're good. |
@@ -17,7 +18,7 @@ OUTPUT=$(docker_build || true 2>&1) | |||
17 | if echo "$OUTPUT" | grep '/usr/local/bin/tox-bootstrapd: FAILED'; then | 18 | if echo "$OUTPUT" | grep '/usr/local/bin/tox-bootstrapd: FAILED'; then |
18 | # This is a checksum warning, so we need to update it. | 19 | # This is a checksum warning, so we need to update it. |
19 | IMAGE=$(echo "$OUTPUT" | grep '^ ---> [0-9a-f]*$' | grep -o '[0-9a-f]*$' | tail -n1) | 20 | IMAGE=$(echo "$OUTPUT" | grep '^ ---> [0-9a-f]*$' | grep -o '[0-9a-f]*$' | tail -n1) |
20 | docker run --rm "$IMAGE" sha256sum /usr/local/bin/tox-bootstrapd > other/bootstrap_daemon/docker/tox-bootstrapd.sha256 | 21 | docker run --rm "$IMAGE" sha256sum /usr/local/bin/tox-bootstrapd >other/bootstrap_daemon/docker/tox-bootstrapd.sha256 |
21 | fi | 22 | fi |
22 | 23 | ||
23 | # Run once last time to complete the build. | 24 | # Run once last time to complete the build. |