1 |
#!/bin/bash |
#!/bin/bash |
2 |
# $Header: /root/magellan-cvs/src/udev/udev.rc,v 1.1 2010-07-14 13:15:13 niro Exp $ |
# $Header: /root/magellan-cvs/src/udev/udev.rc,v 1.2 2010-08-18 00:57:31 niro Exp $ |
3 |
|
|
4 |
udev_version() |
udev_version() |
5 |
{ |
{ |
30 |
echo CONSOLE=${CONSOLE} > /dev/.udev_populate |
echo CONSOLE=${CONSOLE} > /dev/.udev_populate |
31 |
|
|
32 |
# populate /dev with devices already found by the kernel |
# populate /dev with devices already found by the kernel |
33 |
echo -e ${COLOREDSTAR}" Populating /dev with existing devices through uevents ..." |
rc_print " Populating /dev with existing devices through uevents ..." |
34 |
if [[ ${RC_COLDPLUG} = yes ]] |
if [[ ${RC_COLDPLUG} = yes ]] |
35 |
then |
then |
36 |
/sbin/udevadm trigger |
/sbin/udevadm trigger |
47 |
evaluate_retval |
evaluate_retval |
48 |
|
|
49 |
# loop until everything is finished |
# loop until everything is finished |
50 |
echo -e ${COLOREDSTAR}" Letting udev process events ..." |
rc_print " Letting udev process events ..." |
51 |
/sbin/udevadm settle --timeout=60 |
/sbin/udevadm settle --timeout=60 |
52 |
evaluate_retval |
evaluate_retval |
53 |
|
|
61 |
seed_dev() |
seed_dev() |
62 |
{ |
{ |
63 |
# seed /dev with some things that we know we need |
# seed /dev with some things that we know we need |
64 |
echo -e ${COLOREDSTAR}" Seeding /dev with needed nodes ..." |
rc_print " Seeding /dev with needed nodes ..." |
65 |
( |
( |
66 |
[ ! -c /dev/console ] && mknod /dev/console c 5 1 |
[ ! -c /dev/console ] && mknod /dev/console c 5 1 |
67 |
[ ! -c /dev/tty1 ] && mknod /dev/tty1 c 4 1 |
[ ! -c /dev/tty1 ] && mknod /dev/tty1 c 4 1 |
96 |
[ -c /dev/console ] ; need_redirect=$? |
[ -c /dev/console ] ; need_redirect=$? |
97 |
|
|
98 |
# create a ramdisk for populating udev |
# create a ramdisk for populating udev |
99 |
echo -e ${COLOREDSTAR}"Mounting udev at /dev ..." |
rc_print "Mounting udev at /dev ..." |
100 |
# many video drivers needed exec access |
# many video drivers needed exec access |
101 |
fstype=ramfs |
fstype=ramfs |
102 |
# tmpfs was suggested by Greg Kroah-Hartman |
# tmpfs was suggested by Greg Kroah-Hartman |
107 |
evaluate_retval |
evaluate_retval |
108 |
|
|
109 |
# if a device tarball exists load it and if it is activated |
# if a device tarball exists load it and if it is activated |
110 |
echo -e ${COLOREDSTAR}"Configurating system to use udev ..." |
rc_print "Configurating system to use udev ..." |
111 |
if [[ ${RC_DEVICE_TARBALL} = yes ]] |
if [[ ${RC_DEVICE_TARBALL} = yes ]] |
112 |
then |
then |
113 |
echo -e ${COLOREDSTAR}" Populating /dev with saved device nodes ..." |
rc_print " Populating /dev with saved device nodes ..." |
114 |
tar -jxpf /lib/udev/state/devices.tar.bz2 -C /dev |
tar -jxpf /lib/udev/state/devices.tar.bz2 -C /dev |
115 |
evaluate_retval |
evaluate_retval |
116 |
fi |
fi |
120 |
|
|
121 |
if [ -e /proc/sys/kernel/hotplug ] |
if [ -e /proc/sys/kernel/hotplug ] |
122 |
then |
then |
123 |
echo -e ${COLOREDSTAR}" Using netlink for hotplug events ..." |
rc_print " Using netlink for hotplug events ..." |
124 |
echo "" > /proc/sys/kernel/hotplug |
echo "" > /proc/sys/kernel/hotplug |
125 |
evaluate_retval |
evaluate_retval |
126 |
else |
else |
127 |
echo -e ${COLOREDSTAR}${COLYELLOW}" Kernel was not compiled with hotplug support !" |
rc_print ${COLYELLOW}" Kernel was not compiled with hotplug support !" |
128 |
print_status failure |
print_status failure |
129 |
fi |
fi |
130 |
|
|
134 |
modprobe -q unix 2>/dev/null |
modprobe -q unix 2>/dev/null |
135 |
fi |
fi |
136 |
|
|
137 |
echo -e ${COLOREDSTAR}" Starting udevd daemon ..." |
rc_print " Starting udevd daemon ..." |
138 |
if [ ${need_redirect} -eq 1 ] |
if [ ${need_redirect} -eq 1 ] |
139 |
then |
then |
140 |
# we need to open fds 0 1 2 |
# we need to open fds 0 1 2 |
150 |
populate_udev |
populate_udev |
151 |
|
|
152 |
# create nodes that udev can't |
# create nodes that udev can't |
153 |
echo -e ${COLOREDSTAR}" Finializing udev configuration ..." |
rc_print " Finializing udev configuration ..." |
154 |
[[ -x /sbin/dmsetup ]] && /sbin/dmsetup mknodes &>/dev/null |
[[ -x /sbin/dmsetup ]] && /sbin/dmsetup mknodes &>/dev/null |
155 |
[[ -x /sbin/lvm ]] && /sbin/lvm vgscan -P --mknodes --ignorelockingfailure &>/dev/null |
[[ -x /sbin/lvm ]] && /sbin/lvm vgscan -P --mknodes --ignorelockingfailure &>/dev/null |
156 |
[[ -x /sbin/evms_activate ]] && /sbin/evms_activate -q &>/dev/null |
[[ -x /sbin/evms_activate ]] && /sbin/evms_activate -q &>/dev/null |
162 |
|
|
163 |
stop_devicemanager() |
stop_devicemanager() |
164 |
{ |
{ |
165 |
echo -e ${COLOREDSTAR}" Stopping udevd daemon ..." |
rc_print "Stopping udevd daemon ..." |
166 |
start-stop-daemon --stop --exec /sbin/udevd |
start-stop-daemon --stop --exec /sbin/udevd |
167 |
evaluate_retval |
evaluate_retval |
168 |
} |
} |