diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2018-07-25 23:26:31 +0800 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2018-07-26 01:16:31 +0800 |
commit | abae8968403eeb1fa7a5e6908555a1dece6e5ec3 (patch) | |
tree | 96d06a57d8310368e980c1b20bea60b43d78dca6 | |
parent | f273172beb41326c8dc81e5b734e3ee00b0930b5 (diff) |
scripts/functions: Merge information from BOOTIF/DEVICE and ip parameters
If the BOOTIF parameter or the DEVICE configuration parameter is set,
and the ip parameter is also set but does not specify a device name,
we need to convey the device name to ipconfig as well as the ip
parameter value.
Previously we didn't do this if the value was a colon-separated list.
But now that we can parse the list correctly, it's easy to substitute
the device name into it.
Closes: #721088
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | scripts/functions | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/scripts/functions b/scripts/functions index 997269c..7c6f8aa 100644 --- a/scripts/functions +++ b/scripts/functions @@ -182,15 +182,21 @@ get_fstype () _handle_device_vs_ip() { - # If the ip= parameter is present and is a colon-separated list - # that specifies a device, use that in preference to any device - # name we already have. + # If the ip= parameter is present and is a colon-separated list, + # then: + # - If it specifies a device, use that in preference to any + # device name we already have + # - Otherwise, substitute in any device name we already have local IFS=: set -f set -- ${IP} set +f if [ -n "$6" ]; then DEVICE="$6" + elif [ $# -ge 2 ] && [ -n "${DEVICE}" ]; then + IP="$1:$2:$3:$4:$5:${DEVICE}" + shift 6 || shift $# + IP="${IP}:$*" fi } |