aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files
Commit message (Collapse)AuthorAgeFilesLines
* base-files: add support for restoring config from tmpfsDaniel Golle2021-02-281-2/+3
| | | | | | | | Instead of only relying in /sysupgrade.tgz being present in rootfs to restore configuration, also grab /tmp/sysupgrade.tar which may have magically gotten there during preinit... Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* base-files: remove unneeded '$' signs in nand.shDaniel Golle2021-02-241-2/+2
| | | | | | | When using Shell arithmetric evaluation via $((..)) the variables in the expression do not need to be prefixed by the '$' sign. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* sysupgrade-nand: allow limiting rootfs_data by setting env variableDaniel Golle2021-02-241-4/+16
| | | | | | | | | | | | | | | | | Check if firmware environment variable 'rootfs_data_max' exists and is set to a numerical value greater than 0. If so, limit rootfs_data volume to that size instead of using the maximum available size. This is useful on devices with lots of flash where users may want to have eg. a volume for persistent logs and statistics or for external applications/containers. Persistence on rootfs overlay is limited by the size of memory available during the sysugprade process as that data needs to be copied to RAM while the volume is being recreated during sysupgrade. Hence it is unsuitable for keeping larger amounts of data accross upgrade which makes additional volume(s) for application data desirable. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* image: add support for building FIT image with filesystemDaniel Golle2021-02-241-37/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow for single (external-data) FIT image to hold kernel, dtb and squashfs. In that way, the bootloader verifies the system integrity including the rootfs, because what's the point of checking that the hash of the kernel is correct if it won't boot in case of squashfs being corrupted? Better allow bootloader to check everything needed to make it at least up to failsafe mode. As a positive side effect this change also makes the sysupgrade process on nand potentially much easier as it is now. In short: mkimage has a parameter '-E' which allows generating FIT images with 'external' data rather than embedding the data into the device-tree blob itself. In this way, the FIT structure itself remains small and can be parsed easily (rather than having to page around megabytes of image content). This patch makes use of that and adds support for adding sub-images of type 'filesystem' which are used to store the squashfs. Now U-Boot can verify the whole OS and the new partition parsers added in the Linux kernel can detect the filesystem sub-images, create partitions for them, and select the active rootfs volume based on the configuration in FIT (passing configuration via device tree could be implemented easily at a later stage). This new FIT partition parser works for NOR flash (on top of mtdblock), NAND flash (on top of ubiblock) as well as classic block devices (ie. eMMC, SDcard, SATA, NVME, ...). It could even be used to mount such FIT images via `losetup -P` on a user PC if this patch gets included in Linux upstream one day ;) Signed-off-by: John Crispin <john@phrozen.org> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* base-files: use hwclock --systzRosen Penev2021-02-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The date -k patch is non standard and will be removed in the next commit. Tested behavior to be identical with a simple C program: #define _GNU_SOURCE #include <unistd.h> #include <stdio.h> #include <sys/time.h> #include <sys/syscall.h> int main() { struct timezone tt; struct timezone tz; int a = syscall(SYS_gettimeofday, NULL, &tt); int b = gettimeofday(NULL, &tz); printf("%d - %d, %d\n", a, tt.tz_minuteswest, tt.tz_dsttime); printf("%d - %d, %d\n", b, tz.tz_minuteswest, tz.tz_dsttime); } Signed-off-by: Rosen Penev <rosenp@gmail.com>
* base-files: mount pstore if presentBrian Norris2021-01-291-0/+1
| | | | | | | | Pstore (persistent store) can be used to stash debug information (kernel console, panics, ftrace) across reboots or crashes. If the filesystem is present, mount it. Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* base-files: remove execute bit and shebang from functions.shAdrian Schmutzler2021-01-291-1/+0
| | | | | | | | | | | /lib/functions.sh was executable for no obvious reason and its execute property was even checked in package-ipkg.mk just to source it afterwards. Remove the execute bit and shebang as this is clearly a library. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Reviewed-by: Philip Prindeville <philipp@redfish-solutions.com>
* treewide: drop shebang from non-executable lib filesAdrian Schmutzler2021-01-2916-20/+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: read all 3 bytes in get_magic_vfat() at onceAdrian Schmutzler2021-01-071-1/+1
| | | | | | | While the speed improvement might be negligible, there is still no reason to read individual bytes. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* base-files: wifi: add support for 802.11adDaniel Golle2021-01-051-0/+1
| | | | Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* x86/efi: add FAT32 esp mounting supportKagurazaka Kotori2021-01-031-1/+6
| | | | | | | | | Adds a new function get_magic_fat32() in base-files to read FAT32 magic. Now FAT32 EFI system partition can be handled in the same way as FAT12/FAT16. Signed-off-by: Kagurazaka Kotori <kagurazakakotori@gmail.com> [replace '-o' with '] || [' to satisfy shellsheck] Signed-off-by: Paul Spooren <mail@aparcar.org>
* base-files: allow reusing of boolean value extraction logicOldřich Jedlička2021-01-011-5/+12
| | | | | | | | | | | | | | | | | | | The `functions.sh` script has `config_get_bool()` function, which is usable when using UCI config direct access API, but there is no equivalent for the callback API. Introduce `get_bool()` function to allow reusing it from init scripts. Example: ```sh option_cb() { local option="$1" local value="$(get_bool "$2")" ... } ``` Signed-off-by: Oldřich Jedlička <oldium.pro@gmail.com>
* base-files: sysupgrade: add function for conffiles retrievalAdrian Schmutzler2020-12-301-7/+12
| | | | | | | | | | | | The find command to retrieve files from /etc/sysupgrade.conf and /lib/upgrade/keep.d/* is used twice in almost the same way. Move it into a function to consolidate, enhance readability and make future adjustments easier. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Acked-by: Paul Spooren <mail@aparcar.org> Reviewed-by: Philip Prindeville <philipp@redfish-solutions.com>
* 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>
* base-files: upgrade: fix initramfs detectionRobert Marko2020-12-201-1/+1
| | | | | | | | | | | | | | | Commit "initramfs: switch to tmpfs to fix ujail" switched initramfs to now use tmpfs, it causes $(rootfs_type) to now return tmpfs when running initramfs image instead of being empty. This broke initramfs detection which prevents config files from being saved as it does not work from initramfs. So, lets test for $(rootfs_type) returning "tmpfs" instead. Fixes: 7fd3c68 ("initramfs: switch to tmpfs to fix ujail) Signed-off-by: Robert Marko <robimarko@gmail.com>
* 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: informative service command in /etc/shinit. service command ↵Stan Grishin2020-12-031-5/+17
| | | | | | | | | | | | | | shows services enabled/disabled and running status, when the service command is invoked with no/invalid arguments, like this: Usage: service <service> [command] The following services are available: /etc/init.d/acme enabled stopped /etc/init.d/boot enabled stopped /etc/init.d/cron enabled running /etc/init.d/dnsmasq enabled running ... Signed-off-by: Stan Grishin <stangri@melmac.net>
* base-files: allow setting device and bridge macsJohn Crispin2020-12-022-9/+42
| | | | | | | | | 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: fix alias more to properly detect /usr/bin/moreHuangbin Zhan2020-11-281-1/+1
| | | | | | Package more is installed to /usr/bin rather than /bin. Signed-off-by: Huangbin Zhan <zhanhb88@gmail.com>
* 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: generated named bridge-vlan sectionsJohn Crispin2020-11-191-7/+8
| | | | Signed-off-by: John Crispin <john@phrozen.org>
* base-files: fix backwards compatiblity of rc.common EXTRA_COMMANDSMatthias Schiffer2020-11-171-6/+7
| | | | | | | | | | | | | | Avoid needlessly breaking old initscripts that set EXTRA_COMMANDS. This will aid in debugging (as it simplifies reverting to an older version of a package) and unbreaks third-party feeds (and packages that maintain their OpenWrt initscripts as part of the software's repo instead of the OpenWrt feed like fastd). Without this, initscripts that set EXTRA_COMMANDS become completely unusable, as all default commands like start/stop cease working. Fixes: 1a69f50dc627 ("base-files: fix rc.common help alignment") Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
* 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-042-2/+37
| | | | | | | | | 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: fix rc.common help alignmentFlorian Eckert2020-11-021-14/+24
| | | | | | | | | | | | | | This commit introduces a new function `extra_command` to better format the help text without having to calculate the indentation in every startup script that wants to add a new command. So far it looks weird and is not formatted correctly on some startup scripts. After using the new `extra_command` wrapper the alignement looks correctly. And if the indentation is not sufficient in the future, this can be changed in the function extra_command at a central location. Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* 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: drop default setup for vconfigAdrian Schmutzler2020-09-161-1/+0
| | | | | | | | | | | | | | | | | vconfig has been disabled by default since 2015 [1] and there are no remaining uses in entire OpenWrt trunk. However, we still set up a specific name_type for it during boot. While this setup is properly implemented to be only triggered when vconfig is present, it still seems anachronistic and unnecessary to set up a standard for a tool that is not used anymore. Therefore, this removes the set_name_type initialization and leaves it for those people actually using the tool to configure it as needed. [1] 899a23227e55 ("busybox: improve applets & deprecate ifconfig, route") Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* base-files: disable LEDs if default state is undefinedDavid Bauer2020-09-111-1/+1
| | | | | | | | | | | | | | | Set the default state for LEDs to off. When a trigger is set, the trigger will turn the LED automatically on. Currently LEDs might stay on, e.g. when the LED trigger is set to a netdev trigger and the interface is never activated or the 'none' trigger is selected without setting the 'default' option to 0 and it's set for the LED indicating the system running state. Using off as a default value is also consistent with the documentation in the OpenWrt wiki. Signed-off-by: David Bauer <mail@david-bauer.net>
* 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: mount bpffs at bootTony Ambardar2020-07-311-0/+1
| | | | | | | | | | Explicitly mount the BPF filesystem if available. This is used for pinning eBPF programs and maps, making them accessible to other eBPF programs or from userspace with the help of libbpf or bpftool. Signed-off-by: Tony Ambardar <itugrok@yahoo.com> [daniel@makrotopia.org: bumped PKG_RELEASE] Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* 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-312-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: remove useless catAdrian Schmutzler2020-07-111-1/+1
| | | | | | Check file contents directly instead of using cat. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>