coreos-base/oem-gce: migrate gce to sysext format

Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
This commit is contained in:
Mathieu Tortuyaux 2023-11-29 12:11:49 +01:00
parent 90fb8ad002
commit 5cfbf6e1eb
No known key found for this signature in database
GPG Key ID: AC5CCFB52545D9B8
12 changed files with 67 additions and 105 deletions

View File

@ -256,8 +256,10 @@ IMG_iso_MEM=2048
## gce, image tarball ## gce, image tarball
IMG_gce_DISK_LAYOUT=vm IMG_gce_DISK_LAYOUT=vm
IMG_gce_CONF_FORMAT=gce IMG_gce_CONF_FORMAT=gce
IMG_gce_OEM_PACKAGE=oem-gce IMG_gce_OEM_PACKAGE=common-oem-files
IMG_gce_OEM_ACI=gce IMG_gce_OEM_ACI=gce
IMG_gce_OEM_USE=gce
IMG_gce_OEM_SYSEXT=oem-gce
## rackspace ## rackspace
IMG_rackspace_OEM_PACKAGE=oem-rackspace IMG_rackspace_OEM_PACKAGE=oem-rackspace

View File

@ -31,6 +31,7 @@ fi
COMMON_OEMIDS=( COMMON_OEMIDS=(
ami ami
azure azure
gce
openstack openstack
packet packet
qemu qemu

View File

@ -1,7 +1,3 @@
# Flatcar GRUB settings
set oem_id="gce"
# GCE only has a serial console. # GCE only has a serial console.
set linux_console="console=ttyS0,115200n8" set linux_console="console=ttyS0,115200n8"
serial com0 --speed=115200 --word=8 --parity=no serial com0 --speed=115200 --word=8 --parity=no

View File

@ -0,0 +1,13 @@
/etc/systemd/system/multi-user.target.wants/oem-cloudinit.service
/etc/systemd/system/multi-user.target.wants/oem-gce.service
/etc/systemd/system/oem-cloudinit.service
/etc/systemd/system/oem-gce-enable-oslogin.service
/etc/systemd/system/oem-gce.service
/etc/systemd/system/sysinit.target.wants/oem-gce-enable-oslogin.service
/oem/base/
/oem/bin/
/oem/files/
/oem/flatcar-oem-gce.aci
/oem/units/
/var/lib/flatcar-oem-gce
/var/lib/flatcar-oem-gce.img

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 userdata.

View File

@ -1,57 +0,0 @@
{
"ignition": {
"version": "2.2.0"
},
"storage": {
"files": [
{
"filesystem": "root",
"path": "/etc/systemd/system/oem-gce.service",
"contents": {
"source": "oem:///units/oem-gce.service"
},
"mode": 292
},
{
"filesystem": "root",
"path": "/etc/systemd/system/oem-gce-enable-oslogin.service",
"contents": {
"source": "oem:///units/oem-gce-enable-oslogin.service"
},
"mode": 292
},
{
"filesystem": "root",
"path": "/etc/hosts",
"contents": {
"source": "oem:///files/hosts"
},
"mode": 292
},
{
"filesystem": "root",
"path": "/etc/profile.d/google-cloud-sdk.sh",
"contents": {
"source": "oem:///files/google-cloud-sdk.sh"
},
"mode": 292
}
]
},
"systemd": {
"units": [
{
"name": "coreos-metadata-sshkeys@.service",
"enabled": true
},
{
"name": "oem-gce.service",
"enabled": true
},
{
"name": "oem-gce-enable-oslogin.service",
"enabled": true
}
]
}
}

View File

@ -1,5 +0,0 @@
ID=gce
VERSION_ID=@@OEM_VERSION_ID@@
NAME="Google Compute Engine"
HOME_URL="https://cloud.google.com/products/compute-engine/"
BUG_REPORT_URL="https://issues.flatcar.org"

View File

@ -0,0 +1,2 @@
[Unit]
Upholds=oem-gce-enable-oslogin.service setup-oem.service

View File

@ -10,7 +10,7 @@ Before=sshd.socket
Type=oneshot Type=oneshot
RemainAfterExit=true RemainAfterExit=true
ExecStart=/oem/bin/enable-oslogin ExecStart=/usr/bin/enable-oslogin
[Install] [Install]
WantedBy=sysinit.target WantedBy=sysinit.target

View File

@ -0,0 +1,12 @@
[Unit]
Description=Setup OEM
Before=oem-gce-enable-oslogin.service
DefaultDependencies=false
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=-/usr/bin/ln --symbolic --force /usr/share/gce/hosts /etc/hosts
ExecStart=-/usr/bin/ln --symbolic /usr/share/gce/google-cloud-sdk.sh /etc/profile.d/google-cloud-sdk.sh
[Install]
WantedBy=sysinit.target

View File

@ -1,33 +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 Google Compute Engine images"
HOMEPAGE=""
SRC_URI=""
LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="amd64"
IUSE=""
# 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}/files"
doins -r "${FILESDIR}/units"
exeinto "/oem/bin"
doexe "${FILESDIR}/bin/enable-oslogin"
}

View File

@ -0,0 +1,35 @@
# Copyright (c) 2013 CoreOS, Inc.. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
# Copyright (c) 2020 Kinvolk GmbH. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit systemd
DESCRIPTION="OEM suite for Google Compute Engine images"
HOMEPAGE="https://cloud.google.com/products/compute-engine/"
SRC_URI=""
LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="amd64"
IUSE=""
# no source directory
S="${WORKDIR}"
OEM_NAME="Google Compute Engine"
src_install() {
systemd_dounit "${FILESDIR}/units/oem-gce-enable-oslogin.service"
systemd_dounit "${FILESDIR}/units/setup-oem.service"
systemd_install_dropin "multi-user.target" "${FILESDIR}/units/10-oem-gce.conf"
dobin "${FILESDIR}/bin/enable-oslogin"
# These files will be symlinked to /etc via 'setup-oem.service'
insinto /usr/share/gce/
doins "${FILESDIR}/files/hosts"
doins "${FILESDIR}/files/google-cloud-sdk.sh"
}