@@ -533,18 +533,30 @@ command toolsBuilderMakeAppBundle pVersion, pEdition, pPlatform
533533
534534 -- Copy a shell script and AppleScript into the app bundle to catch attempts
535535 -- from old auto-updaters to launch the installer
536+ local tEngineFolder
537+ builderFetchEngine empty , "macosx"
538+ put the result into tEngineFolder
536539 builderLog "message" , "Adding installer shim to app bundle"
537- get shell ("install -m755" && escapeArg(builderCommunityResourceFolder() & "/dmg/fake- installer.sh " ) && escapeArg(tAppBundle & "/Contents/MacOS/installer" ))
540+ get shell ("install -m755" && escapeArg(tEngineFolder & "/installer-stub " ) && escapeArg(tAppBundle & "/Contents/MacOS/installer" ))
538541 if the result is not zero then
539542 builderLog "error" , "Failed to copy installer stub shell script:" && it
540543 throw "failure"
541544 end if
542- get shell ("osacompile" && "-o" && escapeArg(tAppBundle & "/Contents/MacOS/installer.scpt" ) && escapeArg(builderCommunityResourceFolder() & "/dmg/open-dmg.applescript" ))
545+ get shell ("mkdir -p" && escapeArg(tAppBundle & "/Contents/Resources/Installer" ))
546+ if the result is not zero then
547+ builderLog "error" , "Failed to create installer resources directory:" && it
548+ throw "failure"
549+ end if
550+ get shell ("osacompile" && "-o" && escapeArg(tAppBundle & "/Contents/Resources/Installer/ShowDmgWindow.scpt" ) && escapeArg(builderCommunityResourceFolder() & "/dmg/open-dmg.applescript" ))
543551 if the result is not zero then
544552 builderLog "error" , "Failed to compile installer stub AppleScript:" && it
545553 throw "failure"
546554 end if
547555
556+ -- Remove a problematic (but un-neccessary) file from the CEF framework bundle
557+ -- Doing it here is ugly, but is temporary (only needed in 6.7 and 7.1).
558+ get shell ("rm -f" && escapeArg(tAppBundle & "/Contents/Frameworks/Chromium Embedded Framework.framework/Manifest" ))
559+
548560 -- Find the signing identity and sign the app bundle
549561 get findSigningIdentity()
550562 if it is not empty then
@@ -622,8 +634,31 @@ command toolsBuilderMakeDisk pVersion, pEdition, pPlatform
622634 get shell ("hdiutil detach" && escapeArg(tVolumeName ))
623635
624636 -- Generate an initial read-write DMG and mount it
637+ -- This needs to be run with root privileges to get the ownership correct
638+ -- If the $GENERATE_DMG_SCRIPT env var is set, the script identified by
639+ -- that path will be used instead of the one stored in the repo
625640 builderLog "message" , "Generating initial DMG"
626- get shell ("hdiutil create -fs HFS+ -format UDRW -attach -volname" && escapeArg(tVolumeName ) && "-srcfolder" && escapeArg(tDmgFolder ) && escapeArg(tTempDmg ))
641+ local tGenerateScript
642+ if $GENERATE_DMG_SCRIPT is not empty then
643+ -- Check that the generate script is identical to the in-repo copy
644+ -- so it is kept up-to-date
645+ local tLocalScript
646+ local tRepoScript
647+ get shell ("which" && escapeArg($GENERATE_DMG_SCRIPT))
648+ put url("file:" & line 1 of it ) into tLocalScript
649+ put url("file:" & builderSystemFolder() & "/generate-dmg.sh" ) into tRepoScript
650+ if tLocalScript is not tRepoScript then
651+ builderLog "error" , "Local DMG generation script differs from the repo copy (please update)"
652+ throw "failure"
653+ end if
654+
655+ put $GENERATE_DMG_SCRIPT into tGenerateScript
656+ else if $GENERATE_DMG_SUDO is not empty and $GENERATE_DMG_SUDO is not 0 then
657+ put "sudo -n" && escapeArg(builderSystemFolder() & "/generate-dmg.sh" ) into tGenerateScript
658+ else
659+ put escapeArg(builderSystemFolder() & "/generate-dmg.sh" ) into tGenerateScript
660+ end if
661+ get shell (tGenerateScript && escapeArg(tVolumeName ) && escapeArg(tDmgFolder ) && escapeArg(tTempDmg ))
627662 if "created:" is not in it then
628663 builderLog "error" , "Failed to create initial DMG:" && it
629664 throw "failure"
0 commit comments