File: discover-sbus.sh

package info (click to toggle)
hw-detect 1.137
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,604 kB
  • sloc: sh: 1,300; makefile: 103; perl: 102; ansic: 39
file content (38 lines) | stat: -rwxr-xr-x 1,030 bytes parent folder | download | duplicates (11)
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
#! /bin/sh
set -e

# Detect hardware from output of prtconf utility to support devices on a Sparc
# sbus. Should be removed once the kernel has sysfs support for these devices.
#
# If the hardware is of use within d-i, then echo it.
# We should probably also call register-module or schedule drivers for addition
# in initramfs initrd generators, but that will be taken care of later.

# If discover is present, then prefer discover for sbus hardware detection.
if type discover >/dev/null 2>&1 ; then
	exit 0
fi

if ! type prtconf >/dev/null 2>&1 ; then
	exit 0
fi

SBUSLIST=/usr/share/hw-detect/sbus.list

PRTCONF=$(prtconf)

grep "^[^#].*:.*:.*" $SBUSLIST | while read DEVLINE; do
	DEVID=$(echo $DEVLINE | cut -d: -f1)
	DEVDESCR=$(echo $DEVLINE | cut -d: -f2)
	DEVMOD=$(echo $DEVLINE | cut -d: -f3)
	TARGET=$(echo $DEVLINE | cut -d: -f4)

	if echo "$PRTCONF" | grep -q "^ *$DEVID "; then
		echo "$DEVMOD:$DEVDESCR"
		if [ "$TARGET" = initrd ]; then
			register-module -i $DEVMOD
		else
			register-module $DEVMOD
		fi
	fi
done