From 440f4d1fdd1a69fc2d7828fb5b138ed710ed4ff9a3d7faceba4f02399842292f Mon Sep 17 00:00:00 2001 From: Nicolas Belouin Date: Tue, 22 Oct 2024 15:17:04 +0200 Subject: [PATCH] Add openstack-ironic-image and fix nm-configurator Signed-off-by: Nicolas Belouin --- .gitattributes | 1 + nm-configurator/nmc.spec | 2 +- openstack-ironic-image/_constraints | 8 + openstack-ironic-image/config.sh | 105 +++++++++++ .../openstack-ironic-image.kiwi | 173 ++++++++++++++++++ .../openstack-ironic-image.spec | 167 +++++++++++++++++ openstack-ironic-image/root.tar.bz2 | 3 + 7 files changed, 458 insertions(+), 1 deletion(-) create mode 100644 openstack-ironic-image/_constraints create mode 100644 openstack-ironic-image/config.sh create mode 100644 openstack-ironic-image/openstack-ironic-image.kiwi create mode 100644 openstack-ironic-image/openstack-ironic-image.spec create mode 100644 openstack-ironic-image/root.tar.bz2 diff --git a/.gitattributes b/.gitattributes index 20e4220..1f14bc3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,3 +2,4 @@ *.tar.gz filter=lfs diff=lfs merge=lfs -text *.tar.xz filter=lfs diff=lfs merge=lfs -text *.obscpio filter=lfs diff=lfs merge=lfs -text +*.tar.bz2 filter=lfs diff=lfs merge=lfs -text diff --git a/nm-configurator/nmc.spec b/nm-configurator/nmc.spec index e6c5947..1bd9d8f 100644 --- a/nm-configurator/nmc.spec +++ b/nm-configurator/nmc.spec @@ -16,7 +16,7 @@ # -Name: nm-configurator-031 +Name: nm-configurator Version: 0.3.1 Release: 0 Summary: NM Configurator diff --git a/openstack-ironic-image/_constraints b/openstack-ironic-image/_constraints new file mode 100644 index 0000000..19d0995 --- /dev/null +++ b/openstack-ironic-image/_constraints @@ -0,0 +1,8 @@ + + + 4 + + 12 + + + diff --git a/openstack-ironic-image/config.sh b/openstack-ironic-image/config.sh new file mode 100644 index 0000000..8285ba4 --- /dev/null +++ b/openstack-ironic-image/config.sh @@ -0,0 +1,105 @@ +#!/bin/bash + +test -f /.kconfig && . /.kconfig +test -f /.profile && . /.profile + +#====================================== +# Greeting... +#-------------------------------------- +echo "Configure image: [$kiwi_iname]..." + +#========================================== +# setup build day +#------------------------------------------ +baseSetupBuildDay + +#====================================== +# Mount system filesystems +#-------------------------------------- +#baseMount + +#========================================== +# remove unneded kernel files +#------------------------------------------ +suseStripKernel +baseStripLocales en_US.utf-8 C.utf8 + +#====================================== +# Setup baseproduct link +#-------------------------------------- +suseSetupProduct + +#====================================== +# Add missing gpg keys to rpm +#-------------------------------------- +suseImportBuildKey + +#====================================== +# Activate services +#-------------------------------------- +baseInsertService openstack-ironic-python-agent +baseInsertService suse-ironic-image-setup +baseInsertService suse-network-setup +baseInsertService sshd +baseInsertService NetworkManager +#suseInsertService sshd +#suseInsertService openstack-ironic-python-agent +#suseInsertService suse-ironic-image-setup + +echo 'DEFAULT_TIMEZONE="UTC"' >> /etc/sysconfig/clock +baseUpdateSysConfig /etc/sysconfig/clock HWCLOCK "-u" +baseUpdateSysConfig /etc/sysconfig/clock TIMEZONE UTC +baseUpdateSysConfig /etc/sysconfig/network/dhcp DHCLIENT_SET_HOSTNAME no +baseUpdateSysConfig /etc/sysconfig/network/dhcp WRITE_HOSTNAME_TO_HOSTS no + +#========================================== +# generate autologin@ service +# based on getty@ service +#------------------------------------------ +#sed 's/^ExecStart=.*/\0 --autologin root/' /usr/lib/systemd/system/getty@.service > /etc/systemd/system/autologin\@.service +sed -E 's/^(ExecStart=.*\/agetty).*(--noclear.*)/\1 \2 --autologin root/' /usr/lib/systemd/system/getty@.service > /etc/systemd/system/autologin\@.service + +#========================================== +# add fstab entry for tmpfs based /tmp +#------------------------------------------ +echo 'tmpfs /tmp tmpfs size=3G 0 0' >> /etc/fstab + +#========================================== +# remove package docs and manuals +#------------------------------------------ +#baseStripDocs +#baseStripMans +#baseStripInfos + +#====================================== +# only basic version of vim is +# installed; no syntax highlighting +#-------------------------------------- +sed -i -e's/^syntax on/" syntax on/' /etc/vimrc + +#====================================== +# Remove yast if not in use +#-------------------------------------- +#suseRemoveYaST + +#====================================== +# Remove package manager +#-------------------------------------- +#suseStripPackager + +#rm -f usr/lib/perl5/*/*/auto/Encode/??/??.so # 9MB + +#====================================== +# Umount kernel filesystems +#-------------------------------------- +#baseCleanMount + +ln -s /sbin/init /init + +#========================================== +# umount +#------------------------------------------ +umount /proc >/dev/null 2>&1 + +exit 0 + diff --git a/openstack-ironic-image/openstack-ironic-image.kiwi b/openstack-ironic-image/openstack-ironic-image.kiwi new file mode 100644 index 0000000..2256a82 --- /dev/null +++ b/openstack-ironic-image/openstack-ironic-image.kiwi @@ -0,0 +1,173 @@ + + + + Cloud developers + cloud-devel@suse.de + kernel and ramdisk image for metal3 + + + + + + en_US + zypper + false + UTC + 1.0.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/openstack-ironic-image/openstack-ironic-image.spec b/openstack-ironic-image/openstack-ironic-image.spec new file mode 100644 index 0000000..26def39 --- /dev/null +++ b/openstack-ironic-image/openstack-ironic-image.spec @@ -0,0 +1,167 @@ +# +# spec file for package openstack-ironic-image +# +# Copyright (c) 2023 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# +# needsrootforbuild +# needsbinariesforbuild + + +Name: openstack-ironic-image +Version: 2.0.0 +Release: 0 +Summary: Kernel and ramdisk image for OpenStack Ironic +License: SUSE-EULA +Group: System/Management +URL: https://github.com/SUSE-Cloud/ +Source0: config.sh +Source10: openstack-ironic-image.kiwi +Source20: root.tar.bz2 + +BuildRequires: -post-build-checks +BuildRequires: bash +BuildRequires: kiwi +BuildRequires: kiwi-tools +BuildRequires: zypper +BuildArch: noarch + +BuildRequires: checkmedia +BuildRequires: acl +BuildRequires: ca-certificates +BuildRequires: cracklib-dict-full +BuildRequires: cron +BuildRequires: dbus-1 +BuildRequires: elfutils +BuildRequires: filesystem +BuildRequires: fipscheck +BuildRequires: fontconfig +BuildRequires: fonts-config +BuildRequires: gptfdisk +BuildRequires: grub2 +BuildRequires: grub2-x86_64-efi +BuildRequires: haveged +BuildRequires: hdparm +BuildRequires: hwinfo +BuildRequires: ipmitool +BuildRequires: iproute2 +BuildRequires: iputils +BuildRequires: kernel-default +BuildRequires: kernel-firmware +BuildRequires: lvm2 +BuildRequires: net-tools +BuildRequires: ntp +BuildRequires: open-iscsi +BuildRequires: openssh +BuildRequires: openstack-ironic-python-agent +BuildRequires: pam-config +BuildRequires: parted +BuildRequires: patterns-base-minimal_base +BuildRequires: pinentry +BuildRequires: pkgconfig +BuildRequires: Mesa-gallium +BuildRequires: plymouth +BuildRequires: plymouth-scripts +BuildRequires: python311-proliantutils +BuildRequires: psmisc +BuildRequires: qemu-tools +BuildRequires: sg3_utils +BuildRequires: sles-release +BuildRequires: sudo +BuildRequires: suse-build-key +BuildRequires: systemd-presets-branding-SLE +BuildRequires: timezone +BuildRequires: udev +BuildRequires: vim +BuildRequires: wpa_supplicant +BuildRequires: dhcp-client +BuildRequires: which +BuildRequires: NetworkManager +BuildRequires: nm-configurator +BuildRequires: logrotate +BuildRequires: plymouth-dracut +BuildRequires: plymouth-theme-bgrt +BuildRequires: dracut-kiwi-oem-dump +BuildRequires: dracut-kiwi-oem-repart +BuildRequires: gfxboot-branding-SLE +BuildRequires: grub2-branding-SLE +BuildRequires: open-iscsi +BuildRequires: plymouth-branding-SLE +BuildRequires: lshw +BuildRequires: kbd +%ifarch aarch64 +BuildRequires: dmidecode +BuildRequires: efibootmgr +%endif +%ifarch x86_64 +BuildRequires: dmidecode +BuildRequires: efibootmgr +BuildRequires: syslinux +%endif + +%description +Kernel and ramdisk image for use with Metal3 + +%package %{_arch} +Summary: Kernel and ramdisk image for Metal3 +Group: System/Management +Provides: openstack-ironic-python-agent = %{version} +Obsoletes: openstack-ironic-python-agent < %{version} + +%description %{_arch} +Kernel and ramdisk image for use with Metal3 +For %{_arch} + +%prep +mkdir -p /tmp/openstack-ironic-image/build /tmp/openstack-ironic-image/root /tmp/openstack-ironic-image/img + +cp -a %{SOURCE0} /tmp/openstack-ironic-image/config.sh + +cp -a %{SOURCE10} /tmp/openstack-ironic-image/config.kiwi + +tar -xC /tmp/openstack-ironic-image/root -f %{SOURCE20} + +%build +if ! which kiwi; then + cat <&2 +kiwi not found in \$PATH; most likely this build was missing +the --userootforbuild option. If you are invoking osc build +manually, please use 'make buildlocal' instead. +EOF + exit 1 +fi + +kiwi-ng --debug --profile default system build --description /tmp/openstack-ironic-image --target-dir /tmp/openstack-ironic-image/img + +%install +TDIR=`mktemp -d /tmp/openstack-ironic-image.XXXXX` +cd /tmp/openstack-ironic-image/img/build/image-root +find . | cpio --create --format=newc --quiet > $TDIR/initrdtmp +cd $TDIR +gzip -9 -f initrdtmp +INITRDGZ=`ls *.gz | head -1` +gzip -cd $INITRDGZ | xz --check=crc32 -c9 > initrd.xz +INITRD=`ls *.xz | head -1` + +ls /tmp/openstack-ironic-image/img/openstack-ironic-image* +KERNEL=`ls /tmp/openstack-ironic-image/img/openstack-ironic-image*default*kernel | head -1` + +mkdir -p %{buildroot}/srv/tftpboot/openstack-ironic-image +install -p -m 644 $KERNEL $INITRD %{buildroot}/srv/tftpboot/openstack-ironic-image/ + +%files %{_arch} +%defattr(644,root,root) +%dir %attr(755, root, root) /srv/tftpboot/openstack-ironic-image +%attr(644, root, root) /srv/tftpboot/openstack-ironic-image/* + +%changelog diff --git a/openstack-ironic-image/root.tar.bz2 b/openstack-ironic-image/root.tar.bz2 new file mode 100644 index 0000000..9a48808 --- /dev/null +++ b/openstack-ironic-image/root.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4c628a708dd2bf2d858852f67027e8c339872d09d46a4661c4b0551c8594c46f +size 3233