From 3c0983f60f7af52eb1bc192b87c7e8e4a4a12997 Mon Sep 17 00:00:00 2001 From: immarvin Date: Wed, 24 Apr 2013 07:57:24 +0000 Subject: [PATCH] 1. fill in the proper value in /etc/sysconfig/clock and set the timezone of the stateless/statelite node with site:timezone 2. copy libnss_files.so.2 from directory lib(for 32bit system) or lib64(for 64 bit system) into initrd git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@16053 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/genimage.pm | 6 ++++++ xCAT-server/share/xcat/netboot/sles/genimage | 14 ++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) 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..7eb4eafb8 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,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");