diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..723ef36 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea \ No newline at end of file diff --git a/Convert to CD Image.workflow/Contents/Info.plist b/Convert to CD Image.workflow/Contents/Info.plist new file mode 100644 index 0000000..1e5f566 --- /dev/null +++ b/Convert to CD Image.workflow/Contents/Info.plist @@ -0,0 +1,27 @@ + + + + + NSServices + + + NSMenuItem + + default + Convert to CD Image + + NSMessage + runWorkflowAsService + NSRequiredContext + + NSApplicationIdentifier + com.apple.finder + + NSSendFileTypes + + public.item + + + + + diff --git a/Convert to CD Image.workflow/Contents/QuickLook/Preview.png b/Convert to CD Image.workflow/Contents/QuickLook/Preview.png new file mode 100644 index 0000000..5285750 Binary files /dev/null and b/Convert to CD Image.workflow/Contents/QuickLook/Preview.png differ diff --git a/Convert to CD Image.workflow/Contents/document.wflow b/Convert to CD Image.workflow/Contents/document.wflow new file mode 100644 index 0000000..57372da --- /dev/null +++ b/Convert to CD Image.workflow/Contents/document.wflow @@ -0,0 +1,217 @@ + + + + + AMApplicationBuild + 444.7 + AMApplicationVersion + 2.8 + AMDocumentVersion + 2 + actions + + + action + + AMAccepts + + Container + List + Optional + + Types + + com.apple.cocoa.string + + + AMActionVersion + 2.0.3 + AMApplication + + Automator + + AMParameterProperties + + COMMAND_STRING + + CheckedForUserDefaultShell + + inputMethod + + shell + + source + + + AMProvides + + Container + List + Types + + com.apple.cocoa.string + + + ActionBundlePath + /System/Library/Automator/Run Shell Script.action + ActionName + Shell-Skript ausführen + ActionParameters + + COMMAND_STRING + handle_error() { + osascript -e 'tell app "System Events" to display dialog "Select a single directory (not a file) and make sure the output ISO file does not exist already."' +} + +trap 'handle_error $LINENO' ERR + +for f in "$@" + do + hdiutil makehybrid -o "$f.iso" "$f" -iso -joliet 2>> /dev/null + done + +exit 0 + + + + CheckedForUserDefaultShell + + inputMethod + 1 + shell + /bin/bash + source + + + BundleIdentifier + com.apple.RunShellScript + CFBundleVersion + 2.0.3 + CanShowSelectedItemsWhenRun + + CanShowWhenRun + + Category + + AMCategoryUtilities + + Class Name + RunShellScriptAction + InputUUID + 1C640013-171B-4B17-B504-8E4AA93A10B0 + Keywords + + Shell + Skript + Befehl + Ausführen + Unix + + OutputUUID + 159C5A72-E4DA-413B-BA2D-A802BD5B63C6 + UUID + BDF74FB8-48F8-4B7B-8ABB-50EE8F189A02 + UnlocalizedApplications + + Automator + + arguments + + 0 + + default value + 0 + name + inputMethod + required + 0 + type + 0 + uuid + 0 + + 1 + + default value + + name + source + required + 0 + type + 0 + uuid + 1 + + 2 + + default value + + name + CheckedForUserDefaultShell + required + 0 + type + 0 + uuid + 2 + + 3 + + default value + + name + COMMAND_STRING + required + 0 + type + 0 + uuid + 3 + + 4 + + default value + /bin/sh + name + shell + required + 0 + type + 0 + uuid + 4 + + + conversionLabel + 0 + isViewVisible + + location + 309.000000:609.000000 + nibPath + /System/Library/Automator/Run Shell Script.action/Contents/Resources/German.lproj/main.nib + + isViewVisible + + + + connectors + + workflowMetaData + + serviceApplicationBundleID + com.apple.finder + serviceApplicationPath + /System/Library/CoreServices/Finder.app + serviceInputTypeIdentifier + com.apple.Automator.fileSystemObject + serviceOutputTypeIdentifier + com.apple.Automator.nothing + serviceProcessesInput + 0 + workflowTypeIdentifier + com.apple.Automator.servicesMenu + + + diff --git a/README.md b/README.md new file mode 100644 index 0000000..00e6b7b --- /dev/null +++ b/README.md @@ -0,0 +1,47 @@ +## MacOS/Finder context menu entry: Convert to CD image + +Transforms arbitrary files and folders into an ISO 9660 joliet image +from the MacOS Finder file/folder context menu. + +### How to install? + +1. Click on the green button "Clone or Download" -> "Download ZIP". +2. Extract the ZIP and double-click: "Convert to CD image". +3. Click "Install" (prompts if system service should be installed) + +### How to use? + +1. Open Finder +2. Select an arbitrary file or folder +3. Right-click -> "Convert to CD image" + +Use the .iso file of the file/folder created as ISO 9660 joliet image. + +### How it works + +The whole process is using the Automator capabilities of Mac OS. +Automator is a scripting subsystem available since OS X 10.4 (Tiger). +It is set up as a "Service" which takes selected files/folders of +Finder as arguments and registeres as a context menu. + +The command executed (in bash) is: + + handle_error() { + osascript -e 'tell app "System Events" to display dialog "Select a single directory (not a file) and make sure the output ISO file does not exist already."' + } + + trap 'handle_error $LINENO' ERR + + for f in "$@" + do + hdiutil makehybrid -o "$f.iso" "$f" -iso -joliet 2>> /dev/null + done + + exit 0 + +#### Motivation + +Helping PCem, an emulator to run on MacOS brought up the issue how +to transfer files/folders from the host to the guest OS. This works +using CD ROM image mounts but the process wasn't quite elegant and +involved complex terminal interactions. This solution feels better. \ No newline at end of file