overlay coreos-base/oem-vmware: Update to be sysext-ready

Ignition files are not necessary any more. Grub config file and
oem-releas file are now provided by the coreos-base/oem-common-files
package.

We install drop-in files for systemd units instead of providing our
own copies. This is where we set up PrivateTmp option and create
symlinks for /etc.

There's also manglefs.sh script, that will be executed by the
build_sysext utility. It drops unnecessary stuff like translations,
debugging symbols and development files.
This commit is contained in:
Krzesimir Nowak 2023-09-13 16:08:57 +02:00
parent cc40a00aa1
commit 90b74e29b3
10 changed files with 80 additions and 86 deletions

View File

@ -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 guestinfo.

View File

@ -1,25 +0,0 @@
{
"ignition": {
"version": "2.1.0"
},
"storage": {
"files": [
{
"filesystem": "root",
"path": "/etc/systemd/system/vmtoolsd.service",
"contents": {
"source": "oem:///units/vmtoolsd.service"
},
"mode": 292
}
]
},
"systemd": {
"units": [
{
"name": "vmtoolsd.service",
"enabled": true
}
]
}
}

View File

@ -0,0 +1,3 @@
[Service]
PrivateTmp=true
ExecStartPre=/usr/bin/ln -sfrT /usr/share/flatcar/oem-vmware/vmware-tools /etc/vmware-tools

View File

@ -1,4 +0,0 @@
# Flatcar GRUB settings
set oem_id="vmware"
set linux_append="flatcar.autologin"

View File

@ -0,0 +1,37 @@
#!/bin/bash
set -euo pipefail
rootfs=${1}
cd "${rootfs}"
# Move stuff out of /etc. The systemd unit files are patched to create
# symlinks from /etc to those directories.
mkdir -p usr/lib/pam.d
mv etc/pam.d/vmtoolsd usr/lib/pam.d/vmtoolsd
mkdir -p usr/share/flatcar/oem-vmware
mv etc/vmware-tools usr/share/flatcar/oem-vmware/vmware-tools
files_to_drop=(
# Development stuff.
usr/bin/dnet-config
usr/bin/*xslt-config
usr/bin/xmlsec1-config
usr/lib64/*Conf.sh
)
dirs_to_drop=(
# Debugging symbols.
usr/lib/debug/
# Translations.
usr/share/open-vm-tools/messages/
# Development stuff.
usr/include/
usr/lib64/cmake/
usr/lib64/pkgconfig/
usr/share/aclocal/
)
rm -f "${files_to_drop[@]}"
rm -rf "${dirs_to_drop[@]}"

View File

@ -1,5 +0,0 @@
ID=vmware
VERSION_ID=@@OEM_VERSION_ID@@
NAME="VMware"
HOME_URL="https://www.vmware.com/"
BUG_REPORT_URL="https://issues.flatcar.org"

View File

@ -0,0 +1,2 @@
[Unit]
Upholds=vmtoolsd.service vgauthd.service

View File

@ -1,13 +0,0 @@
[Unit]
Description=VMware Tools Agent
Documentation=https://github.com/vmware/open-vm-tools
ConditionVirtualization=vmware
[Service]
ExecStartPre=/usr/bin/ln -sfT /oem/vmware-tools /etc/vmware-tools
ExecStart=/oem/bin/vmtoolsd
TimeoutStopSec=5
PrivateTmp=true
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,38 @@
# Copyright (c) 2014 CoreOS, Inc.. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit systemd
DESCRIPTION="OEM suite for VMware"
HOMEPAGE="https://www.vmware.com/"
SRC_URI=""
LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="amd64 arm64"
IUSE=""
RDEPEND="
~app-emulation/open-vm-tools-${PV}
"
# no source directory
S="${WORKDIR}"
# for coreos-base/common-oem-files
OEM_NAME="VMware"
src_install() {
local unit_dir
unit_dir=$(systemd_get_systemunitdir)
unit_dir=${unit_dir#"${EPREFIX}"}
local tool
for tool in vmtoolsd vgauthd; do
insinto "${unit_dir}/${tool}.service.d"
doins "${FILESDIR}/flatcar-fixups.conf"
done
insinto "${unit_dir}/multi-user.target.d"
doins "${FILESDIR}/open-vm-tools-sysext-upholds.conf"
}

View File

@ -1,35 +0,0 @@
# Copyright (c) 2014 CoreOS, Inc.. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
EAPI=7
DESCRIPTION="OEM suite for VMware"
HOMEPAGE="https://github.com/flatcar/coreos-overlay/tree/main/coreos-base"
SRC_URI=""
LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="amd64"
IUSE=""
DEPEND="
~app-emulation/open-vm-tools-${PV}
"
RDEPEND="${DEPEND}"
# no source directory
S="${WORKDIR}"
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"
}