more pedantry and curiosity ... poring over the usage of procd and
it seems like the online docs are somewhat incomplete, so a few notes
and questions, if i might.
i'm using the dropbear package as the basis for figuring out how
procd is properly used, and the first thing that was unclear was the
proper use of "uci_validate_section", as in:
validate_section_dropbear()
{
uci_validate_section dropbear dropbear "${1}" \
'PasswordAuth:bool:1' \
'enable:bool:1' \
'Interface:string' \
'GatewayPorts:bool:0' \
'RootPasswordAuth:bool:1' \
'RootLogin:bool:1' \
'rsakeyfile:file' \
'dsskeyfile:file' \
'BannerFile:file' \
'Port:list(port):22' \
'SSHKeepAlive:uinteger:300' \
'IdleTimeout:uinteger:0' \
'mdns:uinteger:1'
}
there seems to be little documentation on the usage of the
uci_validate_section() routine, other than looking in procd.sh, but
just looking at an example or two seems to give one the basic usage,
except for a couple things.
first, it wasn't clear to me what the optional third "default" value
was used for in the above lines -- after all, if this routine was used
strictly to "validate", what did that have to do with default values?
until i read further into /etc/init.d/dropbear and noticed that, once
you validate a section, you then have access to local variables by
those names. aha! that didn't seem to be noted anywhere, and it's kind
of important. (i apologize if that feature was painfully obvious to
long-time users, but it's not obvious to someone who never knew it
existed.)
next omission(?) is the list of possible validation types. types
like "string" and "bool" are fairly obvious, but if i peek into
/etc/init.d/network, i see validation types like "cidr4" and "ip6addr"
and "netmask4" and so on. is there a complete list of these types? is
there some kind of "help" option to /sbin/validate_data that would
list them? that would be kind of helpful. searching the openwrt wiki
for the strings "validate_data" or "uci_validate_section" doesn't seem
to find anything terribly useful -- a search for the string "cidr4"
produces no hits whatever.
moving on, the primary openwrt wiki page on procd:
http://wiki.openwrt.org/inbox/procd-init-scripts
also seems incomplete. as i perused /etc/init.d/dropbear, i noticed
the useful procd-related lines using "procd_append_param", which i can
only assume allows me to construct the service invocation line option
by option:
procd_open_instance
procd_set_param command "$PROG" -F -P "$pid_file"
[ "${PasswordAuth}" -eq 0 ] && procd_append_param command -s
[ "${GatewayPorts}" -eq 1 ] && procd_append_param command -a
[ "${RootPasswordAuth}" -eq 0 ] && procd_append_param command -g
... snip ...
but that utility (and other procd-related utilities) don't seem to be
documented anywhere. a wiki search for that name brings up nothing,
and there's a reference on that wiki page to look at the top of the
procd.sh script for "as much information as is available", but even
the script doesn't mention a number of those utilities in the comments
at the top -- there's no mention of, say:
* procd_append_param
* procd_add_raw_trigger
* procd_set_config_changed
and so on.
anyway, just some late-night random thoughts ... more specific
questions coming shortly.
rday
--
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================
_______________________________________________
openwrt-users mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-users