SHA256
1
0
forked from pool/warewulf4

Accepting request 1063772 from network:cluster

OBS-URL: https://build.opensuse.org/request/show/1063772
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/warewulf4?expand=0&rev=9
This commit is contained in:
Dominique Leuenberger 2023-02-08 16:20:02 +00:00 committed by Git OBS Bridge
commit d3e7a3288b
4 changed files with 1105 additions and 6 deletions

1004
CreateMt-Targets.patch Normal file

File diff suppressed because it is too large Load Diff

71
config-ww4.sh Normal file
View File

@ -0,0 +1,71 @@
#!/bin/sh
# Configure warewulf with the primary network of the host
WW4CONF=/etc/warewulf/warewulf.conf
# Get the mask from prefix
cdr2mask()
{
# Number of args to shift, 255..255, first non-255 byte, zeroes
set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0
[ $1 -gt 1 ] && shift $1 || shift
echo ${1-0}.${2-0}.${3-0}.${4-0}
}
# Get the ip4 address of the netork
network_address() {
declare address prefix_length
IFS=/ read address prefix_length <<< "$1"
declare -a octets
IFS=. read -a octets <<< "$address"
declare mask
mask=$( printf "%08x" $(( (1 << 32) - (1 << (32 - prefix_length)) )) )
declare -i i
for i in {0..3}; do octets[$i]=$(( octets[i] & 16#${mask:2*i:2} )); done
echo $( IFS=.; echo "${octets[*]}" )
}
echo "-- WW4 CONFIGURAION $* --"
# Make sure that a ip address was defined for out network so that
# we can configure dhcpd correctly
IP4CIDR=`ip addr | awk '/scope global/ {print $2;exit}'`
IP4=${IP4CIDR%/*}
IP4PREFIX=${IP4CIDR#*/}
IP4MASK=$(cdr2mask $IP4PREFIX)
IP4NET=$(network_address "$IP4/$IP4PREFIX")
if [ "$IP4PREFIX" -gt 25 ] ; then
echo "ERROR: warewulf does at least a /25 network for dynamic addresses"
exit 1
fi
DYNSIZE=20
DYNSTART=${IP4#*.*.*.}
DYNPRE=${IP4%.*}
DYNEND=$(( $DYNSTART + $DYNSIZE ))
if [ $DYNEND -gt 254 ] ; then
DYNEND=$(( $IPNET + 2 + $DYNSIZE ))
DYNSTART=$(( $IPNET + 2 ))
fi
DYNSTART="${DYNPRE}.${DYNSTART}"
DYNEND="${DYNPRE}.${DYNEND}"
if [ -e $WW4CONF ] ; then
test -n $IP4 && sed -i 's/^ipaddr:.*/ipaddr: '$IP4'/' $WW4CONF
test -n $IP4MASK && sed -i 's/^netmask:.*/netmask: '$IP4MASK'/' $WW4CONF
test -n $IP4NET && sed -i 's/^network:.*/network: '$IP4NET'/' $WW4CONF
test -n $DYNSTART && sed -i 's/^ range start:.*/ range start: '$DYNSTART'/' $WW4CONF
test -n $DYNEND && sed -i 's/^ range end:.*/ range end: '$DYNEND'/' $WW4CONF
cat << EOF
ipaddr: $IP4
netmask: $IP4MASK
network: $IP4NET
range start: $DYNSTART
range end: $DYNEND
EOF
fi

View File

@ -1,7 +1,23 @@
-------------------------------------------------------------------
Tue Feb 7 15:34:13 UTC 2023 - Christian Goll <cgoll@suse.com>
- added CreateMt-Targets.patch
which moonts in resolv.conf and files for SCC registration
- added config-ww4.sh which is used for initial configuration for
simple network setups
-------------------------------------------------------------------
Tue Jan 31 18:24:50 UTC 2023 - Egbert Eich <eich@suse.com>
- Add %sysusers_requires macro to account for missing dependencies
(boo#1207802).
-------------------------------------------------------------------
Tue Jan 24 11:17:32 UTC 2023 - Christian Goll <cgoll@suse.com>
- added make-ipxe-binary-source-configureable.patch
- use distro ipxe binaries instead of binaries blobs from the
warewulf github repo
-------------------------------------------------------------------
Thu Jan 19 11:13:58 UTC 2023 - Christian Goll <cgoll@suse.com>

View File

@ -30,12 +30,15 @@ URL: https://warewulf.org
Source0: https://github.com/hpcng/warewulf/archive/v%{version}%{?rls_cndt}.tar.gz#/warewulf4-v%{version}.tar.gz
Source1: vendor.tar.gz
Source3: warewulf4-rpmlintrc
Source10: config-ww4.sh
Patch1: make-ipxe-binary-source-configureable.patch
Patch2: CreateMt-Targets.patch
# no firewalld in sle12
%if 0%{?sle_version} >= 150000 || 0%{?suse_version} > 1500
BuildRequires: firewalld
%endif
BuildRequires: distribution-release
BuildRequires: dracut
BuildRequires: go >= 1.15
BuildRequires: golang-packaging
@ -46,14 +49,14 @@ BuildRequires: sysuser-tools
BuildRequires: tftp
BuildRequires: yq
BuildRoot: %{_tmppath}/%{name}-%{version}-build
#Requires: %{name}-ipxe = %{version}
%sysusers_requires
Requires: %{name}-overlay = %{version}
Recommends: dhcp-server
Requires: dhcp-server
Requires: ipxe-bootimgs
Requires: pigz
Requires: tftp
Recommends: ipmitool
Recommends: ipxe-bootimgs
Recommends: ipxe-bootimgs
Recommends: nfs-kernel-server
Recommends: tftp
%{go_nostrip}
@ -146,7 +149,9 @@ yq e '
.tftp.ipxe."00:00" = "undionly.kpxe" |
.tftp.ipxe."00:07" = "ipxe-x86_64.efi" |
.tftp.ipxe."00:09" = "ipxe-x86_64.efi" |
.tftp.ipxe."00:0B" = "snp-arm64.efi"'\
.tftp.ipxe."00:0B" = "snp-arm64.efi" |
.["container mounts"] += {"source": "/etc/SUSEConnect", "dest": "/etc/SUSEConnect", "readonly": true} |
.["container mounts"] += {"source": "/etc/zypp/credentials.d/SCCcredentials", "dest": "/etc/zypp/credentials.d/SCCcredentials", "readonly": true}' \
-i %{buildroot}%{_sysconfdir}/warewulf/warewulf.conf
sed -i 's@\(^\s*\)\(.*:.*\):@\1"\2":@' %{buildroot}%{_sysconfdir}/warewulf/warewulf.conf
@ -155,6 +160,7 @@ echo "u warewulf -" > system-user-%{name}.conf
echo "g warewulf -" >> system-user-%{name}.conf
%sysusers_generate_pre system-user-%{name}.conf %{name} system-user-%{name}.conf
install -D -m 644 system-user-%{name}.conf %{buildroot}%{_sysusersdir}/system-user-%{name}.conf
install -D -m 755 %{S:10} %{buildroot}%{_datadir}/warewulf/scripts/config-warewulf.sh
# get the slurm package readay
mkdir -p %{buildroot}%{_datadir}/warewulf/overlays/host/etc/slurm
@ -174,6 +180,7 @@ EOF
%post
%service_add_post warewulfd.service
%{_datadir}/warewulf/scripts/config-warewulf.sh
%preun
%service_del_preun warewulfd.service
@ -201,6 +208,7 @@ EOF
%{_sbindir}/rcwarewulfd
%{_unitdir}/warewulfd.service
%{_sysusersdir}/system-user-%{name}.conf
%{_datadir}/warewulf/scripts
%files overlay
# The configuration files in this location are for the compute