[Pkg-sysvinit-devel] Bug#383123: mountnfs.sh: Patch to mount remote block devices as well

Andrew Pollock apollock at debian.org
Tue Aug 15 04:44:27 UTC 2006


Package: initscripts
Version: 2.86.ds1-15
Severity: normal

Related to #383073, merge if you wish.

Please find attached a patch that extends /etc/init.d/mountnfs.sh to
also mount filesystems on network-accessed block devices, that cannot be
mounted when /etc/init.d/mountall.sh is run.

This was crafted for a system using ATA over Ethernet, but should apply
equally as well to one using NBD, or any other implementation for that
matter.

regards

Andrew

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.15-1-686
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8)

Versions of packages initscripts depends on:
ii  debianutils   2.15.2                     Miscellaneous utilities specific t
ii  e2fsprogs     1.38+1.39-WIP-2005.12.31-1 ext2 file system utilities and lib
ii  libc6         2.3.6-7                    GNU C Library: Shared libraries
ii  lsb-base      3.0-15                     Linux Standard Base 3.0 init scrip
ii  mount         2.12r-6                    Tools for mounting and manipulatin

initscripts recommends no packages.

-- no debconf information
-------------- next part --------------
--- /etc/init.d/mountnfs.sh.orig	2006-08-14 19:35:28.000000000 -0700
+++ /etc/init.d/mountnfs.sh	2006-08-14 19:50:53.000000000 -0700
@@ -36,6 +36,7 @@
 
 	portmap=no
 	gss_or_idmap=no
+	mount_netdev=no
 	while read DEV MTPT FSTYPE OPTS REST
 	do
 		case "$DEV" in
@@ -47,6 +48,9 @@
 		  noauto|*,noauto|noauto,*|*,noauto,*)
 			continue
 			;;
+		  _netdev|*,_netdev|_netdev,*|*,_netdev,*)
+			mount_netdev=yes
+			;;
 		esac
 		case "$FSTYPE" in
 		  nfs|nfs4)
@@ -151,6 +155,30 @@
 			fi
 		fi
 	fi
+	if [ "$mount_netdev" = yes ]; then
+		mount_all_netdev() { mount -a -O _netdev ; }
+		if [ "$VERBOSE" = no ]
+		then
+			MOUNT_OUT="$(LC_ALL=C mount_all_netdev)"
+			ES=$?
+			echo "$MOUNT_OUT" | sed -e '/already mounted/d' -e '/nothing was mounted/d'
+			if [ 0 = "$ES" ] || [ 96 = "$ES" ] || [ 64 = "$ES" ]
+			then
+				log_action_end_msg 0
+			else
+				log_action_end_msg 1 "code $ES"
+			fi
+		else
+			mount_all_netdev
+			ES=$?
+			if [ 0 = "$ES" ] || [ 96 = "$ES" ] || [ 64 = "$ES" ]
+			then
+				log_success_msg "Done mounting remote filesystems."
+			else
+				log_failure_msg "Mounting remote filesystems failed with error code ${ES}."
+			fi
+		fi
+	fi
 }
 
 


More information about the Pkg-sysvinit-devel mailing list