From 9a449ba26c73978934aa60e38c4f1b8e865a0c02 Mon Sep 17 00:00:00 2001 From: linggao Date: Tue, 22 Nov 2011 01:28:14 +0000 Subject: [PATCH] fixed defect 3368796 nodestat does not show install of packages under SLES 11 SP1 git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11032 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- .../share/xcat/install/scripts/pre.sles | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/xCAT-server/share/xcat/install/scripts/pre.sles b/xCAT-server/share/xcat/install/scripts/pre.sles index 5a39f3424..e6e77ec47 100644 --- a/xCAT-server/share/xcat/install/scripts/pre.sles +++ b/xCAT-server/share/xcat/install/scripts/pre.sles @@ -65,6 +65,7 @@ BEGIN { } if(\$1 == "stat") { + if( system( "[ -f /mnt/var/log/YaST2/y2logRPM ]" ) == 0 ) { while((getline < "/mnt/var/log/YaST2/y2logRPM") > 0) { line = \$0 } @@ -79,9 +80,30 @@ BEGIN { } print ("installing " line) |& ns - } + } + else { + # The format of /var/log/zypp/history is documented at + # http://en.opensuse.org/Libzypp/Package_History - close(ns) + lastrpm = "prep" + + oldFS = FS + FS="|" + + while((getline < "/mnt/var/log/zypp/history") > 0) { + if (\$0 !~ /#/ && \$2 == "install") { + lastrpm = (\$3 "-" \$4) + } + } + close("/mnt/var/log/zypp/history") + + FS = oldFS + + print ("installing " lastrpm) |& ns + } + } + + close(ns) } } EOF