File: mkdev.sh

package info (click to toggle)
lm-sensors 1%3A2.10.1-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 5,104 kB
  • ctags: 10,474
  • sloc: ansic: 61,469; perl: 7,544; sh: 1,491; makefile: 400; lex: 300; yacc: 291
file content (32 lines) | stat: -rwxr-xr-x 677 bytes parent folder | download | duplicates (3)
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
#!/bin/bash

# Here you can set several defaults.

# The number of devices to create (max: 256)
# If not provided on the command line, default to 32
NUMBER=${1:-32}

# The owner and group of the devices
OUSER=root
OGROUP=root
# The mode of the devices
MODE=600

# This script doesn't need to be run if devfs is used
if [ -r /proc/mounts ] ; then
	if grep -q "/dev devfs" /proc/mounts ; then
		echo "You do not need to run this script as your system uses devfs."
		exit;
	fi
fi

i=0;

while [ $i -lt $NUMBER ] ; do
	if [ ! -c /dev/i2c-$i ] ; then
		echo /dev/i2c-$i
		mknod -m $MODE /dev/i2c-$i c 89 $i || exit
		chown "$OUSER:$OGROUP" /dev/i2c-$i || exit
	fi
	i=$[$i + 1]
done