mirror of
https://github.com/elliotnunn/empw.git
synced 2024-11-22 20:33:58 +00:00
32 lines
786 B
Plaintext
32 lines
786 B
Plaintext
|
#!/usr/bin/env python3
|
||
|
|
||
|
from sys import argv
|
||
|
from subprocess import run, PIPE, DEVNULL
|
||
|
from os import path
|
||
|
|
||
|
srcimg = 'SourceForEmulator.dmg'
|
||
|
|
||
|
rsync_opts = [
|
||
|
'--exclude', '.*', # Down with dotfiles.
|
||
|
'--exclude', srcimg,
|
||
|
'--exclude', 'Desktop DB',
|
||
|
'--exclude', 'Desktop DF',
|
||
|
'--exclude', 'Trash',
|
||
|
'--recursive',
|
||
|
'-tX', # consider times and xattrs
|
||
|
'--delete', # may delete things on the vMac drive
|
||
|
# '--itemize-changes',
|
||
|
]
|
||
|
|
||
|
|
||
|
|
||
|
devnode, mountpoint = run(['hdiutil', 'attach', '-nobrowse', srcimg], stdout=PIPE, check=True).stdout.decode('ascii').split()
|
||
|
|
||
|
try:
|
||
|
mountpoint = mountpoint.rstrip('/') # try to deal in clean paths
|
||
|
|
||
|
run(['rsync', *rsync_opts, mountpoint+'/', './'], check=True)
|
||
|
|
||
|
finally:
|
||
|
run(['hdiutil', 'detach', mountpoint], stdout=DEVNULL, check=True)
|