Two problems with coreconfig-softwareupdate-run.py
grahampugh opened this issue · 4 comments
Hi, I've come across two problems with coreconfig-softwareupdate-run.py
:
- On a 10.13.6 machine, the script appears to continue when the user presses "Restart Now", and logs the user out, but nothing else happens:
Downloading updates
OK to defer until 2018-11-10 10:27:08
User permitted immediate update
Setting up the updates index file
Setting up 041-18191 to install at logout
Setting up 041-01598 to install at logout
Setting updates to run on logout
/Library/Updates/index.plist
does appear to have been updated, but no software updates run at logout or on subsequent manual logouts. It seems like it's missing some trigger to kick off the updates. I note that neither /var/db/.AppleLaunchSoftwareUpdate
nor /var/db/.SoftwareUpdateOptions
have been written (or, at least, they don't exist after a reboot), so that might be something to do with it.
- On a 10.14.1 machine, the script crashes when the user presses "Restart Now". It looks like
/Library/Updates
is now SIP-protected in Mojave, so theindex.plist
file cannot be updated.
I think I've made some progress with these.
With problem 1 (10.13.6) - after two subsequent restarts, the updates finally kicked in. I think it would be good to have some mechanism in place that ensures the updates are downloaded before even bringing up the popup.
With Problem 2 (10.14.1), I was able to tweak the script and make it work. I'll do some further testing and perhaps do a PR, but in short:
- Removed the
prep_index_for_logout_install
definition, and the references to it. - Amended the
friendly_logout
definition to call softwareupdate at this point:
def friendly_logout():
user = console_user()
subprocess.call([ 'sudo', '-u', user, 'osascript', '-e', u'tell application "loginwindow" to «event aevtrlgo»' ])
cmd_with_timeout([ SWUPDATE, '-i', '-r', '-R' ], 3600)
I'm not sure all this is required, but it did work (again, after two restarts).
Thanks for this! I never did get this to work properly on 10.13 and haven't even looked at it on 10.14.
Your fix (which looks like it's effectively dispensing with trying to use apple's mechanism for auto-applying the updates on logout) is probably reasonable, though it was much nicer when it worked properly under 10.12.
We're in the process of looking at 10.14 support just now so I'll hopefully be able to revisit this script shortly.
We have moved away from this to a simpler shell script software-update-2019
Thanks for the info, I seem to be having more success with the latest version of coreconfig-softwareupdate-run.py
in combination with a change in scope based on an EA that shows the deferral time. I'll probably stick with it for now - I prefer it to the replacement bash script to be honest.