Skip to content

Commit

Permalink
#13
Browse files Browse the repository at this point in the history
Update GITHUB source to use new mirrors
Rework git source, remove sparse-checkout, add images as submodule
Remove "GIT_URL" option
  • Loading branch information
Jafner committed Jan 30, 2024
1 parent 1d58294 commit 497e602
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
8 changes: 2 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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".

Expand Down
14 changes: 5 additions & 9 deletions init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 497e602

Please sign in to comment.