2023-02-08 19:46:00 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-06-16 23:13:11 +00:00
|
|
|
COMPOSE_PLUGIN=$(docker compose >/dev/null 2>&1; if [ "$?" == "0" ]; then echo "true"; else echo "false"; fi)
|
|
|
|
COMPOSE_LEGACY=$(docker-compose >/dev/null 2>&1; if [ "$?" == "0" ]; then echo "true"; else echo "false"; fi)
|
|
|
|
|
|
|
|
case "true" in
|
|
|
|
$COMPOSE_PLUGIN)
|
|
|
|
echo "using docker compose"
|
|
|
|
COMPOSE="docker compose"
|
|
|
|
;;
|
|
|
|
$COMPOSE_LEGACY)
|
|
|
|
echo "using docker-compose"
|
|
|
|
COMPOSE="docker-compose"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "No docker-compose found."
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2023-02-08 19:46:00 +00:00
|
|
|
if [ ! -z $1 ]; then
|
|
|
|
START_DIR="$1"
|
|
|
|
else
|
|
|
|
START_DIR="$HOME/docker-compose"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -d "$START_DIR" ]; then
|
|
|
|
echo "Invalid directory '$START_DIR': Exiting."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Current dir is $START_DIR"
|
|
|
|
|
|
|
|
for f in $(find $START_DIR/ -iname "docker-compose.yml")
|
|
|
|
do
|
|
|
|
CURRENT_DIR=$(dirname "${f}")
|
|
|
|
echo "Updating $CURRENT_DIR..."
|
|
|
|
cd $CURRENT_DIR
|
|
|
|
if [ ! -f ".update.ignore" ]; then
|
2023-06-16 23:13:11 +00:00
|
|
|
$COMPOSE pull --no-parallel && $COMPOSE up -d --remove-orphans 2>&1
|
2023-02-08 19:46:00 +00:00
|
|
|
else
|
|
|
|
echo "Stack flagged for ignore updates"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2023-06-16 23:13:11 +00:00
|
|
|
cd $START_DIR
|