From 2bbce57260b440593962282846f196ccddf89909 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Fri, 10 May 2013 14:52:44 +0000 Subject: [PATCH] Simple implementation of postscripts, put in postscripts table and /install/winpostscripts git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@16237 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/perl/xCAT/Template.pm | 19 +++++++++++++++++++ xCAT-server/lib/xcat/plugins/windows.pm | 6 ++++++ 2 files changed, 25 insertions(+) diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index 67b16c526..5811cc031 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -220,6 +220,7 @@ sub subvars { $inc =~ s/#WINPRODKEY:([^#]+)#/get_win_prodkey($1)/eg; $inc =~ s/#WINNETCFG#/windows_net_cfg()/eg; $inc =~ s/#WINADJOIN#/windows_join_data()/eg; + $inc =~ s/#WINPOSTSCRIPTS#/windows_postscripts()/eg; $inc =~ s/#WINDNSCFG#/windows_dns_cfg()/eg; $inc =~ s/#WINACCOUNTDATA#/windows_account_data()/eg; $inc =~ s/#WINDISABLENULLADMIN#/windows_disable_null_admin()/eg; @@ -394,6 +395,24 @@ sub windows_dns_cfg { $componentxml .= "\r\n\r\n\r\n\r\n"; return $componentxml; } +#this will lay out the data from postscripts table in a manner that is appropriate for windows consumption in Microsoft-Windows-Deployment +#component under specialize pass +sub windows_postscripts { + my $posttab = xCAT::Table->new('postscripts',-create=>0); + unless ($posttab) { return ""; } + my $psent = $posttab->getNodeAttribs($node,['postscripts'],prefetchcache=>1); + unless ($psent and $psent->{postscripts}) { return ""; } + my @cmds = split /,/,$psent->{postscripts}; + my $order = 1; + my $xml; + my $pscript; + foreach $pscripts (@cmds) { + unless ($pscript =~ /\\/) { + $pscript = "C:\\xcatpost\\".$pscript; + } + $xml .= "\r\n$order\r\n$pscript\r\n\r\n"; + } +} #this will examine table data, decide *if* a Microsoft-Windows-UnattendedJoin is warranted #there are two variants in how to proceed: #-Hide domain administrator from node: xCAT will use MACHINEPASSWORD to do joining to AD. Currently requires SSL be enabled on DC. Samba 4 TODO diff --git a/xCAT-server/lib/xcat/plugins/windows.pm b/xCAT-server/lib/xcat/plugins/windows.pm index fcad599c1..a11db6914 100644 --- a/xCAT-server/lib/xcat/plugins/windows.pm +++ b/xCAT-server/lib/xcat/plugins/windows.pm @@ -461,6 +461,12 @@ sub mkinstall print $shandle 'reg copy HKLM\system\CurrentControlSet\services\TCPIP6\parameters HKLM\csystem\ControlSet001\services\TCPIP6\parameters /f'."\r\n"; print $shandle 'reg copy HKLM\system\CurrentControlSet\services\TCPIP6\parameters HKLM\csystem\ControlSet002\services\TCPIP6\parameters /f'."\r\n"; print $shandle 'reg unload HKLM\csystem'."\r\n"; + print $shandle "If EXIST %instdrv%\\winpostscripts GOTO wps\r\n"; + print $shandle "goto up\r\n"; + print $shandle ":wps\r\n"; + print $shandle "mkdir c:\\xcatpost\r\n"; + print $shandle "xcopy %instdrv%\\winpostscripts c:\\xcatpost\r\n"; + print $shandle ":up\r\n"; print $shandle "If EXIST X:\\Windows\\system32\\WindowsPowerShell GOTO PSH\r\n"; print $shandle "IF %PROCESSOR_ARCHITECTURE%==AMD64 GOTO x64\r\n"; print $shandle "IF %PROCESSOR_ARCHITECTURE%==x64 GOTO x64\r\n";