From patchwork Mon Apr 28 10:41:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 29199 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f200.google.com (mail-ob0-f200.google.com [209.85.214.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AA93620B8D for ; Mon, 28 Apr 2014 10:42:46 +0000 (UTC) Received: by mail-ob0-f200.google.com with SMTP id vb8sf40160080obc.7 for ; Mon, 28 Apr 2014 03:42:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-type:content-transfer-encoding; bh=HAKHudK1BXPkhi3ECWrwSU4PaVnmZjdxxRhWS5jjFS4=; b=BaQMa/G9/QOWadNrHB4L4+2vp/QWHcTqRlfbHitsO215uZLcd04eeBvwsnxt2Zty7k OhcGOcC/yPXfPG/oiQG9FBl8+n4TgGlCmNK+9I300JBMG9Fh3K50LYgpmQamCsm9uQy6 QV+mvc05zB2dpKopfVE0DHaCHlCzDaWZyOKvuVVHUDgCPssPg4oddkpLTKq6wLWqw98I qBxF31IDz+9/4TlBjR1UsX4ZATrVzcklSpfBKOrArqKwEyVqj0kvPjTyhkef7HI9UVcP Z+U50R8/nRH72ztt16Ygz3dbSB7Uh3SBeTC6A2/vvkh9zm3sZ8gD7+2kKKnsm7LvADWo X9KA== X-Gm-Message-State: ALoCoQk9D7031ESAcIoOvcxzsnxmIAN9hJH86H+IllSQsXyLEFBiWGQUDQjr0DT2KnokERBu+Hp5 X-Received: by 10.182.213.37 with SMTP id np5mr12703821obc.36.1398681766216; Mon, 28 Apr 2014 03:42:46 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.23.232 with SMTP id 95ls2648360qgp.68.gmail; Mon, 28 Apr 2014 03:42:46 -0700 (PDT) X-Received: by 10.52.123.39 with SMTP id lx7mr19827395vdb.22.1398681766079; Mon, 28 Apr 2014 03:42:46 -0700 (PDT) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by mx.google.com with ESMTPS id dl6si3528738veb.19.2014.04.28.03.42.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 28 Apr 2014 03:42:46 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.128.169; Received: by mail-ve0-f169.google.com with SMTP id pa12so7686346veb.14 for ; Mon, 28 Apr 2014 03:42:46 -0700 (PDT) X-Received: by 10.58.123.71 with SMTP id ly7mr23177248veb.11.1398681766008; Mon, 28 Apr 2014 03:42:46 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp107043vcb; Mon, 28 Apr 2014 03:42:45 -0700 (PDT) X-Received: by 10.58.1.5 with SMTP id 5mr23520581vei.8.1398681764788; Mon, 28 Apr 2014 03:42:44 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id dh4si3523380veb.157.2014.04.28.03.42.44 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 28 Apr 2014 03:42:44 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Wej0U-0007zI-3q; Mon, 28 Apr 2014 10:41:54 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Wej0P-0007tS-2G for xen-devel@lists.xen.org; Mon, 28 Apr 2014 10:41:49 +0000 Received: from [85.158.139.211:38511] by server-12.bemta-5.messagelabs.com id 48/DA-03824-C603E535; Mon, 28 Apr 2014 10:41:48 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-15.tower-206.messagelabs.com!1398681700!979240!3 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 24148 invoked from network); 28 Apr 2014 10:41:45 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-15.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 28 Apr 2014 10:41:45 -0000 X-IronPort-AV: E=Sophos;i="4.97,943,1389744000"; d="scan'208";a="125320469" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 28 Apr 2014 10:41:45 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.79) with Microsoft SMTP Server id 14.3.181.6; Mon, 28 Apr 2014 06:41:45 -0400 Received: from kazak.uk.xensource.com ([10.80.2.80] helo=zakaz.uk.xensource.com) by ukmail1.uk.xensource.com with smtp (Exim 4.69) (envelope-from ) id 1Wej0J-0007Zn-JL; Mon, 28 Apr 2014 11:41:44 +0100 Received: by zakaz.uk.xensource.com (sSMTP sendmail emulation); Mon, 28 Apr 2014 11:41:43 +0100 From: Ian Campbell To: Date: Mon, 28 Apr 2014 11:41:29 +0100 Message-ID: <1398681696-2773-8-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1398681672.29700.55.camel@kazak.uk.xensource.com> References: <1398681672.29700.55.camel@kazak.uk.xensource.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: Ian Campbell , xen-devel@lists.xen.org Subject: [Xen-devel] [PATCH OSSTEST v2 08/15] Debian: add preseed_create_guest helper X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ian.campbell@citrix.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: Creates a preseed file suitable for use in a PV guest Signed-off-by: Ian Campbell --- Osstest/Debian.pm | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm index ab09abb..043ab0d 100644 --- a/Osstest/Debian.pm +++ b/Osstest/Debian.pm @@ -35,6 +35,7 @@ BEGIN { %preseed_cmds preseed_base preseed_create + preseed_create_guest preseed_hook_command preseed_hook_installscript di_installcmdline_core ); @@ -429,6 +430,8 @@ sub di_installcmdline_core ($$;@) { sub preseed_base ($$;@) { my ($suite,$extra_packages,%xopts) = @_; + $extra_packages ||= ''; + return <<"END"; d-i mirror/suite string $suite @@ -498,7 +501,66 @@ $xopts{ExtraPreseed} ### END OF DEBIAN PRESEED BASE END -} +} + +sub preseed_create_guest ($$;@) { + my ($ho, $sfx, %xopts) = @_; + + my $suite= $xopts{Suite} || $c{DebianSuite}; + + my $extra_packages; + + my $preseed_file= preseed_base($suite, $extra_packages, %xopts); + $preseed_file.= (<.ssh/authorized_keys +$authkeys +ENDKEYS + +u=osstest +h=/home/\$u +mkdir /target\$h/.ssh +cp .ssh/authorized_keys /target\$h/.ssh +chroot /target chown -R \$u.\$u \$h/.ssh + +rm -f /target/etc/ssh/ssh_host_*_key +rm -f /target/etc/ssh/ssh_host_*_key.pub + +cat <<'ENDKEYS' > /target/etc/ssh/ssh_host_rsa_key +$host_rsa_key +ENDKEYS +chmod 0600 /target/etc/ssh/ssh_host_rsa_key +END + + foreach my $di_key (keys %preseed_cmds) { + $preseed_file .= "d-i preseed/$di_key string ". + (join ' && ', @{ $preseed_cmds{$di_key} }). "\n"; + } + + return create_webfile($ho, "preseed$sfx", $preseed_file); +} sub preseed_create ($$;@) { my ($ho, $sfx, %xopts) = @_;