diff --git a/dracut/anaconda-lib.sh b/dracut/anaconda-lib.sh index e91e7f65137..a03f2356a73 100755 --- a/dracut/anaconda-lib.sh +++ b/dracut/anaconda-lib.sh @@ -26,6 +26,10 @@ config_get() { \[*\]*) cursec="${line#[}"; cursec="${cursec%%]*}" ;; *=*) k="${line%%=*}"; v="${line#*=}" ;; esac + # trim leading and trailing whitespace characters + k=$(echo "$k" | sed 's/^ *//;s/ *$//') + v=$(echo "$v" | sed 's/^ *//;s/ *$//') + if [ "$cursec" = "$section" ] && [ "$k" == "$key" ]; then echo "$v" break @@ -108,6 +112,10 @@ anaconda_net_root() { local repo="$1" info "anaconda: fetching stage2 from $repo" + # Remove last `/` from repo to enable cunstructs like ...os/../BaseOS/image/install.img + # Otherwise curl will fail to work with `...os//../BaseOS...` + repo=${repo%/} + # Try to get the local path to stage2 from treeinfo. treeinfo=$(fetch_url "$repo/.treeinfo" 2> /tmp/treeinfo_err) && \ stage2=$(config_get stage2 mainimage < "$treeinfo")