Thank you for the explanation. It was not obvious to me that the configuration of the DMG appearance actually means configuring the .DS_Store file in the DMG.
Alan > On Mar 4, 2024, at 1:27 PM, Alexander Matveev <alexander.matv...@oracle.com> > wrote: > > Hi Alan, > > See below. > > From: core-libs-dev <core-libs-dev-r...@openjdk.org > <mailto:core-libs-dev-r...@openjdk.org>> on behalf of Alan Snyder > <javali...@cbfiddle.com <mailto:javali...@cbfiddle.com>> > Date: Sunday, March 3, 2024 at 7:09 PM > To: core-libs-dev@openjdk.org <mailto:core-libs-dev@openjdk.org> > <core-libs-dev@openjdk.org <mailto:core-libs-dev@openjdk.org>> > Subject: jpackage requests permission via a dialog > > I tried using jpackage on macOS to create a DMG (which I have not done > before) and was surprised when a system dialog was displayed requesting > permission for Terminal to control Finder. > > I found this issue described in JDK-8231855, which was closed without > explanation as “not an issue”. > > From JDK-8231855: “Looks like this dialog is part of macOS Catalina Data > Protection features. I did not found if it possible not to trigger this > prompt. Also, this prompt is shown only once and subsequent jpackage runs > will not show any prompts. As workaround in case when jpackage will be part > of automated build system which needs to be run without user intervention it > is recommended to run jpackage first on this system and confirm any prompts.”. > > It seems to me that having a command line build tool try to interact with a > user via a dialog is inappropriate, even if it happens only once per system. > > So far, I did not figure out other solution for this problem. > > I’m not sure why this dialog is shown, as it appears that all of the actions > are performed by running the hdiutil program. > > This dialog is shown when we running osascript > (https://github.com/openjdk/jdk/blob/master/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/DMGsetup.scpt) > to post process DMG file. This script will setup DMG background and > re-arrange icons, so it look nice. > > It does seem odd, however, that jpackage mounts the DMG to modify its > contents. Shouldn’t the contents be set up before creating the DMG? > > We need to mount it to run osascript I mentioned above. > > Is mounting the image the source of the dialog? > > No, dialog is shown after we mount it from osascript which is run right after > DMG is mounted. > > Is there some reason this cannot be fixed? > > So far I did not found any substitution to our osascript to setup background > image and re-arrange icons. I do not think that Apple provides any other ways > to do it. > > Thanks, > > Alexander >