1 |
zzam 08/12/27 23:03:52 |
2 |
|
3 |
Added: udev-mount-135-r3.initd udev-135-r3.confd |
4 |
udev-start-135-r3.sh |
5 |
Log: |
6 |
Create /dev/.rcsysinit only for older baselayouts. Add some comments about rc_oldplug to /etc/conf.d/udev, suggested by Polynomial-C <polynomial-c@×××.de>. |
7 |
(Portage version: 2.1.6.2/cvs/Linux 2.6.27-gentoo-r1 i686) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 sys-fs/udev/files/udev-mount-135-r3.initd |
11 |
|
12 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/udev/files/udev-mount-135-r3.initd?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/udev/files/udev-mount-135-r3.initd?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: udev-mount-135-r3.initd |
16 |
=================================================================== |
17 |
#!/sbin/runscript |
18 |
# Copyright 1999-2008 Gentoo Foundation |
19 |
# Distributed under the terms of the GNU General Public License v2 |
20 |
|
21 |
description="Mount tmpfs on /dev" |
22 |
[ -e /etc/conf.d/udev ] && . /etc/conf.d/udev |
23 |
|
24 |
# get_KV and others |
25 |
. /lib/udev/shell-compat.sh |
26 |
|
27 |
# FIXME |
28 |
# Instead of this script testing kernel version, udev itself should |
29 |
# Maybe something like udevd --test || exit $? |
30 |
check_kernel() |
31 |
{ |
32 |
if [ $(get_KV) -lt $(KV_to_int '2.6.15') ]; then |
33 |
eerror "Your kernel is too old to work with this version of udev." |
34 |
eerror "Current udev only supports Linux kernel 2.6.15 and newer." |
35 |
return 1 |
36 |
fi |
37 |
if [ $(get_KV) -lt $(KV_to_int '2.6.18') ]; then |
38 |
ewarn "You need at least Linux kernel 2.6.18 for reliable operation of udev." |
39 |
fi |
40 |
return 0 |
41 |
} |
42 |
|
43 |
|
44 |
mount_dev_directory() |
45 |
{ |
46 |
# No options are processed here as they should all be in /etc/fstab |
47 |
ebegin "Mounting /dev" |
48 |
if fstabinfo --quiet /dev; then |
49 |
mount -n /dev |
50 |
else |
51 |
# Some devices require exec, Bug #92921 |
52 |
mount -n -t tmpfs -o "exec,nosuid,mode=0755,size=10M" udev /dev |
53 |
fi |
54 |
eend $? |
55 |
} |
56 |
|
57 |
seed_dev() |
58 |
{ |
59 |
# Seed /dev with some things that we know we need |
60 |
|
61 |
# creating /dev/console, /dev/tty and /dev/tty1 to be able to write |
62 |
# to $CONSOLE with/without bootsplash before udevd creates it |
63 |
[ -c /dev/console ] || mknod /dev/console c 5 1 |
64 |
[ -c /dev/tty1 ] || mknod /dev/tty1 c 4 1 |
65 |
[ -c /dev/tty ] || mknod /dev/tty c 5 0 |
66 |
|
67 |
# udevd will dup its stdin/stdout/stderr to /dev/null |
68 |
# and we do not want a file which gets buffered in ram |
69 |
[ -c /dev/null ] || mknod /dev/null c 1 3 |
70 |
|
71 |
# copy over any persistant things |
72 |
if [ -d /lib/udev/devices ]; then |
73 |
cp -RPp /lib/udev/devices/* /dev 2>/dev/null |
74 |
fi |
75 |
|
76 |
# Not provided by sysfs but needed |
77 |
ln -snf /proc/self/fd /dev/fd |
78 |
ln -snf fd/0 /dev/stdin |
79 |
ln -snf fd/1 /dev/stdout |
80 |
ln -snf fd/2 /dev/stderr |
81 |
[ -e /proc/kcore ] && ln -snf /proc/kcore /dev/core |
82 |
|
83 |
# Create problematic directories |
84 |
mkdir -p /dev/pts /dev/shm |
85 |
return 0 |
86 |
} |
87 |
|
88 |
|
89 |
start() |
90 |
{ |
91 |
# do not run this on too old baselayout - udev-addon is already loaded! |
92 |
if [ ! -f /etc/init.d/sysfs ]; then |
93 |
eerror "The $SVCNAME init-script is written for baselayout-2!" |
94 |
eerror "Please do not use it with baselayout-1!". |
95 |
return 1 |
96 |
fi |
97 |
|
98 |
_start |
99 |
} |
100 |
|
101 |
_start() |
102 |
{ |
103 |
check_kernel || return 1 |
104 |
mount_dev_directory || return 1 |
105 |
|
106 |
# Selinux lovin; /selinux should be mounted by selinux-patched init |
107 |
if [ -x /sbin/restorecon -a -c /selinux/null ]; then |
108 |
restorecon /dev > /selinux/null |
109 |
fi |
110 |
|
111 |
# make sure it exists |
112 |
mkdir -p /dev/.udev |
113 |
|
114 |
seed_dev |
115 |
|
116 |
return 0 |
117 |
} |
118 |
|
119 |
|
120 |
|
121 |
1.1 sys-fs/udev/files/udev-135-r3.confd |
122 |
|
123 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/udev/files/udev-135-r3.confd?rev=1.1&view=markup |
124 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/udev/files/udev-135-r3.confd?rev=1.1&content-type=text/plain |
125 |
|
126 |
Index: udev-135-r3.confd |
127 |
=================================================================== |
128 |
# /etc/conf.d/udev: config file for udev |
129 |
|
130 |
# We discourage to disable persistent-net!! |
131 |
# this may lead to random interface naming |
132 |
|
133 |
# Disable adding new rules for persistent-net |
134 |
persistent_net_disable="no" |
135 |
|
136 |
# Set to "yes" if you want to save /dev to a tarball on shutdown |
137 |
# and restore it on startup. This is useful if you have a lot of |
138 |
# custom device nodes that udev does not handle/know about. |
139 |
# |
140 |
# As this option is fragile, we recommend you |
141 |
# to create your devices in /lib/udev/devices. |
142 |
# These will be copied to /dev on boot. |
143 |
#rc_device_tarball="NO" |
144 |
|
145 |
# udev can trigger coldplug events which cause services to start and |
146 |
# kernel modules to be loaded. |
147 |
# Services are deferred to start in the boot runlevel. |
148 |
# Set rc_coldplug="NO" if you don't want this. |
149 |
# If you want module coldplugging but not coldplugging of services then you |
150 |
# can disable service coldplugging in baselayout/openrc config files. |
151 |
# The setting is named different in different versions. |
152 |
# in /etc/rc.conf: rc_hotplug="!*" or |
153 |
# in /etc/conf.d/rc: rc_plug_services="!*" |
154 |
#rc_coldplug="YES" |
155 |
|
156 |
|
157 |
|
158 |
1.1 sys-fs/udev/files/udev-start-135-r3.sh |
159 |
|
160 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/udev/files/udev-start-135-r3.sh?rev=1.1&view=markup |
161 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/udev/files/udev-start-135-r3.sh?rev=1.1&content-type=text/plain |
162 |
|
163 |
Index: udev-start-135-r3.sh |
164 |
=================================================================== |
165 |
# Copyright 1999-2007 Gentoo Foundation |
166 |
# Distributed under the terms of the GNU General Public License v2 |
167 |
|
168 |
[ -e /etc/conf.d/udev ] && . /etc/conf.d/udev |
169 |
|
170 |
. /lib/udev/shell-compat.sh |
171 |
|
172 |
compat_volume_nodes() |
173 |
{ |
174 |
# Only do this for baselayout-1* |
175 |
if [ ! -e /lib/librc.so ]; then |
176 |
|
177 |
# Create nodes that udev can't |
178 |
[ -x /sbin/lvm ] && \ |
179 |
/sbin/lvm vgscan -P --mknodes --ignorelockingfailure &>/dev/null |
180 |
# Running evms_activate on a LiveCD causes lots of headaches |
181 |
[ -z "${CDBOOT}" -a -x /sbin/evms_activate ] && \ |
182 |
/sbin/evms_activate -q &>/dev/null |
183 |
fi |
184 |
} |
185 |
|
186 |
start_initd() |
187 |
{ |
188 |
( |
189 |
. /etc/init.d/"$1" |
190 |
_start |
191 |
) |
192 |
} |
193 |
|
194 |
# mount tmpfs on /dev |
195 |
start_initd udev-mount || exit 1 |
196 |
|
197 |
# Create a file so that our rc system knows it's still in sysinit. |
198 |
# Existance means init scripts will not directly run. |
199 |
# rc will remove the file when done with sysinit. |
200 |
# this is no longer needed as of openrc-0.4.0 |
201 |
touch /dev/.rcsysinit |
202 |
|
203 |
# load device tarball |
204 |
start_initd udev-dev-tarball |
205 |
|
206 |
# run udevd |
207 |
start_initd udev || exit 1 |
208 |
|
209 |
compat_volume_nodes |
210 |
|
211 |
# inject into boot runlevel |
212 |
IN_HOTPLUG=1 /etc/init.d/udev-postmount start >/dev/null 2>&1 |
213 |
|
214 |
# udev started successfully |
215 |
exit 0 |