net-p2p/deluge uses a single rc script to start the daemon. There is an option in conf.d/deluge to start a UI as well. The "default" is the web-ui, but can be set to console or gtk. But why would you ever start anything but the webui (really a daemon) at startup? While this doesn't really cause any problems in normal operation, it should be separated to be more correct. They can be run as separate users, with different config folders, and started and stoped completely independently. This also lets rc think that deluged started just fine as long as the webui was started since it's exit status overrides the daemon's. So for now, I'm attaching a first attempt at splitting these two. All I did was move the ui starting code to it's own rc script, made it explicitly call deluge-web, and fix the appropriate variables. Unfortunately, I can't say this works %100 as my deluge wasn't starting properly before this and this was my first attempt to make it's init script work better to help find the problem. There is still plenty of room to improve these scripts which I plan to do soon, for instance: - Make webserver rc-script installed with use flag - Make deluge write it's own pid file (permission issue since deluge user can't write to /var/run/deluged.pid) - Let deluge fork it's self Some will require a small patch to deluge... - Make deluge chuid on it's own - Make deluge use config from /etc (and state files in /var maybe?)
Created attachment 258495 [details, diff] Initial split of daemons in patch form
I've written a simple patch (that I also will submit upstream) to let deluged and deluge-web switch uid (and gid) on their own. This lets them write a pidfile as root and then switch to a lower privilege. (which I think is the standard?) I've also updated the init.d files to: - use this patch - let the daemons fork themselves - use symlink to run a second instance - use explicit variables for (without disabling old style I hope) - group - config dir It all seems to work for me!
Created attachment 258969 [details, diff] Patch for current ebuild to use deluge patches and multiple init.d files
Created attachment 258971 [details, diff] Adding support to deluged to switch uid on it's own
Created attachment 258973 [details, diff] Adding support to deluge-web to switch uid on it's own
Created attachment 258975 [details] New init.d file for deluged
Created attachment 258976 [details] New init.d file for deluge-web
Created attachment 258978 [details] New conf.d file for deluged
Created attachment 258979 [details] New conf.d file for deluge-web
Created attachment 259879 [details, diff] Fixed group support for deluged I accidentally used setuid for both user and group (instead of setgid) I've also put the setgid before setuid so we are still root when we try to change groups
Created attachment 259880 [details, diff] Fixed group support for deluge-web The same fix for deluge-web
Fixed in deluge-1.3.12-r2