Skip to content

Instantly share code, notes, and snippets.

@llbbl
Created April 24, 2022 21:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save llbbl/5f8daa959950ce3f7433c426c3a4372b to your computer and use it in GitHub Desktop.
Save llbbl/5f8daa959950ce3f7433c426c3a4372b to your computer and use it in GitHub Desktop.
sync 5etools content script
#!bin/bash
# sync_5etools_latest.sh
# sync 5etools content script
SERVER_USER=
SERVER_HOST=
SERVER_PATH=
LOCAL_DIR=5etools-mirror-1
# Get the URL of the latest release.
URL=$(curl -L -s https://api.github.com/repos/5etools-mirror-1/5etools-mirror-1.github.io/releases/latest | grep -o -E "https://(.*)/zipball/(.*)[^\",]")
#mkdir if not exists
mkdir -p $LOCAL_DIR
# Download and extract the release to the build dir.
curl -L -s $URL | tar xvz -C ./$LOCAL_DIR
#get the directory name
MIRROR_DIR=$(ls -d $LOCAL_DIR/5etools*)
PWD=$(pwd)
echo "rsync -azPe ssh $PWD/$MIRROR_DIR/ $SERVER_USER@$SERVER_HOST:$SERVER_PATH"
rsync -azPe ssh $PWD/$MIRROR_DIR/ $SERVER_USER@$SERVER_HOST:$SERVER_PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment