aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files/lib
Commit message (Collapse)AuthorAgeFilesLines
* base-files: upgrade: add case to export_bootdeviceKlaus Kudielka2020-01-051-1/+13
| | | | | | | | | | | | | | The factory uboot of the Turris Omnia boots with "root=b301", and we instruct new users to sysupgrade from there (e.g. method 1, step 7). Currently, this will fail with "Unable to determine upgrade device". Add a new case to export_bootdevice, which parses the hex argument. Ref: https://github.com/openwrt/openwrt/pull/2340#issuecomment-561317688 Fixes: 2e5a0b81ec29 ("mvebu: sysupgrade: sdcard: keep user added partitons") Reviewed-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: Klaus Kudielka <klaus.kudielka@gmail.com> Signed-off-by: Petr Štetiar <ynezz@true.cz> (cherry picked from commit 3a4f587c465a0531b820ca1a3e90eb05c4927b68)
* base-files: add /usr/share/libubox/jshn.sh to sysupgrade stage2Russell Senior2019-11-141-1/+1
| | | | | | | | Discovered recent changes had broken sysupgrade for ar71xx mikrotik rb-493g, traced the problem to missing /usr/share/libubox/jshn.sh after switching to tmpfs. Signed-off-by: Russell Senior <russell@personaltelco.net>
* base-files: use get_mac_binary() in mtd_get_mac_binary_ubi()Adrian Schmutzler2019-09-291-6/+1
| | | | | | | | | | | | | The actual retrieval of the MAC address in mtd_get_mac_binary_ubi() is the same as in get_mac_binary(). Thus, use the latter function in the former to reduce duplicate code. This will also allow to benefit from the enhanced path check there and bring mtd_get_mac_binary_ubi() more in line with the similar mtd_get_mac_binary(). Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> (cherry picked from commit 45600124fcbd14ece6e289cb59b318ea44c598fe)
* treewide: sysupgrade: use $UPGRADE_BACKUP to check for backupRafał Miłecki2019-09-162-2/+2
| | | | | | | | Now that $UPGRADE_BACKUP is set conditionally there is no need to check the $UPGRADE_OPT_SAVE_CONFIG anymore. All conditions can be simplified. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit a858db313687ddfa6ed1ddba76bd74844a7b89dc)
* treewide: use new procd sysupgrade $UPGRADE_BACKUP variableRafał Miłecki2019-09-122-2/+1
| | | | | | | | | | | It's a variable set by procd that should replace hardcoded /tmp/sysupgrade.tgz. This change requires the most recent procd with the commit 0f3c136 ("sysupgrade: set UPGRADE_BACKUP env variable"). Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit 641f6b6c26cb9ab5e1198810015e5f4b2b5b34ad)
* treewide: don't hardcode "sysupgrade.tgz" file nameRafał Miłecki2019-09-122-1/+3
| | | | | | | | | 1) Add BACKUP_FILE and use it when copying an archive to be restored after sysupgrade (on the next preinit). 2) Use CONF_TAR for copying backup prepared by the /sbin/sysupgrade Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit bf390478727ac5f4f9d6fb684de48b8150bcec67)
* treewide: sysupgrade: pass "save_partitions" option to the "sysupgrade" methodRafał Miłecki2019-09-041-5/+0
| | | | | | | | This explicitly lets stage2 know if partitions should be preserved. No more "touch /tmp/sysupgrade.always.overwrite.bootdisk.partmap" hack. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit b6f4cd57e19a8cfcd9ff52582b65164ce6213c3d)
* base-files: pass "save_config" option to the "sysupgrade" methodRafał Miłecki2019-09-043-4/+2
| | | | | | | This explicitly lets stage2 know if config should be preserved. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit b534ba96110012d2697d19d71b7dcd60bd4cd375)
* base-files: don't set ARGV and ARGCRafał Miłecki2019-09-041-3/+0
| | | | | | | Those are not used by any image check function anymore. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit 3f4c785a6bbde87296e362c315f10b55c98843e3)
* base-files: move stage2 upgrade to separated fileRafał Miłecki2019-09-043-23/+26
| | | | | | | | | | do_upgrade_stage2() isn't really any common code. It isn't used anywhere except for /sbin/sysupgrade that passes it to the stage2. Moving its code to separated file also simplifies COMMAND variable. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit f7edd94a6588aa6a3e2e7a72410a34392a9fbe78)
* base-files: drop support for NAND upgrade in platform_pre_upgrade()Rafał Miłecki2019-09-043-16/+2
| | | | | | | | With bcm53xx switched to the new procedure there is no more need for keeping that backward compatibility code. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit ea4e1dac71dfa015c0da10e68149478fa25878f9)
* base-files: drop unused jffs2_copy_config()Rafał Miłecki2019-09-041-10/+0
| | | | | | | | | Its last usage was dropped back in 2013 in the commit b95bdc8ab56e ("kernel/base-files: clean up old code related to refreshing mtd partitions, it is no longer used anywhere"). Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit f58ca6ee57b77350c69639defdceacb2e77e2249)
* base-files: add network_get_uptime() to /lib/functions/network.shFlorian Eckert2019-09-041-0/+5
| | | | | | | Add missing ubus api call for uptime value. Signed-off-by: Florian Eckert <fe@dev.tdt.de> (cherry picked from commit 9e780ed5f7b834e06ec5c82323731917aef4ee53)
* base-files: apply new sysctl.conf at postinstYousong Zhou2019-09-041-13/+20
| | | | | | | | | | | | | | | | | This is mainly for kmod-br-netfilter. To turn off bridge-netfilter-call-xxx immediately after installation While at it - Define filelist="/usr/lib/opkg/info/${pkgname}.list" - Reuse "[ -z "$root" ]" - Grep with "-m1" Fixes FS#2300 Reported-by: Marco Sartorius <tidbits@ormoorgmen.info> Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com> (cherry picked from commit 3dc4f59eabaed5135cd4eed8d1846248d5f1b37c)
* base-files: move urandom seed bits into separate packagePetr Štetiar2019-07-221-24/+0
| | | | | | | | So it's possible to install or remove it as needed. Tested-by: Lucian Cristian <lucian.cristian@gmail.com> Signed-off-by: Petr Štetiar <ynezz@true.cz> (cherry picked from commit 27bfde9c9f789dbfabebf13047e8b042c27cdeef)
* base-files: Fix path check in get_mac_binaryAdrian Schmutzler2019-07-091-1/+1
| | | | | | | | | | Logic was inverted when changing from string check to file check. Fix it. Fixes: 8592602d0a88 ("base-files: Really check path in get_mac_binary") Reported-by: Matthias Schiffer <mschiffer@universe-factory.net> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> (cherry picked from commit 6ed3349308b24a6bac753643970a1f9f56ff6070)
* base-files: Really check path in get_mac_binaryAdrian Schmutzler2019-07-051-1/+1
| | | | | | | | Currently, path argument is only checked for being not empty. This changes behavior to actually check whether path exists. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* base-files: fix uci led oneshot/timer triggerRobinson Wu2019-06-201-0/+1
| | | | | | | | | | | | | | This patch adds a missing type property which prevented the creation of oneshot and timer led triggers when they are specified in the /etc/board.d/01_leds files. i.e.: ucidef_set_led_timer "system" "system" "zhuotk:green:system" "1000" "1000" Fixes: b06a286a4861 ("base-files: cleanup led functions in uci-defaults.sh") Signed-off-by: Robinson Wu <wurobinson@qq.com> Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
* base-files: add support for the new ar8xxx MIB counters settingsPetr Štetiar2019-05-201-0/+13
| | | | | | | | | | | | | Commit "generic: ar8216: add mib_poll_interval switch attribute" has added mib_poll_interval global config option and commit "generic: ar8216: group MIB counters and use two basic ones only by default" has added mib_type config option. So this patch adds ucidef_set_ar8xxx_switch_mib helper function which would allow configuration of the above mentioned new switch config options. Signed-off-by: Petr Štetiar <ynezz@true.cz>
* base-files: improve lib/upgrade/common.shKlaus Kudielka2019-05-111-13/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recently, upgrade device autodetection has been added to the mvebu target. This exposes some shortcomings of the generic export_bootdevice function, e.g. on the Turris Omnia: export_bootdevice silently reports the root partition to be the boot device. This makes the sysupgrade process fail at several places. Fix this by clearly distinguishing between /proc/cmdline arguments which specify the boot disk, and those which specify the root partition. Only in the latter case, strip off the partition, and do it consistently. root=PARTUUID=<pseudo PARTUUID for MBR> (any partition) and root=/dev/* (any partition) are accepted. The root of the problem is that the *existing* export_bootdevice in /lib/upgrade/common.sh behaves differently, if the kernel is booted with root=/dev/..., or if it is booted with root=PARTUUID=... In the former case, it reports back major/minor of the root partition, in the latter case it reports back major/minor of the complete boot disk. Targets, which boot with root=/dev/... *and* use export_bootdevice / export_partdevice, have added workarounds to this behaviour, by specifying *negative* increments to the export_partdevice function. Consequently, those targets have to be adapted to use positive increments, otherwise they are broken by the change to export_bootdevice. Fixes: 4e8345ff68 ("mvebu: base-files: autodetect upgrade device") Signed-off-by: Klaus Kudielka <klaus.kudielka@gmail.com> Tested-by: Tomasz Maciej Nowak <tomek_n@o2.pl>
* 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>
* base-files: fix ucert verificationFelix Fietkau2019-02-121-1/+2
| | | | | | | | ucert needs to check the firmware part with metadata, but without the signature. Use the new fwtool mode to extract that without altering the firmware image inside the check Signed-off-by: Felix Fietkau <nbd@nbd.name>
* base-files: do not strip fwtool signature data during checkFelix Fietkau2019-02-091-1/+1
| | | | | | | Same reason as in commit 9808bd279927bcd2d3a78d19a55229b93bbbcf05 - sysupgrade --test must not alter the image in any way Signed-off-by: Felix Fietkau <nbd@nbd.name>
* base-files: config_get: prevent filename globbingGünther Kelleter2019-01-301-1/+1
| | | | | | | | | When config_get is called as "config_get section option" the option is unexpectedly globbed by the shell which differs from the way options are read to a variable with "config_get variable section option". Add another layer of double quotes to fix it. Signed-off-by: Günther Kelleter <guenther.kelleter@devolo.de>
* base-files: sysupgrade: support additional mtd optionsDavid Bauer2019-01-261-2/+2
| | | | | | | | | | Add support for passing additional parameters to mtd called during sysupgrade. It will be required to toggle the "recovery moe" flag supported by recent tp-link boards. Signed-off-by: David Bauer <mail@david-bauer.net> [split code from board support patch; add commit message] Signed-off-by: Mathias Kresin <dev@kresin.me>
* base-files: allow non-standard rootfs volume name in UBI in sysupgradeINAGAKI Hiroshi2019-01-011-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit allows to use non-standard UBI volume name as the rootfs volume in sysupgrade. ex.: The U-Boot on Buffalo WXR-2533DHP checks existence and checksum of "ubi_rootfs" volume when booting, so this name is required. OpenWrt currently provides several patches: 490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch 491-ubi-auto-create-ubiblock-device-for-rootfs.patch 492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch to facilitate ubi rootfs automount. However the upstream kernel also supports the means of booting from a fully custom ubi partition name and ubi volume name via bootargs/kernel's cmdline parameters: ubi.mtd=mtd_partition_name ubi.block=rootfs_volume_name root=/dev/ubiblock$X_$Y For more information and examples visit the wiki over at linux-mtd: <http://www.linux-mtd.infradead.org/faq/ubifs.html> <http://www.linux-mtd.infradead.org/doc/ubi.html> Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com> Signed-off-by: Christian Lamparter <chunkeey@gmail.com> [reworded commit]
* base-files: fix several bashismsMichael Heimpold2018-12-053-3/+3
| | | | | | | For equality test a simple = is sufficient, the == is usually disregarded as bashism. Signed-off-by: Michael Heimpold <mhei@heimpold.de>
* Revert "base-files: fwtool: Fix wrong checksum on combined-image with metadata"Jo-Philipp Wich2018-12-021-1/+1
| | | | | | | | | | | | | | | | | This reverts commit 41770add03ad77a0ce41ed424ad050238f7d9272. The fwtool_check_image() procedure is used by `sysupgrade --test` which must not alter the image under test in any way. Currently, when the LuCI ui or any other sysupgrade wrapper first invokes sysupgrade --test to verify the compatibility of the image and then calculates the sha256sum over it, the resulting checksum will differ from the original image since the test invocation will implicitely strip the metadata trailer. To properly fix the underlying issue, the combined image checksumming code must be modified to skip the metadata trailer. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* base-files: fix prerm return value, align with postinst codeTony Ambardar2018-11-291-5/+10
| | | | | | | | | | | | | | | The return value of a package prerm script is discarded and not returned correctly by default_prerm(). This allows other operations like service shutdown to "leak" their return value, prompting workarounds like commit 48cfc826 which do not address the root cause. Preserve a package prerm script return value for use by default_prerm(), sharing the corresponding code from default_postinst() for consistency. Also use consistent code for handling of /etc/init.d/ scripts. Run Tested on: LEDE 17.01.4 running ar71xx. Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
* base-files: fwtool: Fix wrong checksum on combined-image with metadataPetr Štetiar2018-11-261-1/+1
| | | | | | | | | | | | | | | | | | If I create following image: define Device/engenius-m36 IMAGE/sysupgrade.bin := combined-image | append-metadata endef Sysupgrade then errors out: Invalid image. Contents do not match checksum (image:cd285595eaf297370404ae0e2815ec1a calculated:2cf9a2286fb6b01af3ea189128017d44) Image check 'platform_check_image' failed. By removing the metadata from the image I get combined-image checksum working again and sysupgrade works. Signed-off-by: Petr Štetiar <ynezz@true.cz>
* base-files: make it possible to specify switch led modeChristian Lamparter2018-09-291-0/+2
| | | | | | | | | | | | | | | | | The swconfig switch led driver has the ability to switch between a "link, rx and/or tx" mode. However, this feature was not implemented in uci, the led init script and config_generate. This patch adds a seventh parameter to the ucidef_set_led_switch() function. The accepted values for this parameter are: link, rx and tx. Any permutations of these three values are supported, as long as they are properly encased with quotes. If the parameter is not specified it will default to "all" (link rx tx). Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
* base-files: add network_get_metric() to /lib/functions/network.shFlorian Eckert2018-09-251-0/+5
| | | | | Signed-off-by: Florian Eckert <fe@dev.tdt.de> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> [PKG_RELEASE increase]
* base-files: fix postinstall uci-defaults removalTony Ambardar2018-09-241-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 7f694582 introduced a bug where default_postinst() often fails to remove a uci-defaults script after application, leaving it to run again after a reboot. (Note: commit 7f694582 also introduced FS#1021, now fixed by 73c745f6) The subtle problem arises from the shell logical chain: [ -f "$i" ] && . "$i" && rm -f "$i" Most uci-defaults scripts contain a terminal 'exit 0' statement which, when sourced, results in the logic chain exiting before executing 'rm -f'. This was observed while testing upgrades of 'luci-app-sqm'. The solution is to wrap the shell sourcing in a subshell relative to the command 'rm -f': ( [ -f "$i" ] && . "$i" ) && rm -f "$i" Revert to using 'grep' to prefilter the list of entries from the control file, which yields the full path of uci-defaults scripts. This allows keeping the existence check, directory change and script sourcing inside the subshell, with the script removal correctly outside. This approach avoids adding a second subshell only around the "." (source) command. The change also preserves the fix FS#1021, since the full path is used to source the script, which is POSIX-portable irrespective of PATH variable or reference to the CWD. Run Tested on: LEDE 17.01.4 running ar71xx, while tracing installation of package luci-app-sqm with its associated /etc/uci-defaults/luci-sqm file. Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
* treewide: consolidate upgrade state setMathias Kresin2018-08-162-0/+6
| | | | | | | | | | Set the (sys)upgrade state when sourcing the stage2 script instead of setting the state for each target individual. This change fixes the, due to a missing state set, not working upgrade led on ath79 and apm821xx. Signed-off-by: Mathias Kresin <dev@kresin.me>
* base-files: add function to get mac as text from flashMathias Kresin2018-08-111-0/+23
| | | | | | | | | Add a function to get a mac stored as text from flash. The octets of the mac address need to be separated by any separator supported by macaddr_canonicalize(). Signed-off-by: Dmitry Tunin <hanipouspilot@gmail.com> Signed-off-by: Mathias Kresin <dev@kresin.me>
* base-files: use consistent coding styleMathias Kresin2018-08-111-8/+4
| | | | | | | | Add the opening bracket right after the function name, to do it the same way for all functions in this file. Signed-off-by: Dmitry Tunin <hanipouspilot@gmail.com> Signed-off-by: Mathias Kresin <dev@kresin.me>
* base-files: introduce sysupgrade signature chain verificationDaniel Golle2018-08-081-0/+25
| | | | | | | | | Verify ucert signature chains in sysupgrade images in case ucert is installed and $CHECK_IMAGE_SIGNARURE = 1. Also make sure ucert host binary is present and generate a self-signed ucert in case $TOPDIR/key-build.ucert is missing. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* base-files: drop fwtool_pre_upgradeJohn Crispin2018-07-301-4/+0
| | | | | | | this feature has never worked, the fw image name was not passed and the -t parameter was missing in the tool invocation. drop the feature. Signed-off-by: John Crispin <john@phrozen.org>
* base-files: network.sh: gracefully handle missing network.interface ubus nsJo-Philipp Wich2018-07-171-4/+10
| | | | | | | | | | | | | | | | | | | | | When attempting to use any of the functions in network.sh while netifd is not started yet, the ubus interface dump query will fail with "Not found", yielding an empty response. Subsequently, jsonfilter is invoked with an empty string instead of a valid JSON document, causing it to emit a second "unexpected end of data" error. This caused the dnsmasq init script to log the following errors during early boot on some systems: procd: /etc/rc.d/S19dnsmasq: Command failed: Not found. procd: /etc/rc.d/S19dnsmasq: Failed to parse json data: unexpected end of data. Fix the issue by allowing the ubus query to fail with "Not found" but still logging other failures, and by passing an empty JSON object to jsonfilter if the interface status cache is empty. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* base-files: exit if mtd write command fails during sysupgradeRafał Miłecki2018-06-181-0/+1
| | | | | | | | | | It avoids confusing situations like: > Could not get image magic > Image check failed. > Upgrade completed > Rebooting system... Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* base-files: sysupgrade: fix handing get_image unpack commandsMatthias Schiffer2018-06-111-6/+6
| | | | | | | | On bcm53xx and brcm47xx, commands are passed to default_do_upgrade that expect the image to be passed on stdin, rather than as an argument. Fixes: 30f61a34b4cf ("base-files: always use staged sysupgrade") Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
* base-files: fix UCI config parsing and callback handlingTony Ambardar2018-06-061-8/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are several long-standing issues present in the UCI shell API as documented in https://wiki.openwrt.org/doc/devel/config-scripting. They relate both to high-level, user-defined callback functions used to process UCI config files, and also to low-level functions used within scripts generally. The related problems have been encountered now and in the past, e.g. https://forum.openwrt.org/viewtopic.php?id=54295, and include: a) UCI parsing option() function and user-defined option_cb() callbacks being erroneously called during processing of "list" config file entries; b) normal usage of the low-level config_set() unexpectedy calling any defined option_cb() if present; and c) handling of the list_cb() not respecting the NO_CALLBACK variable. Root causes include a function stack "inversion", where the low-level config_set() function incorrectly calls the high-level option() function, intended only for processing the "option" keyword of UCI config files. This change addresses the inversion and other issues, making the option handling code more consistent and smaller, and simplifying developers' usage of UCI callbacks. Signed-off-by: Tony Ambardar <itugrok@yahoo.com> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> [PKG_RELEASE increase]
* base-files: fix ucidef_set_interface() protocol selectionJo-Philipp Wich2018-05-251-5/+11
| | | | | | | | | | | | The previous refactoring of ucidef_set_interface() removed the protocol selection heuristic which breaks the networking defaults for the majority of boards. Re-add the protocol selection and rename two bad "proto" references to the expected "protocol" value. Fixes: 85048a9c1f ("base-files: rework _ucidef_set_interface to be more generic") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* base-files: rework _ucidef_set_interface to be more genericRoman Yeryomin2018-05-241-50/+24
| | | | | | | | | | | | This is a rework of previously submitted patch reworking ucidef_set_interface_raw [1]. Here, keep the idea but instead make _ucidef_set_interface more generic and use it instead of ucidef_set_interface_raw. Also change the users like ucidef_set_interface_lan and others. [1] https://patchwork.ozlabs.org/patch/844961/ Signed-off-by: Roman Yeryomin <roman@advem.lv>
* base-files: /lib/functions.sh: remove unused insert_modulesMatthias Schiffer2018-04-171-10/+0
| | | | | | insert_modules has been unused since r5279. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
* base-files: get_dt_led: don't warn about missing ledMathias Kresin2018-04-041-2/+1
| | | | | | | | | It's intentional that some boards within a target don't have all LEDs which are tried to be setup in a common script. Don't show a warning in such cases. Fixes: 4f4fc993db4c ("base-files: add more name source to get_dt_led helper function") Signed-off-by: Mathias Kresin <dev@kresin.me>
* base-files: add more name source to get_dt_led helper functionMathias Kresin2018-03-141-1/+4
| | | | | | | | Not all LED driver are using the label devicetree property for the led name. Add support for the TI/National Semiconductor LP55xx Led Drivers, which are using the chan-name property for the led name, as fallback. Signed-off-by: Mathias Kresin <dev@kresin.me>
* base-files: add function to get binary mac from fileMathias Kresin2018-03-141-6/+13
| | | | | | | Add a fucntion to get the a binary mac address from file. Use the new function for mtd_get_mac_binary() to limit duplicate code. Signed-off-by: Mathias Kresin <dev@kresin.me>
* base-files: don't evaluate block-device ueventDaniel Golle2018-02-131-4/+8
| | | | | | | | | | | | | Current code and also before commit da52dd0c83 was vulnerable to shell injection using volume lables in the GPT partition table of block devices. Given that partition names can be freely defined in GPT tables we really shouldn't evaluate a string which is potentially crafted with evil intentions. Hence rather use `export -n` to absorb the uevent's variables into the environment. Fixes commit da52dd0c83 (base-files: quote values when evaluating uevent) Signed-off-by: Daniel Golle <daniel@makrotopia.org> [mschiffer@universe-factory.net: suggested export -n usage]
* base-files: quote values when evaluating ueventDaniel Golle2018-02-111-3/+2
| | | | | | | | When sourcing /sys/class/block/*/uevent values have to be quoted as they may contain spaces (e.g. in PARTNAME). Fix this by pre-processing with sed before sourcing. Signed-off-by: Daniel Golle <daniel@makrotopia.org>