aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files/lib/functions/migrations.sh
Commit message (Collapse)AuthorAgeFilesLines
* treewide: drop shebang from non-executable lib filesAdrian Schmutzler2021-01-291-2/+0
| | | | | | | | | | | | This drops the shebang from another bunch of files in various /lib folders, as these are sourced and the shebang is useless. Fix execute bit in one case, too. This should cover almost all trivial cases now, i.e. where /lib is actually used for library files. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* base-files: allow exceptions when removing devicename from LEDsAdrian Schmutzler2020-10-021-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Without the model-based devicename for LEDs, there are still cases where a third component is required, typically when it refers to internal "devices" like phys etc. An example are the following two found on ramips: - rt2800soc-phy0::radio - rt2800pci-phy0::radio So far, the rt2800*-phy: prefixes would be removed by the devicename removal ("migration") script, and the configuration for these LEDs would be broken. To address this, this patch allows to add arguments to a call of remove_devicename_leds, which will be compared against the first part of the LED names/labels, and then be ignored by the routine, and thus not removed: remove_devicename_leds "rt2800soc-phy0" "rt2800pci-phy0" This mechanism is supposed to be used when a "devicename" applies to several devices. If only a single device is affected, it might be more effective to use a case statement and exclude the device from migration by that entirely. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* base-files: add function to remove devicename from LED labelsAdrian Schmutzler2020-10-021-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* base-files: add leds migrationTomasz Maciej Nowak2019-04-061-0/+39
Currently leds migration scripts in ar71xx and lantiq share a lot of logic and introducing leds migration to another target would mean copying this code, again. Therefore add common logic to library in base-files package. Suggested-by: Petr Štetiar <ynezz@true.cz> Signed-off-by: Petr Štetiar <ynezz@true.cz> Signed-off-by: Tomasz Maciej Nowak <tomek_n@o2.pl>