Skip to content

Instantly share code, notes, and snippets.

@madc
Created October 19, 2015 22:06
Show Gist options
  • Save madc/58282a0dd8a5f0a6cf69 to your computer and use it in GitHub Desktop.
Save madc/58282a0dd8a5f0a6cf69 to your computer and use it in GitHub Desktop.
A little helper script to archive a BoltCMS installation
#!/usr/bin/env bash
# A little helper script to archive a BoltCMS installation
# Usage:
# Default behaviour:
# $ ./archive
# Restore:
# $ ./archive --restore <archive>
if [ $1 ] && [ $2 ]; then
if [ $1 == "--restore" ] || [ $1 == "-r" ]; then
ARCHIVEFILE=$2
echo "Restoring Archive File: $ARCHIVEFILE"
tar -xjf $ARCHIVEFILE
echo "Done."
fi
else
ARCHIVEFILE="archive_${PWD##*/}_$(date +%Y%m%d_%H-%M).tar.bz2"
echo "Creating Archive File: $ARCHIVEFILE"
tar -jcf $ARCHIVEFILE app/config/*.yml app/config/extensions/*.yml app/database/bolt.db extensions files theme composer.* --exclude='*.html' --exclude='.htaccess' --exclude='.git*' --exclude='extensions/composer.json' --exclude='extensions/ExtensionInstaller.php' --exclude='extensions/vendor/autoload.php' --exclude='extensions/vendor/composer' --exclude="theme/base-*" --exclude="theme/default" &> /dev/null
echo "Done."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment