I'm writing an app for jailbroken iOS that includes both a UI application and a launch daemon. I set up the launch daemon as a subproject of the UI application project.
Everything's working perfectly, except that I can't get the package to unload and then reload the launch daemon as a part of the install process, or chown
the launch daemon plist file to root:wheel
.
In mainproject/subproject/layout/DEBIAN/preinst
I have the following code:
#!/bin/sh
chown root:wheel /Library/LaunchDaemons/com.plistname.plist
launchctl unload /Library/LaunchDaemons/com.plistname.plist 2>&1 > /dev/null
and in mainproject/subproject/layout/DEBIAN/postinst
:
#!/bin/sh
chown root /Library/LaunchDaemons/com.plistname.plist
launchctl load /Library/LaunchDaemons/com.plistname.plist
If I uninstall the package and reinstall it, the plist is created, but it's owned by 502:staff
, and I'm not seeing the messages I see in syslog
if I manually run launchctl unload
and launchctl load
.
Any idea what could be wrong?