cdrtools/MKNOD.hpux-800
2025-06-15 04:19:58 +08:00

93 lines
1.9 KiB
Bash
Executable File

#!/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