@@ -27,7 +27,7 @@ if [ -n "$PATH_PREFIX" ] ; then
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+debian2
CHROOT=/
## $CONFIG is relative to $CHROOT
CONFIG=etc/yaboot.conf
@@ -732,6 +732,27 @@ if [ -n "$INITRDIMG" ] ; then
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
##
@@ -739,9 +760,9 @@ GLOBAL="## yaboot.conf generated by $PRG $VERSION
${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"
@@ -1641,6 +1641,12 @@ if [ "$boot" = unconfigured ] ; then
exit 1
fi
+## also accept quoted symlink names
+for v in boot bsd macos macosx darwin ; do
+ eval $v="\`echo \$$v | tr -d '\"'\`"
+ eval [ -h \"\$$v\" ] \&\& $v="\`readlink -f \$$v\`"
+done
+
## 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
Support persistent device naming symlinks, UUID, and LABEL tags in addition to openfirmware paths and aliases as traditional Unix block device names are not persistent anymore. Signed-off-by: Milan Kupcevic <milan@physics.harvard.edu> --- ybin/yabootconfig | 27 ++++++++++++++++++++++++--- ybin/ybin | 6 ++++++ 2 files changed, 30 insertions(+), 3 deletions(-)