Created
October 24, 2015 13:15
-
-
Save Inndy/80cfffef244eb613ff48 to your computer and use it in GitHub Desktop.
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 | |
| if [ -z "$1" ]; then | |
| echo "Usage: $0 /path/to/backup/without/ext" | |
| echo "" | |
| echo " * p7zip and tar is required" | |
| exit | |
| fi | |
| echo "[+] Backup \$HOME/* to ${1}.tar but following files will be excluded" | |
| echo " - \$HOME/Library" | |
| echo " - \$HOME/Applications" | |
| echo "[+] Backup following files to ${1}_secrets.7z with password" | |
| echo " - \$HOME/.ssh" | |
| echo " - \$HOME/Library/Cookies" | |
| echo " - \$HOME/Library/Safari" | |
| echo " - \$HOME/Library/Keychains" | |
| echo " - \$HOME/Library/Application Support/Firefox/Profiles" | |
| echo "[+] ls /Applications to ${1}_applist.txt" | |
| echo "" | |
| echo "--- Press enter to start backup or Ctrl-C to abort ---" | |
| read -s _ | |
| cd $HOME | |
| tar cfv "${1}.tar" "$HOME" --exclude "$HOME/Library" --exclude "$HOME/Applications" --exclude "$HOME/.*" | |
| 7z -p -mx=9 a "${1}_secrets.7z" .ssh Library/Cookies Library/Safari Library/Keychains "Library/Application Support/Firefox/Profiles" | |
| ls /Applications > "${1}_applist.txt" | |
| echo "" | |
| echo "[+] Done!" | |
| echo "" | |
| ls -al "$(dirname "$1")" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment