~ubuntu-branches/ubuntu/dapper/cdrtools/dapper

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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/sh
################################################################
# mk node boot script for HP9000 800 series following man scsi_pt
#
# This script is provided WITHOUT ANY WARRANTY.
################################################################

PATH=/sbin:/usr/sbin:/usr/bin:.
export PATH

case $1 in

start_msg)
	echo "Creating SCSI passthru (spt) driver nodes"
	;;

stop_msg)
	echo "Removing SCSI passthru (spt) driver nodes"
	;;

start)

	hpser=`uname -m | awk -F / '{print substr($2, 1, 1);}'`
	if [ $hpser -ne "8" ]; then
		echo "spt driver only needed on HP 9000/800 series."
		exit 0
	fi

	#mknod="echo mknod"
	#mkdir="echo mkdir -p"
	#chmod="echo chmod"
    
	mknod="/usr/sbin/mknod"
	mkdir="mkdir -p"
	chmod="chmod"
    
	sptlist="/tmp/spt.$$"
	echo "Searching SCSI passthru drivers (spt) ..."
	ioscan -kf -d spt | sed '1,2d' | awk '{print $3;}' > $sptlist
	nctl=`wc -l < $sptlist`
	echo "... found $nctl"

	if [ ! -s $sptlist ]; then
		rm -f $sptlist
		exit 0
	fi

	scsi=/dev/scsi
	${mkdir} ${scsi}
    
	rscsi=/dev/rscsi
	${mkdir} ${rscsi}
    
	cmajor=`lsdev -h -d spt | awk '{print $1;}'`
    
	for line in `cat $sptlist` ; do

		ctl=`echo $line | awk -F . '{print $1;}'`
		bus=`ioscan -f -k -H $ctl -C ext_bus | sed '1,2d' | awk '{print $2;}'`
		tgt=`echo $line | awk -F . '{print $2;}'`
		hextgt=`printf "%x" $tgt`

		# make first scsi nodes
		name="${scsi}/c${bus}t${tgt}l0"
		echo "Creating $name"
		${mknod} $name c $cmajor 0x${bus}${hextgt}000 > /dev/null 2>&1
		${chmod} 0600 $name > /dev/null 2>&1

		# then rscsi nodes
		rname="${rscsi}/c${bus}t${tgt}l0"
		echo "Creating $rname"
		# Old version, not working!
		#${mknod} $rname c $cmajor 0x${bus}${hextgt}020 > /dev/null 2>&1
		${mknod} $rname c $cmajor 0x${bus}${hextgt}000 > /dev/null 2>&1
		${chmod} 0600 $rname > /dev/null 2>&1
	done

	rm -f $sptlist
	exit 0
    
	;;

stop)
	;;

*)
	echo usage: $0 "{start|stop}"
	;;
esac

exit 0