File: setup_devs

package info (click to toggle)
dmx4linux 2.5%2Bdfsg-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,660 kB
  • ctags: 2,835
  • sloc: ansic: 23,341; yacc: 918; asm: 846; makefile: 614; sh: 439
file content (52 lines) | stat: -rwxr-xr-x 1,190 bytes parent folder | download
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh

function clean()
{
  # remove device nodes
  rm -f /dev/dmx*

  # clean up /etc/modules.conf
  cp -f /etc/modules.conf /etc/modules.conf.bak
  sed -e '/dmxdev/d' < /etc/modules.conf.bak > /etc/modules.conf
}

function distclean()
{
  clean
  groupdel dmx
}

function install()
{
  # get minor numbers
  DMXROOT=..
  grep MINOR < $DMXROOT/config.mk > /tmp/$$.tmp
  source /tmp/$$.tmp
  rm -f /tmp/$$.tmp

  # clean old settting from /etc/modules.conf and /dev/dmx*
  clean

  #  add a new group for dmx activity
  groupadd dmx

  # create device nodes
  mknod /dev/dmx     c 10 ${DMXOUTMINOR}
  mknod /dev/dmxin   c 10 ${DMXINMINOR}
  chown root.dmx /dev/dmx /dev/dmxin
  chmod 660 /dev/dmx /dev/dmxin

  # fix /etc/modules.conf
  cp -f /etc/modules.conf /etc/modules.conf.old
  echo "alias char-major-10-${DMXOUTMINOR} dmxdev" >> /etc/modules.conf
  echo "alias char-major-10-${DMXINMINOR} dmxdev" >> /etc/modules.conf
}

if [ "$1" = "install" ]
then install
elif [ "$1" = "distclean" -o "$1" = "uninstall" ]
then distclean
else echo "usage: setup_devs install   - create device nodes in /dev"
     echo "    or setup_devs distclean - remove device nodes in /dev"
     exit 1
fi