aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files/lib
Commit message (Collapse)AuthorAgeFilesLines
* base-files: flush kernel memory cache during sysupgradeHannu Nyman2020-12-222-0/+2
| | | | | | | | | | | Flush kernel memory caches during sysupgrade in order to mitigate the impact from memory consumption spikes in low-RAM devices. This may help to prevent sysupgrade causing a reboot before the actual flashing starts. Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
* package/base-files: caldata: use dd iflag fullblockJohn Thomson2020-12-111-12/+25
| | | | | | | | | | | | | | | | This dd flag ensures that the requested size is retrieved from pipes or special filesystems (if available). Without this flag, on multi-core systems, Piped or special filesystem data can be truncated when a size greater than PIPE_BUF is requested. Fixes: FS#3494 Fixes: 7557e7f ("package/base-files: caldata: work around dd's limitation") Cc: Thibaut VARÈNE <hacks@slashdirt.org> Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
* base-files: allow setting device and bridge macsJohn Crispin2020-12-021-1/+17
| | | | | | | | | Add code for setting mac addresses inside board.json and rendering them out to uci. On switches we want to have a unique MAC on each port. With 48 port switches that would require 48 device sections in /etc/config/network. Doing so via board.json is easier. Signed-off-by: John Crispin <john@phrozen.org>
* base-files: merge /etc/passwd on rw-rootfsImran Khan2020-11-271-3/+5
| | | | | | | | | Support installations without root-overlayfs (and hence without /rom) when migrating user accounts. Signed-off-by: Imran Khan <gururug@gmail.com> Signed-off-by: Daniel Golle <daniel@makrotopia.org> [simplified patch, bumped PKG_RELEASE, cleaned message]
* base-files: functions.sh: replace [^...] with [!...] in caseRosen Penev2020-11-251-1/+1
| | | | | | | | | | | | | | | | Strictly speaking, ash does not support it. From https://wiki.ubuntu.com/DashAsBinSh#A.5B.5E.5D Not to be confused by sed's and other program's regular expression syntax. Uses of [^...] in case (parameter/word expansion in general) need to be replaced with [!...]. Found with shellcheck: https://github.com/koalaman/shellcheck/wiki/SC2169 Signed-off-by: Rosen Penev <rosenp@gmail.com> [minor commit title/message adjustments] Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* base-files: upgrade: stage2: use v for log linesYousong Zhou2020-11-111-7/+7
| | | | Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
* base-files: upgrade: fwtool.sh: rewording logsYousong Zhou2020-11-111-2/+2
| | | | | | | | | | The intent is to make it sound more like info level message, not some error like "404 not found". x86 target at the moment makes image with only signature but no metadata (ref commit f8141216 "x86: append metadata to combined images"). Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com> Reviewed-By: Philip Prindeville <philipp@redfish-solutions.com>
* base-files: upgrade: fwtool.sh: use v for log linesYousong Zhou2020-11-111-13/+13
| | | | | | | | | This will have at least the following effects - Log lines will have common prefix - They will be output to stderr instead of stdout Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
* base-files: upgrade: add get_image_dd()Yousong Zhou2020-11-111-0/+11
| | | | | | | | | | This is mainly to handle stderr message "Broken pipe", "F+P records in/out" by common pattern "xcat | dd .." Ref: https://bugs.openwrt.org/index.php?do=details&task_id=3140 Reported-by: Philip Prindeville <philipp@redfish-solutions.com> Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com> Reviewed-By: Philip Prindeville <philipp@redfish-solutions.com>
* base-files: upgrade: use stdin redirection to replace cat commandYousong Zhou2020-11-111-1/+1
| | | | Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
* base-files: upgrade: add vn and variantsYousong Zhou2020-11-111-1/+13
| | | | | | | | | | | | To be used with in the following pattern vn "Remaining: " for p in $xx; do _vn "$p" done _v Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
* base-files: upgrade: log with date prefixYousong Zhou2020-11-112-2/+2
| | | | | | And log to stderr Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
* base-files: add board.d support for bridge deviceJohn Crispin2020-11-041-0/+4
| | | | | | | | | Latest netifd allows us to setup network bridges with implicit vlan tagging. For this to work, we need to setup several additional uci sections. This feature is particularly usefull for DSA tupe devices. Add board.d and uci-defaults support for generating the sections. Signed-off-by: John Crispin <john@phrozen.org>
* base-files: merge /etc/passwd et al at sysupgrade config restoreDaniel Golle2020-10-221-0/+16
| | | | Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* base-files: remove block2mtd checks from sysupgradeFelix Fietkau2020-10-171-4/+0
| | | | | | This hasn't been used in a long time Signed-off-by: Felix Fietkau <nbd@nbd.name>
* 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: support label-property-less in get_dt_ledsChristian Lamparter2020-09-051-1/+2
| | | | | | | | | | | | | | | | | | | | | | | The LED's "label" property has been deprecated in upstream by: |commit c5d18dd6b64e09dd6984bda9bdd55160af537a8c |Author: Jacek Anaszewski <jacek.anaszewski@gmail.com> |Date: Sun Jun 9 20:19:04 2019 +0200 | | dt-bindings: leds: Add properties for LED name construction | | Introduce dedicated properties for conveying information about | LED function and color. Mark old "label" property as deprecated. | | Additionally function-enumerator property is being provided | for the cases when neither function nor color can be used | for LED differentiation. in order to be somewhat prepared, this patch adds a fallback as a last resort to make the current led code work by falling back to the node-name as the "label". Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
* base-files: fix comment typo in lib/functions/network.shWalter Sonius2020-09-021-1/+1
| | | | | | | | Fix typo in comment. Signed-off-by: Walter Sonius <walterav1984@gmail.com> [commit title/message facelift] Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* treewide: replace `which` with `command -v`Paul Spooren2020-08-121-1/+1
| | | | | | | | | | | | | | | | | Fix shellcheck SC2230 > which is non-standard. Use builtin 'command -v' instead. Using `command -v` is POSIX compliant while `which` is not. Also to mention, `command -v` is a shell builtin whereas `which` is a separate busybox applet. Once applied to everything concerning OpenWrt we can disable the busybox feature `which` and save 3.8kB. Acked-by: Stijn Tintel <stijn@linux-ipv6.be> Signed-off-by: Paul Spooren <mail@aparcar.org> [also replace cases in zram-swap] Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* base-files: functions.sh: fix config_get() on invalid identifiersJo-Philipp Wich2020-08-071-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When passing a section or option value to config_get() which contains characters that happen to be valid variable interpolation expressions, the function returns a nonsensical expression result instead of the expected empty string. When the passed section or option name contains other characters which are not valid within a shell variable name, a substitution error is occuring instead. The issue can be easily reproduced by one of the following examples: root@OpenWrt:~# . /lib/functions.sh root@OpenWrt:~# config load system root@OpenWrt:~# config_get variable invalid-section option root@OpenWrt:~# echo "$variable" section_option:- root@OpenWrt:~# . /lib/functions.sh root@OpenWrt:~# config load system root@OpenWrt:~# config_get variable section invalid-option root@OpenWrt:~# echo "$variable" option:- root@OpenWrt:~# . /lib/functions.sh root@OpenWrt:~# config load system root@OpenWrt:~# config_get variable section invalid@option -ash: eval: syntax error: bad substitution Fix this issue by only performing interpolations when the given section and option arguments are free of illegal characters. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* base-files: fwtool: make compat_version backward compatibleAdrian Schmutzler2020-07-311-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So far, the compatibility mechanism only works if both device and image are already updated to the new routines. This patch extends the sysupgrade metadata and fwtool_check_image() to account for "older" images as well: The basic mechanism for older devices to check for image compatibility is the supported_devices entry. This can be exploited by putting a custom message into this variable of the metadata, so older FW will produce a mismatch and print the message as it thinks it's the list of supported devices. So, we have two cases: device 1.0, image 1.0: The metadata will just contain supported_devices as before. device 1.0, image 1.1: The metadata will contain: "new_supported_devices":["device_string1", "device_string2", ...], "supported_devices":["Image version 1.1 incompatible to device: ..."] If the device is "legacy", i.e. does not have the updated fwtool.sh, it will just fail with image check and print the content of supported_devices. If DEVICE_COMPAT_MESSAGE is set, this will be printed on old devices as well through the same mechanism. Otherwise a generic "Please check documentation ..." is appended. Upgrade can still be performed with -F like when SUPPORTED_DEVICES has been removed to prevent bricking. If the device has updated fwtool.sh (but is 1.0), it will just use the new_supported_devices instead, and work as intended (flashing with -n will work, flashing without will print the appropriate warning). This mechanism should provide a fair tradeoff between simplicity and functionality. Since we touched a lot of fields in metadata, this also bumps metadata_version to 1.1. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* base-files: fwtool: implement compatibility check for imagesAdrian Schmutzler2020-07-311-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We regularly encounter the situation that devices are subject to changes that will make them incompatible to previous versions. Removing SUPPORTED_DEVICES will not really be helpful in most of these cases, as this only helps after a rename. To solve this situation, this patchset introduces a compatibility version for devices. In this patch, the actual checks are implemented into fwtool_check_image(): If an incompatible change is introduced, one can increase either the minor version (1.0->1.1) or the major version (1.0->2.0). Minor version increment: This will still allow sysupgrade, but require to reset config (-n or SAVE_CONFIG=0). If sysupgrade is called without -n, a corresponding message will be printed. If sysupgrade is called with -n, it will just pass, with supported devices being checked as usual. (Which will allow us to add back SUPPORTED_DEVICES for many cases.) Major version increment: This is meant for potential (rare) cases where sysupgrade is not possible at all, because it would break the device. In this case, a warning will be printed, and -n won't help. If image check fails because of one of the versions parts not matching, the content of DEVICE_COMPAT_MESSAGE is printed in addition to the generic message (if set). For both cases, upgrade can still be forced with -F as usual. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* base-files: add support for compat_version on deviceAdrian Schmutzler2020-07-311-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We regularly encounter the situation that devices are subject to changes that will make them incompatible to previous versions. Removing SUPPORTED_DEVICES will not really be helpful in most of these cases, as this only helps after a rename. To solve this situation, this patchset introduces a compatibility version for devices. To complement the DEVICE_COMPAT_VERSION set for the image to be flashed, this implements a compat_version on the device, so it will have something to compare with the image. The only viable way to achieve this seems to be via board.d files, i.e. this is technically adding a compat version for the device's config. Like for the network setup, this will set up a command ucidef_set_compat_version to set the compat_version in board.d. This will then add a string to /etc/board.json, which will be translated into uci system config by bin/config_generate. By this, the compat_version, being a version of the config, will also be exposed to the user. As with DEVICE_COMPAT_VERSION, missing uci entry will be assumed as compat_version "1.0", so we only need to add this if a device needs to be bumped, e.g. ucidef_set_compat_version "1.1" Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* base-files: add function for generating random MACDavid Bauer2020-07-281-0/+12
| | | | | | | | | | This adds a function for generating a valid random MAC address (unset MC bit / set locally administered bit). It is necessary for devices which do not have a MAC address programmed by the manufacturer. Signed-off-by: David Bauer <mail@david-bauer.net>
* base-files: replace backticks in lib/upgrade/nand.shAdrian Schmutzler2020-07-151-4/+4
| | | | | | This replaces deprecated backticks by more versatile $(...) syntax. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* base-files/functions.sh: use command -v instead of whichRosen Penev2020-07-111-2/+2
| | | | | | | | which must be executed. command -v is a shell builtin. https://github.com/koalaman/shellcheck/wiki/SC2230 Signed-off-by: Rosen Penev <rosenp@gmail.com>
* base-files: replace backticks by $(...)Adrian Schmutzler2020-07-111-1/+1
| | | | | | | | | This replaces deprecated backticks by more versatile $(...) syntax. This does not touch lib/upgrade/nand.sh, as there replacement is not trivial. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* base-files: add functions to set or clear bit in MAC addressSungbo Eo2020-07-081-2/+18
| | | | | | | | Some devices (e.g. Arduino Yun) need bitwise operations during MAC address setup. This commit adds generalized versions of macaddr_setbit_la(), which are helpful when manipulating a single bit in a MAC address. Signed-off-by: Sungbo Eo <mans0n@gorani.run>
* base-files: gpio switch: add named GPIO supportKuan-Yi Li2020-06-181-1/+1
| | | | | | | | | | | | | | | | Previously, gpio_switch only accepts GPIO pin number as input. Once a GPIO pin is exported and named by device tree, its pin state cannot be configured and saved across reboots by UCI. This patch adds support for named GPIO pins. Thus GPIO pin can be exported by device tree with active high/low correctly configured, having human-readable name in /sys/class/gpio/ is also now possible. More importantly, GPIO pins which are referenced by name will be immune from pin mapping breakage while unintentional pin number changes are introduced by kernel or driver updates. Signed-off-by: Kuan-Yi Li <kyli@abysm.org>
* base-files: prevent issues w/ overlay on powerloss after sysupgradeSergey Ryazanov2020-06-031-0/+2
| | | | | | | | | | | | | | | | Due to filesystem write caching the old configuration data could stay out of flash for a long time during a first boot after the sysupgrade. Power loss during this period could damage the overlay data and even make device inaccessable via the network. Fix this by syncing data to a flash as soon as the previous configuration will be unpacked after the sysupgrade. Also sync the FS state after the sysupgrade.tgz archive removing to prevent duplicative extraction of a previous configuration. Tested with AMD Geode based board. Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
* base-files: fix LED IDE triggerThomas Albers2020-06-031-1/+1
| | | | | | | | | | This changes the ide-disk LED trigger to the generic disk-activity as ide-disk trigger was removed in upstream commit eb25cb9956cc ("leds: convert IDE trigger to common disk trigger"). Signed-off-by: Thomas Albers <thomas.gameiro@googlemail.com> [split into separate commit, commit description facelift] Signed-off-by: Petr Štetiar <ynezz@true.cz>
* package/base-files: caldata: work around dd's limitationThibaut VARÈNE2020-05-281-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | tl;dr: dd will silently truncate the output if reading from special files (e.g. sysfs attributes) with a too large bs parameter. This problem was exposed on some RouterBOARD ipq40xx devices which use a caldata payload which is larger than PAGE_SIZE, contrary to all other currently supported RouterBOARD devices: the caldata would fail to properly load with the current scripts. Background: dd doesn't seem to correctly handle read() results that return less than requested data. sysfs attributes have a kernel exchange buffer which is at most PAGE_SIZE big, so only 1 page can be read() at a time. In this case, if bs is larger than PAGE_SIZE, dd will silently truncate blocks to PAGE_SIZE. With the current scripts using bs=<size> count=1, the data is truncated to PAGE_SIZE as soon as the requested <size> exceeds this value. This commit works around this problem by using `cat` in the caldata routines that can read from a file (routines that read from mtd devices are untouched). cat correctly handles partial read requests. The output is then piped to dd with the same parameters as before, to ensure that the resulting file remains exactly the same. This is a simple workaround, the downside is that it uses a pipe and one more executable, and therefore has a larger memory footprint and is slower. This is deemed acceptable considering these routines are only used at boot time. Tested-by: Robert Marko <robimarko@gmail.com> Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
* base-files: switch_to_ramfs: add nand-utilsÁlvaro Fernández Rojas2020-05-181-1/+1
| | | | Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
* base-files: upgrade: fix indentJavier Marcet2020-05-081-2/+2
| | | | | | | | Use same indent as for the rest of the file. Signed-off-by: Javier Marcet <javier@marcet.info> [add commit description] Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* package/base-files: add caldata_sysfsload_from_file()Thibaut VARÈNE2020-05-081-0/+15
| | | | | | | | This routine enables loading caldata binary via the kernel sysfs loader See https://www.kernel.org/doc/html/v4.19/driver-api/firmware/fallback-mechanisms.html Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
* package/base-files: caldata: allow setting target fileThibaut VARÈNE2020-05-081-8/+21
| | | | | | | This will enable platforms to extract caldata to an arbitrary file, or patch mac in an abitrary file. Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
* base-files: ensure VERBOSE is setAlexander Couzens2020-04-211-1/+1
| | | | | | | If not set, it shows the following error sh: out of range Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
* base-files: preinit: also config switch when no port roles definedChuanhong Guo2020-04-121-6/+7
| | | | | | | | | current preinit code in base-files doesn't config switch when there are no port roles defined. But this kind of configuration exists on single port devices where switch vlan is simply disabled. configure reset and enable_vlan property when a switch node exist. Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
* base-files: source functions.sh in /lib/functions/system.shAdrian Schmutzler2020-04-121-0/+1
| | | | | | | | The file /lib/functions/system.sh depends on find_mtd_index() and find_mtd_part() located in /lib/function.sh, so let's source that file. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* base-files: do not source system.sh in functions.shAdrian Schmutzler2020-04-121-1/+0
| | | | | | | | | | | | | | | | | | The default_postinst() function in /lib/functions.sh sources /lib/functions/system.sh before cycling through uci-defaults files. This creates a pseudo-cyclic dependency as system.sh also uses functions that are located in functions.sh. Despite that, there is actually only one uci-defaults file in the entire repo that needs system.sh, and this one contains an explicit source for system.sh anyway. Consequently, this patch removes the sourcing of system.sh in functions.sh. There are no relevant uses in packages, routing and luci repositories. This may require adjustments for downstream, though. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* treewide: convert sed -r to posix -EKevin Darbyshire-Bryant2020-04-041-1/+1
| | | | Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
* x86: generate EFI platform bootable images李国2020-03-311-8/+54
| | | | | | | | | | | | | | | | | Add EFI platform bootable images for x86 platforms. These images can also boot from legacy BIOS platform. EFI System Partition need to be fat12/fat16/fat32 (not need to load filesystem drivers), so the first partition of EFI images are not ext4 filesystem any more. GPT partition table has an alternate partition table, we did not generate it. This may cause problems when use these images as qemu disk (kernel can not find rootfs), we pad enough sectors will be ok. Signed-off-by: 李国 <uxgood.org@gmail.com> [part_magic_* refactoring, removed genisoimage checks] Signed-off-by: Petr Štetiar <ynezz@true.cz>
* base-files: convert leading spaces to tabs in functions.shAdrian Schmutzler2020-03-131-2/+2
| | | | | | Use tabs for indent consistently. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* base-files: Add /etc/shinit for non-login shell initJeffery To2020-03-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because /etc/profile (and ~/.profile) are read by login shells only, aliases and functions defined there are not available to non-login shells, e.g. when using screen or tmux. If the ENV environment variable exists (exported by /etc/profile or ~/.profile) and references an existing file, then all interactive shells (login or non-login) will read that file as well. This sets the ENV environment variable in /etc/profile, pointing to /etc/shinit. This also adds /etc/shinit, which: * Contains alias and function definitions originally in /etc/profile * Sources /etc/mkshrc if the user is using mksh (also originally in /etc/profile), as /etc/mkshrc is meant for all interactive shells * Sources ~/.mkshrc if the user is using mksh, to compensate for the fact that mksh will not read ~/.mkshrc if ENV is set * Sources ~/.shinit if the user is not using mksh This also removes the shebang from /etc/profile, as the file is sourced, not executed. Signed-off-by: Jeffery To <jeffery.to@gmail.com>
* base-files: diag: restore default trigger for 'boot' LEDPiotr Dymacz2020-02-241-4/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For devices without a dedicated 'diag' LED, we use sometimes one of other LEDs for indicating at least 'boot', 'failsafe' and 'upgrade' stages. In some cases, at the same time these LEDs have defined default triggers in DTS using 'linux,default-trigger' property. Current 'diag' setup removes the trigger and turns off 'boot' LED after bootup. One of the examples of such device is TP-Link TL-WR841N v14 (ramips) which uses 'wlan' LED with defined 'linux,default-trigger' for 'diag': aliases { led-boot = &led_wlan; led-failsafe = &led_wlan; led-upgrade = &led_wlan; }; [...] led_wlan: wlan { label = "tl-wr841n-v14:green:wlan"; gpios = <&gpio1 9 GPIO_ACTIVE_LOW>; linux,default-trigger = "phy0tpt"; }; This patch extends 'diag.sh' and 'leds.sh' scripts to make sure default trigger defined in DTS is restored for 'diag' LED which isn't used for indicating 'running' stage. Acked-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
* base-files: remove some bashismsSven Roederer2020-01-261-1/+1
| | | | | | | | | | "[[" is a bash extension for test. As the ash-implementation is not fully compatible we drop its usage. Also change to "=" for simple test, which is sufficient. (see d6ac8ca76c04ed) Signed-off-by: Sven Roederer <devel-sven@geroedel.de> [split patch, removed shebang] Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* base-files/functions.sh: use grep -q instead of []Rosen Penev2020-01-181-4/+4
| | | | | | | | | | | | It's cleaner and faster as it does not need to do extra work. Also removed $() to avoid executing the output. The shell can handle it. https://github.com/koalaman/shellcheck/wiki/SC2143 Signed-off-by: Rosen Penev <rosenp@gmail.com> [correct || to && for one conversion] Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* base-files/system.sh: remove $ in $(())Rosen Penev2020-01-171-1/+1
| | | | | | | | Not needed. https://github.com/koalaman/shellcheck/wiki/Sc2004 Signed-off-by: Rosen Penev <rosenp@gmail.com>
* base-files/functions.sh: use && instead of -aRosen Penev2020-01-171-2/+2
| | | | | | | | -a is not well defined. https://github.com/koalaman/shellcheck/wiki/SC2166 Signed-off-by: Rosen Penev <rosenp@gmail.com>