[Fedora-livecd-list] Branch 'f16-branch' - 2 commits - Makefile tools/livecd-iso-to-disk.sh

Brian C. Lane bcl at fedoraproject.org
Thu Apr 26 22:14:08 UTC 2012


 Makefile                    |    2 
 tools/livecd-iso-to-disk.sh |  170 +++++++++++---------------------------------
 2 files changed, 44 insertions(+), 128 deletions(-)

New commits:
commit 1b6c8fa6d39cae100fe382ea6940560587ef9307
Author: Brian C. Lane <bcl at redhat.com>
Date:   Thu Apr 26 15:13:39 2012 -0700

    Version 16.14

diff --git a/Makefile b/Makefile
index f9a927e..52821b8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 
-VERSION = 16.13
+VERSION = 16.14
 
 INSTALL = /usr/bin/install -c
 INSTALL_PROGRAM = ${INSTALL}


commit c3c1a01674c2a734ea057658f90a20a2f270e4fc
Author: Brian C. Lane <bcl at redhat.com>
Date:   Thu Apr 26 14:43:41 2012 -0700

    copy repo data to USB for F17 (#806166)
    
    Fedora 17 runs from the media so repo= cannot be used to mount the same
    device for access to the repo so we now copy the repodata from the iso
    over to the / of the USB. This requires anaconda-17.23-1 or later.
    
    For releases before F17 the iso is still copied and repo= is setup to
    point to it.
    
    This reverts the use of 2 partitions that was used to work around this.

diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index 37abae0..15de42d 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -276,14 +276,11 @@ cleanup() {
     sleep 2
     [ -d "$SRCMNT" ] && umount $SRCMNT && rmdir $SRCMNT
     [ -d "$TGTMNT" ] && umount $TGTMNT && rmdir $TGTMNT
-    if [ -n "$REPOMNT" ]; then
-        [ -d "$REPOMNT" ] && umount $REPOMNT && rmdir $REPOMNT
-    fi
 }
 
 exitclean() {
     RETVAL=$?
-    if [ -d "$SRCMNT" ] || [ -d "$TGTMNT" ] || [ -n "$REPOMNT" ];
+    if [ -d "$SRCMNT" ] || [ -d "$TGTMNT" ];
     then
         [ "$RETVAL" = 0 ] || echo "Cleaning up to exit..."
         cleanup
@@ -423,16 +420,7 @@ createGPTLayout() {
     /sbin/parted --script $device mklabel gpt
     partinfo=$(LC_ALL=C /sbin/parted --script -m $device "unit MB print" |grep ^$device:)
     dev_size=$(echo $partinfo |cut -d : -f 2 |sed -e 's/MB$//')
-
-    # Is a 2nd partition needed for package iso?
-    if [ -n "$packages" ]; then
-        src_size=$(du -s -B 1MB "$SRC" | awk {'print $1;'})
-        # iso size + 7% of slop for filesystem metadata
-        p2_size=$(($src_size * 107 / 100))
-    else
-        p2_size=0
-    fi
-    p1_size=$(($dev_size - 3 - $p2_size))
+    p1_size=$(($dev_size - 3))
 
     if [ $p1_size -le 0 ]; then
         echo "Your device isn't big enough to hold $SRC"
@@ -442,11 +430,6 @@ createGPTLayout() {
     p1_start=1
     p1_end=$(($p1_size + 1))
     /sbin/parted -s $device u MB mkpart '"EFI System Partition"' fat32 $p1_start $p1_end set 1 boot on
-    if [ $p2_size -gt 0 ]; then
-        p2_start=$p1_end
-        p2_end=$(($p2_size + $p2_start))
-        /sbin/parted -s $device u MB mkpart '"LIVE REPO"' fat32 $p2_start $p2_end
-    fi
     # Sometimes automount can be _really_ annoying.
     echo "Waiting for devices to settle..."
     /sbin/udevadm settle
@@ -455,12 +438,6 @@ createGPTLayout() {
     umount $TGTDEV &> /dev/null || :
     /sbin/mkdosfs -n LIVE $TGTDEV
     TGTLABEL="UUID=$(/sbin/blkid -s UUID -o value $TGTDEV)"
-
-    if [ $p2_size -gt 0 ]; then
-        REPODEV=${device}2
-        umount $REPODEV &> /dev/null || :
-        /sbin/mkdosfs -n LIVE-REPO $REPODEV
-    fi
 }
 
 createMSDOSLayout() {
@@ -475,16 +452,7 @@ createMSDOSLayout() {
     /sbin/parted --script $device mklabel msdos
     partinfo=$(LC_ALL=C /sbin/parted --script -m $device "unit MB print" |grep ^$device:)
     dev_size=$(echo $partinfo |cut -d : -f 2 |sed -e 's/MB$//')
-
-    # Is a 2nd partition needed for package iso?
-    if [ -n "$packages" ]; then
-        src_size=$(du -s -B 1MB "$SRC" | awk {'print $1;'})
-        # iso size + 7% of slop for filesystem metadata
-        p2_size=$(($src_size * 107 / 100))
-    else
-        p2_size=0
-    fi
-    p1_size=$(($dev_size - 3 - $p2_size))
+    p1_size=$(($dev_size - 3))
 
     if [ $p1_size -le 0 ]; then
         echo "Your device isn't big enough to hold $SRC"
@@ -494,11 +462,6 @@ createMSDOSLayout() {
     p1_start=1
     p1_end=$(($p1_size + 1))
     /sbin/parted -s $device u MB mkpart primary fat32 $p1_start $p1_end set 1 boot on
-    if [ $p2_size -gt 0 ]; then
-        p2_start=$p1_end
-        p2_end=$(($p2_size + $p2_start))
-        /sbin/parted -s $device u MB mkpart primary fat32 $p2_start $p2_end
-    fi
     # Sometimes automount can be _really_ annoying.
     echo "Waiting for devices to settle..."
     /sbin/udevadm settle
@@ -511,12 +474,6 @@ createMSDOSLayout() {
     umount $TGTDEV &> /dev/null || :
     /sbin/mkdosfs -n LIVE $TGTDEV
     TGTLABEL="UUID=$(/sbin/blkid -s UUID -o value $TGTDEV)"
-
-    if [ $p2_size -gt 0 ]; then
-        REPODEV=${device}2
-        umount $REPODEV &> /dev/null || :
-        /sbin/mkdosfs -n LIVE-REPO $REPODEV
-    fi
 }
 
 createEXTFSLayout() {
@@ -531,16 +488,7 @@ createEXTFSLayout() {
     /sbin/parted -s $device mklabel msdos
     partinfo=$(LC_ALL=C /sbin/parted -s -m $device "u MB print" |grep ^$device:)
     dev_size=$(echo $partinfo |cut -d : -f 2 |sed -e 's/MB$//')
-
-    # Is a 2nd partition needed for package iso?
-    if [ -n "$packages" ]; then
-        src_size=$(du -s -B 1MB "$SRC" | awk {'print $1;'})
-        # iso size + 7% of slop for filesystem metadata
-        p2_size=$(($src_size * 107 / 100))
-    else
-        p2_size=0
-    fi
-    p1_size=$(($dev_size - 3 - $p2_size))
+    p1_size=$(($dev_size - 3))
 
     if [ $p1_size -le 0 ]; then
         echo "Your device isn't big enough to hold $SRC"
@@ -550,11 +498,6 @@ createEXTFSLayout() {
     p1_start=1
     p1_end=$(($p1_size + 1))
     /sbin/parted -s $device u MB mkpart primary ext2 $p1_start $p1_end set 1 boot on
-    if [ $p2_size -gt 0 ]; then
-        p2_start=$p1_end
-        p2_end=$(($p2_size + $p2_start))
-        /sbin/parted -s $device u MB mkpart primary ext2 $p2_start $p2_end
-    fi
     # Sometimes automount can be _really_ annoying.
     echo "Waiting for devices to settle..."
     /sbin/udevadm settle
@@ -570,12 +513,6 @@ createEXTFSLayout() {
     fi
     $mkfs -L LIVE $TGTDEV
     TGTLABEL="UUID=$(/sbin/blkid -s UUID -o value $TGTDEV)"
-
-    if [ $p2_size -gt 0 ]; then
-        REPODEV=${device}2
-        umount $REPODEV &> /dev/null || :
-        $mkfs -L LIVE-REPO $REPODEV
-    fi
 }
 
 checkGPT() {
@@ -650,25 +587,6 @@ checkFilesystem() {
     fi
 }
 
-# Check partition 2 to see if it has been setup as LIVE-REPO
-# Setup REPODEV for later use
-findLIVEREPO() {
-    dev=$1
-    getdisk $dev
-
-    if [ -b ${device}2 ]; then
-        label=$(/sbin/blkid -s LABEL -o value ${device}2)
-        if [ "$label" == "LIVE-REPO" ]; then
-            echo "Found LIVE-REPO on ${device}2"
-            REPODEV=${device}2
-            return
-        fi
-    fi
-    echo "DVD installs need a second partition labeled LIVE-REPO."
-    echo "This is setup when you use --format"
-    exitclean
-}
-
 checkSyslinuxVersion() {
     if [ ! -x /usr/bin/syslinux ]; then
         echo "You need to have syslinux installed to run this script"
@@ -710,9 +628,7 @@ fi
 
 detectsrctype() {
     if [[ -e "$SRCMNT/Packages" ]]; then
-        # This will cause the source .iso to be copied to a second partiton
-        # on the target and the boot args to have repo=... pointing to the iso
-        echo "/Packages found, will copy source .iso to target"
+        echo "/Packages found, will copy source packages to target"
         packages=1
     fi
     if [[ -e "$SRCMNT/LiveOS/squashfs.img" ]]; then
@@ -947,9 +863,6 @@ if [ -n "$format" -a -z "$skipcopy" ]; then
     else
         createEXTFSLayout $TGTDEV
     fi
-elif [ -n "$packages" ]; then
-    # Need the LIVE-REPO partition to copy the .iso to
-    findLIVEREPO $TGTDEV
 fi
 
 checkFilesystem $TGTDEV
@@ -993,11 +906,6 @@ fi
 
 TGTMNT=$(mktemp -d /media/tgttmp.XXXXXX)
 mount $mountopts $TGTDEV $TGTMNT || exitclean
-if [ -n "$REPODEV" ]; then
-    REPOLABEL="UUID=$(/sbin/blkid -s UUID -o value $REPODEV)"
-    REPOMNT=$(mktemp -d /media/repotmp.XXXXXX)
-    mount $mountopts $REPODEV $REPOMNT || exitclean
-fi
 
 trap exitclean SIGINT SIGTERM
 
@@ -1163,27 +1071,6 @@ if [ "$srctype" = "live" -a -z "$skipcopy" ]; then
     sync
 fi
 
-# DVD installer copy
-# Also copies over the source .iso if the image is a new-style LiveOS DVD (F17+)
-if [ -z "$skipcopy" -a \( "$srctype" = "installer" -o "$srctype" = "netinst" \) ]; then
-    echo "Copying DVD image to target device."
-    mkdir -p $TGTMNT/images/
-    if [ "$imgtype" = "install" ]; then
-        for img in install.img updates.img product.img; do
-            if [ -e $SRCMNT/images/$img ]; then
-                copyFile $SRCMNT/images/$img $TGTMNT/images/$img || exitclean
-            fi
-        done
-    fi
-fi
-
-# Copy source .iso to repo partition
-if [ -n "$packages" -a -z "$skipcopy" -a -n "$REPOMNT" ]; then
-    echo "Copying $SRC"
-    copyFile "$SRC" $REPOMNT/
-    sync
-fi
-
 # Adjust syslinux sources for replication of installed images
 # between filesystem types.
 if [[ -d $SRCMNT/isolinux/ ]]; then
@@ -1201,6 +1088,7 @@ BOOTCONFIG=$TGTMNT/$SYSLINUXPATH/isolinux.cfg
 # Set this to nothing so sed doesn't care
 BOOTCONFIG_EFI=
 if [ -n "$efi" ]; then
+    echo "Setting up $EFI_BOOT"
     cp $SRCMNT$EFI_BOOT/* $TGTMNT$EFI_BOOT
 
     # FIXME
@@ -1240,7 +1128,43 @@ if [ -n "$efi" ]; then
     fi
 fi
 
-if [[ live == $srctype ]]; then
+# DVD installer copy
+if [ -z "$skipcopy" -a \( "$srctype" = "installer" -o "$srctype" = "netinst" \) ]; then
+    echo "Copying DVD image to target device."
+    mkdir -p $TGTMNT/images/
+    if [ "$imgtype" = "install" ]; then
+        for img in install.img updates.img product.img; do
+            if [ -e $SRCMNT/images/$img ]; then
+                copyFile $SRCMNT/images/$img $TGTMNT/images/$img || exitclean
+            fi
+        done
+    fi
+fi
+
+# Copy packages over.
+# Before Fedora17 we could copy the .iso and setup a repo=
+# F17 and later look for repodata on the source media.
+# The presence of packages and LiveOS indicates F17 or later.
+if [ -n "$packages" -a -z "$skipcopy" ]; then
+    if [ "$srctype" != "live" ]; then
+        echo "Copying $SRC to device"
+        copyFile "$SRC" "$TGTMNT/"
+
+        # Setup a repo= to point to the .iso
+        sed -i -e "s;initrd.img;initrd.img repo=hd:$TGTLABEL:/;g" $BOOTCONFIG
+        if [ -n "$efi" ]; then
+            sed -i -e "s;vmlinuz;vmlinuz repo=hd:$TGTLABEL:/;g" $BOOTCONFIG_EFI
+        fi
+    else
+        echo "Copying package data from $SRC to device"
+        rsync --inplace -rLDP --exclude EFI/ --exclude images/ --exclude isolinux/ \
+            --exclude TRANS.TBL --exclude LiveOS/ "$SRCMNT/" "$TGTMNT/"
+    fi
+    echo "Waiting for device to finish writing"
+    sync
+fi
+
+if [ "$srctype" = "live" ]; then
     # Copy this installer script.
     cp -fT "$thisScriptpath" $TGTMNT/$LIVEOS/livecd-iso-to-disk
     chmod +x $TGTMNT/$LIVEOS/livecd-iso-to-disk &> /dev/null || :
@@ -1278,14 +1202,6 @@ if [ -n "$efi" ]; then
     sed -i -e "s;findiso;;g" $BOOTCONFIG_EFI
 fi
 
-# Add repo= to point to the source .iso with the packages
-if [[ -n "$packages" ]]; then
-    sed -i -e "s;initrd.img;initrd.img repo=hd:$REPOLABEL:/;g" $BOOTCONFIG
-    if [ -n "$efi" ]; then
-        sed -i -e "s;vmlinuz;vmlinuz repo=hd:$REPOLABEL:/;g" $BOOTCONFIG_EFI
-    fi
-fi
-
 # DVD Installer for netinst
 if [ "$srctype" != "live" ]; then
     if [ "$imgtype" = "install" ]; then




More information about the livecd mailing list