public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "William Hubbs" <williamh@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/udev-gentoo-scripts:master commit in: init.d/
Date: Mon, 20 Feb 2012 22:10:12 +0000 (UTC)	[thread overview]
Message-ID: <1329775120.0ed42d35995bc6c35a6b6fe02a5164c4fa73a71c.WilliamH@gentoo> (raw)

commit:     0ed42d35995bc6c35a6b6fe02a5164c4fa73a71c
Author:     William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 20 21:58:40 2012 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Feb 20 21:58:40 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/udev-gentoo-scripts.git;a=commit;h=0ed42d35

fix mounting logic in udev-mount

Udev-mount now follows the following logic:

1. If there is an entry in fstab for /dev:
a. If /dev is mounted, remount it according to fstab.
b. Otherwise, mount it according to fstab.

2. Otherwise, if /dev is not mounted:
a. Mount it with default settings.
B. Otherwise, output a message and use the mounted /dev.

Reported-by: duncan <1i5t5.duncan <AT> cox.net>
X-Gentoo-Bug: 402845
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=402845

---
 init.d/udev-mount |   43 ++++++++++++++++++++++---------------------
 1 files changed, 22 insertions(+), 21 deletions(-)

diff --git a/init.d/udev-mount b/init.d/udev-mount
index 096e710..676643f 100644
--- a/init.d/udev-mount
+++ b/init.d/udev-mount
@@ -11,33 +11,34 @@ depend()
 
 mount_dev_directory()
 {
-	local rc=0
+	local mounted=false fstab=false action=--mount msg=Mounting rc=0
 
-	if mountinfo -q -f devtmpfs /dev; then
-		einfo "/dev is already mounted"
-		return 0
+	if ! grep -qs devtmpfs /proc/filesystems; then
+		eerror "Udev uses a devtmpfs mounted on /dev to manage devices."
+		eerror "This means that CONFIG_DEVTMPFS=y is required"
+		eerror "in the kernel configuration."
+		return 1
 	fi
 
+	# Is /dev already a mounted devtmpfs?
+	mountinfo -q -f devtmpfs /dev && mounted=true
+
 	# If an entry for /dev exists in fstab it must be a devtmpfs.
-	if fstabinfo -q /dev && ! fstabinfo -q -f devtmpfs /dev; then
-		eerror "The entry in /etc/fstab is not correct."
-		eerror "Udev requires it to be a devtmpfs file system."
-		return 1
-	fi
+	fstabinfo -q -t devtmpfs /dev && fstab=true
 
 	# No options are processed here as they should all be in /etc/fstab
-	ebegin "Mounting /dev"
-	if ! fstabinfo --mount /dev; then
-		if grep -qs devtmpfs /proc/filesystems; then
-			# Some devices require exec, Bug #92921
-			mount -n -t devtmpfs -o "exec,nosuid,mode=0755,size=10M" udev /dev
-			rc=$?
-		else
-			eerror "Udev uses a devtmpfs mounted on /dev to manage devices."
-			eerror "This means that CONFIG_DEVTMPFS=y is required"
-			eerror "in the kernel configuration."
-			return 1
-		fi
+	if $fstab; then
+		$mounted && action=--remount && msg=Remounting
+		ebegin "$msg /dev according to /etc/fstab"
+		fstabinfo $action /dev
+		rc=$?
+	elif ! $mounted; then
+		ebegin "Mounting /dev"
+		# Some devices require exec, Bug #92921
+		mount -n -t devtmpfs -o "exec,nosuid,mode=0755,size=10M" udev /dev
+		rc=$?
+	else
+		ebegin "Using /dev mounted from kernel"
 	fi
 
 	eend $rc



             reply	other threads:[~2012-02-20 22:10 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-20 22:10 William Hubbs [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-08-29 18:38 [gentoo-commits] proj/udev-gentoo-scripts:master commit in: init.d/ William Hubbs
2021-05-24 22:55 William Hubbs
2021-05-22 18:49 William Hubbs
2020-08-05 16:13 William Hubbs
2020-08-05 16:13 William Hubbs
2019-11-30 21:26 William Hubbs
2019-11-30 20:08 William Hubbs
2019-02-20 17:13 William Hubbs
2016-11-10 17:20 William Hubbs
2016-11-10 16:39 William Hubbs
2016-11-09 20:33 William Hubbs
2016-06-01 21:25 William Hubbs
2016-05-31 21:19 William Hubbs
2016-05-26 15:56 William Hubbs
2015-09-10 16:03 William Hubbs
2015-09-10 16:00 William Hubbs
2015-09-10 16:00 William Hubbs
2015-06-17 21:42 William Hubbs
2015-06-14 15:43 William Hubbs
2015-06-10 21:18 William Hubbs
2015-06-01 15:33 William Hubbs
2015-06-01 15:33 William Hubbs
2015-05-02 19:50 William Hubbs
2015-04-30  2:07 William Hubbs
2015-04-30  2:04 William Hubbs
2014-12-04  0:53 William Hubbs
2014-11-03 20:38 William Hubbs
2014-08-10 19:42 William Hubbs
2014-08-19  0:08 ` William Hubbs
2014-03-07 17:43 Samuli Suominen
2013-04-15 15:54 William Hubbs
2013-04-03 15:39 William Hubbs
2013-03-21 16:06 William Hubbs
2013-03-21 15:59 William Hubbs
2013-03-19 17:24 William Hubbs
2013-03-19 16:38 William Hubbs
2013-02-27 21:23 William Hubbs
2013-02-04 21:59 William Hubbs
2013-01-27 19:38 William Hubbs
2013-01-27 18:56 William Hubbs
2013-01-27 18:56 William Hubbs
2013-01-21 19:29 William Hubbs
2013-01-21 16:45 William Hubbs
2013-01-08 21:58 William Hubbs
2013-01-08 20:01 William Hubbs
2013-01-04 23:21 William Hubbs
2013-01-04 21:55 William Hubbs
2013-01-04 21:52 William Hubbs
2013-01-04 21:28 William Hubbs
2012-11-24  4:44 William Hubbs
2012-09-26 21:41 Robin H. Johnson
2012-08-01 16:22 William Hubbs
2012-07-13  0:26 William Hubbs
2012-07-12 20:59 William Hubbs
2012-07-12 20:59 William Hubbs
2012-07-04 16:27 William Hubbs
2012-07-04 15:45 William Hubbs
2012-07-01 21:09 William Hubbs
2012-06-30 23:47 William Hubbs
2012-06-30 23:47 William Hubbs
2012-06-30 23:47 William Hubbs
2012-05-01 16:57 William Hubbs
2012-05-01 16:39 William Hubbs
2012-03-20 18:43 William Hubbs
2012-02-24 21:43 Matthias Schwarzott
2012-02-14 19:07 William Hubbs
2012-02-14 17:30 William Hubbs
2012-01-08 20:15 William Hubbs
2012-01-03 17:43 William Hubbs
2012-01-03 16:26 William Hubbs
2012-01-02  0:01 William Hubbs
2011-12-22 15:47 William Hubbs
2011-12-21 19:51 William Hubbs
2011-12-09  4:42 William Hubbs
2011-12-09  3:45 William Hubbs
2011-09-14 18:03 William Hubbs
2011-09-14 17:09 William Hubbs
2011-09-05 19:58 William Hubbs
2011-09-05 19:01 William Hubbs
2011-09-04  3:23 William Hubbs
2011-09-01 19:49 William Hubbs
2011-08-17 20:26 William Hubbs
2011-08-17 16:55 William Hubbs
2011-08-03 21:22 William Hubbs
2011-07-31 20:41 William Hubbs
2011-07-15 19:18 William Hubbs
2011-07-15 18:02 William Hubbs
2011-07-15 16:30 William Hubbs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1329775120.0ed42d35995bc6c35a6b6fe02a5164c4fa73a71c.WilliamH@gentoo \
    --to=williamh@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox