From 995910cd783f5e2c8e88d0e791ac769e64dc76fb Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Tue, 6 Jun 2023 13:14:55 +0200 Subject: [PATCH] overlay coreos-base/oem-azure: Make it a sysext package This package will be used for the sysext image, instead of for installing files into /usr/share/oem. This means that we can drop some files or move them elsewhere. The systemd service file is not needed, because it is installed by the app-emulation/wa-linux-agent package now. This also means that the ignition file as lost its purpose. The grub.cfg and oem-release must be installed in /usr/share/oem, next to the sysext raw image file, so handling of these files is moved to the newly added coreos-base/common-oem-files package. `eject` symlink to `/usr/bin/true` is installed in the newly added manglefs.sh script. With this done, we also opt into building an OEM sysext image for Azure platform. --- build_library/vm_image_util.sh | 4 +- .../common-oem-files-0.ebuild | 1 + .../files/azure/grub.cfg.frag} | 4 -- .../coreos-base/oem-azure/files/base/README | 4 -- .../coreos-base/oem-azure/files/base/base.ign | 37 ------------------- .../coreos-base/oem-azure/files/manglefs.sh | 16 ++++++++ .../coreos-base/oem-azure/files/oem-release | 5 --- .../oem-azure/files/units/waagent.service | 15 -------- .../oem-azure/oem-azure-2.6.0.2-r2.ebuild | 36 ------------------ .../oem-azure/oem-azure-2.6.0.2-r3.ebuild | 21 +++++++++++ 10 files changed, 41 insertions(+), 102 deletions(-) rename sdk_container/src/third_party/coreos-overlay/coreos-base/{oem-azure/files/grub.cfg => common-oem-files/files/azure/grub.cfg.frag} (89%) delete mode 100644 sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/files/base/README delete mode 100644 sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/files/base/base.ign create mode 100755 sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/files/manglefs.sh delete mode 100644 sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/files/oem-release delete mode 100644 sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/files/units/waagent.service delete mode 100644 sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/oem-azure-2.6.0.2-r2.ebuild create mode 100644 sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/oem-azure-2.6.0.2-r3.ebuild diff --git a/build_library/vm_image_util.sh b/build_library/vm_image_util.sh index 4cd7f455a7..c7ab823929 100644 --- a/build_library/vm_image_util.sh +++ b/build_library/vm_image_util.sh @@ -279,7 +279,9 @@ IMG_exoscale_OEM_PACKAGE=oem-exoscale ## azure IMG_azure_DISK_FORMAT=vhd_fixed IMG_azure_DISK_LAYOUT=azure -IMG_azure_OEM_PACKAGE=oem-azure +IMG_azure_OEM_USE=azure +IMG_azure_OEM_PACKAGE=common-oem-files +IMG_azure_OEM_SYSEXT=oem-azure ## hyper-v IMG_hyperv_DISK_FORMAT=vhd diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/common-oem-files/common-oem-files-0.ebuild b/sdk_container/src/third_party/coreos-overlay/coreos-base/common-oem-files/common-oem-files-0.ebuild index 2b4d25670b..be541bc00c 100644 --- a/sdk_container/src/third_party/coreos-overlay/coreos-base/common-oem-files/common-oem-files-0.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/coreos-base/common-oem-files/common-oem-files-0.ebuild @@ -4,6 +4,7 @@ EAPI=8 OEMIDS=( + azure ) DESCRIPTION='Common OEM files' diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/files/grub.cfg b/sdk_container/src/third_party/coreos-overlay/coreos-base/common-oem-files/files/azure/grub.cfg.frag similarity index 89% rename from sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/files/grub.cfg rename to sdk_container/src/third_party/coreos-overlay/coreos-base/common-oem-files/files/azure/grub.cfg.frag index 15e7e50555..48d22ee886 100644 --- a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/files/grub.cfg +++ b/sdk_container/src/third_party/coreos-overlay/coreos-base/common-oem-files/files/azure/grub.cfg.frag @@ -1,7 +1,3 @@ -# Flatcar GRUB settings - -set oem_id="azure" - set linux_append="flatcar.autologin" # Azure only has a serial console. diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/files/base/README b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/files/base/README deleted file mode 100644 index d128309fef..0000000000 --- a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/files/base/README +++ /dev/null @@ -1,4 +0,0 @@ -These Ignition configs are part of the OEM configuration. Do not modify -them. If you want to write an Ignition config directly to disk, put it in -../config.ign and it will be applied at first boot instead of a config -in userdata. diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/files/base/base.ign b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/files/base/base.ign deleted file mode 100644 index 5c359a9410..0000000000 --- a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/files/base/base.ign +++ /dev/null @@ -1,37 +0,0 @@ -{ - "ignition": { - "version": "2.1.0" - }, - "storage": { - "files": [ - { - "filesystem": "root", - "path": "/etc/systemd/system/waagent.service", - "contents": { - "source": "oem:///units/waagent.service" - }, - "mode": 292 - }, - { - "filesystem": "root", - "path": "/etc/systemd/system/nvidia.service", - "contents": { - "source": "oem:///units/nvidia.service" - }, - "mode": 292 - } - ] - }, - "systemd": { - "units": [ - { - "name": "waagent.service", - "enabled": true - }, - { - "name": "nvidia.service", - "enabled": true - } - ] - } -} diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/files/manglefs.sh b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/files/manglefs.sh new file mode 100755 index 0000000000..28637a0eeb --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/files/manglefs.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -euo pipefail + +rootfs="${1}" + +to_delete=( + /usr/include + /usr/lib/debug + /usr/share/gdb + /usr/lib64/pkgconfig +) + +rm -rf "${to_delete[@]/#/${rootfs}}" + +ln -sf /usr/bin/true "${rootfs}/usr/bin/eject" diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/files/oem-release b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/files/oem-release deleted file mode 100644 index fa11b4c3e0..0000000000 --- a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/files/oem-release +++ /dev/null @@ -1,5 +0,0 @@ -ID=azure -VERSION_ID=@@OEM_VERSION_ID@@ -NAME="Microsoft Azure" -HOME_URL="https://azure.microsoft.com/" -BUG_REPORT_URL="https://issues.flatcar.org" diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/files/units/waagent.service b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/files/units/waagent.service deleted file mode 100644 index d8c6e71ad2..0000000000 --- a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/files/units/waagent.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=Microsoft Azure Agent -Wants=network-online.target sshd-keygen.service -After=network-online.target sshd-keygen.service - -[Service] -Type=simple -Restart=always -RestartSec=5s -Environment=PATH=/oem/python/bin:/oem/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin -Environment=PYTHONUNBUFFERED=x -ExecStart=/oem/bin/waagent -daemon - -[Install] -WantedBy=multi-user.target diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/oem-azure-2.6.0.2-r2.ebuild b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/oem-azure-2.6.0.2-r2.ebuild deleted file mode 100644 index 91a72143d4..0000000000 --- a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/oem-azure-2.6.0.2-r2.ebuild +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright (c) 2013 CoreOS, Inc.. All rights reserved. -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -DESCRIPTION="OEM suite for Azure" -HOMEPAGE="" -SRC_URI="" - -LICENSE="Apache-2.0" -SLOT="0" -KEYWORDS="amd64 arm64" -IUSE="" - -# no source directory -S="${WORKDIR}" - -RDEPEND=" - ~app-emulation/wa-linux-agent-${PV} - x11-drivers/nvidia-drivers -" - -src_prepare() { - default - sed -e "s\\@@OEM_VERSION_ID@@\\${PVR}\\g" \ - "${FILESDIR}/oem-release" > "${T}/oem-release" || die -} - -src_install() { - insinto "/oem" - doins "${FILESDIR}/grub.cfg" - doins "${T}/oem-release" - doins -r "${FILESDIR}/base" - doins -r "${FILESDIR}/units" - dosym "/usr/bin/true" "/oem/bin/eject" -} diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/oem-azure-2.6.0.2-r3.ebuild b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/oem-azure-2.6.0.2-r3.ebuild new file mode 100644 index 0000000000..24fa7fbe41 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/oem-azure-2.6.0.2-r3.ebuild @@ -0,0 +1,21 @@ +# Copyright (c) 2013 CoreOS, Inc.. All rights reserved. +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DESCRIPTION="OEM suite for Azure" +HOMEPAGE="https://azure.microsoft.com/" +SRC_URI="" + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="amd64 arm64" +IUSE="" + +RDEPEND=" + ~app-emulation/wa-linux-agent-${PV} + x11-drivers/nvidia-drivers +" + +# for coreos-base/common-oem-files +OEM_NAME="Microsoft Azure"