macadmins / installapplications

A tool for dynamically using installapplication
Apache License 2.0
285 stars 62 forks source link

Cleanup removes embedded Python before reboot command is issued #58

Closed lucasjhall closed 4 years ago

lucasjhall commented 4 years ago

context

workaround

further investigation

#!/Library/installapplications/Python.framework/Versions/3.8/bin/python3
...
subprocess.call(['/sbin/shutdown', '-r', 'now'])
...

hypothesis

    cleanup(0)

    if reboot:
        iaslog('Triggering reboot')
        subprocess.call(['/sbin/shutdown', '-r', 'now'])
lucasjhall commented 4 years ago

@erikng

I pulled fixrebootpy3 and deployed.

The process ended in a reboot as expected.

erikng commented 4 years ago

Did everything cleanup?

Was the last log event after the reboot a cleanup entry?

lucasjhall commented 4 years ago

Yes, verified:

Logs appeared as expected:

...
Python[107:1419] [InstallApplications] Starting root script: /Library/installapplications/script.sh
Python[107:1419] [InstallApplications] Running Script: /Library/installapplications/script.sh
Python[107:1419] [InstallApplications] Attempting to remove LaunchDaemon: /Library/LaunchDaemons/com.erikng.installapplications.plist
Python[107:1419] [InstallApplications] Attempting to remove LaunchAgent: /Library/LaunchAgents/com.erikng.installapplications.plist
Python[107:1419] [InstallApplications] Targeting user id for LaunchAgent removal: 0
Python[107:1419] [InstallApplications] Attempting to remove LaunchAgent: com.erikng.installapplications
Python[107:1419] [InstallApplications] Attempting to remove InstallApplications directory: /Library/installapplications
Python[107:1419] [InstallApplications] Attempting to remove LaunchDaemon: com.erikng.installapplications
Python[107:1419] [InstallApplications] Cleanup done. Exiting.
erikng commented 4 years ago

Hm, could have sworn on the branch there should have been a reboot log event prior to the last message.

erikng commented 4 years ago

Addressed with https://github.com/erikng/installapplications/pull/59