tags 580455 patch
thanks

Attached patch will:

- Correctly parse boot, bsd, macosx, and darwin options with escaped
characters or when in quotes; convert symlinks into canonical unix block
device names;

- Create yaboot.conf using by-id persistent device name for boot, and
UUID label for root variables.

diff -Nru ./ybin/yabootconfig ../yaboot-1.3.13a/ybin/yabootconfig
--- ./ybin/yabootconfig	2004-07-11 16:12:23.000000000 -0400
+++ ../yaboot-1.3.13a/ybin/yabootconfig	2010-12-02 11:26:10.000000000 -0500
@@ -27,7 +27,7 @@
     PATH="${PATH}:${PATH_PREFIX}/sbin:${PATH_PREFIX}/bin:${PATH_PREFIX}/usr/sbin:${PATH_PREFIX}/usr/bin:${PATH_PREFIX}/usr/local/sbin:${PATH_PREFIX}/usr/local/bin"
 fi
 PRG="${0##*/}"
-VERSION=1.0.8
+VERSION=1.0.8+debian1
 CHROOT=/
 ## $CONFIG is relative to $CHROOT
 CONFIG=etc/yaboot.conf
@@ -720,6 +720,27 @@
     INITRDIMGS="\tinitrd=$INITRDIMG\n\tinitrd-size=8192\n"
 fi
 
+## 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=,"
+}
+
 ## generate global section of yaboot.conf
 GLOBAL="## yaboot.conf generated by $PRG $VERSION
 ##
@@ -727,9 +748,9 @@
 ${HEADER}##
 ## For a dual-boot menu, add one or more of: 
 ## bsd=/dev/hdaX, macos=/dev/hdaY, macosx=/dev/hdaZ\n
-boot=${BOOT}${DEVICE:-}
+boot=\"`devsymlink "${BOOT}"`\"${DEVICE:-}
 partition=$PARTITION
-root=$ROOT
+root=\"`uuidlabel "${ROOT}"`\"
 timeout=30
 install=${INSTALL}${OFBOOT:-}\n"
 
diff -Nru ./ybin/ybin ../yaboot-1.3.13a/ybin/ybin
--- ./ybin/ybin	2004-07-11 16:12:12.000000000 -0400
+++ ../yaboot-1.3.13a/ybin/ybin	2010-12-02 11:25:53.000000000 -0500
@@ -1589,6 +1589,13 @@
     exit 1
 fi
 
+## also accept symlink names in quotes or with escaped characters
+boot="`readlink -f \"$(eval echo ${boot})\"`"
+bsd="`readlink -f \"$(eval echo ${bsd})\"`"
+macos="`readlink -f \"$(eval echo ${macos})\"`"
+macosx="`readlink -f \"$(eval echo ${macosx})\"`"
+darwin="`readlink -f \"$(eval echo ${darwin})\"`"
+
 ## if there is still no config file use the automatic generation to make a
 ## generic yaboot.conf. do this before the confcheck to avoid wierd errors.
 if [ "$bootconf" = /dev/null ] ; then

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to