Improvements to disk image creation #190
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current build system sets up the default window parameters by running Finder via AppleScript. Aside from the annoying (and initially puzzling) flashes during the build, this has a number of disadvantages:
It means that the otherwise purely command-line-oriented build procedure may not work over an SSH connection. I say may not work because AppleScript is perfectly willing to go outside the process tree to find an instance of Finder running under the current user ID, which seems like rather inappropriate default behavior, but that's another story.
It appears to incorporate uninitialized memory into the resulting .DS_Store file, leaking some information about the build machine in the process. This also makes the contents of the file nonreproducible.
Since that mechanism is designed primarily for use with interactive users, it doesn't have a well-defined way to be certain that the state is correct on disk (as evidenced by the delays that have been added to that code in the master branch).
Since all the settings are contained in the .DS_Store file, and since the window parameters are rarely changed, a way to mostly avoid the need to run Finder in the build is to capture a copy of a .DS_Store file with the proper setup, and then simply copy it into the disk image in normal builds. This also means that issue # 2 can be ameliorated by using a "near virgin" Finder to create the file.
This approach doesn't eliminate the uncertainty as to when the .DS_Store file can be trusted to be up to date. Currently, it adds a 5-second delay to the end of the Finder commands, and then waits until after the syncs to grab the copy. A slightly safer approach might be to remount the final image and grab it from there, but that would be more complicated. Fortunately, once a copy has been determined to be OK, all subsequent builds using it will be OK as well, which is a good deal more deterministic than the present approach.
This pull request includes three commits (which I've tested here):
Adding code to implement the above. Note that most of the diff is just an indentation change. It includes setting up the binary attribute for the xDS_Store file, but not the file itself.
Adding code to remove the superfluous .Trashes directory.
Adding an xDS_Store file based on the current settings (and created in a "sanitized" environment).