224
|
1 |
#!/bin/sh
|
232
|
2 |
module="ec_msr_sample"
|
224
|
3 |
device="msr"
|
|
4 |
mode="664"
|
|
5 |
|
|
6 |
# Group: since distributions do it differently, look for wheel or use staff
|
|
7 |
if grep '^staff:' /etc/group > /dev/null; then
|
|
8 |
group="staff"
|
|
9 |
else
|
|
10 |
group="wheel"
|
|
11 |
fi
|
|
12 |
|
|
13 |
# invoke insmod with all arguments we got
|
|
14 |
# and use a pathname, as newer modutils don't look in . by default
|
|
15 |
/sbin/insmod -f ./$module.ko $* || exit 1
|
|
16 |
|
|
17 |
major=`cat /proc/devices | awk "\\$2==\"$device\" {print \\$1}"`
|
|
18 |
|
|
19 |
echo $major
|
|
20 |
# Remove stale nodes and replace them, then give gid and perms
|
|
21 |
# Usually the script is shorter, it's scull that has several devices in it.
|
|
22 |
|
|
23 |
rm -f /dev/${device}
|
|
24 |
mknod /dev/${device} c $major 0
|
|
25 |
# ln -sf ${device}0 /dev/${device}
|
|
26 |
chgrp users /dev/${device}
|
|
27 |
chmod $mode /dev/${device}
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|