Blob Blame History Raw
From 4350c73199b3d2ac1e22b5e2e093de12ca5ad598 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 2 Jul 2015 15:21:35 +0200
Subject: [PATCH] nfs/nfs-lib.sh: add anaconda_nfsv6_to_var()

add "nfs:[[2001:0db8:85a3:08d3:1319:8a2e:0370:7344]]/path" style parsing

https://bugzilla.redhat.com/show_bug.cgi?id=1190098
(cherry picked from commit ba665de454e7d6ef1da4ba95308fb9f65c7a9497)
---
 modules.d/95nfs/nfs-lib.sh | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/modules.d/95nfs/nfs-lib.sh b/modules.d/95nfs/nfs-lib.sh
index bf7d044..4f24f69 100755
--- a/modules.d/95nfs/nfs-lib.sh
+++ b/modules.d/95nfs/nfs-lib.sh
@@ -17,6 +17,7 @@ nfs_to_var() {
     # FIXME: local netif=${2:-$netif}?
     case "$1" in
         nfs://*) rfc2224_nfs_to_var "$1" ;;
+        nfs:*[*) anaconda_nfsv6_to_var "$1" ;;
         nfs:*:*:/*) anaconda_nfs_to_var "$1" ;;
         *) nfsroot_to_var "$1" ;;
     esac
@@ -86,6 +87,23 @@ anaconda_nfs_to_var() {
     path="/${1##*:/}"
 }
 
+# IPv6 nfs path will be treated separately
+anaconda_nfsv6_to_var() {
+    nfs="nfs"
+    path="$1:"
+    options="${path#*:/}"
+    path="/${options%%:*}"
+    server="${1#*nfs:}"
+    if str_starts $server '['; then
+        server="${server%:/*}"
+        options="${options#*:*}"
+    else
+        server="${server%:/*}"
+        options="${server%%:*}"
+        server="${server#*:}"
+    fi
+}
+
 # nfsroot_from_dhcp NETIF
 # fill in missing server/path from DHCP options.
 nfsroot_from_dhcp() {