diff options
| author | Roy Marples <roy@marples.name> | 2007-05-23 14:12:06 +0000 | 
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2007-05-23 14:12:06 +0000 | 
| commit | d94d68767aab2b05d369092111338e25ba69e027 (patch) | |
| tree | 22ec43e1761aedcd34e26cb067c8833683d0a73c /sh.Linux/init.sh | |
| parent | f754cfd2a936d8ccc13839f9ecdefc663bf746f6 (diff) | |
| download | openrc-d94d68767aab2b05d369092111338e25ba69e027.tar.xz | |
Harden testing of /proc being valid
Diffstat (limited to 'sh.Linux/init.sh')
| -rwxr-xr-x | sh.Linux/init.sh | 20 | 
1 files changed, 19 insertions, 1 deletions
diff --git a/sh.Linux/init.sh b/sh.Linux/init.sh index bbc5e2c6..4aac61b4 100755 --- a/sh.Linux/init.sh +++ b/sh.Linux/init.sh @@ -100,7 +100,24 @@ fi  check_statedir /proc  # By default VServer already has /proc mounted, but OpenVZ does not! -if [ ! -e /proc/self/stat ] ; then +# However, some of our users have an old proc image in /proc +# NFC how they managed that, but the end result means we have to test if +# /proc actually works or not. We to this by comparing uptime to one a second +# ago +mountproc=true +if [ -e /proc/uptime ] ; then +	up="$(cat /proc/uptime)" +	sleep 1 +	if [ "${up}" = "$(cat /proc/uptime)" ] ; then +		eerror "You have cruft in /proc that should be deleted" +	else +		einfo "/proc is already mounted, skipping" +		mountproc=false +	fi +	unset up +fi + +if ${mountproc} ; then  	procfs="proc"  	[ "${RC_UNAME}" = "GNU/kFreeBSD" ] && proc="linprocfs"  	ebegin "Mounting ${procfs} at /proc" @@ -108,6 +125,7 @@ if [ ! -e /proc/self/stat ] ; then  	try mount -n ${mntcmd:--t ${procfs} -o noexec,nosuid,nodev proc /proc}  	eend $?  fi +unset mountproc  # Read off the kernel commandline to see if there's any special settings  # especially check to see if we need to set the  CDBOOT environment variable  | 
