1 | #! /bin/bash |
---|
2 | # Make extra /dev nodes. |
---|
3 | # |
---|
4 | # Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com> |
---|
5 | # Released under the GPL v2 only. |
---|
6 | # |
---|
7 | # Enhanced for Slackware Linux by volkerdi@slackware.com. |
---|
8 | |
---|
9 | if [ -z $udev_root ]; then |
---|
10 | . /etc/udev/udev.conf |
---|
11 | fi |
---|
12 | |
---|
13 | # these are a few things that sysfs does not export for us. |
---|
14 | ln -snf /proc/self/fd $udev_root/fd |
---|
15 | ln -snf /proc/self/fd/0 $udev_root/stdin |
---|
16 | ln -snf /proc/self/fd/1 $udev_root/stdout |
---|
17 | ln -snf /proc/self/fd/2 $udev_root/stderr |
---|
18 | ln -snf /proc/kcore $udev_root/core |
---|
19 | if [ -r $udev_root/psaux ]; then |
---|
20 | ( cd $udev_root ; ln -sf psaux mouse ) |
---|
21 | fi |
---|
22 | mkdir $udev_root/pts |
---|
23 | mkdir $udev_root/shm |
---|
24 | |
---|
25 | # If we can, add a default /dev/cdrom and /dev/dvd link: |
---|
26 | if /bin/ls -l /dev | grep -w cdrom 1> /dev/null 2> /dev/null ; then |
---|
27 | ( cd $udev_root |
---|
28 | /bin/ls -l * | grep -w cdrom | cut -f 2 -d : | cut -f 2 -d ' ' | while read optical_device ; do |
---|
29 | # It has to be a cdrom. Last one wins. |
---|
30 | ln -sf $optical_device cdrom |
---|
31 | # If it's a DVD, set that link as well: |
---|
32 | if grep -i dvd /proc/ide/$optical_device/model 1> /dev/null 2> /dev/null ; then |
---|
33 | ln -sf $optical_device dvd |
---|
34 | fi |
---|
35 | done |
---|
36 | unset optical_device |
---|
37 | ) |
---|
38 | fi |
---|
39 | |
---|
40 | # If we add /dev/ppp manually, then using it will autoload the modules. |
---|
41 | # I think this is how most people expect ppp to work these days. |
---|
42 | if [ ! -r /dev/ppp ]; then |
---|
43 | mknod -m 660 /dev/ppp c 108 0 |
---|
44 | chown root:uucp /dev/ppp |
---|
45 | fi |
---|
46 | |
---|
47 | # nVidia modules don't know about udev, so a little bit more clutter is in order. |
---|
48 | mknod -m 660 /dev/nvidiactl c 195 255 |
---|
49 | mknod -m 660 /dev/nvidia0 c 195 0 |
---|
50 | mknod -m 660 /dev/nvidia1 c 195 1 |
---|
51 | # If you have more than two of these cards, you'll have to add devices below. |
---|
52 | #mknod -m 660 /dev/nvidia2 c 195 2 |
---|
53 | #mknod -m 660 /dev/nvidia3 c 195 3 |
---|
54 | chown root:video /dev/nvidia* |
---|
55 | |
---|
56 | # Seed the loop device by adding /dev/loop0 (use this, and they'll all appear): |
---|
57 | if [ ! -r /dev/loop0 ]; then |
---|
58 | mknod -m 660 /dev/loop0 b 7 0 |
---|
59 | chown root:disk /dev/loop0 |
---|
60 | fi |
---|
61 | |
---|
62 | # Seed the floppy devices: |
---|
63 | if [ ! -r /dev/fd0 ]; then |
---|
64 | mknod -m 660 /dev/fd0 b 2 0 |
---|
65 | mknod -m 660 /dev/fd1 b 2 1 |
---|
66 | mknod -m 660 /dev/fd2 b 2 2 |
---|
67 | mknod -m 660 /dev/fd3 b 2 3 |
---|
68 | chown root:floppy /dev/fd{0,1,2,3} |
---|
69 | fi |
---|
70 | |
---|
71 | # We don't want to kludge *every* possible device, but a few would certainly be |
---|
72 | # useful. Most of the benefit in udev is the massive reduction of tty/pty clutter |
---|
73 | # (well, IMO), and I'd like to see kmod remain functional. I'd take a few more |
---|
74 | # requests here. :-) |
---|
75 | if [ ! -r /dev/rtc ]; then |
---|
76 | mknod -m 664 /dev/rtc c 10 135 |
---|
77 | fi |
---|
78 | |
---|
79 | # Devices needed for VMWare: |
---|
80 | if [ ! -r /dev/vmmon ]; then |
---|
81 | mknod -m 660 /dev/vmmon c 10 165 |
---|
82 | fi |
---|
83 | if [ ! -r /dev/vmnet0 ]; then |
---|
84 | mknod -m 660 /dev/vmnet0 c 119 0 |
---|
85 | for vmdev in 1 2 3 4 5 6 7 8 9 ; do |
---|
86 | if [ ! -r /dev/vmnet${vmdev} ]; then |
---|
87 | mknod -m 660 /dev/vmnet${vmdev} c 119 ${vmdev} |
---|
88 | fi |
---|
89 | done |
---|
90 | unset vmdev |
---|
91 | fi |
---|
92 | |
---|