Add a knob to avoid the unmounting of some points.
This commit is contained in:
		@@ -1,5 +1,5 @@
 | 
				
			|||||||
DIR=	${CONFDIR}
 | 
					DIR=	${CONFDIR}
 | 
				
			||||||
CONF=	bootmisc fsck hostname local net urandom
 | 
					CONF=	bootmisc fsck hostname local localmount net urandom
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MK=	../mk
 | 
					MK=	../mk
 | 
				
			||||||
include ${MK}/os.mk
 | 
					include ${MK}/os.mk
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										3
									
								
								conf.d/localmount
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								conf.d/localmount
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					# Stop the unmounting of certain points.
 | 
				
			||||||
 | 
					# This could be useful for some NFS related work.
 | 
				
			||||||
 | 
					#no_umounts="/dir1:/var/dir2"
 | 
				
			||||||
@@ -4,6 +4,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
. @SYSCONFDIR@/init.d/functions.sh
 | 
					. @SYSCONFDIR@/init.d/functions.sh
 | 
				
			||||||
. "${RC_LIBDIR}"/sh/rc-functions.sh
 | 
					. "${RC_LIBDIR}"/sh/rc-functions.sh
 | 
				
			||||||
 | 
					[ -r @SYSCONFDIR@/conf.d/localmount ] && . @SYSCONFDIR@/conf.d/localmount
 | 
				
			||||||
[ -r @SYSCONFDIR@/rc.conf ] && . @SYSCONFDIR@/rc.conf
 | 
					[ -r @SYSCONFDIR@/rc.conf ] && . @SYSCONFDIR@/rc.conf
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Support LiveCD foo
 | 
					# Support LiveCD foo
 | 
				
			||||||
@@ -79,6 +80,20 @@ if [ "${RC_UNAME}" = "Linux" ]; then
 | 
				
			|||||||
	# We need the do_unmount function
 | 
						# We need the do_unmount function
 | 
				
			||||||
	. "${RC_LIBDIR}"/sh/rc-mount.sh
 | 
						. "${RC_LIBDIR}"/sh/rc-mount.sh
 | 
				
			||||||
	eindent
 | 
						eindent
 | 
				
			||||||
 | 
						no_umounts_r="/|/dev|/dev/.*|${RC_SVCDIR}"
 | 
				
			||||||
 | 
						# RC_NO_UMOUNTS is an env var that can be set by plugins
 | 
				
			||||||
 | 
						OIFS=${IFS} SIFS=${IFS-y}
 | 
				
			||||||
 | 
						IFS=$IFS:
 | 
				
			||||||
 | 
						for x in ${no_umounts} ${RC_NO_UMOUNTS}; do
 | 
				
			||||||
 | 
							no_umounts_r="${no_umounts_r}|${x}"
 | 
				
			||||||
 | 
						done
 | 
				
			||||||
 | 
						if [ "${SIFS}" = "y" ]; then
 | 
				
			||||||
 | 
							IFS=$OIFS
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							unset IFS
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
						no_umounts_r="${no_umounts_r}|/proc|/proc/.*|/sys|/sys/.*"
 | 
				
			||||||
 | 
						no_umounts_r="^(${no_umounts})$"
 | 
				
			||||||
	fs=
 | 
						fs=
 | 
				
			||||||
	for x in ${net_fs_list}; do
 | 
						for x in ${net_fs_list}; do
 | 
				
			||||||
		fs="${fs}${fs:+|}${x}"
 | 
							fs="${fs}${fs:+|}${x}"
 | 
				
			||||||
@@ -86,7 +101,6 @@ if [ "${RC_UNAME}" = "Linux" ]; then
 | 
				
			|||||||
	[ -n "${fs}" ] && fs="^(${fs})$"
 | 
						[ -n "${fs}" ] && fs="^(${fs})$"
 | 
				
			||||||
	do_unmount "mount -n -o remount,ro" \
 | 
						do_unmount "mount -n -o remount,ro" \
 | 
				
			||||||
		--skip-point-regex "^(/dev|/dev/.*|/proc|/proc/.*|/sys|/sys/.*)$" \
 | 
							--skip-point-regex "^(/dev|/dev/.*|/proc|/proc/.*|/sys|/sys/.*)$" \
 | 
				
			||||||
		--skip-options-regex "^ro" \
 | 
					 | 
				
			||||||
		${fs:+--skip-fstype-regex} ${fs} --nonetdev
 | 
							${fs:+--skip-fstype-regex} ${fs} --nonetdev
 | 
				
			||||||
	eoutdent
 | 
						eoutdent
 | 
				
			||||||
	eend $?
 | 
						eend $?
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,13 +30,13 @@ start()
 | 
				
			|||||||
stop()
 | 
					stop()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	# We never unmount / or /dev or $RC_SVCDIR
 | 
						# We never unmount / or /dev or $RC_SVCDIR
 | 
				
			||||||
	local x= no_umounts="/|/dev|/dev/.*|${RC_SVCDIR}"
 | 
						local x= no_umounts_r="/|/dev|/dev/.*|${RC_SVCDIR}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# RC_NO_UMOUNTS is an env var that can be set by plugins
 | 
						# RC_NO_UMOUNTS is an env var that can be set by plugins
 | 
				
			||||||
	OIFS=${IFS} SIFS=${IFS-y}
 | 
						OIFS=${IFS} SIFS=${IFS-y}
 | 
				
			||||||
	IFS=$IFS:
 | 
						IFS=$IFS:
 | 
				
			||||||
	for x in ${no_umounts} ${RC_NO_UMOUNTS}; do
 | 
						for x in ${no_umounts} ${RC_NO_UMOUNTS}; do
 | 
				
			||||||
		no_umounts="${no_umounts}|${x}"
 | 
							no_umounts_r="${no_umounts_r}|${x}"
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
	if [ "${SIFS}" = "y" ]; then
 | 
						if [ "${SIFS}" = "y" ]; then
 | 
				
			||||||
		IFS=$OIFS
 | 
							IFS=$OIFS
 | 
				
			||||||
@@ -45,9 +45,9 @@ stop()
 | 
				
			|||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ "${RC_UNAME}" = "Linux" ]; then
 | 
						if [ "${RC_UNAME}" = "Linux" ]; then
 | 
				
			||||||
		no_umounts="${no_umounts}|/proc|/proc/.*|/sys|/sys/.*"
 | 
							no_umounts_r="${no_umounts_r}|/proc|/proc/.*|/sys|/sys/.*"
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
	no_umounts="^(${no_umounts})$"
 | 
						no_umounts_r="^(${no_umounts})$"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Flush all pending disk writes now
 | 
						# Flush all pending disk writes now
 | 
				
			||||||
	sync; sync
 | 
						sync; sync
 | 
				
			||||||
@@ -63,7 +63,7 @@ stop()
 | 
				
			|||||||
	# Umount loopback devices
 | 
						# Umount loopback devices
 | 
				
			||||||
	einfo "Unmounting loopback devices"
 | 
						einfo "Unmounting loopback devices"
 | 
				
			||||||
	eindent
 | 
						eindent
 | 
				
			||||||
	do_unmount "umount -d" --skip-point-regex "${no_umounts}" \
 | 
						do_unmount "umount -d" --skip-point-regex "${no_umounts_r}" \
 | 
				
			||||||
		--node-regex "^/dev/loop"
 | 
							--node-regex "^/dev/loop"
 | 
				
			||||||
	eoutdent
 | 
						eoutdent
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user