diff options
author | Daniel Golle <daniel@makrotopia.org> | 2021-03-31 13:47:35 +0100 |
---|---|---|
committer | Daniel Golle <daniel@makrotopia.org> | 2021-03-31 16:53:39 +0100 |
commit | bb107ad9c13d244bf4aed255da913d6000c28833 (patch) | |
tree | 949ef3e7d9cec809f69e9cb03302b5a66e680646 /package/base-files/files/lib/functions.sh | |
parent | 0bc5ecf2d0fdc47ccbc60a840e595937e79689c3 (diff) | |
download | upstream-bb107ad9c13d244bf4aed255da913d6000c28833.tar.gz upstream-bb107ad9c13d244bf4aed255da913d6000c28833.tar.bz2 upstream-bb107ad9c13d244bf4aed255da913d6000c28833.zip |
base-files: functions: introduce new helper functions
Introduce cmdline_get_var() to /lib/function.sh and make use of it in
export_rootdev() in /lib/upgrade/common.sh, making the code more
simple and removing one level of indentation.
Introduce get_partition_by_name() to /lib/upgrade/common.sh which is
useful on non-EFI GPT platforms like mt7622.
Remove some dead-code while at it.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'package/base-files/files/lib/functions.sh')
-rw-r--r-- | package/base-files/files/lib/functions.sh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh index 2bad45324f..d8604415cc 100644 --- a/package/base-files/files/lib/functions.sh +++ b/package/base-files/files/lib/functions.sh @@ -384,4 +384,14 @@ board_name() { [ -e /tmp/sysinfo/board_name ] && cat /tmp/sysinfo/board_name || echo "generic" } +cmdline_get_var() { + local var=$1 + local cmdlinevar tmp + + for cmdlinevar in $(cat /proc/cmdline); do + tmp=${cmdlinevar##${var}} + [ "=" = "${tmp:0:1}" ] && echo ${tmp:1} + done +} + [ -z "$IPKG_INSTROOT" ] && [ -f /lib/config/uci.sh ] && . /lib/config/uci.sh |