75 lines
2.4 KiB
Diff
75 lines
2.4 KiB
Diff
Description: 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.
|
|
Last-Update: 2011-08-04
|
|
Bug-Debian: http://bugs.debian.org/615602
|
|
Bug-Debian: http://bugs.debian.org/580455
|
|
Author: Milan Kupcevic <milan@physics.harvard.edu>
|
|
Forwarded: http://patchwork.ozlabs.org/patch/108567/
|
|
--- a/ybin/yabootconfig
|
|
+++ b/ybin/yabootconfig
|
|
@@ -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+debian2
|
|
CHROOT=/
|
|
## $CONFIG is relative to $CHROOT
|
|
CONFIG=etc/yaboot.conf
|
|
@@ -732,6 +732,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
|
|
##
|
|
@@ -739,9 +760,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"
|
|
|
|
--- a/ybin/ybin
|
|
+++ b/ybin/ybin
|
|
@@ -1647,6 +1647,12 @@
|
|
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
|