[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#572925: installation-reports: PowerMac G5 ofpath doesn't work in the absence of /proc/scsi/scsi



tags 572925 patch
thanks

linux-base package already transforms old yaboot.conf unix block device
names into persistent device names on upgrades. Yaboot just got bug fix
for #572869 and will be able to parse such configuration files. We
should commit the attached patch and upload yaboot-installer at the same
time, or soon after fixed yaboot reaches squeeze.


Find bug-fix test install cd at:
http://www.quarkline.net/debian/bug/yaboot/
Index: debian/postinst
===================================================================
--- debian/postinst	(revision 65804)
+++ debian/postinst	(working copy)
@@ -240,6 +240,27 @@
     chroot /target ofpath "$1" || return 1
 }
 
+# Get a symlink which always points to the correct block device.
+# If it does not exist, give the unix block device name back.
+devsymlink() {
+  [ "$2" != "nobyid" ] && BYID="/dev/disk/by-id/scsi* /dev/disk/by-id/*"
+  for SYMLINK in $BYID /dev/disk/by-uuid/* /dev/disk/by-label/*; do
+    [ "`readlink -f "$SYMLINK"`" = "$1" ] && {
+      echo $SYMLINK
+      return
+    }
+  done
+  echo $1
+}
+
+# Get UUID= or LABEL= for the given unix partition block device.
+# If it could not be determined, give the unix partition block device back.
+uuidlabel() {
+  echo `devsymlink "$1" nobyid` \
+  | sed -e "s,/dev/disk/by-uuid/,UUID=," \
+        -e "s,/dev/disk/by-label/,LABEL=,"
+}
+
 OLDIFS="$IFS"
 IFS=:
 # Note that this creates a subshell, so variables set inside this loop won't
@@ -270,6 +291,8 @@
 		if [ -z "$label" ]; then
 		    label="$oldlabel"
 		fi
+		# remove root parameter from params
+		params="`echo $params | sed -e "s,root=[^[:space:]]*,,"`"
 		if echo "$kernel" | grep -q '^/boot/' && \
 		   [ "$mappedbootpart" != "$mappedpartition" ]; then
 		    # separate /boot partition
@@ -282,7 +305,7 @@
 # Linux installation on $mappedpartition.
 image=$ofbootpart,$kernel
     label=$label
-    root=$ofrootpart
+    root="`uuidlabel "$mappedpartition"`"
     append="$params"
 EOF
 		if [ -n "$initrd" ]; then
@@ -297,13 +320,13 @@
 	macosx)
 	    if ! [ "$macosx" ]; then
 		macosx=1
-		echo "macosx=$mappedpartition" | writeglobals
+		echo "macosx=\"`devsymlink "$mappedpartition"`\"" | writeglobals
 	    fi
 	    ;;
 	macos)
 	    if ! [ "$macos" ]; then
 		macos=1
-		echo "macos=$mappedpartition" | writeglobals
+		echo "macos=\"`devsymlink "$mappedpartition"`\"" | writeglobals
 	    fi
 	    ;;
 	*)
@@ -408,7 +431,7 @@
 
 if [ "$boot" ]; then
     writeyabootconf <<EOF
-boot=$boot
+boot="`devsymlink "$boot"`"
 EOF
 fi
 
@@ -421,7 +444,7 @@
 fi
 writeyabootconf <<EOF
 partition=$partnr
-root=$root
+root="`uuidlabel "$root"`"
 timeout=$timeout
 install=$yaboot_location
 EOF

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: