Created
April 24, 2022 21:05
-
-
Save llbbl/5f8daa959950ce3f7433c426c3a4372b to your computer and use it in GitHub Desktop.
sync 5etools content script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!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