fix(dc-ops): ensure proper quoting in script #1
1 changed files with 6 additions and 6 deletions
12
dc-ops
12
dc-ops
|
@ -9,27 +9,27 @@
|
||||||
h1() { echo "* $*"; }
|
h1() { echo "* $*"; }
|
||||||
msg() { echo "$*"; }
|
msg() { echo "$*"; }
|
||||||
|
|
||||||
BASEDIR=$(dirname $0)
|
BASEDIR=$(dirname "$0")
|
||||||
|
|
||||||
# use list from file or passed parameters
|
# use list from file or passed parameters
|
||||||
STACKLIST=$(cat $BASEDIR/stacklist 2>/dev/null)
|
STACKLIST=$(cat "$BASEDIR/stacklist" 2>/dev/null)
|
||||||
[[ $# -gt 0 ]] && STACKLIST=$*
|
[[ $# -gt 0 ]] && STACKLIST=$*
|
||||||
|
|
||||||
# iterate list
|
# iterate list
|
||||||
for LINE in $STACKLIST; do
|
for LINE in $STACKLIST; do
|
||||||
grep -q "^[[:space:]]*#" <<<$LINE && continue # skip comments
|
grep -q "^[[:space:]]*#" <<<"$LINE" && continue # skip comments
|
||||||
|
|
||||||
# determine if passed a directory or a file
|
# determine if passed a directory or a file
|
||||||
STACKDIR=$LINE
|
STACKDIR=$LINE
|
||||||
if [[ -f $LINE ]]; then
|
if [[ -f $LINE ]]; then
|
||||||
STACKDIR=$(dirname $LINE)
|
STACKDIR=$(dirname "$LINE")
|
||||||
COMPOSEFILE=$LINE
|
COMPOSEFILE=$LINE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
h1 "processing $STACKDIR"
|
h1 "processing $STACKDIR"
|
||||||
|
|
||||||
# skip if directroy not found
|
# skip if directroy not found
|
||||||
cd $STACKDIR || continue
|
cd "$STACKDIR" || continue
|
||||||
|
|
||||||
# fetch from repo and check for new commits
|
# fetch from repo and check for new commits
|
||||||
git fetch --quiet
|
git fetch --quiet
|
||||||
|
@ -40,5 +40,5 @@ for LINE in $STACKLIST; do
|
||||||
|
|
||||||
# pull new commits and run docker compose
|
# pull new commits and run docker compose
|
||||||
git pull
|
git pull
|
||||||
docker compose --file ${COMPOSEFILE:=docker-compose.yml} up --build --detach --remove-orphans
|
docker compose --file "${COMPOSEFILE:=docker-compose.yml}" up --build --detach --remove-orphans
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue