[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


-----BEGIN PGP SIGNED MESSAGE-----
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-0.9.33.2/root-ar71xx/etc/uci-defaults/
> > 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
/etc/uci-defaults/*

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?

Cheers,
Karl P

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBAgAGBQJWqONhAAoJEBmotQ/U1cr2E7QP/jQz2mZp75xiZDEx8tnSwuku
XcYObMug6vtUAO+RAnzAkhLCp+A+37dwxMhvRgCrTMwTncpELncuwoFIJZ7fd5yQ
+vHV1e0S0WUgNNEjKOy8iCPnXugatI82F7prUZNNb6LjnwlnD2MQdEUF3prFm0eZ
WdQDuE+oShtN/L2V/RcGqF+wnl1c8/PQX+XJ558+1TqBRAjIckkgv+T6E/ysiZ0O
3TfFSpYRftXZ/EQnxeO8J5vCkJb3q7kZ84fZVf9Awr5MuD5zjKnJTIuXpBBcne59
3HM2BCGtlCwn0AWrvg/8lTRSyYN2biubygrsj/w901cEKd+i3Hb9E/VwIY38pEyE
3jXywYvWkKk+rgAw5A7cZk8hYj5Tc3b8E235H1h5tOUJzk/XdDK9lisuTuKK+aib
MS6qx8U5gx1cJ2yrUQL9BFv5FWKAh63W/aPweqK18QhQjCcTWMreDRodlasS8TT+
jLptAl10BITtjztRXrlRjaq+BHEu8dU1/jTN97puBApuIiuHpcbjY9e8LoixvGG0
S1w4oT10NkccYyEcXGdHN+u+k0NOKp74sRaLx/vTjvygI2e/BMW2nha5xzhQQEzt
oJDrQLh4pOV31IQTa2AzbTKVF9pk40ii7+zZOLLQ8pqJnsi7gTa+MDykdgiuXbHG
sEF7mAr2OFE9QF9Ih9uk
=HZHN
-----END PGP SIGNATURE-----
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list