2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-06-13 09:50:19 +00:00

SLE 15 support

This commit is contained in:
Jarrod Johnson
2018-06-12 11:08:48 -04:00
parent a39707fa94
commit f26c82b7ba
4 changed files with 389 additions and 105 deletions

View File

@ -37,10 +37,10 @@ sub handled_commands
{
return {
copycd => "sles",
mknetboot => "nodetype:os=(sles.*)|(suse.*)",
mkinstall => "nodetype:os=(sles.*)|(suse.*)",
mkstatelite => "nodetype:os=(sles.*)",
mksysclone => "nodetype:os=(sles.*)|(suse.*)"
mknetboot => "nodetype:os=(sle.*)|(suse.*)",
mkinstall => "nodetype:os=(sle.*)|(suse.*)",
mkstatelite => "nodetype:os=(sle.*)",
mksysclone => "nodetype:os=(sle.*)|(suse.*)"
};
}
@ -210,7 +210,7 @@ sub mknetboot
if (!defined($::DISABLENODESETWARNING)) { # set by AAsn.pm
xCAT::MsgUtils->report_node_error($callback, $node, "OS image name must be specified in nodetype.provmethod");
next;
}
}
}
$osver = $ent->{os};
@ -863,7 +863,7 @@ sub mkinstall
if (!defined($::DISABLENODESETWARNING)) { # set by AAsn.pm
xCAT::MsgUtils->report_node_error($callback, $node, "OS image name must be specified in nodetype.provmethod");
next;
}
}
}
$os = $ent->{os};
$arch = $ent->{arch};
@ -1616,7 +1616,7 @@ sub copycd
$path =~ s,//*,/,g;
}
if ($distname and $distname !~ /^sles|^suse/)
if ($distname and $distname !~ /^sle|^suse/)
{
#If they say to call it something other than SLES or SUSE, give up?
@ -1624,121 +1624,136 @@ sub copycd
}
#parse the disc info of the os media to get the distribution, arch of the os
unless (-r $mntpath . "/content")
if (-r $mntpath . "/content")
{
return;
}
my $dinfo;
open($dinfo, $mntpath . "/content");
my $darch;
while (<$dinfo>)
{
if (m/^DEFAULTBASE\s+(\S+)/)
my $dinfo;
open($dinfo, $mntpath . "/content");
my $darch;
while (<$dinfo>)
{
$darch = $1;
chomp($darch);
last;
}
if (not $darch and m/^BASEARCHS\s+(\S+)/) {
$darch = $1;
}
if (not $darch and m/^REPOID.*\/(\S+)/) {
$darch = $1;
}
}
close($dinfo);
unless ($darch)
{
return;
}
my $dirh;
opendir($dirh, $mntpath);
my $discnumber;
my $totaldiscnumber;
while (my $pname = readdir($dirh))
{
if ($pname =~ /media.(\d+)/)
{
$discnumber = $1;
chomp($discnumber);
my $mfile;
open($mfile, $mntpath . "/" . $pname . "/media");
<$mfile>;
<$mfile>;
$totaldiscnumber = <$mfile>;
chomp($totaldiscnumber);
close($mfile);
open($mfile, $mntpath . "/" . $pname . "/products");
my $prod = <$mfile>;
close($mfile);
if ($prod =~ m/SUSE-Linux-Enterprise-Server/ || $prod =~ m/SUSE-Linux-Enterprise-Software-Development-Kit/ || $prod =~ m/SLES/ || $prod =~ m/SDK/)
if (m/^DEFAULTBASE\s+(\S+)/)
{
if (-f "$mntpath/content") {
my $content;
open($content, "<", "$mntpath/content");
my @contents = <$content>;
close($content);
foreach (@contents) {
if (/^VERSION/) {
my @verpair = split /\s+|-/;
$detdistname = "sles" . $verpair[1];
unless ($distname) { $distname = $detdistname; }
}
unless ($distname) {
if (/^DISTRO/ || /^LABEL/) {
$darch = $1;
chomp($darch);
last;
}
if (not $darch and m/^BASEARCHS\s+(\S+)/) {
$darch = $1;
}
if (not $darch and m/^REPOID.*\/(\S+)/) {
$darch = $1;
}
}
close($dinfo);
unless ($darch)
{
return;
}
# only set to $1 if the regex was successful
if ($_ =~ /sles:(\d+),/) {
$distname = "sles" . $1;
} elsif ($_ =~ /sles:(\d+):sp(\d+),/) {
$distname = "sles" . $1 . "." . $2;
} elsif ($_ =~ /Software Development Kit\s*(\d+)\s*SP(\d+)/) {
$distname = "sles" . $1 . "." . $2;
} elsif ($_ =~ /Software Development Kit\s*(\d+)/) {
$distname = "sles" . $1;
if ($_ =~ /sdk:(\d+):sp(\d+),/) {
my $dirh;
opendir($dirh, $mntpath);
my $discnumber;
my $totaldiscnumber;
while (my $pname = readdir($dirh))
{
if ($pname =~ /media.(\d+)/)
{
$discnumber = $1;
chomp($discnumber);
my $mfile;
open($mfile, $mntpath . "/" . $pname . "/media");
<$mfile>;
<$mfile>;
$totaldiscnumber = <$mfile>;
chomp($totaldiscnumber);
close($mfile);
open($mfile, $mntpath . "/" . $pname . "/products");
my $prod = <$mfile>;
close($mfile);
if ($prod =~ m/SUSE-Linux-Enterprise-Server/ || $prod =~ m/SUSE-Linux-Enterprise-Software-Development-Kit/ || $prod =~ m/SLES/ || $prod =~ m/SDK/)
{
if (-f "$mntpath/content") {
my $content;
open($content, "<", "$mntpath/content");
my @contents = <$content>;
close($content);
foreach (@contents) {
if (/^VERSION/) {
my @verpair = split /\s+|-/;
$detdistname = "sles" . $verpair[1];
unless ($distname) { $distname = $detdistname; }
}
unless ($distname) {
if (/^DISTRO/ || /^LABEL/) {
# only set to $1 if the regex was successful
if ($_ =~ /sles:(\d+),/) {
$distname = "sles" . $1;
} elsif ($_ =~ /sles:(\d+):sp(\d+),/) {
$distname = "sles" . $1 . "." . $2;
} elsif ($_ =~ /Software Development Kit\s*(\d+)\s*SP(\d+)/) {
$distname = "sles" . $1 . "." . $2;
} elsif ($_ =~ /Software Development Kit\s*(\d+)/) {
$distname = "sles" . $1;
if ($_ =~ /sdk:(\d+):sp(\d+),/) {
$distname = "sles" . $1 . "." . $2;
}
}
}
}
}
} else {
my @parts = split /\s+/, $prod;
my @subparts = split /-/, $parts[2];
$detdistname = "sles" . $subparts[0];
unless ($distname) { $distname = "sles" . $subparts[0] }
}
} else {
my @parts = split /\s+/, $prod;
my @subparts = split /-/, $parts[2];
$detdistname = "sles" . $subparts[0];
unless ($distname) { $distname = "sles" . $subparts[0] }
}
if ($prod =~ m/Software-Development-Kit/ || $prod =~ m/SDK/) {
#
# It's been seen that the 3rd disc on the SDK ISO images are using 'media.1' instead of
# media.3 to represent the 3rd disc. This code here is to work around this issue. I'm not
# sure why this only applies to sles 11.3 since I do see the same issue in sles 11. But will
# keep the logic as is... checking for >= 11.3
#
(my $numver = $distname) =~ s/[^0-9]//g;
if ($numver >= 11.3) {
if ($discnumber == 1 and $totaldiscnumber == 1) { #disc 3, aka disc1 of 'debug'
$discnumber = 3;
if ($prod =~ m/Software-Development-Kit/ || $prod =~ m/SDK/) {
#
# It's been seen that the 3rd disc on the SDK ISO images are using 'media.1' instead of
# media.3 to represent the 3rd disc. This code here is to work around this issue. I'm not
# sure why this only applies to sles 11.3 since I do see the same issue in sles 11. But will
# keep the logic as is... checking for >= 11.3
#
(my $numver = $distname) =~ s/[^0-9]//g;
if ($numver >= 11.3) {
if ($discnumber == 1 and $totaldiscnumber == 1) { #disc 3, aka disc1 of 'debug'
$discnumber = 3;
}
}
$discnumber = 'sdk' . $discnumber;
}
$discnumber = 'sdk' . $discnumber;
# check media.1/products for text.
# the cselx is a special GE built version.
# openSUSE is the normal one.
} elsif ($prod =~ m/cselx 1.0-0|openSUSE 11.1-0/) {
$distname = "suse11";
$detdistname = "suse11";
}
# check media.1/products for text.
# the cselx is a special GE built version.
# openSUSE is the normal one.
} elsif ($prod =~ m/cselx 1.0-0|openSUSE 11.1-0/) {
$distname = "suse11";
$detdistname = "suse11";
}
}
closedir($dirh);
} elsif (-r $mntpath . "/media.1/media") {
my $dinfo;
open($dinfo, $mntpath . "/media.1/media");
my $dsc = <$dinfo>;
if ($dsc =~ /x86_64/) {
$darch = "x86_64";
}
if ($dsc =~ /Installer/ and $dsc =~ /SLE-/) {
$discnumber = 1;
$distname = "sle";
} elsif ($dsc =~ /SLE-/ and $dsc =~ /Packages/) {
$discnumber = 2;
$distname = "sle";
}
}
closedir($dirh);
unless ($distname and $discnumber)
{
#failed to parse the disc info

View File

@ -0,0 +1,165 @@
<pre-scripts config:type="list">
<script>
<filename>foo.sh</filename>
<interpreter>shell</interpreter>
<debug config:type="boolean">false</debug>
<source>
<![CDATA[
#!/bin/sh
{
echo "Running AutoYaST Pre-Installation script..."
export XCATDEBUGMODE="#TABLEBLANKOKAY:site:key=xcatdebugmode:value#"
if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then
set -x
fi
AWK=`find / -name awk | tail -1`
#old awk /mounts/instsys/bin/awk -f
if [ ! -e /usr/bin/awk ]; then
ln -s $AWK /usr/bin/awk
fi
XCATDPORT=#TABLE:site:key=xcatiport:value#
XCATDHOST="#XCATVAR:XCATMASTER#"
(
cat << 'EOF'
#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/updateflag.awk#
EOF
) > /tmp/updateflag
if [ ! -c /dev/vcs ]; then
mknod /dev/vcs c 7 0
fi
cat >/tmp/foo.awk <<EOF
#!$AWK -f
BEGIN {
ns = "/inet/tcp/3054/0/0"
while(1) {
ns |& getline
#UNCOMMENTOENABLEDEBUGPORT# if(\$1 == "sh") { #TODO: ENABLE IF DEBUG
#UNCOMMENTOENABLEDEBUGPORT# sub(/^sh +/,"",\$0)
#UNCOMMENTOENABLEDEBUGPORT# output = \$0
#UNCOMMENTOENABLEDEBUGPORT# while((output | getline) > 0)
#UNCOMMENTOENABLEDEBUGPORT# print \$0 |& ns
#UNCOMMENTOENABLEDEBUGPORT# print "EOO" |& ns
#UNCOMMENTOENABLEDEBUGPORT# close(output)
#UNCOMMENTOENABLEDEBUGPORT# }
if(\$1 == "screendump") {
output = "chvt " \$2 ";cat /dev/vcs"
while((output | getline) > 0)
print \$0 |& ns
close(output)
}
if(\$1 == "stat") {
if( system( "[ -f /mnt/var/log/YaST2/y2logRPM ]" ) == 0 ) {
while((getline < "/mnt/var/log/YaST2/y2logRPM") > 0) {
line = \$0
}
close("/mnt/var/log/YaST2/y2logRPM")
if(line ~ /\.rpm /) {
sub(/\.[^\.]+\.rpm .*$/,"",line)
sub(/^.* /,"",line)
}
else {
line = "prep"
}
print ("installing " line) |& ns
}
else {
# The format of /var/log/zypp/history is documented at
# http://en.opensuse.org/Libzypp/Package_History
lastrpm = "prep"
oldFS = FS
FS="|"
while((getline < "/mnt/var/log/zypp/history") > 0) {
if (\$0 !~ /#/ && \$2 == "install") {
lastrpm = (\$3 "-" \$4)
}
}
close("/mnt/var/log/zypp/history")
FS = oldFS
print ("installing " lastrpm) |& ns
}
}
close(ns)
}
}
EOF
chmod 755 /tmp/foo.awk
chmod 755 /tmp/updateflag
/tmp/updateflag $XCATDHOST $XCATDPORT "installmonitor" &
NODESTATUS=#TABLEBLANKOKAY:site:key=nodestatus:value#
if [ -z "$NODESTATUS" ] || [ "$NODESTATUS" != "0" -a "$NODESTATUS" != "N" -a "$NODESTATUS" != "n" ]; then
/tmp/updateflag $XCATDHOST $XCATDPORT "installstatus installing" &
fi
/tmp/foo.awk >/tmp/foo.log 2>&1 &
shopt -s nullglob
#
# The getinstdisk script is common for RHEL/SLES/PowerKVM/Ubuntu.
# It will attempt to select the install disk and write the selection to /tmp/xcat.install_disk
#
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/getinstdisk#
if [ -e "/tmp/xcat.install_disk" ]; then
instdisk=`cat /tmp/xcat.install_disk`
fi
if [ -d /sys/firmware/efi ]; then
sed -e 's!<device>XCATPARTITIONHOOK</device>!<device>'$instdisk'</device><partitions config:type="list"><partition><filesystem config:type="symbol">vfat</filesystem><mount>/boot/efi</mount><size>128mb</size></partition><partition><mount>swap</mount><size>auto</size></partition><partition><mount>/</mount><size>auto</size></partition></partitions>!' /tmp/profile/autoinst.xml > /tmp/profile/modified.xml
else
sed -e 's!<device>XCATPARTITIONHOOK</device>!<device>'$instdisk'</device>!' /tmp/profile/autoinst.xml > /tmp/profile/modified.xml
fi
#XCA_PARTITION_SCRIPT#
#add the following part for replace the partition definition in /tmp/profile/autoinst.xml
if [ -r "/tmp/partitionfile" ]; then
while read line
do
con="${con}${line}"
done < /tmp/partitionfile
con=${con//>\s+</><}
con=${con// /xcattempspace}
sed -e '/<drive>/{N;N;s!.*!'$con'!}' /tmp/profile/autoinst.xml > /tmp/profile/modified1.xml
sed -e 's!xcattempspace! !g' /tmp/profile/modified1.xml > /tmp/profile/modified.xml
fi
export nextserver=`cat /proc/cmdline | grep http | awk -F'autoyast=http://' {'print \$2'} | awk -F':' {'print \$1'}`
cp /tmp/profile/modified.xml /tmp/profile/modified1.xml
sed -e 's!XCATNEXTSERVERHOOK!'$nextserver'!' /tmp/profile/modified1.xml > /tmp/profile/modified.xml
if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then
set +x
fi
} >>/tmp/pre-install.log 2>&1
]]>
</source>
</script>
</pre-scripts>

View File

@ -0,0 +1,2 @@
openssl
rsync

View File

@ -0,0 +1,102 @@
<?xml version="1.0"?>
<!DOCTYPE profile SYSTEM "/usr/share/YaST2/include/autoinstall/profile.dtd">
<profile xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns">
<install>
<bootloader>
<write_bootloader config:type="boolean">true</write_bootloader>
<activate config:type="boolean">true</activate>
<kernel_parameters></kernel_parameters>
<lba_support config:type="boolean">false</lba_support>
<linear config:type="boolean">false</linear>
<location>mbr</location>
</bootloader>
<general>
<clock>
<hwclock>GMT</hwclock>
<timezone>#TABLE:site:key=timezone:value#</timezone>
</clock>
<keyboard>
<keymap>english-us</keymap>
</keyboard>
<language>en_US</language>
<mode>
<confirm config:type="boolean">false</confirm>
<forceboot config:type="boolean">false</forceboot>
<interactive_boot config:type="boolean">false</interactive_boot>
<reboot config:type="boolean">true</reboot>
</mode>
<mouse>
<id>non</id>
</mouse>
<signature-handling>
<accept_non_trusted_gpg_key config:type="boolean">true</accept_non_trusted_gpg_key>
<accept_unknown_gpg_key config:type="boolean">true</accept_unknown_gpg_key>
<accept_unsigned_file config:type="boolean">true</accept_unsigned_file>
</signature-handling>
</general>
<partitioning config:type="list">
<!-- XCAT-PARTITION-START -->
<drive>
<device>XCATPARTITIONHOOK</device>
<initialize config:type="boolean">true</initialize>
<use>all</use>
</drive>
<!-- XCAT-PARTITION-END -->
</partitioning>
<add-on>
<add_on_products config:type="list">
<listentry><media_url>http://XCATNEXTSERVERHOOK/install/sles15/x86_64/2</media_url><product>sle-module-basesystem</product><product_dir>/Module-Basesystem</product_dir></listentry>
<listentry><media_url>http://XCATNEXTSERVERHOOK/install/sles15/x86_64/2</media_url><product>sle-module-hpc</product><product_dir>/Module-HPC</product_dir></listentry>
<listentry><media_url>http://XCATNEXTSERVERHOOK/install/sles15/x86_64/2</media_url><product>sle-module-server-applications</product><product_dir>/Module-Server-Applications</product_dir></listentry>
<listentry><media_url>http://XCATNEXTSERVERHOOK/install/sles15/x86_64/2</media_url><product>sle-module-server-applications</product><product_dir>/Module-Server-Applications</product_dir></listentry>
<listentry><media_url>http://XCATNEXTSERVERHOOK/install/sles15/x86_64/2</media_url><product>SLE_HPC</product><product_dir>/Product-HPC</product_dir></listentry>
</add_on_products>
</add-on>
<software>
<products config:type="list">
<product>SLE_HPC</product>
</products>
<patterns config:type="list">
#INCLUDE_DEFAULT_PTRNLIST_S#
</patterns>
<packages config:type="list">
#INCLUDE_DEFAULT_PKGLIST_S#
</packages>
</software>
</install>
<configure>
<users config:type="list">
<user>
<username>root</username>
<user_password>#CRYPT:passwd:key=system,username=root:password#</user_password>
<encrypted config:type="boolean">true</encrypted>
<forename/>
<surname/>
</user>
</users>
<networking>
<dns>
<dhcp_hostname config:type="boolean">true</dhcp_hostname>
<dhcp_resolv config:type="boolean">true</dhcp_resolv>
<domain>local</domain>
<hostname>linux</hostname>
</dns>
<interfaces config:type="list">
<interface>
<bootproto>dhcp</bootproto>
<device>eth0</device>
<startmode>onboot</startmode>
</interface>
</interfaces>
<routing>
<ip_forward config:type="boolean">false</ip_forward>
<routes config:type="list"/>
</routing>
</networking>
<scripts>
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/pre.sle15#
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/chroot.sles#
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.sles11#
</scripts>
</configure>
</profile>