Mini vMac under OS X - mount disk image from command line?

About Mini vMac and all other 68k emulators, including SoftMac, Executor, and MESS.

Moderators: Cat_7, Ronald P. Regensburg

Post Reply
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Mini vMac under OS X - mount disk image from command line?

Post by emendelson »

Under OS X, is it possible to use a terminal command (or an AppleScript) that automatically launches a disk image when starting Mini vMac? I'd like to create a self-contained AppleScript bundle that contains a copy of Mini vMac, a ROM file, and a disk image, and start it all at once if possible.

Maybe this is something that everyone else knows how to do, but I'll be grateful for any help.
User avatar
adespoton
Forum All-Star
Posts: 4226
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Mini vMac under OS X - mount disk image from command lin

Post by adespoton »

Not sure if it's common knowledge, but it's something I've been doing for years. What I generally do is build a Platypus package that has Mini vMac, the ROM and the disk image in its Resources folder, and the launch script is just ../Resources/mvMac/Contents/MacOS/mvMac ../Resources/image.dsk

This always does the trick. However, if you want to do more, I think the binary located at mvMac/Contents/MacOS/mvMac (or whatever you call yours) takes commands just like the Windows binary, as documented here:
http://minivmac.sourceforge.net/doc/control.html

If, for some reason, none of this works, you could always associate ".dsk" with a specific build of Mini vMac, and just use the command line script "open image.dsk" to launch it with that copy of Mini vMac (the association is a build option when you compile Mini vMac from scratch, or you can do manual association)
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Mini vMac under OS X - mount disk image from command lin

Post by emendelson »

Thanks for this, but the current custom builds don't seem to accept filenames as command-line parameters. I'm certain that I'm using the syntax correctly, because I'm able to launch the unix executable from the terminal, and I let the terminal fill in the name of the disk image. The emulator launches, but with the disk icon.

The page you linked to says that command-line arguments work in Linux and Windows, but doesn't say anything about command-line arguments working in OS X.

I've now looked at earlier versions of miniVMac, and they don't seem to launch disk images either. Could you point to a unix executables of miniVmac that works with the disk image as a command line? Or are you willing to link to one of your Platypus packages?

Thanks again for your help.
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Mini vMac under OS X - mount disk image from command lin

Post by emendelson »

Could I make this a more general question to the forum:

Can anyone make the OS X version of mini vMac mount a disk image from the command line? The mini vMac site says nothing about this ability under OS X; the site says it can be done under Linux and Windows, but does not describe it working under OS X.

I've tried this with the current stable version and many different disk images, and I cannot make the unix executable mount a disk image from the command line. Adespoton says that this "always works." I can't make it work at all. Can anyone suggest what I might be doing wrong?

Thanks for any help.
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Mini vMac under OS X - mount disk image from command lin

Post by Ronald P. Regensburg »

I don't know if this will help to start from. The below AppleScript works on my Mac. Paths need to be known, though.

Code: Select all

tell application "Finder"
	open document file "hfs10M.DSK" of folder "Mini vMac" of folder "Applications" of folder "ronald" of folder "Users" of startup disk using application file "Mini vMac.app" of folder "Mini vMac" of folder "Applications" of folder "ronald" of folder "Users" of startup disk
end tell
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Mini vMac under OS X - mount disk image from command lin

Post by emendelson »

Ronald P. Regensburg wrote:I don't know if this will help to start from. The below AppleScript works on my Mac. Paths need to be known, though.

Code: Select all

tell application "Finder"
	open document file "hfs10M.DSK" of folder "Mini vMac" of folder "Applications" of folder "ronald" of folder "Users" of startup disk using application file "Mini vMac.app" of folder "Mini vMac" of folder "Applications" of folder "ronald" of folder "Users" of startup disk
end tell
I'm away from my Mac now, but if it works for you, I'm sure it will work here. I'd like to put together an AppleScript bundle. It can easily be set up to work wherever it is, using relative paths in the AppleScript. If I can make this work, I'll post the code here for anyone else to use.

I'd still like to figure out how adespoton can make this work from the command line!
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Mini vMac under OS X - mount disk image from command lin

Post by emendelson »

I've started a new thread with instructions for building a self-contained mini vMac AppleScript application, using Ronald's method.
Last edited by emendelson on Fri Feb 14, 2014 5:51 pm, edited 1 time in total.
User avatar
adespoton
Forum All-Star
Posts: 4226
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Mini vMac under OS X - mount disk image from command lin

Post by adespoton »

Having problems getting to my bundles at the same time I have time to write on here... but the following should also work:

open ::path to dsk:: -a ::path to application::

In this case, the romfile needs to be in the same folder as the .app -- which can be inside a bundle.

For that matter, you can make an executable bundle yourself. Create a folder, inside it create a folder named Contents. Inside that, create a folder named MacOS and one named Resources.

Inside the MacOS folder, create a text file -- say "MacOS" (no extension). Make that your script, like so:

Code: Select all

#!/bin/sh
open ../Resources/disk.dsk -a ../Resources/vMac.app
Save it, and then use terminal to chmod +x MacOS

Now back up, and create a text file in the Contents folder named Info.plist.

Put the following in:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd
<plist version="1.0">
<dict>
  <key>CFBundleExecutable</key>
  <string>MacOS</string>
</dict>
</plist>
That's it! Now rename the outer folder whatever you want to call it (eg "Mac OS 7.5.5.app"), double-click, and away you go. If you want to add a custom icon for the app, stick the icon file (named AppIcon.icns for the below example) in the Resources folder, and add the following to your Info.plist file:

Code: Select all

  <key>CFBundleIconFile</key>
  <string>AppIcon</string>
You could also add a bunch more stuff using the Info.plist file (version strings, package type, bundle identifier, etc.) but it isn't really necessary -- version string might be useful if you plan to roll out future versions.

[edit] Just one other note, this doesn't sign the app, so anyone else downloading it will have to right-click and select Open to get it to run the first time. To sign it, you need to also have a _CodeSignature folder with a file inside named CodeResources that contains the manifest of all the other files in the bundle, along with b64-encoded hashes of the files or an explicit omission.
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Mini vMac under OS X - mount disk image from command lin

Post by emendelson »

That is essentially the same as what I did with AppleScript (following Ronald's suggestion) in this thread:

http://www.emaculation.com/forum/viewto ... f=7&t=8276

Your bash script version probably starts a few milliseconds faster, though!
User avatar
gryphel
Nice Guy
Posts: 106
Joined: Sat Nov 17, 2007 6:46 pm

Re: Mini vMac under OS X - mount disk image from command lin

Post by gryphel »

emendelson wrote: Can anyone make the OS X version of mini vMac mount a disk image from the command line? The mini vMac site says nothing about this ability under OS X; the site says it can be done under Linux and Windows, but does not describe it working under OS X.
OS X applications do not usually take command line parameters. (When this question came up before, I think I remember reading that in recent versions of OS X, there is a way to find command line parameters, but that's not implemented in Mini vMac.)

As an alternative, as documented in the Floppy Drives section of the Emulated Hardware Reference, you can put a disk image named "disk1.dsk" in the folder containing the Mini vMac application, and Mini vMac will automatically mount it on launch. (And also "disk2.dsk", etc.) These files can be aliases (or symbolic links) to images elsewhere.

The OS X version also has a feature not available in other versions. You can create a folder named "mnvm_dat" contained inside the "content" folder inside the application, and Mini vMac will look for the ROM and disk images in that folder instead of the folder containing the application. This allows you to make a self contained application.

The AppleScript method described works too.
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Mini vMac under OS X - mount disk image from command lin

Post by emendelson »

That's really excellent - and I should have figured it out from your site, but wasted a lot of time because I didn't look hard enough! Thank you!!
User avatar
adespoton
Forum All-Star
Posts: 4226
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Mini vMac under OS X - mount disk image from command lin

Post by adespoton »

Ah; of course -- now that I'm at a computer where I implemented it, I did exactly what Gryphel documented; disk1.dsk. I used to do the platypus script method back before he added those options, many moons ago.

One question emendelson: are you planning a Mini vMac similar to the instant-setup SheepShaver you did?
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Mini vMac under OS X - mount disk image from command lin

Post by emendelson »

adespoton wrote: One question emendelson: are you planning a Mini vMac similar to the instant-setup SheepShaver you did?
It's something I've got in mind, but it may be impractical.
Post Reply