mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-05-02 21:17:48 +00:00
fix: [WIP] Build xCAT-genesis-base source package in buildrpms.pl
Signed-off-by: Daniel Hilst Selli <392820+dhilst@users.noreply.github.com>
This commit is contained in:
208
buildrpms.pl
208
buildrpms.pl
@@ -5,12 +5,18 @@ use warnings;
|
||||
|
||||
use feature 'say';
|
||||
|
||||
use Data::Dumper;
|
||||
use File::Copy ();
|
||||
use File::Slurper qw(read_text write_text);
|
||||
use Parallel::ForkManager;
|
||||
use Getopt::Long qw(GetOptions);
|
||||
use Carp;
|
||||
use Cwd qw();
|
||||
use Data::Dumper;
|
||||
use File::Copy qw(cp);
|
||||
use File::Path qw(make_path);
|
||||
use File::Slurper qw(read_text write_text);
|
||||
use FindBin qw($Bin);
|
||||
use Getopt::Long qw(GetOptions);
|
||||
use Parallel::ForkManager;
|
||||
|
||||
use autodie;
|
||||
use autodie qw(cp);
|
||||
|
||||
my $SOURCES = "$ENV{HOME}/rpmbuild/SOURCES";
|
||||
my $VERSION = read_text("Version");
|
||||
@@ -29,13 +35,15 @@ my @PACKAGES = qw(
|
||||
xCAT-buildkit
|
||||
xCAT-client
|
||||
xCAT-confluent
|
||||
xCAT-genesis-base
|
||||
xCAT-genesis-scripts
|
||||
xCAT-openbmc-py
|
||||
xCAT-probe
|
||||
xCAT-rmc
|
||||
xCAT-server
|
||||
xCAT-genesis-scripts
|
||||
xCAT-test
|
||||
xCAT-vlan);
|
||||
xCAT-vlan
|
||||
);
|
||||
|
||||
my @TARGETS = qw(
|
||||
rhel+epel-8-x86_64
|
||||
@@ -44,47 +52,35 @@ my @TARGETS = qw(
|
||||
|
||||
|
||||
my %opts = (
|
||||
targets => \@TARGETS,
|
||||
packages => \@PACKAGES,
|
||||
nproc => int(`nproc --all`),
|
||||
force => 0,
|
||||
verbose => 0,
|
||||
xcat_dep_path => "$PWD/../xcat-dep/",
|
||||
configure_nginx => 0,
|
||||
force => 0,
|
||||
help => 0,
|
||||
nginx_port => 8080,
|
||||
nproc => int(`nproc --all`),
|
||||
packages => \@PACKAGES,
|
||||
targets => \@TARGETS,
|
||||
verbose => 0,
|
||||
xcat_dep_path => "$PWD/../xcat-dep/",
|
||||
);
|
||||
|
||||
GetOptions(
|
||||
"target=s@" => \$opts{targets},
|
||||
"package=s@" => \$opts{packages},
|
||||
"nproc=i" => \$opts{nproc},
|
||||
"verbose" => \$opts{verbose},
|
||||
"force" => \$opts{force},
|
||||
"xcat_dep_path=s" => \$opts{xcat_dep_path},
|
||||
"configure_nginx" => \$opts{configure_nginx},
|
||||
"force" => \$opts{force},
|
||||
"help" => \$opts{help},
|
||||
"nginx_port" => \$opts{nginx_port},
|
||||
"nproc=i" => \$opts{nproc},
|
||||
"package=s@" => \$opts{packages},
|
||||
"target=s@" => \$opts{targets},
|
||||
"verbose" => \$opts{verbose},
|
||||
"xcat_dep_path=s" => \$opts{xcat_dep_path},
|
||||
) or usage();
|
||||
|
||||
sub sh {
|
||||
my ($cmd) = @_;
|
||||
say "Running: $cmd"
|
||||
if $opts{verbose};
|
||||
open my $fh, "-|", "bash -lc '$cmd'" or die "cannot run $cmd: $!";
|
||||
|
||||
while (my $line = <$fh>) {
|
||||
print $line
|
||||
if $opts{verbose};
|
||||
}
|
||||
close $fh;
|
||||
return $? >> 8;
|
||||
}
|
||||
|
||||
# cp $src, $dst copies $src to $dst or aborts with an error message
|
||||
sub cp {
|
||||
my ($src, $dst) = @_;
|
||||
File::Copy::copy($src, $dst) or die "copy $src, $dst failed: $!";
|
||||
system($cmd);
|
||||
$? >> 8;
|
||||
}
|
||||
|
||||
# sed { s/foo/bar/ } $filepath applies s/foo/bar/ to the file at $filepath
|
||||
@@ -102,7 +98,7 @@ sub is_in {
|
||||
for (@_) {
|
||||
return 1 if $_ eq $needle;
|
||||
}
|
||||
return 0;
|
||||
0;
|
||||
}
|
||||
|
||||
# product(\@A, \@B) returns the catersian product of \@A and \@B
|
||||
@@ -124,12 +120,124 @@ sub createmockconfig {
|
||||
$contents =~ s/config_opts\['root'\]\s+=.*/config_opts['root'] = \"$chroot\"/;
|
||||
if ($pkg eq "perl-xCAT") {
|
||||
# perl-generators is required for having perl(xCAT::...) symbols
|
||||
# exported by the RPM
|
||||
# exported by the RPM
|
||||
$contents .= "config_opts['chroot_additional_packages'] = 'perl-generators'\n";
|
||||
}
|
||||
write_text($cfgfile, $contents);
|
||||
}
|
||||
|
||||
sub buildsources_genesis_base() {
|
||||
die "Assertion failed! No directory xCAT-genesis-builder in the current directory"
|
||||
unless -d "./xCAT-genesis-builder";
|
||||
|
||||
my @deps = qw(
|
||||
bind-utils
|
||||
dosfstools
|
||||
ethtool
|
||||
ipmitool
|
||||
kexec-tools
|
||||
lldpad
|
||||
mdadm
|
||||
mstflint
|
||||
nmap-ncat
|
||||
net-tools
|
||||
pciutils
|
||||
psmisc
|
||||
rpm-build
|
||||
rpmdevtools
|
||||
screen
|
||||
usbutils
|
||||
);
|
||||
sh("dnf install -y " . join " ", @deps)
|
||||
and die "Error installing packages $?";
|
||||
|
||||
my $dracutmoddir = "/usr/lib/dracut/modules.d/97xcat/";
|
||||
|
||||
my $buildarch = `uname -m`;
|
||||
my $kernelversion = `uname -r`;
|
||||
chomp $buildarch;
|
||||
chomp $kernelversion;
|
||||
|
||||
my $genesispath = "/tmp/xcatgenesis.$$";
|
||||
my $buildpath = "$genesispath/opt/xcat/share/xcat/netboot/genesis/$buildarch";
|
||||
|
||||
make_path $dracutmoddir;
|
||||
make_path "$buildpath/fs/etc/ssh/";
|
||||
|
||||
my @files = map { "$Bin/xCAT-genesis-builder/dracut_105/el/$_" }
|
||||
qw(
|
||||
module-setup.sh
|
||||
xcat-cmdline.sh
|
||||
xcatroot
|
||||
dhclient.conf
|
||||
dhclient-script
|
||||
rsyslog.conf
|
||||
);
|
||||
# copy @files to $dracutmoddir
|
||||
cp $_, $dracutmoddir for @files;
|
||||
|
||||
# The dependents of these must be updated
|
||||
# * netstat
|
||||
# * /sbin/route
|
||||
# * /sbin/ifconfig -> net-tool
|
||||
# * nslookup
|
||||
|
||||
|
||||
|
||||
my $opts = $opts{verbose} ? "set -x" : "";
|
||||
sh(<<"EOF");
|
||||
$opts
|
||||
dracut --compress gzip -m "xcat base" --no-early-microcode -N -f $genesispath.rfs;
|
||||
rm -rf $buildpath/fs || :
|
||||
mkdir -p $buildpath/fs || :
|
||||
cd $buildpath/fs
|
||||
zcat $genesispath.rfs | cpio -dumi
|
||||
EOF
|
||||
|
||||
my @perl_lib_dir = qw(
|
||||
/usr/share/perl5
|
||||
/usr/lib64/perl5
|
||||
/usr/local/lib64/perl5
|
||||
/usr/local/share/perl5
|
||||
/usr/share/ntp/lib
|
||||
);
|
||||
|
||||
for my $d (@perl_lib_dir) {
|
||||
next unless -d $d;
|
||||
my $temp_dir = "$buildpath/fs/$d";
|
||||
make_path $temp_dir;
|
||||
# cp function does not copy directories recursively
|
||||
`cp -a -t $temp_dir $d/.`;
|
||||
}
|
||||
|
||||
make_path "$buildpath/fs/lib/udev/rules.d/";
|
||||
my $oldcwd = Cwd::cwd();
|
||||
my $lib_udev_rules="/lib/udev/rules.d/";
|
||||
cp "$lib_udev_rules/80-net-name-slot.rules", "$buildpath/fs/lib/udev/rules.d/"
|
||||
if -e "$lib_udev_rules/80-net-name-slot.rules";
|
||||
|
||||
make_path("$buildpath/kernel/");
|
||||
cp "/boot/vmlinuz-$kernelversion", "$buildpath/kernel/";
|
||||
|
||||
# Create the targz
|
||||
#
|
||||
# Note:
|
||||
#
|
||||
# Deletes character devices from the genesis-base
|
||||
# image filesystem prior to tarball creation. The installation
|
||||
# of the package fails in vanilla containers with "Operation not
|
||||
# permited" during the creation of
|
||||
#
|
||||
# /opt/xcat/../genesis/../fs/dev/{console,random,...}
|
||||
#
|
||||
# otherwise.
|
||||
sh(<<"EOF")
|
||||
cd $genesispath
|
||||
find . -type c -delete
|
||||
tar jcf $SOURCES/xCAT-genesis-base-$buildarch.tar.bz2 opt
|
||||
EOF
|
||||
}
|
||||
|
||||
sub buildsources {
|
||||
my ($pkg, $target) = @_;
|
||||
|
||||
@@ -139,7 +247,7 @@ sub buildsources {
|
||||
cp "xCAT-genesis-scripts/usr/bin/$f", "$pkg/postscripts/$f";
|
||||
sed { s/xcat.genesis.$f/$f/ } "${pkg}/postscripts/$f";
|
||||
}
|
||||
qx {bash -c '
|
||||
sh(<<'EOF');
|
||||
cd xCAT
|
||||
tar --exclude upflag -czf $SOURCES/postscripts.tar.gz postscripts LICENSE.html
|
||||
tar -czf $SOURCES/prescripts.tar.gz prescripts
|
||||
@@ -149,21 +257,30 @@ sub buildsources {
|
||||
cp xcat.conf $SOURCES
|
||||
cp xcat.conf.apach24 $SOURCES
|
||||
cp xCATMN $SOURCES
|
||||
'};
|
||||
EOF
|
||||
} elsif ($pkg eq "xCAT-genesis-scripts") {
|
||||
`tar -cjf "$SOURCES/$pkg.tar.bz2" $pkg`;
|
||||
sh qq(tar -cjf "$SOURCES/$pkg.tar.bz2" $pkg);
|
||||
} elsif ($pkg eq "xCAT-genesis-base") {
|
||||
buildsources_genesis_base();
|
||||
} else {
|
||||
`tar -czf "$SOURCES/$pkg-$VERSION.tar.gz" $pkg`;
|
||||
sh qq(tar -czf "$SOURCES/$pkg-$VERSION.tar.gz" $pkg);
|
||||
}
|
||||
}
|
||||
|
||||
sub buildspkgs {
|
||||
my ($pkg, $target) = @_;
|
||||
|
||||
my $chroot = "$pkg-$target";
|
||||
|
||||
my $diskcache = "dist/$target/srpms/$pkg-$VERSION-$RELEASE.src.rpm";
|
||||
return if -f $diskcache and not $opts{force};
|
||||
|
||||
my $dir = sub {
|
||||
return "xCAT-genesis-builder"
|
||||
if $pkg eq "xCAT-genesis-base";
|
||||
$pkg;
|
||||
}->();
|
||||
|
||||
my @opts;
|
||||
push @opts, "--quiet" unless $opts{verbose};
|
||||
|
||||
@@ -177,7 +294,7 @@ mock -r $chroot \\
|
||||
--define "release $RELEASE" \\
|
||||
--define "gitinfo $GITINFO" \\
|
||||
--buildsrpm \\
|
||||
--spec $pkg/$pkg.spec \\
|
||||
--spec $dir/$pkg.spec \\
|
||||
--sources $SOURCES \\
|
||||
--resultdir "dist/$target/srpms/"
|
||||
EOF
|
||||
@@ -195,6 +312,11 @@ sub buildpkgs {
|
||||
|
||||
# get x86_64 from rhel+epel-9-x86_64
|
||||
my $targetarch = (split /-/, $target, 3)[2];
|
||||
|
||||
# get the builder arch, xCAT-genesis-base include it in its package name
|
||||
my $nativearch = `uname -m`;
|
||||
chomp $nativearch;
|
||||
$nativearch = "ppc64" if $nativearch =~ /^ppc/;
|
||||
my $arch = is_in($pkg, @native_pkgs) ? $targetarch : "noarch";
|
||||
|
||||
my $diskcache = "dist/$target/rpms/$pkg-$VERSION-$RELEASE.$arch.rpm";
|
||||
@@ -206,6 +328,8 @@ sub buildpkgs {
|
||||
my $spkgname = sub {
|
||||
return "${pkg}-${arch}-${VERSION}-${RELEASE}.src.rpm"
|
||||
if $pkg eq 'xCAT-genesis-scripts';
|
||||
return "xCAT-genesis-base-${nativearch}-${VERSION}-${RELEASE}.src.rpm"
|
||||
if $pkg eq 'xCAT-genesis-base';
|
||||
|
||||
return "$pkg-${VERSION}-${RELEASE}.src.rpm";
|
||||
}->();
|
||||
@@ -247,7 +371,7 @@ EOF
|
||||
my $fullpath = "$PWD/dist/$target/rpms";
|
||||
$conf .= <<"EOF";
|
||||
location /$target/ {
|
||||
alias $fullpath/;
|
||||
alias $fullpath/;
|
||||
autoindex on;
|
||||
index off;
|
||||
allow all;
|
||||
@@ -257,7 +381,7 @@ EOF
|
||||
# TODO:I need one xcat-dep for each target
|
||||
$conf .= <<"EOF";
|
||||
location /xcat-dep/ {
|
||||
alias $xcat_dep_path;
|
||||
alias $xcat_dep_path;
|
||||
autoindex on;
|
||||
index off;
|
||||
allow all;
|
||||
|
||||
9
xCAT-genesis-builder/dracut_105/README
Normal file
9
xCAT-genesis-builder/dracut_105/README
Normal file
@@ -0,0 +1,9 @@
|
||||
Dracut modules for EL10
|
||||
|
||||
|
||||
Notes:
|
||||
|
||||
* For now `ubuntu` is just a symlink to EL module, we
|
||||
may or may not need to diverge later.
|
||||
* These files were copied from ../ so we can adapt they
|
||||
without breaking old behavior
|
||||
60
xCAT-genesis-builder/dracut_105/el/dhclient-script
Executable file
60
xCAT-genesis-builder/dracut_105/el/dhclient-script
Executable file
@@ -0,0 +1,60 @@
|
||||
#!/bin/sh
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin
|
||||
if [ $reason = "PREINIT" -o $reason = "PREINIT6" ]; then
|
||||
ip link set $interface up
|
||||
tries=50
|
||||
while ! (ip link show $interface|grep LOWER_UP > /dev/null 2>&1); do
|
||||
sleep 0.1
|
||||
if [ $tries = 0 ]; then
|
||||
break
|
||||
fi
|
||||
tries=$((tries-1))
|
||||
done
|
||||
elif [ $reason = "BOUND" ]; then
|
||||
if [ ! -z "$old_ip_address" ]; then
|
||||
ip addr del dev $interface $old_ip_address/$old_subnet_mask
|
||||
fi
|
||||
for oldip in `ip -o addr show dev $interface|awk '{print $4}'`; do
|
||||
ip addr del dev $interface $oldip
|
||||
done
|
||||
if [ ! -z "$new_ip_address" -a ! -z "$new_subnet_mask" ]; then
|
||||
ip addr add dev $interface $new_ip_address/$new_subnet_mask
|
||||
fi
|
||||
if [ ! -z "$new_host_name" ]; then
|
||||
hostname $new_host_name
|
||||
lldptool -T -i $interface -V 5 enableTx=yes >& /dev/null
|
||||
fi
|
||||
if [ ! -z "$new_domain_name" ]; then
|
||||
echo search $new_domain_name >> /etc/resolv.conf
|
||||
fi
|
||||
for ns in $new_domain_name_servers; do
|
||||
echo nameserver $ns >> /etc/resolv.conf
|
||||
done
|
||||
for ntp in $new_ntp_servers; do
|
||||
echo server $ntp iburst >> /etc/ntp.conf
|
||||
done
|
||||
for gw in $new_routers; do
|
||||
ip route add default via $gw
|
||||
done
|
||||
|
||||
if [ ! -z "$new_tcode" -a -r "/usr/share/zoneinfo/posix/$new_tcode" ]; then
|
||||
cp "/usr/share/zoneinfo/posix/$new_tcode" /etc/localtime
|
||||
rm -rf /usr/share/zoneinfo #free up ramdisk
|
||||
fi
|
||||
elif [ $reason = "BOUND6" ]; then
|
||||
if [ ! -z "$old_ip6_address" ]; then
|
||||
ip addr del dev $interface $old_ip6_address/$old_ip6_prefixlen
|
||||
fi
|
||||
if [ ! -z "$new_ip6_address" ]; then
|
||||
ip addr add dev $interface $new_ip6_address/$new_ip6_prefixlen
|
||||
fi
|
||||
elif [ $reason = "RELEASE" ]; then
|
||||
if [ ! -z "$old_ip_address" ]; then
|
||||
ip addr del dev $interface $old_ip_address/$old_subnet_mask
|
||||
fi
|
||||
elif [ $reason = "RELEASE6" ]; then
|
||||
if [ ! -z "$old_ip6_address" ]; then
|
||||
ip addr del dev $interface $old_ip6_address/$old_ip6_prefixlen
|
||||
fi
|
||||
fi
|
||||
exit 0
|
||||
2
xCAT-genesis-builder/dracut_105/el/dhclient.conf
Normal file
2
xCAT-genesis-builder/dracut_105/el/dhclient.conf
Normal file
@@ -0,0 +1,2 @@
|
||||
option tcode code 101 = text;
|
||||
request subnet-mask, routers, domain-name, domain-search, domain-name-servers, host-name, ntp-servers, interface-mtu, tcode, log-servers;
|
||||
@@ -51,7 +51,8 @@ install() {
|
||||
dracut_install /lib64/libnss_dns.so.2
|
||||
dracut_install poweroff hwclock date /usr/share/terminfo/x/xterm /usr/share/terminfo/s/screen /etc/nsswitch.conf /etc/services
|
||||
dracut_install /sbin/rsyslogd /etc/protocols umount /bin/rpm /usr/lib/rpm/rpmrc
|
||||
dracut_install chmod /sbin/route /sbin/ifconfig /usr/bin/whoami /usr/bin/head /usr/bin/tail basename /etc/redhat-release ping tr lsusb /usr/share/hwdata/usb.ids #ibm fw wrapper requirements
|
||||
#dracut_install chmod /sbin/route /sbin/ifconfig /usr/bin/whoami /usr/bin/head /usr/bin/tail basename /etc/redhat-release ping tr lsusb /usr/share/hwdata/usb.ids #ibm fw wrapper requirements
|
||||
dracut_install chmod ip /usr/bin/whoami /usr/bin/head /usr/bin/tail basename /etc/redhat-release ping tr lsusb /usr/share/hwdata/usb.ids #ibm fw wrapper requirements
|
||||
dracut_install efibootmgr dmidecode #uxspi prereqs, but will use dmidecode to improve decision on loading ipmi_si
|
||||
dracut_install lldptool
|
||||
dracut_install /usr/share/zoneinfo/posix/Zulu
|
||||
|
||||
4
xCAT-genesis-builder/dracut_105/el/rsyslog.conf
Normal file
4
xCAT-genesis-builder/dracut_105/el/rsyslog.conf
Normal file
@@ -0,0 +1,4 @@
|
||||
$ModLoad imuxsock
|
||||
$ModLoad immark
|
||||
$MarkMessagePeriod 1200
|
||||
*.* /var/log/xcat.genesis
|
||||
88
xCAT-genesis-builder/dracut_105/el/xcat-cmdline.sh
Executable file
88
xCAT-genesis-builder/dracut_105/el/xcat-cmdline.sh
Executable file
@@ -0,0 +1,88 @@
|
||||
#!/bin/bash
|
||||
root=1
|
||||
rootok=1
|
||||
netroot=xcat
|
||||
clear
|
||||
echo PS1="'"'[xCAT Genesis running on \H \w]\$ '"'" > /.bashrc
|
||||
echo PS1="'"'[xCAT Genesis running on \H \w]\$ '"'" > /.bash_profile
|
||||
mkdir -p /etc/ssh
|
||||
mkdir -p /var/tmp/
|
||||
mkdir -p /var/empty/sshd
|
||||
sed -i '/^root:x/d' /etc/passwd
|
||||
cat >>/etc/passwd <<"__ENDL"
|
||||
root:x:0:0::/:/bin/bash
|
||||
sshd:x:30:30:SSH User:/var/empty/sshd:/sbin/nologin
|
||||
rpc:x:32:32:Rpcbind Daemon:/var/cache/rpcbind:/sbin/nologin
|
||||
rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
|
||||
qemu:x:107:107:qemu user:/:/sbin/nologin
|
||||
chrony:x:995:991::/var/lib/chrony:/sbin/nologin
|
||||
__ENDL
|
||||
# Fedora 20 ppc64 uses /lib/dracut/hooks/initqueue/finished
|
||||
# CentOS 7 probably uses /lib/dracut/hooks/initqueue/finished also
|
||||
if [ -d "/initqueue-finished" ]; then
|
||||
echo '[ -e $NEWROOT/proc ]' > /initqueue-finished/xcatroot.sh
|
||||
else
|
||||
#echo 'if [ -e /proc ]; then /bin/doxcat; fi' > /lib/dracut/hooks/initqueue/finished/xcatroot.sh
|
||||
echo '[ -e /proc ]' > /lib/dracut/hooks/initqueue/finished/xcatroot.sh
|
||||
fi
|
||||
mkdir /dev/cgroup
|
||||
mount -t cgroup -o cpu,memory,devices cgroup /dev/cgroup
|
||||
# Fedora 20 ppc64 does not udevd
|
||||
# CentOS 7 probably does not have udevd either
|
||||
if [ -f "/sbin/udevd" ]; then
|
||||
udevd --daemon
|
||||
else
|
||||
/usr/lib/systemd/systemd-udevd --daemon
|
||||
fi
|
||||
udevadm trigger
|
||||
mkdir -p /var/lib/dhclient/
|
||||
mkdir -p /var/log
|
||||
ip link set lo up
|
||||
echo '127.0.0.1 localhost' >> /etc/hosts
|
||||
if grep -q console=ttyS /proc/cmdline; then
|
||||
while :; do sleep 1; screen -S console -ln screen -x doxcat </dev/tty1 &>/dev/tty1; clear &>/dev/tty1 ; done &
|
||||
fi
|
||||
while :; do screen -ln < /dev/tty2 &> /dev/tty2 ; done &
|
||||
|
||||
# The section below is just for System P LE hardware discovery
|
||||
|
||||
# Need to wait for NIC initialization
|
||||
sleep 20
|
||||
ARCH="$(uname -m)"
|
||||
|
||||
if [[ ${ARCH} =~ ppc64 ]]; then
|
||||
# load all network driver modules listed in /lib/modules/<kernel>/modules.dep file
|
||||
KERVER=`uname -r`
|
||||
for line in `cat /lib/modules/$KERVER/modules.dep | awk -F: '{print \$1}' | sed -e "s/\(.*\)\.ko.*/\1/"`; do
|
||||
if [[ $line =~ "kernel/drivers/net" ]]; then
|
||||
modprobe `basename $line`
|
||||
fi
|
||||
done
|
||||
# Check if running on a VM, and load "virtio_pci" module
|
||||
cat /proc/cpuinfo | grep "machine" | grep "emulated"
|
||||
if [ $? -eq 0 ]; then
|
||||
modprobe virtio_pci
|
||||
fi
|
||||
waittime=2
|
||||
ALL_NICS=$(ip link show | grep -v "^ " | awk '{print $2}' | sed -e 's/:$//' | grep -v lo)
|
||||
for tmp in $ALL_NICS; do
|
||||
tmp_data="$(ip link show "$tmp" | grep -v "^ " | grep "UP")"
|
||||
if [ "$tmp_data" == "" ]; then
|
||||
ip link set "$tmp" up
|
||||
fi
|
||||
tmp_data="UP"
|
||||
waittime=$((waittime+1))
|
||||
done
|
||||
# wait 2+number_of_nics seconds for all the LINKed NICs to be UP
|
||||
sleep $waittime
|
||||
elif [[ ${ARCH} =~ x86_64 ]]; then
|
||||
# load all network driver modules listed in /lib/modules/<kernel>/modules.dep file
|
||||
KERVER=`uname -r`
|
||||
for line in `cat /lib/modules/$KERVER/modules.dep |grep -vE 'tunnel|ieee|ifb|bond|dummy|fjes|hv_netvsc|ntb_netdev|xen-netfront|hdlc_fr|dlci'| awk -F: '{print \$1}' | sed -e "s/\(.*\)\.ko.*/\1/"`; do
|
||||
if [[ $line =~ "kernel/drivers/net" ]]; then
|
||||
modprobe `basename $line`
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
while :; do screen -dr doxcat || screen -S doxcat -L -ln doxcat; done
|
||||
8
xCAT-genesis-builder/dracut_105/el/xcatroot
Executable file
8
xCAT-genesis-builder/dracut_105/el/xcatroot
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
echo "Starting xCAT mini-environment"
|
||||
NEWROOT=$3
|
||||
XCATMASTER=$XCAT
|
||||
while :
|
||||
do
|
||||
/bin/sh
|
||||
done
|
||||
1
xCAT-genesis-builder/dracut_105/ubuntu
Symbolic link
1
xCAT-genesis-builder/dracut_105/ubuntu
Symbolic link
@@ -0,0 +1 @@
|
||||
el
|
||||
@@ -1 +0,0 @@
|
||||
../el/module-setup.sh
|
||||
@@ -10,7 +10,8 @@ dracut_install mkswap df vconfig ifenslave ssh-keygen scp clear dhclient lldpad
|
||||
dracut_install /lib64/libnss_dns-2.12.so /lib64/libnss_dns.so.2
|
||||
dracut_install poweroff hwclock date /usr/share/terminfo/x/xterm /usr/share/terminfo/s/screen /etc/nsswitch.conf /etc/services
|
||||
dracut_install /sbin/rsyslogd /etc/protocols umount /bin/rpm /usr/lib/rpm/rpmrc
|
||||
dracut_install chmod /sbin/route /sbin/ifconfig /usr/bin/whoami /usr/bin/head /usr/bin/tail basename /etc/redhat-release ping tr lsusb /usr/share/hwdata/usb.ids #ibm fw wrapper requirements
|
||||
#dracut_install chmod /sbin/route /sbin/ifconfig /usr/bin/whoami /usr/bin/head /usr/bin/tail basename /etc/redhat-release ping tr lsusb /usr/share/hwdata/usb.ids #ibm fw wrapper requirements
|
||||
dracut_install chmod ip /usr/bin/whoami /usr/bin/head /usr/bin/tail basename /etc/redhat-release ping tr lsusb /usr/share/hwdata/usb.ids #ibm fw wrapper requirements
|
||||
dracut_install efibootmgr lldptool dmidecode #uxspi prereqs, but will use dmidecode to improve decision on loading ipmi_si
|
||||
dracut_install /usr/share/zoneinfo/posix/Zulu
|
||||
dracut_install /usr/share/zoneinfo/posix/GMT-0
|
||||
|
||||
@@ -29,7 +29,8 @@ else
|
||||
dracut_install /usr/lib/libldap-2.4.so.2 /usr/lib/liblber-2.4.so.2 /usr/lib64/libsasl2.so.2 #uxspi has incurred these...
|
||||
dracut_install /lib/libc.so.6
|
||||
fi
|
||||
dracut_install chmod /lib/ld-linux.so.2 /sbin/route /sbin/ifconfig /usr/bin/head /etc/debian_version /etc/lsb-release ping tr lsusb /usr/share/hwdata/usb.ids #ibm fw wrapper requirements
|
||||
#dracut_install chmod /lib/ld-linux.so.2 /sbin/route /sbin/ifconfig /usr/bin/head /etc/debian_version /etc/lsb-release ping tr lsusb /usr/share/hwdata/usb.ids #ibm fw wrapper requirements
|
||||
dracut_install chmod /lib/ld-linux.so.2 ip /usr/bin/head /etc/debian_version /etc/lsb-release ping tr lsusb /usr/share/hwdata/usb.ids #ibm fw wrapper requirements
|
||||
dracut_install /usr/share/zoneinfo/posix/Zulu
|
||||
dracut_install /usr/share/zoneinfo/posix/GMT-0
|
||||
dracut_install /usr/share/zoneinfo/posix/Europe/Istanbul
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
%global version %(rpm -q xCAT --qf "%{VERSION}" 2>/dev/null | grep -Po '[0-9\.]+' || echo "2.17.0")
|
||||
Version: %{version}
|
||||
Release: %{?release:%{release}}%{!?release:snap%(date +"%Y%m%d%H%M")}
|
||||
Version: %{?version:%{version}}%{!?version:%(cat Version)}
|
||||
Release: %{?release:%{release}}%{!?release:%(cat Release)}
|
||||
%ifarch i386 i586 i686 x86
|
||||
%define tarch x86
|
||||
%endif
|
||||
@@ -57,7 +56,7 @@ cd -
|
||||
%pretrans -p <lua>
|
||||
-- Lua block of code for removing a directory recursively
|
||||
-- The Lua function remove_directory_deep should be called
|
||||
-- with a directory name or, in a spec file, also with
|
||||
-- with a directory name in a spec file, also with
|
||||
-- a rpm macro defined to a directory name. This function
|
||||
-- is a possible lua equivalent of the shell command "rm -rf"
|
||||
-- using the lua posix extension embedded in rpm
|
||||
|
||||
@@ -789,7 +789,34 @@ start_udevd() {
|
||||
ifconfig_loopback() {
|
||||
logmsg
|
||||
logmsg ifconfig_loopback
|
||||
ifconfig lo 127.0.0.1
|
||||
#ifconfig lo 127.0.0.1
|
||||
ip link set lo up
|
||||
ip addr replace 127.0.0.1/8 dev lo
|
||||
}
|
||||
#
|
||||
################################################################################
|
||||
#
|
||||
# Convert netmask to prefix length (e.g. 255.255.255.0 -> 24)
|
||||
mask2prefix() {
|
||||
nbits=0
|
||||
old_ifs=$IFS
|
||||
IFS=.
|
||||
for dec in $1 ; do
|
||||
case $dec in
|
||||
255) nbits=$((nbits+8));;
|
||||
254) nbits=$((nbits+7));;
|
||||
252) nbits=$((nbits+6));;
|
||||
248) nbits=$((nbits+5));;
|
||||
240) nbits=$((nbits+4));;
|
||||
224) nbits=$((nbits+3));;
|
||||
192) nbits=$((nbits+2));;
|
||||
128) nbits=$((nbits+1));;
|
||||
0);;
|
||||
*) IFS=$old_ifs; return 1;;
|
||||
esac
|
||||
done
|
||||
IFS=$old_ifs
|
||||
echo "$nbits"
|
||||
}
|
||||
#
|
||||
################################################################################
|
||||
@@ -920,7 +947,23 @@ start_network() {
|
||||
if [ ! -z $IPADDR ]; then
|
||||
|
||||
# configure interface and add default gateway
|
||||
ifconfig $DEVICE $IPADDR netmask $NETMASK broadcast $BROADCAST
|
||||
#ifconfig $DEVICE $IPADDR netmask $NETMASK broadcast $BROADCAST
|
||||
if [ -z "$NETMASK" ]; then
|
||||
logmsg
|
||||
logmsg "Invalid netmask: $NETMASK"
|
||||
shellout
|
||||
fi
|
||||
numbits=$(mask2prefix $NETMASK)
|
||||
if [ $? != 0 -o -z "$numbits" ]; then
|
||||
logmsg
|
||||
logmsg "Invalid netmask: $NETMASK"
|
||||
shellout
|
||||
fi
|
||||
if [ -n "$BROADCAST" ]; then
|
||||
ip link set $DEVICE up && ip addr replace $IPADDR/$numbits brd $BROADCAST dev $DEVICE
|
||||
else
|
||||
ip link set $DEVICE up && ip addr replace $IPADDR/$numbits dev $DEVICE
|
||||
fi
|
||||
if [ $? != 0 ]; then
|
||||
logmsg
|
||||
logmsg "I couldn't configure the network interface using your pre-boot settings:"
|
||||
@@ -933,10 +976,12 @@ start_network() {
|
||||
fi
|
||||
|
||||
if [ ! -z $GATEWAY ]; then
|
||||
route add default gw $GATEWAY
|
||||
#route add default gw $GATEWAY
|
||||
ip route add default via $GATEWAY
|
||||
if [ $? != 0 ]; then
|
||||
logmsg
|
||||
logmsg "The command \"route add default gw $GATEWAY\" failed."
|
||||
#logmsg "The command \"route add default gw $GATEWAY\" failed."
|
||||
logmsg "The command \"ip route add default via $GATEWAY\" failed."
|
||||
logmsg "Check your pre-boot network settings."
|
||||
logmsg
|
||||
shellout
|
||||
|
||||
Reference in New Issue
Block a user