Created
December 24, 2019 11:41
-
-
Save avielsh/6be341b3e6c69205edcd8b9e4d7d2993 to your computer and use it in GitHub Desktop.
My simple workspace dir backup
This file contains 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
#!/usr/local/bin/zsh -l | |
echo "$(date) - start - $(basename $0)" | |
cd ~ || return | |
BACKUPLIST=~/backuplist | |
BACKUPDIR=~/Downloads/Backup | |
WORKSPACE=$BACKUPDIR/workspace.tgz | |
TARGET=/Volumes/j\$/Apps/Mac | |
IN=( dotfiles iTerm2-Color-Schemes mac-cli mathias Menlo-for-Powerline node_modules Notes paulirish skwp "Library/Application Support" Library/Preferences Library/Safari Documents/Alfred "Calibre Library" Library/QuickLook Library/Containers Library/PreferencePanes workspace/test_inet) | |
EX=('Cask' 'Dash' 'Google' 'Code' 'CrossOver' 'Spotify' '.npm' 'Firefox' 'Code' 'com.docker.docker' 'Plex Media Server' 'com.rockysandstudio.Leaf') | |
EX=(${^EX}/\*) | |
T=(--exclude) | |
EXC=(${T:^^EX}) | |
ls -1d *(.) .* | grep -Ev "zcompdump|.zwc|.docker|.Trash|.vscode|.gradle|.rvm|.expo|.cache|.android" > $BACKUPLIST | |
#fd -tf -d1 . -E'*.zwc' >> $BACKUPLIST | |
echo ${(j:\n:)IN}>> $BACKUPLIST | |
echo "Backing up to $WORKSPACE" | |
rm $WORKSPACE | |
gtar zcf $WORKSPACE -P "${EXC[@]}" -T $BACKUPLIST | |
#gtar zcf $WORKSPACE -P "${EXC[@]}" "${IN[@]}" $DOTFILES $REGULAR_FILES | |
echo "Dumping brewfile" | |
brew bundle dump --force --file=$BACKUPDIR/Brewfile | |
echo Dumping apps | |
ls -1 /Applications > $BACKUPDIR/Applications | |
echo copying to remote location $TARGET | |
[[ -d $TARGET ]] && \cp -fr $BACKUPDIR $TARGET || echo "Error: $TARGET not found or not mounted" | |
echo "$(date) - end - $(basename $0)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment