Created
March 21, 2015 06:16
-
-
Save samkaufman/18f0f9da7df6f4ff5602 to your computer and use it in GitHub Desktop.
A little shell script for syncing Baldur's Gate II save games between my iPad and Mac
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/sh | |
| # mount | |
| #IPADMOUNTPATH=$(mktemp -d 2>/dev/null || mktemp -d -t bg2mnt) | |
| IPADMOUNTPATH=~/syncbg2mnt # use a constant directory so Unison achive files aren't confused | |
| mkdir "$IPADMOUNTPATH" || exit 1 | |
| ifuse "$IPADMOUNTPATH" --container com.overhaulgames.baldursgateIIenhancededition || exit 2 | |
| # sync | |
| IPADSAVEPATH=${IPADMOUNTPATH%%/}/Library/save | |
| MACSAVEPATH=~/"Library/Containers/com.beamdog.baldursgateIIenhancededition/Data/Documents/Baldur's Gate II - Enhanced Edition/save" | |
| sleep .5 # gives it time to actually be mounted | |
| unison "$IPADSAVEPATH" "$MACSAVEPATH" -batch -ignore "Name .DS_Store" -prefer newer -perms 0 -dontchmod | |
| # done | |
| umount "$IPADMOUNTPATH" || exit 3 | |
| rmdir "$IPADMOUNTPATH" || exit 4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment