diff --git a/xCAT-server/lib/xcat/plugins/genimage.pm b/xCAT-server/lib/xcat/plugins/genimage.pm index 10d1a03f5..f0eac78d3 100644 --- a/xCAT-server/lib/xcat/plugins/genimage.pm +++ b/xCAT-server/lib/xcat/plugins/genimage.pm @@ -305,6 +305,12 @@ sub process_request { } if ($driverupdatesrc) { $cmd .= " --driverupdatesrc $driverupdatesrc"; } + if($osfamily eq "sles") { + my @entries = xCAT::TableUtils->get_site_attribute("timezone"); + my $tz = $entries[0]; + if($tz) { $cmd .= " --timezone $tz"; } + } + if ($imagename) { $cmd.= " $imagename"; } diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index 5a99bb034..a5048e4db 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -59,7 +59,7 @@ my $permission; #the permission works only for statelite mode currently my $krpmver; my $tempfile; my $prompt; - +my $timezone; #the TIMEZONE of the stateless and statelite node sub xdie { system("rm -rf /tmp/xcatinitrd.$$"); @@ -95,6 +95,7 @@ GetOptions( 'g=s' => \$krpmver, 'permission=s' => \$permission, 'kerneldir=s' => \$kerneldir, + 'timezone=s' => \$timezone, 'tempfile=s' =>\$tempfile, #internal flag 'pkglist=s' => \$pkglist, #internal flag 'srcdir=s' => \$srcdir, #internal flag @@ -1403,7 +1404,7 @@ END } } - if ($arch =~ /x86_64/) { + if ($arch =~ /64/) { push @filestoadd,"lib64/libnss_dns.so.2"; push @filestoadd,"lib64/libnss_files.so.2"; } @@ -1540,6 +1541,14 @@ sub postscripts { # TODO: customized postscripts sub generic_post { # This function is meant to leave the image in a state approximating a normal install my $cfgfile; + #modify /etc/sysconfig/clock in the image:HWCLOCK="--local", TIMEZONE=site:timezone + if ($timezone) { + system("sed -i '".'s!\(TIMEZONE=\).*!\1'."\"$timezone\"!"."' $rootimg_dir/etc/sysconfig/clock"); + system("chroot $rootimg_dir zic -l $timezone"); + } + + system("sed -i 's!\\(HWCLOCK=\\).*!\\1\"--localtime\"!' $rootimg_dir/etc/sysconfig/clock"); + unlink("$rootimg_dir/dev/null"); system("mknod $rootimg_dir/dev/null c 1 3"); open($cfgfile,">","$rootimg_dir/etc/fstab");