]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Patch lxc-update-config 2370/head
authorJulien Surloppe <julien@surloppe.fr>
Fri, 1 Jun 2018 13:38:57 +0000 (15:38 +0200)
committerJulien Surloppe <julien@surloppe.fr>
Fri, 1 Jun 2018 13:41:56 +0000 (15:41 +0200)
The current script doesn't generate a valid configuration for
lxc.network.ipv4 key, it lacking an .address part which lead to:

parse.c: lxc_file_for_each_line: 58 Failed to parse config: lxc.net.0.ipv4 = 192.168.10.101/24

Signed-off-by: Julien Surloppe <julien@surloppe.fr>
src/lxc/cmd/lxc-update-config.in

index fd9110345926643a78bbd7691d1cc847797f0e2b..16a56dea1ce8bc5663068e395b1a9da3b53ce7d4 100644 (file)
@@ -102,7 +102,10 @@ while read -r LINE; do
        # one we bump IDX and replace any "lxc.network.<subkey>" keys we
        # encounter with "lxc.network.<IDX>.<subkey>".
        echo "${LINE}" | grep -q "lxc.network.type" && IDX=$((IDX+1))
-       sed -i -e "${LINE_NUM} s/\([[:blank:]*]\|#*\)\(lxc\.network\)\.\([^[:digit:]*]\)/\1lxc\.net\.${IDX}\.\3/g" "${CONFIGPATH}"
+       sed -i \
+-e "${LINE_NUM} s/\([[:blank:]*]\|#*\)\(lxc\.network\)\(\.ipv[[:digit:]]\)\([[:blank:]]*\)=\(.*\)/\1lxc\.net\.${IDX}\3\.address\4=\5/g" \
+-e "${LINE_NUM} s/\([[:blank:]*]\|#*\)\(lxc\.network\)\.\([^[:digit:]*]\)/\1lxc\.net\.${IDX}\.\3/g" \
+       "${CONFIGPATH}"
 done < "${TMPFILE}"
 
 rm "${TMPFILE}"