File: create_static_nodes

package info (click to toggle)
udev 164-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 4,336 kB
  • ctags: 1,738
  • sloc: ansic: 18,516; sh: 11,378; perl: 1,725; xml: 1,286; makefile: 692; python: 34
file content (31 lines) | stat: -rw-r--r-- 616 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh -e

make_extra_nodes() {
  [ -e /etc/udev/links.conf ] || return 0

  grep '^[^#]' /etc/udev/links.conf | \
  while read type name arg1; do
    [ "$type" -a "$name" -a ! -e "/$1/$name" -a ! -L "/$1/$name" ] || continue
    case "$type" in
      L) ln -s $arg1 /$1/$name ;;
      D) mkdir -p /$1/$name ;;
      M) mknod -m 600 /$1/$name $arg1 ;;
      *) echo "links.conf: unparseable line ($type $name $arg1)" >&2 ;;
    esac

    if [ -x /sbin/restorecon ]; then
      /sbin/restorecon /dev/$name
    fi
  done
}

if [ "$1" ]; then
  devdir="$1"
else
  devdir='/dev'
fi

make_extra_nodes $devdir

exit 0