A short repo for any kind of script snippets
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
957 B

3 years ago
#Dependencies
source "./.dependencies/spinner.sh"
#-------CONFIGURATION-------#
URL="blog.noobtoroot.xyz"
ARCHIVE_NAME="content.tar.gz"
CONTENTBACKUP_PATH="./tmp"
IMAGE_FOLDER=NULL
#--------------------------#
#docker run -d --name $URL -p 3001:2368 -e url=https://$URL ghost:latest
#CHECK IF ARCHIVE EXIST
if ! [[ -f "$ARCHIVE_NAME" ]]; then
echo "ARCHIVE BACKUP IS MISSING"
exit
fi
start_spinner "EXTRACT AND COPY CONTENT FILES IN DOCKER CONTAINER"
#-----------------------------------------------------------------#
#EXTRACT
mkdir -p $CONTENTBACKUP_PATH
tar -zxf $ARCHIVE_NAME -C $CONTENTBACKUP_PATH > /dev/null 2>&1
#FIND IMAGES FOLDER
IMAGE_FOLDER=$(find ./ -type d -wholename "*content/images")
#EXTRACT TO DOCKER CONTAINER
docker cp -L "$IMAGE_FOLDER" $URL:/var/lib/ghost/content/
#REMOVE TMP CONTENT BACKUP FILES
rm -dR $CONTENTBACKUP_PATH
#----------------------------------------------------------------#
stop_spinner $?