]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
NFS: Add support for debian based distros
authorPhilippe Seewer <philippe.seewer@bfh.ch>
Tue, 16 Jun 2009 07:56:31 +0000 (09:56 +0200)
committerPhilippe Seewer <philippe.seewer@bfh.ch>
Wed, 17 Jun 2009 06:37:38 +0000 (08:37 +0200)
This patch enhances nfsroot and the nfs test-suite with compatibility
for debian based distros. This is mainly the difference of using
portmap instead of rpcbind and the missing file /etc/netconfig

modules.d/95nfs/check
modules.d/95nfs/install
modules.d/95nfs/nfsroot
modules.d/99base/init
test/TEST-20-NFS/server-init
test/TEST-20-NFS/test.sh

index 0625322ee8349f57e9ac251177a6e75a13cbd80d..f72aaae4c4a5997507dbdee1941c1822dbc37e7a 100755 (executable)
@@ -7,5 +7,6 @@
 [ "$1" = "-h" ] && ! egrep -q '/ nfs[34 ]' /proc/mounts && exit 1
 
 # If our prerequisites are not met, fail anyways.
-which rpcbind rpc.statd mount.nfs mount.nfs4 umount >/dev/null 2>&1 || exit 1
+which rpcbind >/dev/null 2>&1 || which portmap >/dev/null 2>&1 || exit 1
+which rpc.statd mount.nfs mount.nfs4 umount >/dev/null 2>&1 || exit 1
 exit 0
index 1e9ab7b7fc23b9ecbda918d892e3b0f5b8810bd7..a8e3ef195be85a18dad7168e2e5837f9b6fafc4a 100755 (executable)
@@ -1,6 +1,10 @@
 #!/bin/sh
-dracut_install rpcbind rpc.statd mount.nfs mount.nfs4 umount 
-dracut_install /etc/netconfig /etc/passwd /etc/services 
+which portmap >/dev/null 2>&1 && dracut_install portmap
+which rpcbind >/dev/null 2>&1 && dracut_install rpcbind
+
+dracut_install rpc.statd mount.nfs mount.nfs4 umount 
+[ -f /etc/netconfig ] && dracut_install /etc/netconfig 
+dracut_install /etc/passwd /etc/services 
 dracut_install /etc/nsswitch.conf /etc/rpc /etc/protocols
 dracut_install rpc.idmapd /etc/idmapd.conf
 if ldd $(which rpc.idmapd) |grep -q lib64; then
index cd3bc7cdd6e18857fb5e273225d773cccf3b5fda..23fc3aa8ee7d669b123a579aebcaac8fac6e27d4 100755 (executable)
@@ -68,7 +68,8 @@ incol2 /proc/filesystems nfs4 || modprobe nfs || exit 1
 # Start rpcbind and rpc.statd as mount won't let us use locks on a NFSv4
 # filesystem without talking to them, even though they are unneeded
 # XXX occasionally saw 'rpcbind: fork failed: No such device' -- why?
-[ -n "$(pidof rpcbind)" ] || rpcbind
+[ -x /sbin/portmap ] && [ -z "$(pidof portmap)" ] && portmap
+[ -x /sbin/rpcbind ] && [ -z "$(pidof rpcbind)" ] && rpcbind
 [ -n "$(pidof rpc.statd)" ] || rpc.statd
 
 # XXX should I do rpc.idmapd here, or wait and start in the new root
index 998f5e62f7fa82623875cf9b33e1df443d78d805..644b62af889177446ec4a56c152fd02dde86f4c1 100755 (executable)
@@ -7,11 +7,11 @@
 
 emergency_shell()
 {
-    source_all emergency
     echo ; echo
     echo "Bug in initramfs /init detected. Dropping to a shell. Good luck!"
     echo
     sh -i
+    source_all emergency
 }
 
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
index c64a1ea4e2870fb266d3cdd94b6c07490c05fab3..44ee193aa4b5c360c16e307d91b6aa4e31b8e7df 100755 (executable)
@@ -15,7 +15,8 @@ mount --bind /nfs/client /nfs/ip/192.168.50.101
 mount --bind /nfs/client /nfs/tftpboot/nfs4-5
 modprobe sunrpc
 mount -t rpc_pipefs sunrpc /var/lib/nfs/rpc_pipefs
-rpcbind
+[ -x /sbin/portmap ] && portmap
+[ -x /sbin/rpcbind ] && rpcbind
 modprobe nfsd
 mount -t nfsd nfsd /proc/fs/nfsd
 exportfs -r
index 64bb3562e7730e13d1c39d1c51923113eaa53ed2..5e648508ab1b05c5860a406210335f3c6ced3e19 100755 (executable)
@@ -272,8 +272,11 @@ test_setup() {
        . $basedir/dracut-functions
        dracut_install sh ls shutdown poweroff stty cat ps ln ip \
            /lib/terminfo/l/linux dmesg mkdir cp ping exportfs \
-           rpcbind modprobe rpc.nfsd rpc.mountd dhcpd showmount tcpdump \
-           /etc/netconfig /etc/services sleep mount
+           modprobe rpc.nfsd rpc.mountd dhcpd showmount tcpdump \
+           /etc/services sleep mount
+       which portmap >/dev/null 2>&1 && dracut_install portmap
+       which rpcbind >/dev/null 2>&1 && dracut_install rpcbind
+       [ -f /etc/netconfig ] && dracut_install /etc/netconfig 
        instmods nfsd sunrpc ipv6
        inst ./server-init /sbin/init
        inst ./hosts /etc/hosts