diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index dee1055d44..dcc6c3859e 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -119,6 +119,19 @@ sub _openeuler_media_info return { distname => "openeuler$version", arch => $general{arch} }; } +# The second line of .discinfo, or '' when it is missing. +sub _discinfo_description +{ + my ($file) = @_; + open(my $fh, '<', $file) or return ''; + <$fh>; + my $description = <$fh>; + close($fh); + return '' unless defined($description); + chomp($description); + return $description; +} + sub _driver_disk_marker_path { @@ -2503,6 +2516,17 @@ sub copycd { $path = $defaultpath; } + # The RVA20 and RVA23 builds of an openEuler riscv64 release have the same + # .treeinfo identity. Only the .discinfo description tells them apart. + if ($openeuler_media && -r "$path/.discinfo") { + my $copied = _discinfo_description("$path/.discinfo"); + my $media = defined($desc) ? $desc : ''; + if (lc($copied) ne lc($media)) { + my $build = length($copied) ? $copied : 'no build name'; + $callback->({ error => "$path holds openEuler media of another build ($build). Copy this media to another directory with -p.", errorcode => [1] }); + return; + } + } if ($::XCATSITEVALS{osimagerequired}) { my ($nohaveimages, $errstr) = xCAT::SvrUtils->update_tables_with_templates($distname, $arch, $path, $osdistroname, checkonly => 1); if ($nohaveimages) {