Skip to content

Instantly share code, notes, and snippets.

@bijayrungta
Created June 2, 2015 10:23
Show Gist options
  • Save bijayrungta/d123148bbc9ed54c687f to your computer and use it in GitHub Desktop.
Save bijayrungta/d123148bbc9ed54c687f to your computer and use it in GitHub Desktop.
Migrate to a new Mac
function bjMigrateMac()
{
# http://lowendmac.com/2009/step-by-step-guide-to-manual-mac-system-migration/#nowork
host="$1"
if [ ! "${host}" ]; then
host="mac13"
fi
declare -a aHomeFilesToSync=(
Documents
Music
Movies
Downloads
Pictures
Samsung
backups
bin
codebase
docs
tmp
lib
projects
settings
Library
Applications
opt
.ssh
)
declare -a aHomeFilesToSync=(
Documents
Music
Movies
Downloads
Pictures
Samsung
backups
bin
codebase
docs
tmp
lib
projects
settings
opt
.ssh
)
commandOptions=" --cvs-exclude --exclude='.git/'"
if [ "$2" != "commit" ]; then
commandOptions="${commandOptions} --dry-run"
fi
for homeFileToSync in "${aHomeFilesToSync[@]}"
do
printDryRunCommand ssh -t $host "mkdir -p ~/${homeFileToSync}"
ssh -t $host "mkdir -p ~/${homeFileToSync}"
printDryRunCommand rsync -avz ${commandOptions} ${bjHomeDir}/${homeFileToSync}/ ${host}:~/${homeFileToSync}
rsync -avz ${commandOptions} ${bjHomeDir}/${homeFileToSync}/ ${host}:~/${homeFileToSync}
done
declare -a aApplicationsToSync=(
"airtel 3G.app"
"CleanMyMac 2.app"
"Cyberduck.app"
"DiffMerge.app"
"Dropbox.app"
"eclipse-standard-luna-SR2"
"Fantastical.app"
"Firefox.app"
"FortiClient.app"
"FortiClientUninstaller.app"
"Google Drive.app"
"IntelliJ IDEA 14 CE.app"
"iTerm.app"
"Kies.app"
"Komodo Edit 8.app"
"MySQLWorkbench.app"
"NetBeans"
"Parallels Access.app"
"Parallels Desktop.app"
"Path Finder.app"
"PhpStorm EAP.app"
"PhpStorm.app"
"PyCharm CE.app"
"Skitch.app"
"Spectacle.app"
"SQLDeveloper.app"
"Sublime Text 2.app"
"Sublime Text.app"
"Todoist.app"
"Uninstall airtel 3G.app"
"WebStorm.app"
"Xcode.app"
)
for applicationToSync in "${aApplicationsToSync[@]}"
do
printDryRunCommand rsync -avz ${commandOptions} "/Applications/${applicationToSync}" ${host}:/Applications/
# rsync -avz ${commandOptions} "/Applications/${applicationToSync}" ${host}:/Applications/
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment