* [gentoo-commits] gentoo-x86 commit in sys-fs/udev/files: udev-start-119-r1.sh
@ 2008-04-03 13:48 Matthias Schwarzott (zzam)
0 siblings, 0 replies; 3+ messages in thread
From: Matthias Schwarzott (zzam) @ 2008-04-03 13:48 UTC (permalink / raw
To: gentoo-commits
zzam 08/04/03 13:48:23
Added: udev-start-119-r1.sh
Log:
Add masked revision to work on udev-start.sh. This should improve error handling.
(Portage version: 2.1.4.4)
Revision Changes Path
1.1 sys-fs/udev/files/udev-start-119-r1.sh
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/udev/files/udev-start-119-r1.sh?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/udev/files/udev-start-119-r1.sh?rev=1.1&content-type=text/plain
Index: udev-start-119-r1.sh
===================================================================
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
[ -e /etc/udev/udev.conf ] && . /etc/udev/udev.conf
. /lib/udev/shell-compat.sh
rc_coldplug=${rc_coldplug:-${RC_COLDPLUG:-YES}}
rc_device_tarball=${rc_device_tarball:-${RC_DEVICE_TARBALL:-NO}}
cleanup() {
if [ "$1" != "0" ]; then
# cleanup to fail more gracely
start-stop-daemon --stop --exec /sbin/udevd
fi
exit $1
}
# FIXME
# Instead of this script testing kernel version, udev itself should
# Maybe something like udevd --test || exit $?
check_kernel()
{
if [ $(get_KV) -le $(KV_to_int '2.6.14') ]; 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
return 0
}
mount_dev_directory()
{
# No options are processed here as they should all be in /etc/fstab
ebegin "Mounting /dev for udev"
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 $?
}
unpack_device_tarball()
{
local device_tarball=/lib/udev/state/devices.tar.bz2
if yesno "${rc_device_tarball}" && \
[ -s "${device_tarball}" ]
then
ebegin "Populating /dev with saved device nodes"
tar -jxpf "${device_tarball}" -C /dev
eend $?
fi
}
seed_dev()
{
# Seed /dev with some things that we know we need
# creating /dev/console 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
# 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_udev()
{
ebegin "Starting udevd"
start-stop-daemon --start --exec /sbin/udevd -- --daemon
eend $?
}
# populate /dev with devices already found by the kernel
populate_udev()
{
if get_bootparam "nocoldplug" ; then
rc_coldplug="NO"
ewarn "Skipping udev coldplug as requested in kernel cmdline"
fi
ebegin "Populating /dev with existing devices through uevents"
if yesno "${rc_coldplug}"; then
udevtrigger
else
# Do not run any init-scripts, Bug #206518
udevadm control --env do_not_run_plug_service=1
# only create device nodes
udevtrigger --attr-match=dev
# run persistent-net stuff, bug 191466
udevtrigger --subsystem-match=net
fi
eend $?
ebegin "Waiting for uevents to be processed"
udevsettle --timeout=60
eend $?
udevadm control --env do_not_run_plug_service=
return 0
}
compat_device_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
}
check_persistent_net()
{
# check if there are problems with persistent-net
local syspath= devs= problem=false
for syspath in /sys/class/net/*_rename*; do
if [ -d "${syspath}" ]; then
devs="${devs} ${syspath##*/}"
problem=true
fi
done
${problem} || return 0
eerror "UDEV: Your system has a problem assigning persistent names"
eerror "to these network interfaces: ${devs}"
einfo "Checking persistent-net rules:"
# the sed-expression lists all duplicate lines
# from the input, like "uniq -d" does, but uniq
# is installed into /usr/bin and not available at boot.
dups=$(
RULES_FILE='/etc/udev/rules.d/70-persistent-net.rules'
. /lib/udev/rule_generator.functions
find_all_rules 'NAME=' '.*' | \
tr ' ' '\n' | \
sort | \
sed '$!N; s/^\(.*\)\n\1$/\1/; t; D'
)
if [ -n "${dups}" ]; then
ewarn "The rules create multiple entries assigning these names:"
eindent
ewarn "${dups}"
eoutdent
else
ewarn "Found no duplicate names in persistent-net rules,"
ewarn "there must be some other problem!"
fi
return 1
}
check_kernel || cleanup $?
mount_dev_directory || cleanup $?
# 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.
touch /dev/.rcsysinit
# Selinux lovin; /selinux should be mounted by selinux-patched init
if [ -x /sbin/restorecon -a -c /selinux/null ]; then
restorecon /dev > /selinux/null
fi
unpack_device_tarball
seed_dev
if [ -e /proc/sys/kernel/hotplug ]; then
echo "" >/proc/sys/kernel/hotplug
fi
/lib/udev/write_root_link_rule
start_udev || cleanup $?
populate_udev || cleanup $?
compat_device_nodes
check_persistent_net
# trigger executing initscript when /etc is writable
IN_HOTPLUG=1 /etc/init.d/udev-postmount start >/dev/null 2>&1
# should exist on every system, else udev failed
[ -e /dev/zero ] || cleanup 1
# udev started successfully
exit 0
--
gentoo-commits@lists.gentoo.org mailing list
^ permalink raw reply [flat|nested] 3+ messages in thread
* [gentoo-commits] gentoo-x86 commit in sys-fs/udev/files: udev-start-119-r1.sh
@ 2008-04-03 20:09 Matthias Schwarzott (zzam)
0 siblings, 0 replies; 3+ messages in thread
From: Matthias Schwarzott (zzam) @ 2008-04-03 20:09 UTC (permalink / raw
To: gentoo-commits
zzam 08/04/03 20:09:40
Modified: udev-start-119-r1.sh
Log:
Add ewarn about missing /dev/zero and about kernel older than 2.6.18. Cosmetics.
(Portage version: 2.1.4.4)
Revision Changes Path
1.2 sys-fs/udev/files/udev-start-119-r1.sh
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/udev/files/udev-start-119-r1.sh?rev=1.2&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/udev/files/udev-start-119-r1.sh?rev=1.2&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/udev/files/udev-start-119-r1.sh?r1=1.1&r2=1.2
Index: udev-start-119-r1.sh
===================================================================
RCS file: /var/cvsroot/gentoo-x86/sys-fs/udev/files/udev-start-119-r1.sh,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- udev-start-119-r1.sh 3 Apr 2008 13:48:23 -0000 1.1
+++ udev-start-119-r1.sh 3 Apr 2008 20:09:39 -0000 1.2
@@ -7,7 +7,8 @@
rc_coldplug=${rc_coldplug:-${RC_COLDPLUG:-YES}}
rc_device_tarball=${rc_device_tarball:-${RC_DEVICE_TARBALL:-NO}}
-cleanup() {
+cleanup()
+{
if [ "$1" != "0" ]; then
# cleanup to fail more gracely
start-stop-daemon --stop --exec /sbin/udevd
@@ -21,11 +22,14 @@
# Maybe something like udevd --test || exit $?
check_kernel()
{
- if [ $(get_KV) -le $(KV_to_int '2.6.14') ]; then
+ 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
}
@@ -85,6 +89,13 @@
return 0
}
+disable_hotplug_agent()
+{
+ if [ -e /proc/sys/kernel/hotplug ]; then
+ echo "" >/proc/sys/kernel/hotplug
+ fi
+}
+
start_udev()
{
ebegin "Starting udevd"
@@ -123,7 +134,7 @@
return 0
}
-compat_device_nodes()
+compat_volume_nodes()
{
# Only do this for baselayout-1*
if [ ! -e /lib/librc.so ]; then
@@ -192,24 +203,23 @@
unpack_device_tarball
seed_dev
-
-if [ -e /proc/sys/kernel/hotplug ]; then
- echo "" >/proc/sys/kernel/hotplug
-fi
-
+disable_hotplug_agent
/lib/udev/write_root_link_rule
start_udev || cleanup $?
populate_udev || cleanup $?
-compat_device_nodes
+compat_volume_nodes
check_persistent_net
# trigger executing initscript when /etc is writable
IN_HOTPLUG=1 /etc/init.d/udev-postmount start >/dev/null 2>&1
# should exist on every system, else udev failed
-[ -e /dev/zero ] || cleanup 1
+if [ ! -e /dev/zero ]; then
+ eerror "Assuming udev failed somewhere, as /dev/zero does not exist."
+ cleanup 1
+fi
# udev started successfully
exit 0
--
gentoo-commits@lists.gentoo.org mailing list
^ permalink raw reply [flat|nested] 3+ messages in thread
* [gentoo-commits] gentoo-x86 commit in sys-fs/udev/files: udev-start-119-r1.sh
@ 2008-04-14 20:12 Matthias Schwarzott (zzam)
0 siblings, 0 replies; 3+ messages in thread
From: Matthias Schwarzott (zzam) @ 2008-04-14 20:12 UTC (permalink / raw
To: gentoo-commits
zzam 08/04/14 20:12:56
Modified: udev-start-119-r1.sh
Log:
Some small cleanups in udev-start.
(Portage version: 2.1.5_rc3)
Revision Changes Path
1.3 sys-fs/udev/files/udev-start-119-r1.sh
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/udev/files/udev-start-119-r1.sh?rev=1.3&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/udev/files/udev-start-119-r1.sh?rev=1.3&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/udev/files/udev-start-119-r1.sh?r1=1.2&r2=1.3
Index: udev-start-119-r1.sh
===================================================================
RCS file: /var/cvsroot/gentoo-x86/sys-fs/udev/files/udev-start-119-r1.sh,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- udev-start-119-r1.sh 3 Apr 2008 20:09:39 -0000 1.2
+++ udev-start-119-r1.sh 14 Apr 2008 20:12:56 -0000 1.3
@@ -9,12 +9,9 @@
cleanup()
{
- if [ "$1" != "0" ]; then
- # cleanup to fail more gracely
- start-stop-daemon --stop --exec /sbin/udevd
- fi
-
- exit $1
+ # fail more gracely and not leave udevd running
+ start-stop-daemon --stop --exec /sbin/udevd
+ exit 1
}
# FIXME
@@ -37,7 +34,7 @@
mount_dev_directory()
{
# No options are processed here as they should all be in /etc/fstab
- ebegin "Mounting /dev for udev"
+ ebegin "Mounting /dev"
if fstabinfo --quiet /dev; then
mount -n /dev
else
@@ -96,7 +93,12 @@
fi
}
-start_udev()
+root_link()
+{
+ /lib/udev/write_root_link_rule
+}
+
+start_udevd()
{
ebegin "Starting udevd"
start-stop-daemon --start --exec /sbin/udevd -- --daemon
@@ -104,7 +106,7 @@
}
# populate /dev with devices already found by the kernel
-populate_udev()
+populate_dev()
{
if get_bootparam "nocoldplug" ; then
rc_coldplug="NO"
@@ -188,8 +190,20 @@
return 1
}
-check_kernel || cleanup $?
-mount_dev_directory || cleanup $?
+check_udev_works()
+{
+ # should exist on every system, else udev failed
+ if [ ! -e /dev/zero ]; then
+ eerror "Assuming udev failed somewhere, as /dev/zero does not exist."
+ return 1
+ fi
+ return 0
+}
+
+
+
+check_kernel || cleanup
+mount_dev_directory || cleanup
# Create a file so that our rc system knows it's still in sysinit.
# Existance means init scripts will not directly run.
@@ -203,11 +217,11 @@
unpack_device_tarball
seed_dev
+root_link
disable_hotplug_agent
-/lib/udev/write_root_link_rule
-start_udev || cleanup $?
-populate_udev || cleanup $?
+start_udevd || cleanup
+populate_dev || cleanup
compat_volume_nodes
check_persistent_net
@@ -215,11 +229,7 @@
# trigger executing initscript when /etc is writable
IN_HOTPLUG=1 /etc/init.d/udev-postmount start >/dev/null 2>&1
-# should exist on every system, else udev failed
-if [ ! -e /dev/zero ]; then
- eerror "Assuming udev failed somewhere, as /dev/zero does not exist."
- cleanup 1
-fi
+check_udev_works || cleanup
# udev started successfully
exit 0
--
gentoo-commits@lists.gentoo.org mailing list
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-04-14 20:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-03 13:48 [gentoo-commits] gentoo-x86 commit in sys-fs/udev/files: udev-start-119-r1.sh Matthias Schwarzott (zzam)
-- strict thread matches above, loose matches on Subject: below --
2008-04-03 20:09 Matthias Schwarzott (zzam)
2008-04-14 20:12 Matthias Schwarzott (zzam)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox