docker-mirror/update

42 lines
833 B
Bash
Executable File

#!/bin/bash
set -e
if [[ $EUID -ne 0 ]]; then
echo Run as root!
exit 1
fi
./stop
if [ ! -d "./.git" ]; then
if [ "$(git rev-parse --is-inside-work-tree || true)" == "true" ]; then
echo "Please run this script in the main directory"
exit 1
fi
git init --initial-branch=main
git remote add origin https://git.itsmebravo.dev/bravo68web/docker-mirror
git fetch
git reset --hard origin/main
elif [ ! -f ./custom.diff ]; then
git pull || { echo "Git pull failed, please fix the issue at hand."; exit 1; }
else
git fetch
git reset --hard origin/main
git apply ./custom.diff
fi
if [ "$SELFUPDATE" != 1 ]; then
SELFUPDATE=1 ./update
fi
source .env
if [ "$USE_TUNNELS" != "true" ]; then
docker compose -f docker-compose.yml pull
else
docker compose -f docker-compose-tunnels.yml pull
fi
./run