diff --git a/docker-compose-tunnels.yml b/docker-compose-tunnels.yml index f610be7..f28443e 100644 --- a/docker-compose-tunnels.yml +++ b/docker-compose-tunnels.yml @@ -1,7 +1,7 @@ version: "3.7" services: nginx: - image: nginx:mainline-alpine + image: nginx container_name: nginx hostname: ${DOMAIN_NAME:?err} volumes: @@ -37,11 +37,11 @@ services: - /bin/sh - -c - | - trap exit TERM; + trap exit TERM INT; sleep 10; while :; do - apikey="$(grep -oPm 1 '(?<=\).*(?=\)' /data/syncthing/config.xml)" - curl -s -X POST -H "X-API-Key: $$apikey" http://syncthing:8384/rest/db/revert?folder=jhcrt-m2dra; + apikey="$$(grep -oPm 1 '(?<=\).*(?=\)' /data/syncthing/config.xml)" + curl -s --fail -X POST -H "X-API-Key: $$apikey" http://syncthing:8384/rest/db/revert?folder=jhcrt-m2dra || echo Failed to revert folder; sed -i -r '/)|\1ZDHVMSP-EW4TMWX-DBH2W4P-HV5A6OY-BBEFABO-QTENANJ-RJ6GKNX-6KCG7QY\2|' /data/syncthing/config.xml sleep 1h & wait $${!}; diff --git a/docker-compose.yml b/docker-compose.yml index 860c0f8..607d7ee 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: "3.7" services: nginx: - image: nginx:mainline-alpine + image: nginx container_name: nginx hostname: ${DOMAIN_NAME:?err} volumes: @@ -46,11 +46,11 @@ services: - /bin/sh - -c - | - trap exit TERM; + trap exit TERM INT; sleep 10; while :; do - apikey="$(grep -oPm 1 '(?<=\).*(?=\)' /data/syncthing/config.xml)" - curl -s -X POST -H "X-API-Key: $$apikey" http://syncthing:8384/rest/db/revert?folder=jhcrt-m2dra; + apikey="$$(grep -oPm 1 '(?<=\).*(?=\)' /data/syncthing/config.xml)" + curl -s --fail -X POST -H "X-API-Key: $$apikey" http://syncthing:8384/rest/db/revert?folder=jhcrt-m2dra || echo Failed to revert folder; sed -i -r '/)|\1ZDHVMSP-EW4TMWX-DBH2W4P-HV5A6OY-BBEFABO-QTENANJ-RJ6GKNX-6KCG7QY\2|' /data/syncthing/config.xml sleep 1h & wait $${!}; diff --git a/update b/update index d756140..115a89b 100755 --- a/update +++ b/update @@ -18,8 +18,12 @@ if [ ! -d "./.git" ]; then git remote add origin https://github.com/chaotic-aur/docker-mirror git fetch git reset --hard origin/main +else if [ ! -f ./custom.diff ]; then + git pull || { echo "Git pull failed, please fix the issue at hand."; exit 1; } else - git pull || echo "Git pull failed, please fix the issue at hand." + git fetch + git reset --hard origin/main + git apply ./custom.diff fi if [ "$SELFUPDATE" != 1 ]; then