Have been using a Mac for about a month, but am a 48-year engineer. Too many operating systems to list.
Have my cross-platform self-contained Java application looking great on macOS with all the cool Mac conventions and a DMG "installer".
Am attempting to get the existing self-updater working for macOS. It has conditional logic based on the operating system.
But I'm stuck ... this is on a Macbook Pro 13" Retina Late 2013 2.8Ghz running macOS Big Sur 11.7.10 (fully updated). Deliberately supporting older hardware due to the nature of the application.
The Process in Short
- Main program downloads updater program into a system temp directory
- Mounts updater DMG image with -mountroot in that directory
- Executes updater .app
- Exits
- Updater program downloads new Main program
- Mounts new program DMG image in the system temp directory
- The DMG image is the same one used for initial installations
- Makes back-ups of the Java and Plugins directories of existing program
- Copies the new Java and Plugins directories to existing Main program locations
- Umounts new program DMG image
- Either deletes back-up directories or restores them based on success or failure
- Restarts Main program .app
- Exits
- Mounts new program DMG image in the system temp directory
- Main program receives special argument indicating success or failure of update
- Unmounts updater DMG image
- Displays appropriate dialog
Issues
The problems encountered are the mounting and unmounting of the DMG images executing hdiutil
with Java Runtime.getRuntime().exec().
- All mounts and unmounts have 1.5 sec. time-delayed retries for 3 attempts
- The initial download, mount, and execution of the updater works
- The mounting of the downloaded update DMG fails
- Running the command by hand works
- When the Main program is restarted the unmount of the updater DMG fails
- Running the command by hand works
Also - these are unsigned images at this point. Have been unsure whether I would support macOS. But this is the last stumbling block.
Questions
- Odd point - the initial download, mount and execution of the updater works
- Is this all because the DMG images are not signed (yet), so
hdiutil
is failing? - Or is there something basic that I'm missing?
Thank You
For taking your time to read this. Any pointers would be appreciated.
The Project
- https://github.com/Corionis/ELS/tree/Version-4.0.0 (not released)
- Component projects: https://github.com/Corionis