[Fedora-livecd-list] tools/livecd-iso-to-disk.sh
Jeremy Katz
katzj at fedoraproject.org
Tue Jan 27 02:52:19 UTC 2009
tools/livecd-iso-to-disk.sh | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
New commits:
commit 90c15a1993e6356de4b0134bc018834a22ba6b59
Author: Stewart Adam <maillist at diffingo.com>
Date: Mon Jan 26 17:50:44 2009 -0500
Using both EFI and MBR at once on Live USB images and other misc. fixes
Good news - syslinux's gptmbr.bin is working fine. I was using the partition
type UUID, not its unique UUID. With this correction, things work fine when
booting with BIOS or EFI!
I've attached a patch which re-adds the check for gptmbr.bin and if it's
found, then the script will now automatically grab the partition's unique
UUID and write a compatible MBR. It should work on all drives with an LBA
size of 512 bytes.
The patch also includes a minor fix: If --format is specified and the user
has accepted the first warning by hitting <enter>, then it will
automatically unmount all partitions on the device so that the parted
commands don't fail.
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index d37a2e9..85dba7e 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -71,10 +71,15 @@ resetMBR() {
# if mactel, we need to use the hybrid MBR
if [ -n "$mactel" ];then
if [ -f /usr/lib/syslinux/gptmbr.bin ]; then
- cat /usr/lib/syslinux/gptmbr.bin > $device
+ gptmbr='/usr/lib/syslinux/gptmbr.bin'
elif [ -f /usr/share/syslinux/gptmbr.bin ]; then
- cat /usr/share/syslinux/gptmbr.bin > $device
+ gptmbr='/usr/share/syslinux/gptmbr.bin'
+ else
+ echo "Could not find gptmbr.bin (syslinux)"
+ exitclean
fi
+ # our magic number is LBA-2, offset 16 - (512+512+16)/$bs
+ dd if=$device bs=16 skip=65 count=1 | cat $gptmbr - > $device
else
if [ -f /usr/lib/syslinux/mbr.bin ]; then
cat /usr/lib/syslinux/mbr.bin > $device
@@ -136,7 +141,7 @@ createGPTLayout() {
echo "WARNING: THIS WILL DESTROY ANY DATA ON $device!!!"
echo "Press Enter to continue or ctrl-c to abort"
read
-
+ umount ${device}? &> /dev/null
/sbin/parted --script $device mklabel gpt
partinfo=$(/sbin/parted --script -m $device "unit b print" |grep ^$device:)
size=$(echo $partinfo |cut -d : -f 2 |sed -e 's/B$//')
@@ -158,7 +163,7 @@ createMSDOSLayout() {
echo "WARNING: THIS WILL DESTROY ANY DATA ON $device!!!"
echo "Press Enter to continue or ctrl-c to abort"
read
-
+ umount ${device}? &> /dev/null
/sbin/parted --script $device mklabel msdos
partinfo=$(/sbin/parted --script -m $device "unit b print" |grep ^$device:)
size=$(echo $partinfo |cut -d : -f 2 |sed -e 's/B$//')
More information about the livecd
mailing list