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: helpers/, init.d/, /
Date: Tue, 31 Dec 2013 05:28:03 +0000 (UTC)	[thread overview]
Message-ID: <1388463308.d2e712f832cc81db8e35c964991ea3bab7a4b0f0.williamh@gentoo> (raw)

commit:     d2e712f832cc81db8e35c964991ea3bab7a4b0f0
Author:     William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 29 03:56:12 2013 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Dec 31 04:15:08 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/udev-gentoo-scripts.git;a=commit;h=d2e712f8

Move code from dev-root-link helper to udev init script

This code should only be run by the udev init script, so let's put it
inside the script instead of making it a helper.

X-Gentoo-Bug: 495086
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=495086

---
 Makefile                 |  1 -
 helpers/dev-root-link.sh | 22 ----------------------
 init.d/udev              | 19 ++++++++++++++++++-
 3 files changed, 18 insertions(+), 24 deletions(-)

diff --git a/Makefile b/Makefile
index d631832..b1739ed 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,6 @@ CONFD ?= $(SYSCONFDIR)/conf.d
 INITD ?= $(SYSCONFDIR)/init.d
 
 HELPERS = \
-	helpers/dev-root-link.sh \
 	helpers/net.sh
 
 all:

diff --git a/helpers/dev-root-link.sh b/helpers/dev-root-link.sh
deleted file mode 100644
index b92c47e..0000000
--- a/helpers/dev-root-link.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh -e
-#
-# dev-root-link.sh: create /dev/root symlink
-#
-# Distributed under the terms of the GNU General Public License v2
-#
-# This is here because some software expects /dev/root to exist.
-# For more information, see this bug:
-# https://bugs.gentoo.org/show_bug.cgi?id=438380
-
-RULESDIR=/run/udev/rules.d
-
-[ -d $RULESDIR ] || mkdir -p $RULESDIR
-
-eval $(udevadm info --export --export-prefix=ROOT_ --device-id-of-file=/ || true)
-
-[ "$ROOT_MAJOR" -a "$ROOT_MINOR" ] || exit 0
-
-# btrfs filesystems have bogus major/minor numbers
-[ "$ROOT_MAJOR" != 0 ] || exit 0
-
-echo 'ACTION=="add|change", SUBSYSTEM=="block", ENV{MAJOR}=="'$ROOT_MAJOR'", ENV{MINOR}=="'$ROOT_MINOR'", SYMLINK+="root"' > $RULESDIR/61-dev-root-link.rules

diff --git a/init.d/udev b/init.d/udev
index 0e9abfe..c861338 100644
--- a/init.d/udev
+++ b/init.d/udev
@@ -93,11 +93,28 @@ start_udevmonitor()
 		--background --exec /bin/udevadm -- monitor ${udev_monitor_opts}
 }
 
+# This is here because some software expects /dev/root to exist.
+# For more information, see this bug:
+# https://bugs.gentoo.org/show_bug.cgi?id=438380
+dev_root_link()
+{
+	local RULESDIR=/run/udev/rules.d
+	[ -d $RULESDIR ] || mkdir -p $RULESDIR
+	eval $(udevadm info --export --export-prefix=ROOT_ --device-id-of-file=/ ||
+		true)
+	[ "$ROOT_MAJOR" -a "$ROOT_MINOR" ] || return 0
+
+	# btrfs filesystems have bogus major/minor numbers
+	[ "$ROOT_MAJOR" != 0 ] || return 0
+
+	echo 'ACTION=="add|change", SUBSYSTEM=="block", ENV{MAJOR}=="'$ROOT_MAJOR'", ENV{MINOR}=="'$ROOT_MINOR'", SYMLINK+="root"' > $RULESDIR/61-dev-root-link.rules
+}
+
 populate_dev()
 {
 	if yesno ${rc_dev_root_symlink:-yes}; then
 		ebegin "Generating a rule to create a /dev/root symlink"
-		/lib/udev/dev-root-link.sh
+		dev_root_link
 		eend $?
 	fi
 


             reply	other threads:[~2013-12-31  5:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-31  5:28 William Hubbs [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-06-30 23:47 [gentoo-commits] proj/udev-gentoo-scripts:master commit in: helpers/, init.d/, / 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=1388463308.d2e712f832cc81db8e35c964991ea3bab7a4b0f0.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