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>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user