2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-06-20 21:20:36 +00:00

Eliminate specifically checking for OS version

This commit is contained in:
Mark Gurevich
2021-03-26 12:34:50 -04:00
parent 237c7fee91
commit c2220cd695

View File

@ -299,8 +299,8 @@ unless ($onlyinitrd) {
if (-d "$dir/1") {
$ddir .= "/1";
}
if ($osver =~ "^sle15.2") {
# For SLE15 SP2 need 'baseurl' to point to a 3 module subdirs
if (-d "$ddir/Product-SLES" && -d "$ddir/Module-Basesystem" && -d "$ddir/Module-Legacy") {
# If "Modile" and "Product" directories are there, use them for package repositories
system("zypper -R $rootimg_dir $non_interactive ar file:$ddir/Product-SLES $osver-$i-Product-SLES");
system("zypper -R $rootimg_dir $non_interactive ar file:$ddir/Module-Basesystem $osver-$i-Module-Basesystem");
system("zypper -R $rootimg_dir $non_interactive ar file:$ddir/Module-Legacy $osver-$i-Module-Legacy");
@ -2006,14 +2006,21 @@ sub generic_post { # This function is meant to leave the image in a state approx
print $cfgfile "NETWORKING=yes\n";
close($cfgfile);
# SLE15.2 has a symlink to /run/netconfig/resolv.conf but still need a dummy file
if (-l "$rootimg_dir/etc/resolv.conf" && $osver =~ "15.2") {
# Remove resolv.conf, so that link is gone and code below will
# create a dummy file
unlink("$rootimg_dir/etc/resolv.conf");
# Check resolv.conf file.
# If it is a link and link leads to an empty file, remove that link
# If it is a link and link leads to a non emply file, leave it alone
# If it is not a link, fill it it with some "dummy" text
if (-l "$rootimg_dir/etc/resolv.conf" ) {
my $link_file = readlink "$rootimg_dir/etc/resolv.conf";
if (-z "$rootimg_dir/$link_file") {
# Link leading to an empty file
# Remove resolv.conf, so that link is gone and code below will
# create a dummy file
unlink("$rootimg_dir/etc/resolv.conf");
}
}
# SLE15.0 has a symlink to /run/netconfig/resolv.conf and does not need a dummy file
if (! -l "$rootimg_dir/etc/resolv.conf") {
# Not a link, fill in with "dummy" text
open($cfgfile, ">", "$rootimg_dir/etc/resolv.conf");
print $cfgfile "#Dummy resolv.conf to make boot cleaner";
close($cfgfile);