File: subarch-dev

package info (click to toggle)
userdevfs 0.09
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 32 kB
  • ctags: 6
  • sloc: sh: 139; makefile: 36
file content (47 lines) | stat: -rwxr-xr-x 1,212 bytes parent folder | download | duplicates (6)
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
#!/bin/sh

# subarch-specific handling
case "`archdetect`" in
"m68k/*vme*")
	# check for a scsi-floppy
	if [ ! -e /dev/sfd0 ]; then
		PROCSCSI=/proc/scsi/scsi

# algorithm from bf/dbootstrap/main.c, hopefully it works.
#/* scan /proc/scsi/scsi for TEAC FC-1 floppy drive
# * and create /dev/sfd[0-7] symlinks if found
# */
#        if (strstr(buf, "Vendor:")
#        &&  strstr(buf, "TEAC"   )
#        &&  strstr(buf, "Model:" )
#        &&  strstr(buf, "FC-1"   )) {
#          sprintf(dev, "sd%c", 'a' + i);
#          sprintf(buf, "/dev/sfd%d", n++);

		CNTDEV=0
		CNTSFD=0
		cat $PROCSCSI | while read line; do
			if [ "" != "`echo $line | grep 'Host:'`" ]; then
				CNTDEV=$((CNTDEV+1))	
			elif [ "" != "`echo $line | grep 'Vendor:' | grep TEAC | grep 'FC-1'`" ]; then
				ADEV=`printf "%o" $(($CNTDEV+0141))`
				ADEV=`echo -e '\0'$ADEV`
				
				if [ ! -e $ROOT/dev/sfd$CNTSFD ]; then
					if [ ! -e $ROOT/dev/sd$ADEV ]; then
						echo  "Creating /dev/sd$ADEV ..."
						mknod $ROOT/dev/sd$ADEV b $((16*$CNTDEV)) 0
					fi
			
					echo  "Linking /dev/sd$ADEV to /dev/sfd$CNTSFD ..."
					ln -s $ROOT/dev/sd$ADEV $ROOT/dev/sfd$CNTSFD
				fi
				CNTSFD=$((CNTSFD+1))	
			fi
		done
	fi
	;;
*)
	;;
esac