A while back, I built an Automator application named First Boot Package Install Generator.app. It’s designed to generate installer packages, where the generated packages in turn serve as a delivery mechanism to enable other installer packages to be installed when a Mac boots up.
As part of the process of installing the other installer packages, an application named LoginLog is supposed to open over the login window and display a log of what actions are taking place, what is being installed and whether that particular installation succeeded or not.
For the most part, this process of launching LoginLog and displaying the log works as designed but it was brought to my attention that there was one scenario where LoginLog did not appear as expected. When a firstboot package created by First Boot Package Install Generator.app was installed onto a new installation of OS X El Capitan, LoginLog did not appear over the Setup Assistant.
The reason it didn’t appear is because the LaunchAgent for LoginLog is triggered by the Mac being at the login window.
However, Apple’s Setup Assistant on El Capitan no longer runs over in the context of the login window. Instead, it runs in the context of an account named Setup User.
In order to have LoginLog appear again in this scenario, I needed to develop a method which could accomplish two tasks:
- Suppress Apple’s Setup Assistant during the time when I wanted the LoginLog application to appear.
- Avoid interfering with an otherwise desired launch of the Apple Setup Assistant.
For more details, see below the jump.
To accomplish both tasks, I added functionality to the firstboot script to check to see if the /var/db/.AppleSetupDone file is present on the boot drive when the Mac starts up. The reason this check has been added is that when the /var/db/.AppleSetupDone file is present at startup time, Apple’s Setup Assistant is prevented from running. Based on the results of the check, the following actions are performed:
- If the /var/db/.AppleSetupDone file is already present, nothing needs to be done and the script proceeds.
- If the /var/db/.AppleSetupDone file is not present, the script will add add the /var/db/.AppleSetupDone file and an additional /var/db/.firstboot.delete.AppleSetupDone file:
Once both the /var/db/.AppleSetupDone and /var/db/.firstboot.delete.AppleSetupDone files have been added, the Mac will reboot so that the presence of the /var/db/.AppleSetupDone file can be detected by the OS:
In turn, the functionality to add both the /var/db/.AppleSetupDone and /var/db/.firstboot.delete.AppleSetupDone files is triggered only when the script detects the presence of the directory which stores the installer packages which are being installed at startup.
The reason that the /var/db/.firstboot.delete.AppleSetupDone file is added is to provide verification that the firstboot script added the /var/db/.AppleSetupDone file to suppress the Apple Setup Assistant, which in turn allows the LoginLog application to launch and display the log over the login window.
If both the /var/db/.firstboot.delete.AppleSetupDone and /var/db/.AppleSetupDone files are present, both files are later removed by the script to avoid interfering with an otherwise desired launch of the Apple Setup Assistant. If only the /var/db/.AppleSetupDone file is present, no action is taken to delete it:
To help Mac admins verify that the status of the /var/db/.AppleSetupDone file is what they expect, an Apple Setup Assistant status check has also been added to the log displayed by LoginLog.
If the /var/db/.AppleSetupDone file is not present after all the packages have been installed, a message is displayed that the Apple Setup Assistant will appear at the next reboot.
If the /var/db/.AppleSetupDone file is present after all the packages have been installed, a message is displayed that the Apple Setup Assistant is set to be skipped and will not appear after the next reboot.
For more information, please see the release notes for First Boot Package Install Generator 1.5:
https://github.com/rtrouton/First_Boot_Package_Install_Generator/releases/tag/1.5
For the latest version of First Boot Package Install Generator.app, please see the link below:
https://github.com/rtrouton/First_Boot_Package_Install_Generator/releases/latest
For those who want to build a customized First Boot Package Install Generator.app for their own use, the components and scripts are available on my Github repo.