summaryrefslogtreecommitdiff
blob: f225e8e1bb4bdeb96bcd8b79071a13a7ac0e969f (plain)
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
Fix the devspec path on newer kernels

--- usr/sbin/ofpath
+++ usr/sbin/ofpath
@@ -85,11 +85,20 @@
 [ "$DEBUG" = 1 ] && echo "Devpath is: $DEVPATH"
 
 ### Get the OF Path of the controller
-case ${DISK_NAME} in
-	sd*|sg*|sr*) CONTROLLER_PATH=$(cat ${DEVPATH}/../../../devspec) ;;
-	hd*) CONTROLLER_PATH=$(cat ${DEVPATH}/../../devspec) ;;
-	*) CONTROLLER_PATH="" ;;
-esac
+if [ -e  "${DEVPATH}/../../devspec" ]; then
+	### /dev/hd*
+	CONTROLLER_PATH=$(cat ${DEVPATH}/../../devspec);
+elif [ -e "${DEVPATH}/../../../devspec" ]; then
+	### /dev/sd* on kernel <3.3
+	CONTROLLER_PATH=$(cat ${DEVPATH}/../../../devspec);
+elif [ -e "${DEVPATH}/../../../../devspec" ]; then
+	### /dev/sd* on kernel 3.3+
+	CONTROLLER_PATH=$(cat ${DEVPATH}/../../../../devspec);
+else
+	### None of the above...
+	CONTROLLER_PATH="";
+fi
+
 if [ -z "$CONTROLLER_PATH" ]; then
 	echo "Unable to determine controller path!"
 	exit 1