[Pkg-sysvinit-devel] Bug#625726: Patch for grep syntax error in /etc/network/if-up.d/mountnfs

matthew bdo491640 at mailinator.com
Fri Jun 24 10:29:44 UTC 2011


Package: initscripts
Version: 2.88dsf-13.10
Followup-For: Bug #625726

--- mountnfs.old        2011-06-24 20:18:54.534176665 +1000
+++ /etc/network/if-up.d/mountnfs       2011-06-24 20:18:05.480019153 +1000
@@ -117,7 +117,7 @@
 }

 exit_unless_last_interface() {
-    grep "^[:space:]*auto" /etc/network/interfaces  | \
+    grep "^[[:space:]]*auto" /etc/network/interfaces  | \
        sed -e 's/[ \t]*auto[ \t]*//;s/[ \t]*$//;s/[ \t]/\n/g' | \
        while read i; do
        if [ `grep -c $i /etc/network/run/ifstate` -eq "0" ]; then



-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.34 (SMP w/4 CPU cores)
Locale: LANG=en_AU.utf8, LC_CTYPE=en_AU.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages initscripts depends on:
ii  coreutils                  8.5-1         GNU core utilities
ii  debianutils                4.0.2         Miscellaneous utilities specific t
ii  libc6                      2.13-7        Embedded GNU C Library: Shared lib
ii  lsb-base                   3.2-27        Linux Standard Base 3.2 init scrip
ii  mount                      2.19.1-2      Tools for mounting and manipulatin
ii  sysv-rc                    2.88dsf-13.10 System-V-like runlevel change mech
ii  sysvinit-utils             2.88dsf-13.10 System-V-like utilities

Versions of packages initscripts recommends:
ii  e2fsprogs                     1.41.12-4  ext2/ext3/ext4 file system utiliti
ii  psmisc                        22.13-1    utilities that use the proc file s

initscripts suggests no packages.

-- Configuration Files:
/etc/network/if-up.d/mountnfs changed:
PATH=/sbin:/bin
.. /lib/init/vars.sh
.. /lib/lsb/init-functions
.. /lib/init/mount-functions.sh
set_env() {
	[ -f /etc/fstab ] || return
	#
	# Read through fstab line by line. If it is NFS, set the flag
	# for mounting NFS file systems. If any NFS partition is found and it
	# not mounted with the nolock option, we start the portmapper.
	# 
	# If any sec={krb5,krb5i,krb5p} option is given, or any of the file
	# systems are nfs4, we'll need to start rpc.gssd and/or rpc.idmapd too;
	# we'll leave that to nfs-common.
	#
	exec 9<&0 </etc/fstab
	start_nfs=no
	NETFS=""
	NETDEV=""
	while read DEV MTPT FSTYPE OPTS REST
	do
		case "$DEV" in
		  ""|\#*)
			continue
			;;
		esac
		case "$OPTS" in
		  noauto|*,noauto|noauto,*|*,noauto,*)
			continue
			;;
		  _netdev|*,_netdev|_netdev,*|*,_netdev,*)
			NETDEV=yes
			;;
		esac
		case "$FSTYPE" in
		  nfs)
		  	# NFS filsystems normally require statd and portmap. However,
			# if nolock is set, portmap and statd are not required for this
			# file system.
			case "$OPTS" in
			  nolock|*,nolock|nolock,*|*,nolock,*)
			  	# no action
				;;
			  *)
				start_nfs=yes
				;;
			esac
			# However, Kerberos requires gssd, so start nfs-common anyway.
			case "$OPTS" in
			  sec=krb5|*,sec=krb5|sec=krb5,*|*,sec=krb5,*|sec=krb5i|*,sec=krb5i|sec=krb5i,*|*,sec=krb5i,*|sec=krb5p|*,sec=krb5p|sec=krb5p,*|*,sec=krb5p,*)
			  	start_nfs=yes
				;;
			esac
			;;
		  nfs4)
			# NFSv4 requires idmapd, so start nfs-common no matter what the options are.
			start_nfs=yes
			;;
		  smbfs|cifs|coda|ncp|ncpfs|ocfs2|gfs)
			;;
		  *)
			FSTYPE=
			;;
		esac
		if [ "$FSTYPE" ]
		then
			case "$NETFS" in
			  $FSTYPE|*,$FSTYPE|$FSTYPE,*|*,$FSTYPE,*)
				;;
			  *)
				NETFS="$NETFS${NETFS:+,}$FSTYPE"
				;;
			esac
		fi
	done
	exec 0<&9 9<&-
}
do_start() {
	#
	# Initialize nfs-common (which starts rpc.statd, rpc.gssd
	# and/or rpc.idmapd, and loads the right kernel modules if
	# applicable) if we use Kerberos and/or NFSv4 mounts.
	#
	if [ "$start_nfs" = yes ] && [ -x /etc/init.d/nfs-common ]
	then
		[ -x /etc/init.d/portmap ] && /etc/init.d/portmap start
		[ -x /etc/init.d/rpcbind ] && /etc/init.d/rpcbind start
		/etc/init.d/nfs-common start
	fi
	pre_mountall
	if [ "$NETFS" ]
	then
		mount -a -t$NETFS
	fi
	if [ "$NETDEV" ]; then
		mount -a -O _netdev
	fi
	post_mountall
}
exit_unless_last_interface() {
    grep "^[[:space:]]*auto" /etc/network/interfaces  | \
	sed -e 's/[ \t]*auto[ \t]*//;s/[ \t]*$//;s/[ \t]/\n/g' | \
	while read i; do
	if [ `grep -c $i /etc/network/run/ifstate` -eq "0" ]; then
	    msg="if-up.d/mountnfs[$IFACE]: waiting for interface $i before doing NFS mounts"
	    log_warning_msg "$msg"
	    # Can not pass this as a variable because of the while subshell
	    mkdir /var/run/network/mountnfs_earlyexit 2> /dev/null
	fi
    done
    if [ -d /var/run/network/mountnfs_earlyexit ]; then
	rmdir /var/run/network/mountnfs_earlyexit 2>/dev/null
	exit 0
    fi
}
set_env
if [ "$start_nfs" = "no" ] && [ ! "$NETFS" ] && [ ! "$NETDEV" ]; then
  exit 0
fi
if [ no != "$ASYNCMOUNTNFS" ]; then
    # Not for loopback!
    [ "$IFACE" != "lo" ] || exit 0
    # Lock around this otherwise insanity may occur
    mkdir /var/run/network          2>/dev/null || true
    # Wait until all auto interfaces are up before attemting to mount
    # network file systems.
    exit_unless_last_interface
    if mkdir /var/run/network/mountnfs 2>/dev/null ; then
	:
    else
	msg="if-up.d/mountnfs[$IFACE]: lock /var/run/network/mountnfs exist, not mounting"
	log_failure_msg "$msg"
	# Log if /usr/ is mounted
	[ -x /usr/bin/logger ] && /usr/bin/logger -t "if-up.d/mountnfs[$IFACE]" "$msg"
	exit 0
    fi
    on_exit() {
        # Clean up lock when script exits, even if it is interrupted
	rmdir /var/run/network/mountnfs 2>/dev/null || exit 0
    }
    trap on_exit EXIT # Enable emergency handler
    do_start
elif [ yes = "$FROMINITD" ] ; then
    do_start
fi


-- no debconf information





More information about the Pkg-sysvinit-devel mailing list