Skip to content

Commit

Permalink
Merge pull request #7322 from gurevichmark/packimage_timezone_fix2
Browse files Browse the repository at this point in the history
Improve packimage time zone handling with no exlist
  • Loading branch information
besawn committed Jan 31, 2023
2 parents 4b221d5 + 92e1230 commit db8ec39
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions xCAT-server/lib/xcat/plugins/packimage.pm
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,18 @@ sub process_request {
xCAT::Utils->runcmd("cp /opt/xcat/share/xcat/netboot/rh/dracut_033/install.netboot $rootimg_dir/usr/lib/dracut/modules.d/97xcat/install", 0, 1);


# timedatectl requires /etc/localtime link to the zoneinfo in /usr/share/zoneinfo
if ($timezone[0]) {
unlink("$rootimg_dir/etc/localtime");
symlink("../usr/share/zoneinfo/$timezone[0]", "$rootimg_dir/etc/localtime");

if (not stat "$rootimg_dir/etc/localtime") {
$callback->({ warning => ["Unable to set timezone to \'$timezone[0]\', check this is a valid timezone"] });
}
} else {
$callback->({ info => ["No timezone defined in site table, skipping timezone /etc/localtime configuration"] });
}

my $xcat_packimg_tmpfile = "/tmp/xcat_packimg.$$";
my $excludestr = "find . -xdev ";
my $includestr;
Expand All @@ -344,11 +356,7 @@ sub process_request {
}
close($exlist);

# timedatectl requires /etc/localtime link to the zoneinfo in /usr/share/zoneinfo
if ($timezone[0]) {
unlink("$rootimg_dir/etc/localtime");
symlink("../usr/share/zoneinfo/$timezone[0]", "$rootimg_dir/etc/localtime");

# Add the zoneinfo to the include list
$excludetext .= "+./usr/share/zoneinfo/$timezone[0]\n";

Expand All @@ -361,11 +369,8 @@ sub process_request {
$excludetext .= "+.$relativetzpath\n";
}

if (not stat "$rootimg_dir/etc/localtime") {
$callback->({ warning => ["Unable to set timezone to \'$timezone[0]\', check this is a valid timezone"] });
}
} else {
$callback->({ info => ["No timezone defined in site table, skipping timezone configuration"] });
$callback->({ info => ["No timezone defined in site table, skipping timezone exlist configuration"] });
}

#handle the #INLCUDE# tag recursively
Expand Down

0 comments on commit db8ec39

Please sign in to comment.