Fix regex pattern for umounts during shutdown

This patch fixes the regex pattern for /lib -> /lib(32|64)?
as well as the pattern for RC_SVCDIR if it contains /lib(32|64)?/.
This fixes bug 381783.

X-Gentoo-Bug: 381783
X-Gentoo-Bug-URL: https://bugs.gentoo.org/381783
This commit is contained in:
Christian Ruppert 2011-09-11 15:12:54 +02:00
parent a9738a8508
commit 2d180551ef
2 changed files with 14 additions and 6 deletions

View File

@ -34,8 +34,12 @@ start()
stop() stop()
{ {
# We never unmount / or /dev or $RC_SVCDIR # We never unmount / or /dev or $RC_SVCDIR
local x= no_umounts_r="/|/dev|/dev/.*|${RC_SVCDIR}"
no_umounts_r="${no_umounts_r}|/bin|/sbin|/lib|/libexec" # Bug 381783
local rc_svcdir=$(echo $RC_SVCDIR | sed 's:/lib\(32\|64\)\?/:/lib(32|64)?/:g')
local x= no_umounts_r="/|/dev|/dev/.*|${rc_svcdir}"
no_umounts_r="${no_umounts_r}|/bin|/sbin|/lib(32|64)?|/libexec"
# 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
local IFS="$IFS:" local IFS="$IFS:"
for x in $no_umounts $RC_NO_UMOUNTS; do for x in $no_umounts $RC_NO_UMOUNTS; do
@ -69,7 +73,7 @@ stop()
done done
[ -n "$fs" ] && fs="^($fs)$" [ -n "$fs" ] && fs="^($fs)$"
do_unmount umount --skip-point-regex "$no_umounts_r" \ do_unmount umount --skip-point-regex "$no_umounts_r" \
${fs:+--skip-fstype-regex} $fs --nonetdev "${fs:+--skip-fstype-regex}" $fs --nonetdev
eoutdent eoutdent
return 0 return 0

View File

@ -19,8 +19,12 @@ start()
# We need the do_unmount function # We need the do_unmount function
. "$RC_LIBEXECDIR"/sh/rc-mount.sh . "$RC_LIBEXECDIR"/sh/rc-mount.sh
eindent eindent
local m="/dev|/dev/.*|/proc|/proc.*|/sys|/sys/.*|${RC_SVCDIR}" x= fs=
m="$m|/bin|/sbin|/lib|/libexec" # Bug 381783
local rc_svcdir=$(echo $RC_SVCDIR | sed 's:/lib\(32\|64\)\?/:/lib(32|64)?/:g')
local m="/dev|/dev/.*|/proc|/proc.*|/sys|/sys/.*|${rc_svcdir}" x= fs=
m="$m|/bin|/sbin|/lib(32|64)?|/libexec"
# 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
local IFS="$IFS:" local IFS="$IFS:"
for x in $no_umounts $RC_NO_UMOUNTS; do for x in $no_umounts $RC_NO_UMOUNTS; do
@ -34,7 +38,7 @@ start()
[ -n "$fs" ] && fs="^($fs)$" [ -n "$fs" ] && fs="^($fs)$"
do_unmount "umount -r" \ do_unmount "umount -r" \
--skip-point-regex "$m" \ --skip-point-regex "$m" \
${fs:+--skip-fstype-regex} $fs --nonetdev "${fs:+--skip-fstype-regex}" $fs --nonetdev
eoutdent eoutdent
eend $? eend $?
} }