From 619a844bc3bc423bff5b43ee5dcc788b712f056a Mon Sep 17 00:00:00 2001 From: linggao Date: Wed, 4 Aug 2010 19:42:56 +0000 Subject: [PATCH] package remove support for SLES autoyask configuration file git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6981 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/perl/xCAT/Template.pm | 32 ++++++++++++++++++++------- xCAT-server/lib/xcat/plugins/sles.pm | 6 +++++ 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index 4c4ec612f..2c986b284 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -76,6 +76,10 @@ sub subvars { $doneincludes=0; $inc =~ s/#INCLUDE_PTRNLIST:([^#^\n]+)#/includefile($1, 0, 2)/eg; } + if ($inc =~ /#INCLUDE_RMPKGLIST:[^#^\n]+#/) { + $doneincludes=0; + $inc =~ s/#INCLUDE_RMPKGLIST:([^#^\n]+)#/includefile($1, 0, 3)/eg; + } if ($inc =~ /#INCLUDE:[^#^\n]+#/) { $doneincludes=0; $inc =~ s/#INCLUDE:([^#^\n]+)#/includefile($1, 0, 0)/eg; @@ -92,6 +96,7 @@ sub subvars { $inc =~ s/#INCLUDE_NOP:([^#^\n]+)#/includefile($1,1,0)/eg; $inc =~ s/#INCLUDE_PKGLIST:([^#^\n]+)#/includefile($1,0,1)/eg; $inc =~ s/#INCLUDE_PTRNLIST:([^#^\n]+)#/includefile($1,0,2)/eg; + $inc =~ s/#INCLUDE_RMPKGLIST:([^#^\n]+)#/includefile($1,0,3)/eg; $inc =~ s/#INCLUDE:([^#^\n]+)#/includefile($1, 0, 0)/eg; $inc =~ s/#HOSTNAME#/$node/eg; @@ -181,7 +186,9 @@ sub includefile { my $file = shift; my $special=shift; - my $pkglist=shift; #1 means package list, 2 means pattern list, pattern list starts with @ + my $pkglist=shift; #1 means package list, + #2 means pattern list, pattern list starts with @, + #3 means remove package list, packages to be removed start with -. my $text = ""; unless ($file =~ /^\//) { $file = $idir."/".$file; @@ -205,20 +212,29 @@ sub includefile s/#INCLUDE:/#INCLUDE_PKGLIST:/; } elsif ($pkglist == 2) { s/#INCLUDE:/#INCLUDE_PTRNLIST:/; + } elsif ($pkglist == 3) { + s/#INCLUDE:/#INCLUDE_RMPKGLIST:/; } if (( $_ =~ /^\s*#/ ) || ( $_ =~ /^\s*$/ )) { $text .= "$_"; } else { - chomp; #remove tailing spaces - s/\s*$//; #removes leading spaces - next if (($pkglist == 1) && (/^@/)); #for packge list, do not include the lines start with @ + my $tmp=$_; + chomp($tmp); #remove return char + $tmp =~ s/\s*$//; #removes trailing spaces + next if (($pkglist == 1) && (($tmp=~/^\s*@/) || ($tmp=~/^\s*-/))); #for packge list, do not include the lines start with @ if ($pkglist == 2) { #for pattern list, only include the lines start with @ - if (/^@(.*)/) { - $_=$1; + if ($tmp =~/^\s*@(.*)/) { + $tmp=$1; + $tmp =~s/^\s*//; #removes leading spaces } else { next; } - } - $text .= "$pkgb$_$pkge\n"; + } elsif ($pkglist == 3) { #for rmpkg list, only include the lines start with - + if ($tmp =~/^\s*-(.*)/) { + $tmp=$1; + $tmp =~s/^\s*//; #removes leading spaces + } else { next; } + } + $text .= "$pkgb$tmp$pkge\n"; } } diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index 58fc64786..baed6d3c9 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -544,6 +544,7 @@ sub mkinstall #substitute the tag #INCLUDE_DEFAULT_PKGLIST# with package file name #substitute the tag #INCLUDE_DEFAULT_PERNLIST# with package file name + #substitute the tag #INCLUDE_DEFAULT_RMPKGLIST# with package file name my $new_tmplfile=$tmplfile; if ($pkglistfile) { $pkglistfile =~ s/\//\\\//g; @@ -556,6 +557,10 @@ sub mkinstall if ($? == 0) { $new_tmplfile="/tmp/xcattemp2.tmpl"; } + system("sed -e \"s/#INCLUDE_DEFAULT_RMPKGLIST#/#INCLUDE_RMPKGLIST:$pkglistfile#/\" $new_tmplfile > /tmp/xcattemp3.tmpl"); + if ($? == 0) { + $new_tmplfile="/tmp/xcattemp3.tmpl"; + } } #Call the Template class to do substitution to produce a kickstart file in the autoinst dir @@ -571,6 +576,7 @@ sub mkinstall } system("rm -f /tmp/xcattemp1.tmpl"); system("rm -f /tmp/xcattemp2.tmpl"); + system("rm -f /tmp/xcattemp3.tmpl"); if ($tmperr) {