poring over the code related to services and noticed this in
/etc/rc.common:
enable() {
name="$(basename "${initscript}")"
disable
[ -n "$START" -o -n "$STOP" ] || {
echo "/etc/init.d/$name does not have a START or STOP value"
return 1
}
[ "$START" ] && ln -s "../init.d/$name"
"$IPKG_INSTROOT/etc/rc.d/S${START}${name##S[0-9][0-9]}"
[ "$STOP" ] && ln -s "../init.d/$name"
"$IPKG_INSTROOT/etc/rc.d/K${STOP}${name##K[0-9][0-9]}"
}
enabled() {
name="$(basename "${initscript}")"
[ -x "$IPKG_INSTROOT/etc/rc.d/S${START}${name##S[0-9][0-9]}" ]
}
in the three lengthy lines above, what is the purpose of the
"##S[0-9][0-9]" and "##K[0-9][0-9]" after the reference to "name"?
given that (as i read it), the "name" variable is set to the basename
of the initscript out of /etc/init.d, *those* filenames don't have the
K?? or S?? prefixes that exist in /etc/rc.d, so it seems that, while
not a problem, using "##" to remove the longest matching prefix in all
of those cases is superfluous. that is, the variable ${name} would
always have the value, say, "dropbear", and never "S50dropbear" or
"K50dropbear".
am i missing something? as i said, it won't hurt anything, it's just
confusing for anyone trying to read the code. you know ... like me.
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