Skip to content

Commit

Permalink
Remove bashisms in the update module scripts
Browse files Browse the repository at this point in the history
The only update module to actually have any bashisms was the docker module,
and the bashisms were trivial to remove.

Changes to docker:
  - Change any [[ ]] call to [ ]
  - Quote any shell calls in [ -n ]
  - Change the shebang from #!/bin/bash to #!/bin/sh

Changes to single-file:
  - Change the shebang from #!/bin/bash to #!/bin/sh
  - No other bashisms are currently present in the file.

Changelog: None

Signed-off-by: Adam Duskett <[email protected]>
  • Loading branch information
aduskett committed Apr 18, 2020
1 parent eb64345 commit 7027a47
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions support/modules/docker
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

set -e

Expand All @@ -19,17 +19,17 @@ case "$STATE" in

ArtifactInstall)
docker ps -q > $prev_containers_file
[[ -n $(cat $prev_containers_file) ]] && docker stop $(cat $prev_containers_file)
[ -n "$(cat $prev_containers_file)" ] && docker stop $(cat $prev_containers_file)
for container in $(jq -r ".containers[]" "$FILES"/header/meta-data); do
docker pull $container
docker run -dt $container
done
;;

ArtifactRollback)
[[ -f $prev_containers_file ]] || exit 1
[[ -n "$(docker ps -q)" ]] && docker stop $(docker ps -q)
[[ -n $(cat $prev_containers_file) ]] && docker start $(cat $prev_containers_file)
[ -f $prev_containers_file ] || exit 1
[ -n "$(docker ps -q)" ] && docker stop $(docker ps -q)
[ -n "$(cat $prev_containers_file)" ] && docker start $(cat $prev_containers_file)
;;
esac

Expand Down
2 changes: 1 addition & 1 deletion support/modules/single-file
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

set -e

Expand Down

0 comments on commit 7027a47

Please sign in to comment.