Fixed offline startup

Aligned to lancache-dns
This commit is contained in:
James Kinsman 2020-02-23 14:01:08 +00:00 committed by GitHub
parent 75f3bc45e4
commit 67e4bef59f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,16 +2,25 @@
IFS=' '
mkdir -p /data/cachedomains
cd /data/cachedomains
echo "Bootstrapping Monolithic from ${CACHE_DOMAINS_REPO}"
export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
pushd /data/cachedomains > /dev/null
if [[ ! -d .git ]]; then
git clone ${CACHE_DOMAINS_REPO} .
fi
if [[ "${NOFETCH:-false}" != "true" ]]; then
git fetch origin
# Disable error checking whilst we attempt to get latest
set +e
git remote set-url origin ${CACHE_DOMAINS_REPO}
git fetch origin || echo "Failed to update from remote, using local copy of cache_domains"
git reset --hard origin/${CACHE_DOMAINS_BRANCH}
# Reenable error checking
set -e
fi
popd > /dev/null
TEMP_PATH=$(mktemp -d)
OUTPUTFILE=${TEMP_PATH}/outfile.conf
echo "map \"\$http_user_agent£££\$http_host\" \$cacheidentifier {" >> $OUTPUTFILE