Imported Upstream version 1.1.11
[platform/upstream/cdrkit.git] / misc / MKNOD.hpux-800
1 #!/bin/sh
2 ################################################################
3 # mk node boot script for HP9000 800 series following man scsi_pt
4 #
5 # This script is provided WITHOUT ANY WARRANTY.
6 ################################################################
7
8 PATH=/sbin:/usr/sbin:/usr/bin:.
9 export PATH
10
11 case $1 in
12
13 start_msg)
14         echo "Creating SCSI passthru (spt) driver nodes"
15         ;;
16
17 stop_msg)
18         echo "Removing SCSI passthru (spt) driver nodes"
19         ;;
20
21 start)
22
23         hpser=`uname -m | awk -F / '{print substr($2, 1, 1);}'`
24         if [ $hpser -ne "8" ]; then
25                 echo "spt driver only needed on HP 9000/800 series."
26                 exit 0
27         fi
28
29         #mknod="echo mknod"
30         #mkdir="echo mkdir -p"
31         #chmod="echo chmod"
32     
33         mknod="/usr/sbin/mknod"
34         mkdir="mkdir -p"
35         chmod="chmod"
36     
37         sptlist="/tmp/spt.$$"
38         echo "Searching SCSI passthru drivers (spt) ..."
39         ioscan -kf -d spt | sed '1,2d' | awk '{print $3;}' > $sptlist
40         nctl=`wc -l < $sptlist`
41         echo "... found $nctl"
42
43         if [ ! -s $sptlist ]; then
44                 rm -f $sptlist
45                 exit 0
46         fi
47
48         scsi=/dev/scsi
49         ${mkdir} ${scsi}
50     
51         rscsi=/dev/rscsi
52         ${mkdir} ${rscsi}
53     
54         cmajor=`lsdev -h -d spt | awk '{print $1;}'`
55     
56         for line in `cat $sptlist` ; do
57
58                 ctl=`echo $line | awk -F . '{print $1;}'`
59                 bus=`ioscan -f -k -H $ctl -C ext_bus | sed '1,2d' | awk '{print $2;}'`
60                 tgt=`echo $line | awk -F . '{print $2;}'`
61                 hextgt=`printf "%x" $tgt`
62
63                 # make first scsi nodes
64                 name="${scsi}/c${bus}t${tgt}l0"
65                 echo "Creating $name"
66                 ${mknod} $name c $cmajor 0x${bus}${hextgt}000 > /dev/null 2>&1
67                 ${chmod} 0600 $name > /dev/null 2>&1
68
69                 # then rscsi nodes
70                 rname="${rscsi}/c${bus}t${tgt}l0"
71                 echo "Creating $rname"
72                 # Old version, not working!
73                 #${mknod} $rname c $cmajor 0x${bus}${hextgt}020 > /dev/null 2>&1
74                 ${mknod} $rname c $cmajor 0x${bus}${hextgt}000 > /dev/null 2>&1
75                 ${chmod} 0600 $rname > /dev/null 2>&1
76         done
77
78         rm -f $sptlist
79         exit 0
80     
81         ;;
82
83 stop)
84         ;;
85
86 *)
87         echo usage: $0 "{start|stop}"
88         ;;
89 esac
90
91 exit 0
92