Update GITHUB source to use new mirrors
Rework git source, remove sparse-checkout, add images as submodule
Remove "GIT_URL" option
This commit is contained in:
Joey Hafner 2024-01-29 21:16:59 -08:00
parent 1d58294014
commit 497e602605
2 changed files with 7 additions and 15 deletions

View File

@ -11,16 +11,12 @@ services:
- SOURCE=GITHUB
# Required unless OFFLINE_MODE=TRUE and the site files are already present.
# Expects one of GITHUB, GITHUB-NOIMG, GET5ETOOLS, or GET5ETOOLS-NOIMG. Where:
# GITHUB pulls from https://github.com/5etools-mirror-1/5etools-mirror-1
# GITHUB-NOIMG pulls from https://github.com/5etools-mirror-1/5etools-mirror-1 without image files.
# GITHUB pulls from https://github.com/5etools-mirror-2/5etools-mirror-2.github.io and adds https://github.com/5etools-mirror-2/5etools-img as a submodule
# GITHUB-NOIMG pulls from https://github.com/5etools-mirror-2/5etools-mirror-2.github.io without adding the images submodule.
# GET5ETOOLS pulls from https://get.5e.tools
# GET5ETOOLS-NOIMG pulls from https://get.5e.tools without image files.
# The get.5e.tools source has been down (redirecting to 5e.tools) during development.
# This method is not tested.
#- GIT_URL=https://github.com/5etools-mirror-1/5etools-mirror-1.github.io.git
# Use this to override the default "official" mirror link. Only works for initial Git clone.
# Does not work when an existing repository is present.
# Defaults to https://github.com/5etools-mirror-2/5etools-mirror-2.github.io.git
#- OFFLINE_MODE=TRUE
# Optional. Expects "TRUE" or "FALSE".

14
init.sh
View File

@ -48,20 +48,16 @@ case $SOURCE in
git config --global user.name "AutoDeploy"
git config --global pull.rebase false # Squelch nag message
git config --global --add safe.directory '/usr/local/apache2/htdocs' # Disable directory ownership checking, required for mounted volumes
git clone --filter=blob:none --no-checkout $DL_LINK . # clone the repo with no files and no object history
git config core.sparseCheckout true # enable sparse checkout
git sparse-checkout init
git clone $DL_LINK . # clone the repo with no files and no object history
else
echo " === Using existing git repository"
git config --global --add safe.directory '/usr/local/apache2/htdocs' # Disable directory ownership checking, required for mounted volumes
fi
if [[ "$SOURCE" == *"NOIMG"* ]]; then # if user does not want images
echo -e '/*\n!img' > .git/info/sparse-checkout # sparse checkout should include everything except the img directory
echo " === Pulling from GitHub without images..."
else
echo -e '/*' > .git/info/sparse-checkout # sparse checkout should include everything
echo " === Pulling from GitHub with images... (This will take a while)"
if ! [[ "$SOURCE" == *"NOIMG"* ]]; then # if user does want images
echo " === Pulling images from GitHub... (This will take a while)"
git submodule add -f https://github.com/5etools-mirror-2/5etools-img /usr/local/apache2/htdocs/img
fi
echo " === Pulling main files from GitHub..."
git checkout
git fetch
git pull --depth=1