From de7ba3928673a0a16959ada54301d4a088dc3fd4 Mon Sep 17 00:00:00 2001 From: besawn <38794505+besawn@users.noreply.github.com> Date: Wed, 8 Dec 2021 09:32:41 -0500 Subject: [PATCH] Modifed packimage timezone logic to preserve two levels of links --- xCAT-server/lib/xcat/plugins/packimage.pm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index f3eae9f45..3eb79ba23 100755 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -352,6 +352,15 @@ sub process_request { # Add the zoneinfo to the include list $excludetext .= "+./usr/share/zoneinfo/$timezone[0]\n"; + # /usr/share/zoneinfo can have many levels of links + # If the configured timezone is a link, also add the link target to the include list + # Note: this logic can only handle 2 levels of linking + my $realtimezonefile = Cwd::abs_path("$rootimg_dir/usr/share/zoneinfo/$timezone[0]"); + if ("$rootimg_dir/usr/share/zoneinfo/$timezone[0]" ne "$realtimezonefile") { + my $relativetzpath = substr($realtimezonefile, length($rootimg_dir)); + $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"] }); }