tools/livecd-iso-to-disk.sh | 30 +++++++++++++++++++++++++-----
1 file changed, 25 insertions(+), 5 deletions(-)
New commits:
commit 1013b009e4ea2bb2f6dca36c51ef469ad6578fc2
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Wed Apr 18 17:04:02 2012 -0700
check for LIVE-REPO partition when writing DVD (#813905)
When writing a DVD to a device using livecd-iso-to-disk it needs a
second partition for the iso with the packages. Using --format sets this
up, but it was not working correctly without adding --format. It would
instead write the iso to the / of the host system.
This fixes the problem by looking for the LIVE-REPO partition as p2 of
the device and exiting if it is not found.
This also adds --inplace to sync so that devices with limited space can
be updated without reformatting.
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index fe4e59b..070a3b4 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -460,7 +460,6 @@ createGPTLayout() {
REPODEV=${device}2
umount $REPODEV &> /dev/null || :
/sbin/mkdosfs -n LIVE-REPO $REPODEV
- REPOLABEL="UUID=$(/sbin/blkid -s UUID -o value $REPODEV)"
fi
}
@@ -517,7 +516,6 @@ createMSDOSLayout() {
REPODEV=${device}2
umount $REPODEV &> /dev/null || :
/sbin/mkdosfs -n LIVE-REPO $REPODEV
- REPOLABEL="UUID=$(/sbin/blkid -s UUID -o value $REPODEV)"
fi
}
@@ -577,7 +575,6 @@ createEXTFSLayout() {
REPODEV=${device}2
umount $REPODEV &> /dev/null || :
$mkfs -L LIVE-REPO $REPODEV
- REPOLABEL="UUID=$(/sbin/blkid -s UUID -o value $REPODEV)"
fi
}
@@ -653,6 +650,25 @@ 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"
@@ -741,7 +757,7 @@ cp_p() {
copyFile() {
if [ -x /usr/bin/rsync ]; then
- rsync -P "$1" "$2"
+ rsync --inplace -P "$1" "$2"
return
fi
if [ -x /usr/bin/gvfs-copy ]; then
@@ -931,6 +947,9 @@ 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
@@ -975,6 +994,7 @@ 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
@@ -1158,7 +1178,7 @@ if [ -z "$skipcopy" -a \( "$srctype" =
"installer" -o "$srctype" = "netinst" \)
fi
# Copy source .iso to repo partition
-if [ -n "$packages" -a -z "$skipcopy" ]; then
+if [ -n "$packages" -a -z "$skipcopy" -a -n "$REPOMNT" ];
then
echo "Copying $SRC"
copyFile "$SRC" $REPOMNT/
sync
Show replies by date