From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: [PATCH OSSTEST v8 05/14] distros: Support pvgrub for Wheezy too. Date: Wed, 8 Jul 2015 13:30:53 +0100 Message-ID: <1436358662-12886-5-git-send-email-ian.campbell@citrix.com> References: <1436358648.23508.32.camel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1436358648.23508.32.camel@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: ian.jackson@eu.citrix.com Cc: Ian Campbell , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org This requires us to install pv-grub-menu from backports, which we do using a late_command. Signed-off-by: Ian Campbell --- v8: - Use a heredoc for sources.list additions, since this was suggested by Ian I would have retained the ack apart from the second change. - Dropped unused $cd argument to setup_netinst. (Noticed when I came to document _cd and found it wasn't used!) v7: - Remove vestigial attempts to enable -backports via d-i preseeding. v3: - Remove spurious () from <<(END) (and the prexisting "" too) - Remove $xopts{EnableBackports} and automatically handle the need to add backports in preseed_base. - Install via late_command not apt-setup, since the former has issues, hence subject drops "attempt to..." --- Osstest/Debian.pm | 40 ++++++++++++++++++++++++--- make-distros-flight | 58 +++++++++++++++++++++++++++++++++++++-- ts-debian-di-install | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 168 insertions(+), 6 deletions(-) diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm index 1edf49f..7c94b6c 100644 --- a/Osstest/Debian.pm +++ b/Osstest/Debian.pm @@ -777,8 +777,6 @@ sub preseed_base ($$$$;@) { preseed_hook_overlay($ho, $sfx, 'overlay', 'overlay.tar'); my $preseed = <<"END"; -d-i mirror/suite string $suite - d-i debian-installer/locale string en_GB d-i console-keymaps-at/keymap select gb d-i keyboard-configuration/xkb-keymap string en_GB @@ -854,6 +852,11 @@ END d-i clock-setup/ntp-server string $ntpserver END + # For CDROM the suite is part of the image + $preseed .= <>/target/etc/apt/sources.list + +\# $suite backports +deb http://$c{DebianMirrorHost}/$c{DebianMirrorSubpath} $suite-backports main +EOF +in-target apt-get update +in-target apt-get install -y -t wheezy-backports pv-grub-menu +END + } else { + $extra_packages = "pv-grub-menu"; + } + } my $preseed_file= preseed_base($ho, $suite, $sfx, $extra_packages, %xopts); $preseed_file.= (<_arch: # Debian arch to install. # - _method: -# Install method, currently only "netboot". +# Install method, one of "netboot" or "netinst". # - _bootloader: # The PV bootloader to use when booting the guest. One of # "pvgrub" or "pygrub". Default is "pygrub". @@ -36,6 +36,18 @@ # If neither kernel nor ramdisk are specified then the current # TftpDiVersion of d-i will be used, and the runvars will be set to # the file path used. +# +# For method="netinst" +# +# - _netinst_baseurl: +# Base URL of directory containing the netinst jigdo images. +# - _netinst_filere: +# Regular expression to match actual file within baseurl to use +# (without .jigdo suffix) +# - _netinst_kernel: +# Path to kernel within the netinst image. +# - _netinst_ramdisk +# Path to ramdisk within the netinst image. use strict qw(vars); use DBI; @@ -68,6 +80,60 @@ sub prep () { target_cmd_root($ho, "umount $gho->{Lvdev} ||:"); } +sub setup_netinst($$) +{ + my ($didir, $arch) = @_; + + target_install_packages($ho, qw(jigdo-file)); + + my $baseurl = $r{ "$gho->{Guest}_netinst_baseurl" }; + my $filere = $r{ "$gho->{Guest}_netinst_filere" }; + my $kernel = $r{ "$gho->{Guest}_netinst_kernel" }; + my $ramdisk = $r{ "$gho->{Guest}_netinst_ramdisk" }; + + die "params" unless $baseurl && $filere && $kernel && $ramdisk; + + my $filebase; + + # Use the MD5SUMs file as an index + logm("Fetch index from $baseurl/MD5SUMS"); + my $idx = target_cmd_output_root($ho, "wget --quiet -O - $baseurl/MD5SUMS"); + foreach (split /\n/, $idx) { + m/^[0-9a-f]{32} ($filere)\.iso$/ or next; + $filebase = $1; + last; + } + + die unless $filebase; + + logm("Downloading $baseurl/$filebase.jigdo"); + my $netinst_jigdo = "$baseurl/$filebase.jigdo"; + # Jigdo uses wget internally, and so obeys $http_proxy. This seems + # simpler than the advice at + # https://www.debian.org/CD/jigdo-cd/#faq which is to edit + # ~/.jigdo-lite and change the wgetOpts setting. + my $useproxy = $c{DebianMirrorProxy} // $c{HttpProxy} // ''; + my $cmd = ''; + $cmd .= <{Guest}_netinst_jigdo", $netinst_jigdo); + + return (<1); + } else { die "$method"; -- 2.1.4