From 9bd7ba862591a608f3cc38d2b72127978e7352dd Mon Sep 17 00:00:00 2001
From: lissav <lissav@8638fb3e-16cb-4fca-ae20-7b5d299a9bcd>
Date: Mon, 20 Aug 2012 16:32:28 +0000
Subject: [PATCH] fix defect 3558801, do not set TZ if called by updatenode

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@13559 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
---
 xCAT/postscripts/xcataixpost | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/xCAT/postscripts/xcataixpost b/xCAT/postscripts/xcataixpost
index 53a5ead06..dcd2e9281 100755
--- a/xCAT/postscripts/xcataixpost
+++ b/xCAT/postscripts/xcataixpost
@@ -239,21 +239,26 @@ if (&runcmd($chcmd) != 0) {
 }
 
 if (-f $scriptname) {
+  # if called by updatenode do not change TZ 
+  if (@ARGV > 0) {
+    if ($ARGV[0] == 1 || $ARGV[0] == 2) {
 	# set the timezone
-    my $cmd = "cat $scriptname | grep 'TIMEZONE='";
-    &runcmd($cmd);
-    my $TZline = $::outref;
-    my ($junk, $tz) =  split(/=/, $TZline);
-    if ($tz) {
+      my $cmd = "cat $scriptname | grep 'TIMEZONE='";
+      &runcmd($cmd);
+      my $TZline = $::outref;
+      my ($junk, $tz) =  split(/=/, $TZline);
+      if ($tz) {
 		chomp $tz;	
         my $tzcmd = qq~/usr/bin/chtz $tz >/dev/null 2>&1~;
         if (&runcmd($tzcmd) != 0) {
             my $msg = "$::sdate xcataixpost: Could not set timezone.\n";
             `logger -t xcat -p local4.warning $msg`;
         } else {
-			&runcmd("export TZ=$tz");
-		}
+          &runcmd("export TZ=$tz");
+        }
+      }
     }
+  }
 }
 
 # check & run the postscript