Domanda

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?

È stato utile?

Soluzione

It turns out my problem was that the preinst and postinst scripts in the subproject weren't being run. I don't know if this is how debian packages are supposed to run or if it's just a bug in the way theos deals with subprojects, but I was able to resolve it by simply moving those commands to the preinst and postinst scripts for the main project.

It's not ideal since, logically, they belong with the subproject, but it works.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top