openwrt/package/base-files/files/lib
Adrian Schmutzler 365a639f91 base-files: add function to remove devicename from LED labels
Currently, we request LED labels in OpenWrt to follow the scheme

  modelname:color:function

However, specifying the modelname at the beginning is actually
entirely useless for the devices we support in OpenWrt. In patches
subsequent to this one, we will thus remove the modelname from
the label definitions on various targets.

To migrate the existing definitions from older installations,
a migration script needs to be deployed that does

  modelname:color:function -> color:function

e.g.

  dir-789:green:status -> green:status

This patch introduces two functions that do exactly that:
For each entry in /etc/config/system, the routine will check whether
two (or more) colons are present, and then remove everything up to
(and including) the first colon.

For now, this will be applied unconditionally, i.e. if the function
is called for a device, all labels will be cut like this.

However, for a future case of mixed three-part and two-part labels,
it should not be too hard to provide a function argument with
exceptions to the removal.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-10-02 13:50:50 +02:00
..
functions base-files: add function to remove devicename from LED labels 2020-10-02 13:50:50 +02:00
preinit base-files: replace backticks by $(...) 2020-07-11 12:52:01 +02:00
upgrade treewide: replace which with command -v 2020-08-12 11:08:05 +02:00
functions.sh base-files: functions.sh: fix config_get() on invalid identifiers 2020-08-07 11:05:16 +02:00