* [gentoo-commits] proj/udev-gentoo-scripts:master commit in: init.d/, /
@ 2011-10-09 15:24 William Hubbs
0 siblings, 0 replies; 4+ messages in thread
From: William Hubbs @ 2011-10-09 15:24 UTC (permalink / raw
To: gentoo-commits
commit: 5726b21454f7300677447ab7a2d0484fbbe8d43c
Author: William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 7 16:24:11 2011 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sat Oct 8 17:52:53 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/udev-gentoo-scripts.git;a=commit;h=5726b214
encorporate udev-mount script into udev script
udev-mount was a separate init script which mounted devtmpfs or
a tmpfs filesystem on /dev for use with udev.
This commit removes the separate udev-mount script and
encorporates that code into the udev script. If you need to run it
separately, you can do so with rc-service udev udev_mount or
/etc/init.d/udev udev_mount.
---
Makefile | 2 +-
init.d/udev | 91 +++++++++++++++++++++++++++++++++++++++++++++++-
init.d/udev-mount | 100 -----------------------------------------------------
3 files changed, 91 insertions(+), 102 deletions(-)
diff --git a/Makefile b/Makefile
index b88c1bd..fc23e82 100644
--- a/Makefile
+++ b/Makefile
@@ -36,7 +36,7 @@ install:
@install -m 0644 modprobe.d/* $(DESTDIR)$(MODPROBE_DIR)
@sed -e "s/%KV_MIN%/$(KV_min)/" \
-e "s/%KV_MIN_RELIABLE%/$(KV_reliable)/" \
- -i "$(DESTDIR)$(INITD)"/udev-mount
+ -i "$(DESTDIR)$(INITD)"/udev
check-git-repository:
git diff --quiet || { echo 'STOP, you have uncommitted changes in the working directory' ; false ; }
diff --git a/init.d/udev b/init.d/udev
index 57aa580..cb1ad02 100644
--- a/init.d/udev
+++ b/init.d/udev
@@ -5,6 +5,8 @@
command=/sbin/udevd
command_args="--daemon ${udev_opts}"
description="Run udevd and create the device-nodes"
+extra_commands="udev_mount"
+description_udev_mount="mount devtmpfs or tmpfs on /dev"
persistent_cd_disable="${persistent_cd_disable:-no}"
persistent_net_disable="${persistent_net_disable:-no}"
@@ -13,17 +15,40 @@ udev_debug="${udev_debug:-no}"
udev_monitor="${udev_monitor:-no}"
udev_monitor_keep_running="${udev_monitor_keep_running:-no}"
udev_settle_timeout="${udev_settle_timeout:-60}"
+unreliable_kernel_warning="${unreliable_kernel_warning:-yes}"
depend()
{
provide dev
- need sysfs udev-mount
+ need sysfs
before checkfs fsck
# udev does not work inside vservers
keyword -vserver -lxc
}
+# get_KV and KV_to_int
+. /lib/udev/shell-compat-KV.sh
+
+# FIXME
+# Instead of this script testing kernel version, udev itself should
+# Maybe something like udevd --test || exit $?
+check_kernel()
+{
+ if [ $(get_KV) -lt $(KV_to_int '%KV_MIN%') ]; then
+ eerror "Your kernel is too old to work with this version of udev."
+ eerror "Current udev only supports Linux kernel %KV_MIN% and newer."
+ return 1
+ fi
+
+ yesno "${unreliable_kernel_warning}" || return 0
+
+ if [ $(get_KV) -lt $(KV_to_int '%KV_MIN_RELIABLE%') ]; then
+ ewarn "You need at least Linux kernel %KV_MIN_RELIABLE% for reliable operation of udev."
+ fi
+ return 0
+}
+
get_rundir()
{
echo $(udevadm info --run)
@@ -36,6 +61,69 @@ cleanup()
exit 1
}
+mount_dev_directory()
+{
+ if mountinfo -q /dev; then
+ if [ "${RC_CMD}" != "start" ]; then
+ einfo "/dev is already mounted"
+ fi
+ return 0
+ fi
+
+ # No options are processed here as they should all be in /etc/fstab
+ ebegin "Mounting /dev"
+ if ! fstabinfo --mount /dev; then
+ # we mount devtmpfs if supported
+ local fs=tmpfs
+ grep -qs devtmpfs /proc/filesystems && fs=devtmpfs
+
+ # Some devices require exec, Bug #92921
+ mount -n -t "$fs" -o "exec,nosuid,mode=0755,size=10M" udev /dev
+ fi
+ eend $?
+}
+
+seed_dev()
+{
+ # Seed /dev with some things that we know we need
+
+ # creating /dev/console, /dev/tty and /dev/tty1 to be able to write
+ # to $CONSOLE with/without bootsplash before udevd creates it
+ [ -c /dev/console ] || mknod -m 600 /dev/console c 5 1
+ [ -c /dev/tty1 ] || mknod -m 620 /dev/tty1 c 4 1
+ [ -c /dev/tty ] || mknod -m 666 /dev/tty c 5 0
+
+ # udevd will dup its stdin/stdout/stderr to /dev/null
+ # and we do not want a file which gets buffered in ram
+ [ -c /dev/null ] || mknod -m 666 /dev/null c 1 3
+ ${HAVE_SELINUX} && restorecon /dev/null
+
+ # so udev can add its start-message to dmesg
+ [ -c /dev/kmsg ] || mknod -m 660 /dev/kmsg c 1 11
+
+ # Create problematic directories
+ mkdir -p /dev/pts /dev/shm
+ ${HAVE_SELINUX} && restorecon -R /dev >/dev/null
+ return 0
+}
+
+udev_mount()
+{
+ check_kernel || return 1
+ mount_dev_directory || return 1
+
+ # Selinux lovin; /selinux should be mounted by selinux-patched init
+ if [ -x /sbin/restorecon -a -c /selinux/null ]; then
+ HAVE_SELINUX=true
+ restorecon /dev > /selinux/null
+ else
+ HAVE_SELINUX=false
+ fi
+
+ seed_dev
+ return 0
+}
+
rules_disable_switch()
{
# this function disables rules files
@@ -80,6 +168,7 @@ start_pre()
ewarn "You should add udev-postmount service to your default runlevel."
fi
+ udev_mount || return 1
/lib/udev/write_root_link_rule
rules_disable_switch 75-persistent-net-generator.rules "${persistent_net_disable}"
diff --git a/init.d/udev-mount b/init.d/udev-mount
deleted file mode 100644
index f81d82d..0000000
--- a/init.d/udev-mount
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/sbin/runscript
-# Copyright 1999-2010 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-description="Mount tmpfs on /dev"
-[ -e /etc/conf.d/udev ] && . /etc/conf.d/udev
-unreliable_kernel_warning="${unreliable_kernel_warning:-yes}"
-
-# get_KV and KV_to_int
-. /lib/udev/shell-compat-KV.sh
-
-# FIXME
-# Instead of this script testing kernel version, udev itself should
-# Maybe something like udevd --test || exit $?
-check_kernel()
-{
- if [ $(get_KV) -lt $(KV_to_int '%KV_MIN%') ]; then
- eerror "Your kernel is too old to work with this version of udev."
- eerror "Current udev only supports Linux kernel %KV_MIN% and newer."
- return 1
- fi
-
- yesno "${unreliable_kernel_warning}" || return 0
-
- if [ $(get_KV) -lt $(KV_to_int '%KV_MIN_RELIABLE%') ]; then
- ewarn "You need at least Linux kernel %KV_MIN_RELIABLE% for reliable operation of udev."
- fi
- return 0
-}
-
-
-mount_dev_directory()
-{
- if mountinfo -q /dev; then
- einfo "/dev is already mounted"
- return 0
- fi
-
- # No options are processed here as they should all be in /etc/fstab
- ebegin "Mounting /dev"
- if ! fstabinfo --mount /dev; then
- # we mount devtmpfs if supported
- local fs=tmpfs
- grep -qs devtmpfs /proc/filesystems && fs=devtmpfs
-
- # Some devices require exec, Bug #92921
- mount -n -t "$fs" -o "exec,nosuid,mode=0755,size=10M" udev /dev
- fi
- eend $?
-}
-
-seed_dev()
-{
- # Seed /dev with some things that we know we need
-
- # creating /dev/console, /dev/tty and /dev/tty1 to be able to write
- # to $CONSOLE with/without bootsplash before udevd creates it
- [ -c /dev/console ] || mknod -m 600 /dev/console c 5 1
- [ -c /dev/tty1 ] || mknod -m 620 /dev/tty1 c 4 1
- [ -c /dev/tty ] || mknod -m 666 /dev/tty c 5 0
-
- # udevd will dup its stdin/stdout/stderr to /dev/null
- # and we do not want a file which gets buffered in ram
- [ -c /dev/null ] || mknod -m 666 /dev/null c 1 3
- ${HAVE_SELINUX} && restorecon /dev/null
-
- # so udev can add its start-message to dmesg
- [ -c /dev/kmsg ] || mknod -m 660 /dev/kmsg c 1 11
-
- # Create problematic directories
- mkdir -p /dev/pts /dev/shm
- ${HAVE_SELINUX} && restorecon -R /dev >/dev/null
- return 0
-}
-
-
-start()
-{
- # do not run this on too old baselayout - udev-addon is already loaded!
- if [ ! -f /etc/init.d/sysfs ]; then
- eerror "The $SVCNAME init-script is written for baselayout-2!"
- eerror "Please do not use it with baselayout-1!".
- return 1
- fi
-
- check_kernel || return 1
- mount_dev_directory || return 1
-
- # Selinux lovin; /selinux should be mounted by selinux-patched init
- if [ -x /sbin/restorecon -a -c /selinux/null ]; then
- HAVE_SELINUX=true
- restorecon /dev > /selinux/null
- else
- HAVE_SELINUX=false
- fi
-
- seed_dev
-
- return 0
-}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-commits] proj/udev-gentoo-scripts:master commit in: init.d/, /
@ 2011-10-29 20:24 William Hubbs
0 siblings, 0 replies; 4+ messages in thread
From: William Hubbs @ 2011-10-29 20:24 UTC (permalink / raw
To: gentoo-commits
commit: ba62574fdc12c39736032fa7be3715c202f9326c
Author: William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 29 20:16:08 2011 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sat Oct 29 20:16:08 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/udev-gentoo-scripts.git;a=commit;h=ba62574f
Add kv_min variable to the udev init script
The makefile was hard coding a value for the minimal kernel version into
the init script. I feel that a better approach is to have a variable
with a default value in the init script. For testing, it is possible to
adjust the value in /etc/conf.d/udev. I deliberately did not document
this in the conf.d file, because this is a value we would not want users
to modify.
---
Makefile | 4 ----
init.d/udev | 5 +++--
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile
index 055d71a..028dcec 100644
--- a/Makefile
+++ b/Makefile
@@ -7,8 +7,6 @@ MODPROBE_DIR ?= $(SYSCONFDIR)/modprobe.d
VERSION = $(shell git describe --tags)
-KV_min ?= 2.6.24
-
DESTNAME = udev-gentoo-scripts-$(VERSION)
HELPERS = \
@@ -33,8 +31,6 @@ install:
@install -m 0755 init.d/* $(DESTDIR)$(INITD)
@install -d $(DESTDIR)$(MODPROBE_DIR)
@install -m 0644 modprobe.d/* $(DESTDIR)$(MODPROBE_DIR)
- @sed -e "s/%KV_MIN%/$(KV_min)/" \
- -i "$(DESTDIR)$(INITD)"/udev
check-git-repository:
git diff --quiet || { echo 'STOP, you have uncommitted changes in the working directory' ; false ; }
diff --git a/init.d/udev b/init.d/udev
index 51e7081..ea10111 100644
--- a/init.d/udev
+++ b/init.d/udev
@@ -15,6 +15,7 @@ udev_debug="${udev_debug:-no}"
udev_monitor="${udev_monitor:-no}"
udev_monitor_keep_running="${udev_monitor_keep_running:-no}"
udev_settle_timeout="${udev_settle_timeout:-60}"
+kv_min="${kb_min:-2.6.34}"
depend()
{
@@ -34,9 +35,9 @@ depend()
# Maybe something like udevd --test || exit $?
check_kernel()
{
- if [ $(get_KV) -lt $(KV_to_int '%KV_MIN%') ]; then
+ if [ $(get_KV) -lt $(KV_to_int ${kv_min}) ]; then
eerror "Your kernel is too old to work with this version of udev."
- eerror "Current udev only supports Linux kernel %KV_MIN% and newer."
+ eerror "Current udev only supports Linux kernel ${kv_min} and newer."
return 1
fi
return 0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-commits] proj/udev-gentoo-scripts:master commit in: init.d/, /
@ 2012-08-07 17:29 William Hubbs
0 siblings, 0 replies; 4+ messages in thread
From: William Hubbs @ 2012-08-07 17:29 UTC (permalink / raw
To: gentoo-commits
commit: c21655268bd42d668a1d01460133f93deaa1b3a8
Author: William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 7 17:22:50 2012 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Aug 7 17:22:50 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/udev-gentoo-scripts.git;a=commit;h=c2165526
move back to /lib/udev
For now the best option for gentoo is going to be not to move
/lib/systemd/systemd-udevd and /lib/udev to /usr.
---
Makefile | 2 +-
init.d/udev | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 3c531c9..4922ac7 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@ PACKAGE = udev-init-scripts
VERSION = 14
DISTNAME = $(PACKAGE)-$(VERSION)
-LIBUDEV ?= /usr/lib/udev
+LIBUDEV ?= /lib/udev
RULESDIR ?= $(LIBUDEV)/rules.d
SYSCONFDIR ?= /etc
CONFD ?= $(SYSCONFDIR)/conf.d
diff --git a/init.d/udev b/init.d/udev
index 5247b84..24cdb25 100644
--- a/init.d/udev
+++ b/init.d/udev
@@ -2,7 +2,7 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-command=/usr/lib/systemd/systemd-udevd
+command=/lib/systemd/systemd-udevd
command_args="--daemon ${udev_opts}"
description="udev manages device permissions and symbolic links in /dev"
extra_started_commands="reload"
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-commits] proj/udev-gentoo-scripts:master commit in: init.d/, /
@ 2012-08-08 18:37 William Hubbs
0 siblings, 0 replies; 4+ messages in thread
From: William Hubbs @ 2012-08-08 18:37 UTC (permalink / raw
To: gentoo-commits
commit: 240bc47caf46485cfe40b2196e208870114accee
Author: William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 8 18:35:48 2012 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Aug 8 18:35:48 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/udev-gentoo-scripts.git;a=commit;h=240bc47c
Revert "move back to /lib/udev"
This reverts commit c21655268bd42d668a1d01460133f93deaa1b3a8.
Packages in gentoo are being updated to install things in /usr/lib/udev
where they belong.
---
Makefile | 2 +-
init.d/udev | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index b76a11c..0be0390 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@ PACKAGE = udev-init-scripts
VERSION = 15
DISTNAME = $(PACKAGE)-$(VERSION)
-LIBUDEV ?= /lib/udev
+LIBUDEV ?= /usr/lib/udev
RULESDIR ?= $(LIBUDEV)/rules.d
SYSCONFDIR ?= /etc
CONFD ?= $(SYSCONFDIR)/conf.d
diff --git a/init.d/udev b/init.d/udev
index 24cdb25..5247b84 100644
--- a/init.d/udev
+++ b/init.d/udev
@@ -2,7 +2,7 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-command=/lib/systemd/systemd-udevd
+command=/usr/lib/systemd/systemd-udevd
command_args="--daemon ${udev_opts}"
description="udev manages device permissions and symbolic links in /dev"
extra_started_commands="reload"
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-08-08 18:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-09 15:24 [gentoo-commits] proj/udev-gentoo-scripts:master commit in: init.d/, / William Hubbs
-- strict thread matches above, loose matches on Subject: below --
2011-10-29 20:24 William Hubbs
2012-08-07 17:29 William Hubbs
2012-08-08 18:37 William Hubbs
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox