Noel Georgi fb4eb042d7
feat: consolidate extension services
Consolidate extension services to be self contained, don't pollute rootfs or mount up libraries from host unless absolutely needed.

Fixes: #876
Fixes: https://github.com/siderolabs/talos/issues/12667

Signed-off-by: Noel Georgi <git@frezbo.dev>
2026-02-18 21:47:18 +05:30

74 lines
2.5 KiB
YAML

# © 2024 Nokia
# Licensed under the Mozilla Public License 2.0
# SPDX-License-Identifier: MPL-2.0
name: lldpd
variant: scratch
shell: /bin/bash
dependencies:
- stage: base
- image: "{{ .BUILD_ARG_PKGS_PREFIX }}/fhs:{{ .BUILD_ARG_PKGS }}"
from: /
to: /rootfs/usr/local/lib/containers/lldpd
- image: "{{ .BUILD_ARG_PKGS_PREFIX }}/musl:{{ .BUILD_ARG_PKGS }}"
from: /usr/lib
to: /rootfs/usr/local/lib/containers/lldpd/usr/lib
- image: "{{ .BUILD_ARG_PKGS_PREFIX }}/libcap:{{ .BUILD_ARG_PKGS }}"
from: /usr/lib
to: /rootfs/usr/local/lib/containers/lldpd/usr/lib
steps:
- sources:
- url: https://github.com/lldpd/lldpd/releases/download/{{ .LLDPD_VERSION }}/lldpd-{{ .LLDPD_VERSION }}.tar.gz
destination: lldpd.tar.gz
sha256: {{ .LLDPD_SHA256 }}
sha512: {{ .LLDPD_SHA512 }}
env:
SOURCE_DATE_EPOCH: {{ .BUILD_ARG_SOURCE_DATE_EPOCH }}
prepare:
- |
tar -xf lldpd.tar.gz --strip-components=1
mkdir -p /usr/local/include/sys
cp /pkg/patches/sys-queue.h /usr/local/include/sys/queue.h
- |
export CFLAGS="${CFLAGS} -I/usr/local/include"
./configure \
--prefix=/usr/local \
--libexecdir=/usr/local/lib/lldpd \
--datadir=/usr/local/share/lldpd \
--sysconfdir=/usr/local/etc/lldpd \
--enable-hardening \
--with-privsep-user=root \
--with-privsep-group=root \
--with-privsep-chroot=/opt/lldpd
build:
- |
make -j $(nproc) all
install:
- |
mkdir -p /rootfs/usr/local/{etc/containers,lib/containers/lldpd/{etc,opt/lldpd}}
cp /pkg/lldpd.yaml /rootfs/usr/local/etc/containers/lldpd.yaml
cp /pkg/files/* /rootfs/usr/local/lib/containers/lldpd/etc
make DESTDIR=/rootfs/usr/local/lib/containers/lldpd install-exec
test:
- |
mkdir -p /extensions-validator-rootfs
cp -r /rootfs/ /extensions-validator-rootfs/rootfs
cp /pkg/manifest.yaml /extensions-validator-rootfs/manifest.yaml
/extensions-validator validate --rootfs=/extensions-validator-rootfs --pkg-name="${PKG_NAME}"
sbom:
outputPath: /rootfs/usr/local/share/spdx/lldpd.spdx.json
version: {{ .LLDPD_VERSION }}
cpes:
- cpe:2.3:a:lldpd_project:lldpd:{{ .LLDPD_VERSION }}:*:*:*:*:*:*:*
licenses:
- ISC
finalize:
- from: /rootfs
to: /rootfs
- from: /pkg/manifest.yaml
to: /