diff --git a/xCAT-server/lib/xcat/plugins/genimage.pm b/xCAT-server/lib/xcat/plugins/genimage.pm index 4939d195c..927d5a35f 100644 --- a/xCAT-server/lib/xcat/plugins/genimage.pm +++ b/xCAT-server/lib/xcat/plugins/genimage.pm @@ -301,6 +301,12 @@ sub process_request { if ($tempfile) { $cmd .= " --tempfile $tempfile"; } 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 aae6f2193..8697bcec5 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -59,6 +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 { @@ -94,7 +95,8 @@ GetOptions( 'k=s' => \$kernelver, 'g=s' => \$krpmver, 'permission=s' => \$permission, - 'kerneldir=s' => \$kerneldir, + 'kerneldir=s' => \$kerneldir, + 'timezone=s' => \$timezone, 'tempfile=s' =>\$tempfile, #internal flag 'pkglist=s' => \$pkglist, #internal flag 'srcdir=s' => \$srcdir, #internal flag @@ -1367,12 +1369,14 @@ END } } - if ($arch =~ /x86_64/) { - push @filestoadd,"lib64/libnss_dns.so.2"; - } - else { - push @filestoadd,"lib/libnss_dns.so.2"; - } + if ($arch =~ /64/) { + push @filestoadd,"lib64/libnss_dns.so.2"; + push @filestoadd,"lib64/libnss_files.so.2"; + } + else { + push @filestoadd,"lib/libnss_dns.so.2"; + push @filestoadd,"lib/libnss_files.so.2"; + } # cross-platfrom support on power6&7 etc # ldd can't handle such one scenario: mn is power6, the target platform is power7 @@ -1502,6 +1506,15 @@ 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");