From b5ec72640c64c26aadd62e77fa4c24e3c460bfa6 Mon Sep 17 00:00:00 2001 From: Steve McIntyre <93sam@debian.org> Date: Wed, 7 Jul 2010 23:49:46 +0000 Subject: [PATCH] Patch from Ian Campbell : Detect duplicates in the extra images used for installation Several files included under install.{386,amd} are actually identical to others. Rather than duplicating them attempt to detect this and hardlink them. Since images can be downloaded from the web at build time it is not always possible to detect identical files by looking for the symlinks created by the debian-installer build. Instead we pass a list of potential "doppelgangers" to extra_image each of which is checked for similarity to the new image. I added gtk/vmlinuz (which is always the same as plain vmlinuz) which although not necessary makes it more explicit which kernel goes with the initrd at very little cost. Hardlinks are used in preference to symlinks since these are expected to work better with isolinux and the Xen tools. --- debian/changelog | 4 ++++ tools/boot/squeeze/boot-x86 | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 9a8ca761..b4ed622d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -30,6 +30,10 @@ debian-cd (3.1.4) UNRELEASED; urgency=low are at least as new as the jigdo files, as this helps people mirroring. Closes: #587774 + [ Ian Campbell ] + * boot-x86: detect duplicates in the extra images used for installation + and replace with hard links. + -- Steve McIntyre <93sam@debian.org> Tue, 27 Feb 2010 12:24:29 +0100 debian-cd (3.1.3) unstable; urgency=low diff --git a/tools/boot/squeeze/boot-x86 b/tools/boot/squeeze/boot-x86 index c0a5bdc5..4a9b4f17 100644 --- a/tools/boot/squeeze/boot-x86 +++ b/tools/boot/squeeze/boot-x86 @@ -133,6 +133,7 @@ fi extra_image () { image=$1 + doppelgangers="$2" dir=$(dirname "$image") mkdir -p $CDDIR/$INSTALLDIR/$dir @@ -146,6 +147,14 @@ extra_image () { wget "$DI_WWW_HOME/cdrom/$image" -O $CDDIR/$INSTALLDIR/"$image" fi fi + for doppelganger in $doppelgangers ; do + if [ -f "$CDDIR/$INSTALLDIR/$dir/$doppelganger" ] && + cmp -s $CDDIR/$INSTALLDIR/"$image" $CDDIR/$INSTALLDIR/"$dir"/"$doppelganger" ; then + echo " $image identical to $doppelganger. Linking" + ln -nf "$doppelganger" $CDDIR/$INSTALLDIR/"$image" + break + fi + done } # If multiple desktops are to be supported, set the default one @@ -231,7 +240,8 @@ if [ "$THISTYPE" = "isolinux" ]; then fi if [ -e boot$N/isolinux/f3.txt.withgtk ]; then - extra_image gtk/initrd.gz + extra_image gtk/vmlinuz "../vmlinuz" + extra_image gtk/initrd.gz "../initrd.gz" mv boot$N/isolinux/f3.txt.withgtk boot$N/isolinux/f3.txt mv boot$N/isolinux/f4.txt.withgtk boot$N/isolinux/f4.txt if [ -e boot$N/isolinux/isolinux.cfg.withgtk ]; then @@ -243,8 +253,8 @@ if [ "$THISTYPE" = "isolinux" ]; then rm -f boot$N/isolinux/isolinux.cfg.with* if variant_enabled "xen" ; then - extra_image xen/vmlinuz - extra_image xen/initrd.gz + extra_image xen/vmlinuz "../vmlinuz ../gtk/vmlinuz" + extra_image xen/initrd.gz "../initrd.gz ../gtk/initrd.gz" extra_image xen/xm-debian.cfg fi