[arch-projects] [mkinitcpio] mkinitcpio-nfs-utils add nfsv4 support

George Kranis george at kranis.org
Tue Nov 15 04:33:24 UTC 2016


Hopefully this hasn't been posted in the wrong place

>From e3349c4176a70a67411fd9959af5701467666f9f Mon Sep 17 00:00:00 2001    
From: George Kranis <george at kranis.org>    
Date: Mon, 14 Nov 2016 23:29:31 +0200    
Subject: [PATCH] mkinitcpio-nfs-utils: add nfsv4 support    
    
Signed-off-by: George Kranis <george at kranis.org>    
---    
 mkinitcpio-nfs-utils/trunk/PKGBUILD             | 2 +-    
 mkinitcpio-nfs-utils/trunk/initcpio-hook-net    | 8 +++++++-    
 mkinitcpio-nfs-utils/trunk/initcpio-install-net | 3 +++    
 3 files changed, 11 insertions(+), 2 deletions(-)    
    
diff --git a/mkinitcpio-nfs-utils/trunk/PKGBUILD b/mkinitcpio-nfs-utils/trunk/PKGBUILD    
index 27006f6..a8d8e9a 100644    
--- a/mkinitcpio-nfs-utils/trunk/PKGBUILD    
+++ b/mkinitcpio-nfs-utils/trunk/PKGBUILD    
@@ -8,7 +8,7 @@ pkgdesc="ipconfig and nfsmount tools for NFS root support in mkinitcpio"    
 arch=('i686' 'x86_64')    
 url="http://www.archlinux.org/"    
 license=('GPL2')    
-depends=('glibc')    
+depends=('glibc' 'nfs-utils')    
 source=("https://sources.archlinux.org/other/mkinitcpio/$pkgname-$pkgver.tar.xz"    
         'nfsmount-fix-wrong-umount-path.patch'    
         'initcpio-install-net'    
diff --git a/mkinitcpio-nfs-utils/trunk/initcpio-hook-net b/mkinitcpio-nfs-utils/trunk/initcpio-hook-net    
index 4d1ebb9..aa9d4ae 100644    
--- a/mkinitcpio-nfs-utils/trunk/initcpio-hook-net    
+++ b/mkinitcpio-nfs-utils/trunk/initcpio-hook-net    
@@ -62,6 +62,7 @@ run_hook() {    
                 line="${line#"${nfs_path}"}"    
                 [ -z "${nfs_path}" ] && nfs_path="${defaultrootpath}"    
                 nfs_option="${line#","}"    
+                expr match "$nfs_option" '.*vers=4.*' >/dev/null && nfs_vers=4    
             fi    
     
             # ensure root and filesystem type are set proper for nfs boot    
@@ -77,6 +78,7 @@ run_hook() {    
 }    
     
 nfs_mount_handler() {    
+    local mountcommand    
     if [ -z "$nfs_server" -o -z "$nfs_path" ]; then    
         err "Unable to mount root filesystem over NFS: wrong parameters."    
         echo "You are being dropped to a recovery shell"    
@@ -84,7 +86,11 @@ nfs_mount_handler() {    
         launch_interactive_shell    
         msg "Trying to continue (this will most likely fail) ..."    
     fi    
-    nfsmount ${nfs_option:+-o ${nfs_option}} "${nfs_server}:${nfs_path}" "$1"    
+    mountcommand=nfsmount    
+    if [ "$nfs_vers" -eq "4" ]; then    
+     mountcommand="mount.nfs4"    
+    fi    
+    $mountcommand ${nfs_option:+-o ${nfs_option}} "${nfs_server}:${nfs_path}" "$1"    
 }    
     
 # vim: set ft=sh ts=4 sw=4 et:    
diff --git a/mkinitcpio-nfs-utils/trunk/initcpio-install-net b/mkinitcpio-nfs-utils/trunk/initcpio-install-net    
index 79b6789..d2d1c27 100644    
--- a/mkinitcpio-nfs-utils/trunk/initcpio-install-net    
+++ b/mkinitcpio-nfs-utils/trunk/initcpio-install-net    
@@ -3,9 +3,12 @@    
 build() {    
     add_checked_modules '/drivers/net/'    
     add_module nfsv3?    
+    add_module sunrpc    
+    add_module nfsv4    
     
     add_binary "/usr/lib/initcpio/ipconfig" "/bin/ipconfig"    
     add_binary "/usr/lib/initcpio/nfsmount" "/bin/nfsmount"    
+    add_binary "/usr/bin/mount.nfs4" "/bin/mount.nfs4"    
     
     add_runscript    
 }    
--     
2.9.3    
    
   
  
 


More information about the arch-projects mailing list