2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-30 09:36:41 +00:00

Merge pull request #6538 from Obihoernchen/sle15-genimage

SLE15: genimage fixes
This commit is contained in:
cxhong 2020-01-22 13:12:26 -05:00 committed by GitHub
commit 0f9c1a3b5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 65 additions and 89 deletions

View File

@ -1,50 +0,0 @@
aaa_base
coreutils
bash
dbus-1
wicked
device-mapper
dracut
nfs-kernel-server
keyutils
lvm2
openssl
dhcp-client
openssh
procps
psmisc
wget
sysconfig
rsyslog
vim
rsync
timezone
bc
ntp
gzip
e2fsprogs
parted
binutils
tar
open-iscsi
curl
btrfsprogs
cryptsetup
dmraid
mdadm
multipath-tools
gpg2
which
cifs-utils
open-lldp
fcoe-utils
util-linux-systemd
udev
kernel-default
kernel-firmware
adaptec-firmware
xz
SLE_HPC-release
insserv-compat
net-tools-deprecated
rsyslog

View File

@ -0,0 +1 @@
compute.sle15.pkglist

View File

@ -153,11 +153,11 @@ function getdevfrommac() {
done
}
for lf in /tmp/dhclient.*.lease; do
netif=${lf#*.}
netif=${netif%.*}
cp $lf "$NEWROOT/var/lib/dhclient/dhclient-$netif.leases"
done
bootif=$(ls /tmp/net.*.conf|sed -e s/.*net\.// -e s/\.conf//)
cat <<EOF > $NEWROOT/etc/sysconfig/network/ifcfg-$bootif
BOOTPROTO='dhcp'
STARTMODE='auto'
EOF
if [ -f $NEWROOT/etc/hostname ]; then
echo `hostname -s` > $NEWROOT/etc/hostname

View File

@ -295,12 +295,12 @@ function getdevfrommac() {
if [ -z $STATEMNT ]; then
for lf in /tmp/dhclient.*.lease; do
netif=${lf#*.}
netif=${netif%.*}
cp $lf "$NEWROOT/var/lib/dhclient/dhclient-$netif.leases"
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p debug "saving $NEWROOT/var/lib/dhclient/dhclient-$netif.leases"
done
bootif=$(ls /tmp/net.*.conf|sed -e s/.*net\.// -e s/\.conf//)
cat <<EOF > $NEWROOT/etc/sysconfig/network/ifcfg-$bootif
BOOTPROTO='dhcp'
STARTMODE='auto'
EOF
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p debug "saving $NEWROOT/etc/sysconfig/network/ifcfg-$bootif"
if [ ! -z "$ifname" ]; then
MACX=${ifname#*:}

View File

@ -72,6 +72,31 @@ sub xdie {
die @_;
}
sub umount {
# some rpms mounts the imageroot/proc on the /proc, need to release it,
# otherwise got kernal panic when installing
# sometimes, the proc fs is not mounted, so one warning/error message will display,
# and I add one check point here.
my $MFD;
open MFD, "/proc/mounts";
my @lines = <MFD>;
close MFD;
my $ret = grep m{$rootimg_dir/proc}, @lines;
if ($ret > 0) {
system("umount -l $rootimg_dir/proc");
}
$ret = grep m{$rootimg_dir/sys}, @lines;
if ($ret > 0) {
system("umount -l $rootimg_dir/sys");
}
}
# Make sure we clean up all mounts everytime
END {
umount();
}
#-- fetch current version form CVS (overwrite locally changed versions)
# if (opendir(CVS,"$pathtofiles/CVS")){
# close CVS;
@ -203,7 +228,7 @@ unless (grep /af_packet/, @ndrivers) {
}
my $osver_host;
if (`grep VERSION /etc/os-release` =~ /VERSION = (\d+)/) {
if (`grep VERSION /etc/os-release` =~ /VERSION="(\d+)/) {
$osver_host = $1;
} else {
$osver_host = 11;
@ -225,26 +250,32 @@ unless ($onlyinitrd) {
mkpath "$rootimg_dir/etc";
mkpath "$rootimg_dir/dev";
mkpath "$rootimg_dir/proc";
mkpath "$rootimg_dir/sys";
#needed for newer versions of the SLE permissions RPM. See: https://github.com/openSUSE/permissions/commit/2d0ef5d55b30f72322d18951214353ecfd9c4245
system "mount -t proc proc $rootimg_dir/proc";
#Create /sys to have /sys/kernel/fscaps. Fixes: "Warning: running kernel does not support fscaps"
system "mount -o bind /sys $rootimg_dir/sys";
#system "mount -o bind /dev $rootimg_dir/dev";
unless (-e "$rootimg_dir/dev/zero") {
system "mknod $rootimg_dir/dev/zero c 1 5";
system "mknod -m 0666 $rootimg_dir/dev/zero c 1 5";
}
unless (-e "$rootimg_dir/dev/null") {
system "mknod $rootimg_dir/dev/null c 1 3"; #that's neccessary for SLES11
system "mknod -m 0666 $rootimg_dir/dev/null c 1 3"; #that's neccessary for SLES11+
}
unless (-e "$rootimg_dir/dev/random") {
system "mknod $rootimg_dir/dev/random c 1 8"; #that's neccessary for SLES11
system "mknod -m 0666 $rootimg_dir/dev/random c 1 8"; #that's neccessary for SLES11+
}
unless (-e "$rootimg_dir/dev/urandom") {
system "mknod $rootimg_dir/dev/urandom c 1 9"; #that's neccessary for SLES11
system "mknod -m 0666 $rootimg_dir/dev/urandom c 1 9"; #that's neccessary for SLES11+
}
for (my $i = 0 ; $i <= 12 ; $i++)
{
unless (-e "$rootimg_dir/dev/tty$i") {
system "mknod $rootimg_dir/dev/tty$i c 4 $i"; #that's neccessary for SLES11
system "mknod $rootimg_dir/dev/tty$i c 4 $i"; #that's neccessary for SLES11+
}
}
@ -397,10 +428,12 @@ unless ($onlyinitrd) {
#my $yumcmd = "yum -y -c /tmp/genimage.$$.yum.conf --installroot=$rootimg_dir --disablerepo=* ";
#$yumcmd .= "install ";
#mkpath("$rootimg_dir/var/lib/yum");
mkpath("$rootimg_dir/etc/");
my $passwdfile;
open($passwdfile, ">", "$rootimg_dir/etc/passwd");
print $passwdfile "root:x:0:0:root:/root:/bin/bash\n";
if (! -f "$rootimg_dir/etc/passwd") {
mkpath("$rootimg_dir/etc/");
my $passwdfile;
open($passwdfile, ">", "$rootimg_dir/etc/passwd");
print $passwdfile "root:x:0:0:root:/root:/bin/bash\n";
}
my $yumcmd;
if ($osver_host < 11) {
$yumcmd = "zypper -R $rootimg_dir $non_interactive install ";
@ -872,19 +905,8 @@ system("cd $rootimg_dir/usr/bin/; ln -s ../../bin/keyctl $rootimg_dir/usr/bin/ke
# which is different from the Redhat family
# some rpms mounts the imageroot/proc on the /proc, need to release it,
# otherwise got kernal panic when installing
# sometimes, the proc fs is not mounted, so one warning/error message will display,
# and I add one check point here.
my $MFD;
open MFD, "/proc/mounts";
my @lines = <MFD>;
close MFD;
my $ret = grep m{$rootimg_dir/proc}, @lines;
if ($ret > 0) {
system("umount -l $rootimg_dir/proc");
}
# umount /proc and /sys from rootimg
umount();
# Load driver update disk, and copy them to the root image
my @dd_drivers = &load_dd();
@ -1953,7 +1975,7 @@ sub generic_post { # This function is meant to leave the image in a state approx
}
unlink("$rootimg_dir/dev/null");
system("mknod $rootimg_dir/dev/null c 1 3");
system("mknod -m 0666 $rootimg_dir/dev/null c 1 3");
open($cfgfile, ">", "$rootimg_dir/etc/fstab");
print $cfgfile "devpts /dev/pts devpts gid=5,mode=620 0 0\n";
print $cfgfile "tmpfs /dev/shm tmpfs defaults 0 0\n";
@ -1976,9 +1998,12 @@ sub generic_post { # This function is meant to leave the image in a state approx
print $cfgfile "NETWORKING=yes\n";
close($cfgfile);
open($cfgfile, ">", "$rootimg_dir/etc/resolv.conf");
print $cfgfile "#Dummy resolv.conf to make boot cleaner";
close($cfgfile);
# SLE15 has a symlink to /run/netconfig/resolv.conf and does not need a dummy file
if (! -l "$rootimg_dir/etc/resolv.conf") {
open($cfgfile, ">", "$rootimg_dir/etc/resolv.conf");
print $cfgfile "#Dummy resolv.conf to make boot cleaner";
close($cfgfile);
}
# Create the ifcfg-x file for diskless node. But keep the ONBOOT=no
# to skip the break of nfs-based boot