OpenWrt Forum Archive

Topic: How do I enable/disable a daemon at build time (so it ends up in ROM)?

The content of this topic has been archived on 28 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

How do I enable/disable a daemon at build time (so it ends up in ROM)?

I.e., I want to disable p910nd by default at boot, since I have a hotplug script that starts it when I switch on my usb-connected printer. However, after updating to a new openwrt build, p910nd is enabled by default. I first need to do:

/etc/init.d/p910nd stop
/etc/init.d/p910nd disable

How do I compile/build that into the image? I can't figure out if there are any modifications needed to the Makefile. I also looked at http://wiki.openwrt.org/doc/devel/packages but it did not help me much.

(Last edited by avbohemen on 13 Jun 2012, 13:52)

I asked that about a year ago, and did not get a good answer. If I remember correctly, there is no standard way to included a daemon package in "disabled" status in the build. If the package is there and gets installed and has a startup script, it gets started.
https://forum.openwrt.org/viewtopic.php … 68#p126668

You might edit the startup script not to actually start it, or something like that.

You might also try to utilise the scripts in that wiki article you linked: http://wiki.openwrt.org/doc/devel/packa … .a.service
Although I am not sure if we are able to place those commands at the startup path somehow.

(Last edited by hnyman on 13 Jun 2012, 14:40)

Trunk still has the same piece of code for creating the symlinks in /etc/rc.d: https://dev.openwrt.org/browser/trunk/package/Makefile

One thing I don't get, is how it works for miniupnpd: this is the only package I know of that is NOT enabled at build time. And I don't see anything special in the package's Makefile (https://dev.openwrt.org/browser/package … d/Makefile) either.

Or is it this part in the init script?

boot() {
        return
}

It seems to be a function that is never called...

The boot() procedure is called on boot. By default it simply calls start, if you override it with a no-op, the init script will run on boot but do nothing.

I see... I just checked, and indeed /rom/etc/rc.d/S95miniupnpd does exist, is called, but does nothing because of boot() is overridden in the init-script. Right?

So if I add the same empty boot() in the init script for p910nd, it will prevent the autostart?

However, IIRC, in LuCI, miniupnpd is shown as 'disabled', even though the symlinks in /etc/rc.d are there? I'm getting more and more confused...

(Last edited by avbohemen on 13 Jun 2012, 16:27)

avbohemen wrote:

One thing I don't get, is how it works for miniupnpd: this is the only package I know of that is NOT enabled at build time. And I don't see anything special in the package's Makefile (https://dev.openwrt.org/browser/package … d/Makefile) either.

avbohemen wrote:

However, IIRC, in LuCI, miniupnpd is shown as 'disabled', even though the symlinks in /etc/rc.d are there? I'm getting more and more confused...

I think I finally figured it out:
The "disabled" status is not caused by miniupnpd itself, but by luci-upnp...
Luci-upnp places a script to /etc/uci-defaults, which script is then run on the first boot after the flash. That script disables miniupnpd.
http://luci.subsignal.org/trac/browser/ … /luci-upnp

Aha! And right after the first boot after flash, /etc/uci-defaults is cleared... Interesting to see what is in /rom/etc/uci-defaults. Now I can also enable minidlna, the same thing happens there: http://luci.subsignal.org/trac/browser/ … i-minidlna

I will test this as soon as I get past this: https://dev.openwrt.org/ticket/12813. It seems arokh has solved it though, he has it in his latest build (http://enduser.subsignal.org/~trondah/d … /packages/) but I have not heard from him how he managed to do it.

The discussion might have continued from here.