mirror of
https://github.com/elliotnunn/empw.git
synced 2024-11-25 10:30:51 +00:00
dfc33860bc
I have been patching empw ad hoc. It would be too much trouble to separate out all my changes so far. Highlights: - Basilisk II (-b) for when you need more RAM (jankier UI, though) - larger disk images - support for partitioned images, *if* you create them yourself - support for stderr and return codes (but not stdin yet) - support for running from a subdirectory - UNIX->Mac path conversion
36 lines
979 B
Python
Executable File
36 lines
979 B
Python
Executable File
#!/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', 'Desktop Folder',
|
|
'--exclude', 'Trash',
|
|
'--exclude', 'TheVolumeSettingsFolder',
|
|
'--exclude', 'TheFindByContentFolder',
|
|
'--recursive',
|
|
'-tX', # consider times and xattrs
|
|
'--delete', # may delete things on the vMac drive
|
|
# '--itemize-changes',
|
|
]
|
|
|
|
|
|
|
|
cmdresult = run(['hdiutil', 'attach', '-nobrowse', srcimg], stdout=PIPE, check=True).stdout.decode('ascii')
|
|
mountpoint = next(x for x in cmdresult.split() if x.startswith('/') and not x.startswith('/dev'))
|
|
|
|
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)
|