/usr/bin/scsi_vendor is in dds2tar 2.5.2-7.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 | #!/bin/bash
#
# Determine the Vendor of a device
#
# csh-Example:
#
# <1>scsi_vendor
# Disks: SEAGATE SAMSUNG
# Cdroms: TOSHIBA PHILIPS
# Tapes: HP
# <2>scsi_vendor disk
# SEAGATE SAMSUNG
# <383>scsi_vendor cd
# TOSHIBA PHILIPS
# <3>scsi_vendor tape
# HP
# <4>scsi_vendor tape 1
# HP
# <5>scsi_vendor disk 1
# <6>scsi_vendor disk 1
# SEAGATE
# <7>scsi_vendor disk 2
# SAMSUNG
#
# Ported to bash 01.07.03 <kieren@tigs.org>
s=( )
c=( )
d=( )
o=''
v=''
SCSIINFO=`grep '^ ' /proc/scsi/scsi | cut -c3-18`
for i in $SCSIINFO
do
if [ "$o" = "Vendor:" ]; then
v=$i
fi
if [[ "$o" == 'Type:' && "$i" == 'Sequenti' ]]; then
s=( $s $v )
fi
if [[ "$o" == 'Type:' && "$i" == 'CD-ROM' ]]; then
c=( $c $v )
fi
if [[ "$o" == 'Type:' && "$i" == 'Direct-A' ]]; then
d=( $d $v )
fi
o=$i
done
if [ $# == 0 ]; then
echo Disks: $d
echo Cdroms: $c
echo Tapes: $s
exit 0
fi
if [ $# == 1 ]; then
v='' ;
if [ "$1" == "disk" ]; then
echo $d
fi
if [ "$1" == "cd" ]; then
echo $c
fi
if [ "$1" == "tape" ]; then
echo $s
fi
exit 0
fi
if [ $# -eq 2 ]; then
v=''
if [[ "$1" == "disk" && ${#d[@]} -ge $2 ]]; then
v=$d[$2]
fi
if [[ "$1" == "cd" && ${#c[@]} -ge $2 ]]; then
v=$c[$2]
fi
if [[ "$1" == "tape" && ${#s[@]} -ge $2 ]]; then
v=${s[$2]}
fi
echo $v
exit 0
fi
if [ "$v" == "$3" ]; then
exit 2
fi
exit 1
|