OpenWrt Forum Archive

Topic: How to prevent creating /etc/rc.d/ symlinks

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.

Hi,
I created new package, in Makefile I copy initscript to /etc/init.d/. After installing firmware, I see that my program has started, because there is symlink in /etc/rc.d/.
How can I prevent that behaviour?

remove the line

START=XX

from your init script

or run

/etc/init.d/myinitscript disable

on the router

What is the correct way to include a package in the compiled firmware, but still leave it disabled (without rc.d symlink to the initscript), but still having a planned place (START=XX) in the startup order set in the init file?

I would like include a package in the compiled firmware, but leave it disabled until the user enables it from Luci (or from console).

Is there any easy way to do that?

If I remove the START=XX line from that package's init file in the source code, then it shows a priority 0 in Luci. And enabling it then does not place it to any sensible place in the initscript priority queue and in practice requires editing the init file by hand.

Thanks to this message ( https://forum.openwrt.org/viewtopic.php … 68#p118668 ) I think that the symlinks in /etc/rc.d/ are generated in the 'package/Makefile'. It seems to go through all the initscripts and then generate rc.d files for them.

From Backfire: https://dev.openwrt.org/browser/branche … e/Makefile

77            @mkdir -p $(TARGET_DIR)/etc/rc.d
78            @( \
79                    cd $(TARGET_DIR); \
80                    for script in ./etc/init.d/*; do \
81                            grep '#!/bin/sh /etc/rc.common' $$script >/dev/null || continue; \
82                            IPKG_INSTROOT=$(TARGET_DIR) $$(which bash) ./etc/rc.common $$script enable; \
83                    done || true \
84            )

I think that it could be possible to add there a 'grep' line like the rc.common line, and have the Makefile to skip the 'enable' for that initscript. Is that the correct way?

Or is there an easier way?

(Last edited by hnyman on 28 Jan 2011, 09:26)

I think I finally figured it out:
The module can place a script to /etc/uci-defaults, which script is then run on the first boot after the flash. That script can disable the module (although it has been enabeld in the firmware).

Miniupnpd is disabled that way, although the "disabled" status is not caused by miniupnpd itself, but by luci-upnp.
http://luci.subsignal.org/trac/browser/ … /luci-upnp

The discussion might have continued from here.