summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Schwarzott <zzam@gentoo.org>2008-12-27 23:03:52 +0000
committerMatthias Schwarzott <zzam@gentoo.org>2008-12-27 23:03:52 +0000
commit5b3afb3c13f2e53962f6ac5edd0708752caa7456 (patch)
tree0b3a7818573ecab140c9e9c4aca2e2903328c0e8 /sys-fs/udev/files
parentRemove old. (diff)
downloadgentoo-2-5b3afb3c13f2e53962f6ac5edd0708752caa7456.tar.gz
gentoo-2-5b3afb3c13f2e53962f6ac5edd0708752caa7456.tar.bz2
gentoo-2-5b3afb3c13f2e53962f6ac5edd0708752caa7456.zip
Create /dev/.rcsysinit only for older baselayouts. Add some comments about rc_oldplug to /etc/conf.d/udev, suggested by Polynomial-C <polynomial-c@gmx.de>.
(Portage version: 2.1.6.2/cvs/Linux 2.6.27-gentoo-r1 i686)
Diffstat (limited to 'sys-fs/udev/files')
-rw-r--r--sys-fs/udev/files/udev-135-r3.confd27
-rwxr-xr-xsys-fs/udev/files/udev-mount-135-r3.initd101
-rw-r--r--sys-fs/udev/files/udev-start-135-r3.sh51
3 files changed, 179 insertions, 0 deletions
diff --git a/sys-fs/udev/files/udev-135-r3.confd b/sys-fs/udev/files/udev-135-r3.confd
new file mode 100644
index 000000000000..4abfa911674d
--- /dev/null
+++ b/sys-fs/udev/files/udev-135-r3.confd
@@ -0,0 +1,27 @@
+# /etc/conf.d/udev: config file for udev
+
+# We discourage to disable persistent-net!!
+# this may lead to random interface naming
+
+# Disable adding new rules for persistent-net
+persistent_net_disable="no"
+
+# Set to "yes" if you want to save /dev to a tarball on shutdown
+# and restore it on startup. This is useful if you have a lot of
+# custom device nodes that udev does not handle/know about.
+#
+# As this option is fragile, we recommend you
+# to create your devices in /lib/udev/devices.
+# These will be copied to /dev on boot.
+#rc_device_tarball="NO"
+
+# udev can trigger coldplug events which cause services to start and
+# kernel modules to be loaded.
+# Services are deferred to start in the boot runlevel.
+# Set rc_coldplug="NO" if you don't want this.
+# If you want module coldplugging but not coldplugging of services then you
+# can disable service coldplugging in baselayout/openrc config files.
+# The setting is named different in different versions.
+# in /etc/rc.conf: rc_hotplug="!*" or
+# in /etc/conf.d/rc: rc_plug_services="!*"
+#rc_coldplug="YES"
diff --git a/sys-fs/udev/files/udev-mount-135-r3.initd b/sys-fs/udev/files/udev-mount-135-r3.initd
new file mode 100755
index 000000000000..84bed6a48a09
--- /dev/null
+++ b/sys-fs/udev/files/udev-mount-135-r3.initd
@@ -0,0 +1,101 @@
+#!/sbin/runscript
+# Copyright 1999-2008 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
+
+# get_KV and others
+. /lib/udev/shell-compat.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 '2.6.15') ]; then
+ eerror "Your kernel is too old to work with this version of udev."
+ eerror "Current udev only supports Linux kernel 2.6.15 and newer."
+ return 1
+ fi
+ if [ $(get_KV) -lt $(KV_to_int '2.6.18') ]; then
+ ewarn "You need at least Linux kernel 2.6.18 for reliable operation of udev."
+ fi
+ return 0
+}
+
+
+mount_dev_directory()
+{
+ # No options are processed here as they should all be in /etc/fstab
+ ebegin "Mounting /dev"
+ if fstabinfo --quiet /dev; then
+ mount -n /dev
+ else
+ # Some devices require exec, Bug #92921
+ mount -n -t tmpfs -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 /dev/console c 5 1
+ [ -c /dev/tty1 ] || mknod /dev/tty1 c 4 1
+ [ -c /dev/tty ] || mknod /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 /dev/null c 1 3
+
+ # copy over any persistant things
+ if [ -d /lib/udev/devices ]; then
+ cp -RPp /lib/udev/devices/* /dev 2>/dev/null
+ fi
+
+ # Not provided by sysfs but needed
+ ln -snf /proc/self/fd /dev/fd
+ ln -snf fd/0 /dev/stdin
+ ln -snf fd/1 /dev/stdout
+ ln -snf fd/2 /dev/stderr
+ [ -e /proc/kcore ] && ln -snf /proc/kcore /dev/core
+
+ # Create problematic directories
+ mkdir -p /dev/pts /dev/shm
+ 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
+
+ _start
+}
+
+_start()
+{
+ 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
+ restorecon /dev > /selinux/null
+ fi
+
+ # make sure it exists
+ mkdir -p /dev/.udev
+
+ seed_dev
+
+ return 0
+}
diff --git a/sys-fs/udev/files/udev-start-135-r3.sh b/sys-fs/udev/files/udev-start-135-r3.sh
new file mode 100644
index 000000000000..5525483e6966
--- /dev/null
+++ b/sys-fs/udev/files/udev-start-135-r3.sh
@@ -0,0 +1,51 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+[ -e /etc/conf.d/udev ] && . /etc/conf.d/udev
+
+. /lib/udev/shell-compat.sh
+
+compat_volume_nodes()
+{
+ # Only do this for baselayout-1*
+ if [ ! -e /lib/librc.so ]; then
+
+ # Create nodes that udev can't
+ [ -x /sbin/lvm ] && \
+ /sbin/lvm vgscan -P --mknodes --ignorelockingfailure &>/dev/null
+ # Running evms_activate on a LiveCD causes lots of headaches
+ [ -z "${CDBOOT}" -a -x /sbin/evms_activate ] && \
+ /sbin/evms_activate -q &>/dev/null
+ fi
+}
+
+start_initd()
+{
+ (
+ . /etc/init.d/"$1"
+ _start
+ )
+}
+
+# mount tmpfs on /dev
+start_initd udev-mount || exit 1
+
+# Create a file so that our rc system knows it's still in sysinit.
+# Existance means init scripts will not directly run.
+# rc will remove the file when done with sysinit.
+# this is no longer needed as of openrc-0.4.0
+touch /dev/.rcsysinit
+
+# load device tarball
+start_initd udev-dev-tarball
+
+# run udevd
+start_initd udev || exit 1
+
+compat_volume_nodes
+
+# inject into boot runlevel
+IN_HOTPLUG=1 /etc/init.d/udev-postmount start >/dev/null 2>&1
+
+# udev started successfully
+exit 0