Currently I have a user level app written in Java with an installer that only supports "Install for me only" option. Now I want to add a system daemon that runs as root and would like to be installed as part of the same package. Is this a bad idea or are there better ways to support this?
One way I was thinking of achieving this was to copy the plist file for the system daemon to /Library/LaunchDaemons and then load and start the daemon as part of the post-install script.
However, since I want to run the daemon as root, that would mean using sudo to copy and running the launchctl commands. Is there a way to ask for admin privileges as part of the post install script? If the user does not have admin privileges, report it and not run the daemon. The user level app would still run but with lesser functionality.
One way I was thinking of achieving this was to copy the plist file for the system daemon to /Library/LaunchDaemons and then load and start the daemon as part of the post-install script.
However, since I want to run the daemon as root, that would mean using sudo to copy and running the launchctl commands. Is there a way to ask for admin privileges as part of the post install script? If the user does not have admin privileges, report it and not run the daemon. The user level app would still run but with lesser functionality.