mirror of
https://github.com/munki/munki.git
synced 2026-02-22 06:59:09 -06:00
Tweaks around restart handling after a successful startosinstall run
This commit is contained in:
@@ -251,15 +251,28 @@ def doInstallTasks(do_apple_updates, only_unattended=False):
|
||||
# install macOS
|
||||
try:
|
||||
success = osinstaller.run(finishing_tasks=doFinishingTasks)
|
||||
except:
|
||||
except SystemExit:
|
||||
# we _expect_ this since startosinstall or osinstaller will
|
||||
# initiate a restart after successfully setting up a macOS
|
||||
# install.
|
||||
pass
|
||||
except Exception:
|
||||
# some other non-system-exiting exception occurred
|
||||
display.display_error(
|
||||
'Unexpected error in munkilib.osinstaller:')
|
||||
munkilog.log(traceback.format_exc())
|
||||
reports.savereport()
|
||||
raise
|
||||
if success:
|
||||
# startosinstall will be restarting; get out of the way
|
||||
sys.exit()
|
||||
# we really should not get here. If successful, either
|
||||
# startosinstall or osinstaller.run should have initiated a
|
||||
# restart.
|
||||
# Print a warning, and restart anyway.
|
||||
display.display_warning(
|
||||
'Restart not initiated by startosinstall; will initiate '
|
||||
'restart ourselves')
|
||||
if not authrestartd.restart():
|
||||
authrestart.do_authorized_or_normal_restart()
|
||||
|
||||
if do_apple_updates:
|
||||
# install Apple updates
|
||||
|
||||
@@ -359,8 +359,10 @@ class StartOSInstallRunner(object):
|
||||
# startosinstall exited
|
||||
munkistatus.percent(100)
|
||||
retcode = job.returncode()
|
||||
if self.dmg_mountpoint:
|
||||
dmgutils.unmountdmg(self.dmg_mountpoint)
|
||||
# previously we unmounted the disk image, but since we're going to
|
||||
# restart very very soon, don't bother
|
||||
#if self.dmg_mountpoint:
|
||||
# dmgutils.unmountdmg(self.dmg_mountpoint)
|
||||
|
||||
if retcode and not (retcode == 255 and self.got_sigusr1):
|
||||
# append stderr to our startosinstall_output
|
||||
|
||||
Reference in New Issue
Block a user