From: Ian Campbell Subject: [OSSTEST v6 04/24] Debian: refactor code to add preseed commands to the preseed file Date: Wed, 6 May 2015 10:56:33 +0100 Message-ID: <1430906213-30108-4-git-send-email-ian.campbell@citrix.com> References: <1430905605.2660.187.camel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1430905605.2660.187.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: longtaox.pang@intel.com, Ian Campbell , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org Call it from ts-debian-hvm-install. This means that, in future, ts-debian-di-install can use preseed_hook_command and preseed_hook_installscript. The existing opencoded use of d-i/late_command in the guest preseed needs to become a preseed_hook_command so as not to clash with the use of preseed_hook_cmds(). This requires also adding a #! line and the "set -ex" boilerplate which in turn requires slightly rewriting the /boot/EFI handling part to also work if the system is not installed for EFI (in which case grubx64.efi isn't installed). Previously this would have needlessly created the directory and then ignored the error from cp. The ssh authorized keys bit isn't touched since it works as is and will go away in a subsequent patch. Apart from no longer creating /target/boot/efi/EFI/boot when it is not needed there is no functional change for now. Signed-off-by: Ian Campbell Cc: longtaox.pang@intel.com --- v6: Move existing d-i/late_command preseed to use preseed_hook_command v5: Extended commit message v3: New patch --- Osstest/Debian.pm | 16 +++++++++++----- ts-debian-hvm-install | 20 +++++++++++++++----- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm index acdaaa8..0656ba4 100644 --- a/Osstest/Debian.pm +++ b/Osstest/Debian.pm @@ -37,7 +37,7 @@ BEGIN { %preseed_cmds preseed_base preseed_create - preseed_hook_command preseed_hook_installscript + preseed_hook_command preseed_hook_installscript preseed_hook_cmds di_installcmdline_core ); %EXPORT_TAGS = ( ); @@ -913,10 +913,7 @@ d-i partman-auto/expert_recipe string \\ END - foreach my $di_key (keys %preseed_cmds) { - $preseed_file .= "d-i preseed/$di_key string ". - (join ' && ', @{ $preseed_cmds{$di_key} }). "\n"; - } + $preseed_file .= preseed_hook_cmds(); if ($ho->{Flags}{'no-di-kernel'}) { $preseed_file .= < /root/.ssh/authorized_keys"; +preseed_hook_command($gho, 'late_command', '', < /root/.ssh/authorized_keys" END + + $preseed_file .= preseed_hook_cmds(); + return $preseed_file; } -- 2.1.4