kc9wwh / macOSUpgrade

Workflow for doing in-place upgrades.
Other
418 stars 102 forks source link

LaunchDaemon not valid #10

Closed mm2270 closed 7 years ago

mm2270 commented 7 years ago

Hi there. Someone pointed me to this script to look at because they are using it and finding that the LaunchDaemon isn't working. It doesn't load and run the script to cleanup after the OS upgrade.

I took a look at it and found that the method being used to create the plist is creating an invalid plist because none of the double quotes within it are being retained.

My suggestion for fixing this are to change the section where it creates the LaunchDaemon to the following:

cat << EOF > /Library/LaunchDaemons/com.jamfps.cleanupOSInstall.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.jamfps.cleanupOSInstall</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/jamfps/finishOSInstall.sh</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>
EOF

The HEREDOC method above retains the quotes and doesn't require using any backslashes to escape them in the plist.

cpwasthere commented 7 years ago

@mm2270 I can confirm your changes ensure a correct creation of the plist and then deletion of the macOS installer after the reboot into sierra. Thanks.

kc9wwh commented 7 years ago

Thanks @mm2270! I haven't had much time to look at this, so really appreciate this!

I'll run it through and test everything next week and get it updated.

kc9wwh commented 7 years ago

Fixed in v1.7

Thank you @mm2270!