[OpenWrt-Devel] Question about custom script at init on Trunk.-

Karl Palsson karlp at tweak.net.au
Wed Jan 27 10:33:53 EST 2016

Hash: SHA1

David Lang <david at lang.hm> wrote:
> On Wed, 27 Jan 2016, Karl Palsson wrote:
> > David Lang <david at lang.hm> wrote:
> >>>
> >>> Now, yes, I can have my 80_mystuff script go and try and create
> >>> the package config files it might want to modify, but really, I
> >>> want "mystuff" to run _last_ or at least, after all the packages
> >>> have run. Is there any better system for this other than just
> >>> naming my script zzzzz_mystuff instead of 80_mystuff? Is that
> >>> expected to be "good enough" ?
> >>>
> >>> I'm trying this, because I've _been_ trying to use packages
> >>> instead of modifying upstream, but when I want my package to do
> >>> different things for different targets, it's seemed easier to
> >>> hook into the existing target code, rather than trying to copy
> >>> target detection and config into a package Config.in options
> >>
> >> typically people use 99stuff and figure that the order of 99s
> >> doesn't really matter much
> >>
> >
> > Well, the thing is, 99 isn't last. that's what I was getting at.
> >
> > $ ls -l build_dir/target-mips_34kc_uClibc-
> > total 140
> badly wrapped.
> > Here's what you really have in a new image. Putting things in
> > "99_stuff" just won't work very well. All the package provided
> > uci-defaults files, which are the ones I want to extend/augment
> > with my own files have to come later. They are run at
> > /etc/rc.d/S10boot,
> S99_whatever will run after S10_whatever. The S## files are run
> at startup, in order and the K## files are run at shutdown in
> reverse order (since shutdown can sometimes require different
> ordering than startup. If something is in there with just ##
> I'm not sure if they are even run.

I think you may have misunderstood. S10_boot runs the files in

The files in _/etc/uci-defaults/_ do not all start with a
numerical prefix, and are provided by any and all package that
has any config it wants to run. So, for a _package_ that wants to
do something "late" to do any sort of special target
configuration, such as changing serial ports or mount points for
an application based on the hardware it's running on, anything
like 99-xxx is not going to reliably be late at all.

Naming your uci-defaults file something like zzzzz999-something
will probably work, but it's pretty gross. If you instead try and
add your own _init_ script, with a START=99, you now don't even
run until the applications whose config you want to adjust have
already attempted startup, at whatever START=xx tag they have in
their own provided init script.

So, /etc/uci-defaults/zzzzz999-something works, but is there a
better way?

Karl P

Version: GnuPG v1.4.11 (GNU/Linux)

-------------- next part --------------
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list