[Lunar-commits]
CVS: moonbase/filesys/udev 99-udev.permissions, NONE,
1.1 99-udev.rules, NONE, 1.1 POST_INSTALL, NONE, 1.1 udev,
NONE, 1.1 BUILD, 1.7, 1.8
Jaime Buffery
nestu at lunar-linux.org
Mon Nov 8 09:55:54 UTC 2004
Update of /var/cvs/lunar/moonbase/filesys/udev
In directory espresso.foo-projects.org:/tmp/cvs-serv31444
Modified Files:
BUILD
Added Files:
99-udev.permissions 99-udev.rules POST_INSTALL udev
Log Message:
Changing udev so it works OOTB with the new mount script.
--- NEW FILE: 99-udev.permissions ---
#name:user:group:mode
# console devices
console:root:root:0600
tty[0-9][0-9]*:$local:tty:0660
vc/[0-9]*:$local:tty:0660
# pty devices
# Set this to 0660 if you only want users belonging to tty group
# to be able to allocate PTYs
ptmx:root:tty:0666
pty[p-za-e][0-9a-f]*:$local:tty:0660
tty[p-za-e][0-9a-f]*:$local:tty:0660
pty/m*:$local:tty:0660
vc/s*:$local:tty:0660
# serial+dialup devices
ttyS*:root:tty:0660
ippp*:root:tty:0660
isdn*:root:tty:0660
isdnctrl*:root:tty:0660
capi*:root:tty:0660
dcbri*:root:tty:0660
ircomm*:root:tty:0660
tts/[0-9]*:root:tty:0660
tts/USB[0-9]*:root:usb:0660
# vc devices
vcs:root:root:0600
vcs[0-9]*:root:root:0600
vcsa:root:root:0600
vcsa[0-9]*:root:root:0600
vcc/*:root:root:0600
# memory devices
random:root:root:0666
urandom:root:root:0444
mem:root:kmem:0640
kmem:root:kmem:0640
port:root:kmem:0640
full:root:root:0666
null:root:root:0666
zero:root:root:0666
# misc devices
nvram:root:root:0660
rtc:root:root:0660
# floppy devices
floppy/*:root:floppy:0660
# audio devices
dsp*:root:audio:0660
audio*:root:audio:0660
midi*:root:audio:0660
mixer*:root:audio:0660
sequencer*:root:audio:0660
sound/*:root:audio:0660
snd/*:root:audio:0660
beep:root:audio:0660
admm*:root:audio:0660
adsp*:root:audio:0660
aload*:root:audio:0660
amidi*:root:audio:0660
dmfm*:root:audio:0660
dmmidi*:root:audio:0660
sndstat:root:audio:0660
# optical devices
sr*:root:cdrom:660
scd*:root:cdrom:660
pcd*:root:cdrom:0660
cdrom*:root:cdrom:0660
dvd:root:cdrom:0660
rdvd:root:cdrom:0660
cdwriter:root:cdrom:0660
cdroms/*:root:cdrom:0660
# pilot/palm devices
pilot:root:uucp:0660
# jaz devices
jaz*:root:disk:0660
# zip devices
pocketzip*:root:disk:0660
zip*:root:disk:0660
# ls120 devices
ls120:root:disk:0660
ls120*:root:disk:0660
# lp devices
lp*:root:lp:0660
parport*:root:lp:0660
irlpt*:root:lp:0660
usblp*:root:lp:0660
usb/lp*:root:lp:0660
# scanner devices
scanner:root:root:0600
usb/scanner*:root:root:0600
# camera devices
camera*:root:root:0600
usb/dc2xx*:root:root:0600
usb/mdc800*:root:root:0600
# raw devices
ram*:root:disk:660
raw/*:root:disk:660
# disk devices
hd*:root:disk:660
sd*:root:disk:660
dasd*:root:disk:660
ataraid*:root:disk:660
loop*:root:disk:660
md*:root:disk:660
ide/*/*/*/*/*:root:disk:660
discs/*/*:root:disk:660
loop/*:root:disk:660
md/*:root:disk:660
sg*:root:disk:0660
pg*:root:disk:0660
# tape devices
ht*:root:tape:0660
nht*:root:tape:0660
pt[0-9]*:root:tape:0660
npt*:root:tape:0660
st*:root:tape:0660
nst*:root:tape:0660
# dm devices
dm-*:root:root:0640
# memstick devices
memstick*:root:root:0600
# flash devices
flash*:root:root:0600
# diskonkey devices
diskonkey*:root:disk:0660
# rem_ide devices
microdrive*:root:disk:0660
# fb devices
fb/*:root:root:0600
# v4l devices
video*:root:video:0660
radio*:root:video:0660
winradio*:root:video:0660
vtx*:root:video:0660
vbi*:root:video:0660
video/*:root:video:0660
vttuner:root:video:0660
v4l/*:root:video:0660
# input devices
input/*:root:root:644
# gpm devices
gpmctl:root:root:0700
# dri devices
nvidia*:root:video:0660
3dfx*:root:video:0660
dri/*:root:video:0660
# mainboard devices
apm_bios:root:root:0600
# usb devices
usb/*:root:usb:0660
--- NEW FILE: 99-udev.rules ---
# There are a number of modifiers that are allowed to be used in some of the
# fields. See the udev man page for a full description of them.
#
# See the udev.rules.examples file for more examples of how to create rules
#
# if this is a ide cdrom, name it the default name, and create a symlink to cdrom
#BUS="ide", KERNEL="*[!0-9]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom", NAME="%k", SYMLINK="cdrom"
#KERNEL="s{r,g}[0-9]*",PROGRAM="/bin/cat /proc/ide/%k/media", NAME="%k", SYMLINK="%c"
BUS="ide", KERNEL="*[!0-9]", PROGRAM="/etc/udev/scripts.d/get_media_symlink %k", NAME="%k", SYMLINK="%c"
KERNEL="s{r,g}[0-9]*", PROGRAM="/etc/udev/scripts.d/get_media_symlink %k", NAME="%k", SYMLINK="%c"
KERNEL="sd?", PROGRAM="/etc/udev/scripts.d/get_media_symlink %k", NAME="%k", SYMLINK="%c"
# create a symlink named after the device map name
# note devmap_name comes with extras/multipath
KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c"
# DRI devices always go into a subdirectory (as per the LSB spec)
KERNEL="card*", NAME="dri/card%n"
# alsa devices
KERNEL="controlC[0-9]*", NAME="snd/%k"
KERNEL="hw[CD0-9]*", NAME="snd/%k"
KERNEL="pcm[CD0-9cp]*", NAME="snd/%k"
KERNEL="midiC[D0-9]*", NAME="snd/%k"
KERNEL="timer", NAME="snd/%k"
KERNEL="seq", NAME="snd/%k"
# sound devices
KERNEL="adsp", NAME="sound/adsp", SYMLINK="%k"
KERNEL="audio", NAME="sound/audio", SYMLINK="%k"
KERNEL="dsp", NAME="sound/dsp", SYMLINK="%k"
KERNEL="mixer", NAME="sound/mixer", SYMLINK="%k"
KERNEL="sequencer", NAME="sound/sequencer", SYMLINK="%k"
KERNEL="sequencer2", NAME="sound/sequencer2", SYMLINK="%k"
# input devices
KERNEL="kbd", NAME="input/%k"
KERNEL="mice", NAME="input/%k", SYMLINK="%k"
KERNEL="mouse*", NAME="input/%k"
KERNEL="event*", NAME="input/%k"
KERNEL="js*", NAME="input/%k"
KERNEL="djs*", NAME="input/%k"
KERNEL="ts*", NAME="input/%k"
# USB devices
KERNEL="hiddev*", NAME="usb/%k"
KERNEL="auer*", NAME="usb/%k"
KERNEL="legousbtower*", NAME="usb/%k"
KERNEL="dabusb*", NAME="usb/%k"
KERNEL="ttyUSB[0-9]*", NAME="usb/%k"
KERNEL="scanner[0-9]*", NAME="usb/%k"
# fb devices
KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k"
# floppy devices
KERNEL="fd[0-9]*", NAME="floppy/%n", SYMLINK="%k"
# i2c devices
KERNEL="i2c-[0-9]*", NAME="i2c/%n", SYMLINK="%k"
# loop devices
KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k"
# md block devices
KERNEL="md[0-9]*", NAME="md/%n", SYMLINK="%k"
# misc devices
KERNEL="rtc", NAME="misc/%k", SYMLINK="%k"
KERNEL="psaux", NAME="misc/%k", SYMLINK="%k"
KERNEL="agpgart", NAME="misc/%k", SYMLINK="%k"
KERNEL="uinput", NAME="misc/%k", SYMLINK="%k"
# pty devices
KERNEL="pty[p-za-e][0-9a-f]*", NAME="pty/m%n", SYMLINK="%k"
KERNEL="tty[p-za-e][0-9a-f]*", NAME="tty/s%n", SYMLINK="%k"
# ramdisk devices
KERNEL="ram[0-9]*", NAME="rd/%n", SYMLINK="%k"
# tty devices
KERNEL="tty[0-9]*", NAME="vc/%n", SYMLINK="%k"
KERNEL="ttyS[0-9]*", NAME="tts/%n", SYMLINK="%k"
# vc devices
KERNEL="vcs", NAME="vcc/0", SYMLINK="%k"
KERNEL="vcs[0-9]*", NAME="vcc/%n", SYMLINK="%k"
KERNEL="vcsa", NAME="vcc/a0", SYMLINK="%k"
KERNEL="vcsa[0-9]*", NAME="vcc/a%n", SYMLINK="%k"
# v4l devices
KERNEL="video[0-9]*", NAME="v4l/video%n"
KERNEL="radio[0-9]*", NAME="v4l/radio%n"
KERNEL="vbi[0-9]*", NAME="v4l/vbi%n"
KERNEL="vtx[0-9]*", NAME="v4l/vtx%n"
--- NEW FILE: POST_INSTALL ---
# this is a way of checking if the nodes are permanent or not
# e.g. if you have /dev with some static nodes, and you have
# devfs on top, you will see the underlaying static nodes
create_node()
{
local PERMS=$1
local NODE=$2
local TYPE=$3
local MAJOR=$4
local MINOR=$5
echo -ne "\tTesting for /dev/$NODE: "
if [ -e ${FAKEROOT}/dev/$NODE ]; then
echo "node already present.";
else
mknod -m $PERMS ${FAKEROOT}/dev/$NODE $TYPE $MAJOR $MINOR
echo "node created."
fi
}
FAKEROOT=/tmp/UDEV_NODE_ROOT/
echo -n "Creating virtual fake root... " && mkdir ${FAKEROOT} && echo "done."
echo -n "Creating fake root to check /dev... " && mount --bind / ${FAKEROOT} && echo "done."
echo "Checking /dev/ for needed static boot nodes... "
create_node 0600 console c 5 1
create_node 0666 null c 1 3
echo -n "Unmounting fake root... " && umount ${FAKEROOT} && echo "done."
echo -n "Removing fake root dir... " && rm -rf ${FAKEROOT} && echo "done."
exit 0
--- NEW FILE: udev ---
#! /bin/bash
#
# udev init script to setup /udev
#
# chkconfig: 2345 20 80
# description: manage user-space device nodes in /udev
# . /etc/rc.d/init.d/functions
. /etc/udev/udev.conf
prog=udev
sysfs_dir=/sys
bin=/sbin/udev
udevd=/sbin/udevd
udev_root=/udev
# **** Added by florin && nestu, 2004/03/05 ****
# if this subdir doesn't exist, create it
test -d /var/lock/subsys/ || mkdir -p /var/lock/subsys/
# originally in /etc/rc.d/init.d/functions, it has been changed
# and brought here
success() {
RES_COL=60
MOVE_TO_COL="echo -en \\033[${RES_COL}G"
SETCOLOR_SUCCESS="echo -en \\033[1;32m"
SETCOLOR_NORMAL="echo -en \\033[0;39m"
[ "$BOOTUP" = "color" ] && $MOVE_TO_COL
echo -n "[ "
[ "$BOOTUP" = "color" ] && $SETCOLOR_SUCCESS
echo -n $"OK"
[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
echo -n " ]"
echo -ne "\r"
return 0
}
# **** end added by nestu && florin, 2004/03/05 ****
run_udev () {
# handle block devices and their partitions
for i in ${sysfs_dir}/block/*; do
# add each drive
export DEVPATH=${i#${sysfs_dir}}
$bin block &
# add each partition, on each device
for j in $i/*; do
if [ -f $j/dev ]; then
export DEVPATH=${j#${sysfs_dir}}
$bin block &
fi
done
done
# all other device classes
for i in ${sysfs_dir}/class/*; do
for j in $i/*; do
if [ -f $j/dev ]; then
export DEVPATH=${j#${sysfs_dir}}
CLASS=`echo ${i#${sysfs_dir}} | \
cut --delimiter='/' --fields=3-`
$bin $CLASS &
fi
done
done
return 0
}
make_extra_nodes () {
# there are a few things that sysfs does not export for us.
# these things go here (and remember to remove them in
# remove_extra_nodes()
#
# Thanks to Gentoo for the initial list of these.
ln -snf /proc/self/fd $udev_root/fd
ln -snf /proc/self/fd/0 $udev_root/stdin
ln -snf /proc/self/fd/1 $udev_root/stdout
ln -snf /proc/self/fd/2 $udev_root/stderr
ln -snf /proc/kcore $udev_root/core
#ln -snf /proc/asound/oss/sndstat $udev_root/sndstat
}
remove_extra_nodes () {
# get rid of the extra nodes created in make_extra_nodes()
# **** changed by niki (added the if's), 20040305 ****
if [ -e $udev_root/fd ] ; then rm $udev_root/fd; fi
if [ -e $udev_root/stdin ] ; then rm $udev_root/stdin; fi
if [ -e $udev_root/stdout ] ; then rm $udev_root/stdout; fi
if [ -e $udev_root/stderr ] ; then rm $udev_root/stderr; fi
if [ -e $udev_root/core ] ; then rm $udev_root/core; fi
#rm $udev_root/sndstat
}
case "$1" in
start)
# don't use udev if sysfs is not mounted.
if [ ! -d $sysfs_dir/block ]; then
exit 1
fi
if [ ! -d $udev_root ]; then
mkdir $udev_root
fi
# remove the database if it is there as we always want to start fresh
if [ -f $udev_root/.udev.tdb ]; then
rm -f $udev_root/.udev.tdb
fi
# propogate /udev from /sys - we only need this while we do not
# have initramfs and an early user-space with which to do early
# device bring up
export ACTION=add
echo -n $"Creating initial udev device nodes:"
run_udev
make_extra_nodes
# We want to start udevd ourselves if it isn't already running. This
# lets udevd run at a sane nice level...
$udevd &
success /bin/true
echo
touch /var/lock/subsys/udev
;;
stop)
# be careful
echo -n $"Removing udev device nodes: "
export ACTION=remove
run_udev
remove_extra_nodes
success /bin/true
echo
rm -f /var/lock/subsys/udev
;;
status)
if [ -f /var/lock/subsys/udev ]; then
echo $"$prog has run"
exit 0
fi
echo $"$prog is stopped"
exit 3
;;
restart)
$0 stop
$0 start
;;
reload)
# nothing to do here
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
esac
exit 0
Index: BUILD
===================================================================
RCS file: /var/cvs/lunar/moonbase/filesys/udev/BUILD,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- BUILD 21 Apr 2004 23:28:08 -0000 1.7
+++ BUILD 8 Nov 2004 09:55:52 -0000 1.8
@@ -1,5 +1,16 @@
(
-
default_make
+
+ # install the init.d script
+ # we cannot use automagic install via coretools
+ # since the udev script would be linked from rcX.d
+ # and would interfere with boot/{reboot,halt}
+ install ${SCRIPT_DIRECTORY}/udev /etc/init.d/
+
+ UDEV_ETC_DIR=/etc/udev/
+ install ${SCRIPT_DIRECTORY}/99-udev.permissions ${UDEV_ETC_DIR}/permissions.d/
+ install ${SCRIPT_DIRECTORY}/99-udev.rules ${UDEV_ETC_DIR}/rules.d/
+
+ install -d ${SCRIPT_DIRECTORY}/scripts.d/ ${UDEV_ETC_DIR}
) > $C_FIFO 2>&1
More information about the Lunar-commits
mailing list