File: cwsetup.sh

package info (click to toggle)
cwdaemon 0.9.2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 908 kB
  • ctags: 434
  • sloc: ansic: 4,522; sh: 3,392; makefile: 89
file content (51 lines) | stat: -rwxr-xr-x 882 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh

PATH="/bin:/sbin:/usr/bin:/usr/bin:/usr/local/bin:/usr/local/sbin:."

# check if we are root
if [ "$EUID" != "0" ]; then
	echo "You must run this script as root..."
	exit 1
fi

job=0

echo "Checking what needs to be done"

# check for parport devices
if [ ! -c /dev/parport0 ]; then
	echo "Creating parport devices"
	DIR=`pwd`
	cd /dev
	MAKEDEV parport
	cd $DIR
	job=1
fi

# check for kernel modules
if ! lsmod|grep parport > /dev/null; then
	echo "Loading parport modules"
	modprobe parport_pc
	modprobe parport
	job=1
fi

if lsmod|grep lp|grep " 0 " > /dev/null; then
	echo "Unloading lp module"
	rmmod lp
	job=1
fi

if ! lsmod|grep ppdev > /dev/null; then
	echo "Loading ppdev module"
	modprobe ppdev
	job=1
fi

if [ $job -eq 1 ]; then
	echo "Setup is ready"
else
	echo "Nothing to do, your setup is okay"
fi

echo "Please run \"cwdaemon -n\" (as root) for diagnosis"