[PATCH 6/7] anaconda: liveinst.sh: support turboLiveInst/genMinInstDelta

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



this patch takes care of the anaconda side of taking advantage of livecd's created with a livecd-tools that has turboLiveInst/genMinInstDelta support. But the code does check for the legacy situation, and handles it gracefully. Thus this patch is safe even in the absence of the actual beneficial final patch to livecd-tools.





diff -Naur anaconda.5.earlier_resize2fs/liveinst/liveinst.sh anaconda.turboliveinst/liveinst/liveinst.sh
--- anaconda.5.earlier_resize2fs/liveinst/liveinst.sh	2007-04-04 18:05:42.000000000 +0000
+++ anaconda.turboliveinst/liveinst/liveinst.sh	2007-09-14 17:20:13.000000000 +0000
@@ -4,7 +4,29 @@
 #
 
 if [ -z "$LIVE_BLOCK" ]; then
-    LIVE_BLOCK="/dev/live-osimg"
+    #
+    # We avoid copying unused data by copying a filesystem image that has 
+    # been reduced to the minimal possible size. This minimal image is not 
+    # sufficient for a running LiveCD as applications need room to write 
+    # more data, but the minimal image is efficiently created just before 
+    # copying by applying a pre-calculated set of deltas to the original 
+    # large filesystem image.
+    #
+
+    # did mayflower find and expose the delta data via loop118?
+    if ( losetup /dev/loop118 > /dev/null 2>&1 ); then
+	# the delta data is exposed as gzipped data in a loop device
+	zcat /dev/loop118 > /dev/shm/osmin.img
+	# devicemapper needs a loop device with the uncompressed data
+	losetup /dev/loop117 /dev/shm/osmin.img
+	# set up the devicemapper snapshot device, which will merge
+	# the normal live fs image, and the delta, into a minimzied fs image
+	echo "0 $( blockdev --getsize /dev/loop121 ) snapshot /dev/loop121 /dev/loop117 p 8" | dmsetup create --readonly live-osimg-min
+	LIVE_BLOCK="/dev/mapper/live-osimg-min"
+    else
+	# fall back to legacy pre-genMinInstDelta behavior
+	LIVE_BLOCK="/dev/live-osimg"
+    fi
 fi
 
 if [ ! -b $LIVE_BLOCK ]; then
@@ -42,3 +64,10 @@
 if [ -n $current ]; then
     /usr/sbin/setenforce $current
 fi
+
+# cleanup genMinInstDelta stuff if needed
+if ( losetup /dev/loop118 > /dev/null 2>&1 ); then
+    dmsetup remove live-osimg-min
+    losetup -d /dev/loop117
+    rm -f /dev/shm/osmin.img
+fi

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux