From bab6ff04a86869a7137d5e39195e6470d46425cb Mon Sep 17 00:00:00 2001 From: Philip Meulengracht Date: Thu, 5 Sep 2024 09:57:47 +0200 Subject: [PATCH 1/4] slices: add finalrd and add bins slice to libc-bin --- slices/finalrd.yaml | 33 ++++++++++++++++++++++ slices/libc-bin.yaml | 27 ++++++++++++++++++ tests/spread/integration/finalrd/task.yaml | 13 +++++++++ 3 files changed, 73 insertions(+) create mode 100644 slices/finalrd.yaml create mode 100644 tests/spread/integration/finalrd/task.yaml diff --git a/slices/finalrd.yaml b/slices/finalrd.yaml new file mode 100644 index 000000000..c934ca218 --- /dev/null +++ b/slices/finalrd.yaml @@ -0,0 +1,33 @@ +package: finalrd + +essential: + - finalrd_copyright + +slices: + # finalrd is a shell script that relies on a couple of packages to even + # work correctly: libc-bin, systemd, mount, grep and coreutils. If initramfs-tools + # is supplied (which is optional), it also needs findutils and debianutils. + # so rely on atleast the first set of binaries. + bins: + essential: + - coreutils_bins + - finalrd_config + - grep_bins + - libc-bin_bins + - mount_bins + - systemd_bins + contents: + /usr/bin/finalrd: + + config: + contents: + /usr/lib/finalrd/finalrd-static.conf: + /usr/share/finalrd/: + + services: + contents: + /lib/systemd/system/finalrd.service: + + copyright: + contents: + /usr/share/doc/finalrd/copyright: diff --git a/slices/libc-bin.yaml b/slices/libc-bin.yaml index ea49d9995..a9e2ff9d6 100644 --- a/slices/libc-bin.yaml +++ b/slices/libc-bin.yaml @@ -4,6 +4,33 @@ essential: - libc-bin_copyright slices: + bins: + essential: + - libc6_libs + - libc-bin_config + contents: + /usr/bin/getconf: + /usr/bin/getent: + /usr/bin/iconv: + /usr/bin/ld.so: + /usr/bin/ldd: + /usr/bin/locale: + /usr/bin/localedef: + /usr/bin/pldd: + /usr/bin/tzselect: + /usr/bin/zdump: + /usr/sbin/iconvconfig: + /usr/sbin/ldconfig: + /usr/sbin/ldconfig.real: + /usr/sbin/zic: + + config: + contents: + /etc/bindresvport.blacklist: + /etc/gai.conf: + /etc/ld.so.conf: + /etc/ld.so.conf.d/libc.conf: + nsswitch: contents: /etc/nsswitch.conf: {copy: /usr/share/libc-bin/nsswitch.conf} diff --git a/tests/spread/integration/finalrd/task.yaml b/tests/spread/integration/finalrd/task.yaml new file mode 100644 index 000000000..f50ed5c99 --- /dev/null +++ b/tests/spread/integration/finalrd/task.yaml @@ -0,0 +1,13 @@ +summary: Integration tests for finalrd + +execute: | + # Chisel a minimum number of slices to give us a runnable system that we can + # test in. + rootfs="$(install-slices bash_bins base-files_base finalrd_bins)" + + # the script need /bin/sh + chroot "${rootfs}" ln -s /usr/bin/bash /bin/sh + + # try to execute the script, it will fail as it will hit + # an apparmor denial in remounting /run as rw,exec + chroot "${rootfs}" finalrd 2>&1 | grep "cannot remount" From c48ecc7832e2c18d39fe2c1bcb8d2484cc55f21f Mon Sep 17 00:00:00 2001 From: Philip Meulengracht Date: Thu, 5 Sep 2024 10:01:10 +0200 Subject: [PATCH 2/4] slices/finalrd: correct linting issues --- slices/finalrd.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/slices/finalrd.yaml b/slices/finalrd.yaml index c934ca218..080b7d569 100644 --- a/slices/finalrd.yaml +++ b/slices/finalrd.yaml @@ -5,9 +5,9 @@ essential: slices: # finalrd is a shell script that relies on a couple of packages to even - # work correctly: libc-bin, systemd, mount, grep and coreutils. If initramfs-tools - # is supplied (which is optional), it also needs findutils and debianutils. - # so rely on atleast the first set of binaries. + # work correctly: libc-bin, systemd, mount, grep and coreutils. + # If initramfs-tools is supplied (which is optional), it also needs + # findutils and debianutils. so rely on atleast the first set of binaries. bins: essential: - coreutils_bins @@ -18,7 +18,7 @@ slices: - systemd_bins contents: /usr/bin/finalrd: - + config: contents: /usr/lib/finalrd/finalrd-static.conf: From 2c9604fd7e273e3d4668d97856296612066be6fb Mon Sep 17 00:00:00 2001 From: Philip Meulengracht Date: Thu, 5 Sep 2024 10:09:25 +0200 Subject: [PATCH 3/4] slices/finalrd: additional linting issues --- slices/finalrd.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slices/finalrd.yaml b/slices/finalrd.yaml index 080b7d569..af4114f42 100644 --- a/slices/finalrd.yaml +++ b/slices/finalrd.yaml @@ -5,8 +5,8 @@ essential: slices: # finalrd is a shell script that relies on a couple of packages to even - # work correctly: libc-bin, systemd, mount, grep and coreutils. - # If initramfs-tools is supplied (which is optional), it also needs + # work correctly: libc-bin, systemd, mount, grep and coreutils. + # If initramfs-tools is supplied (which is optional), it also needs # findutils and debianutils. so rely on atleast the first set of binaries. bins: essential: From 593c0516c498aeb76a0526e50c46abe416085bcf Mon Sep 17 00:00:00 2001 From: Philip Meulengracht Date: Thu, 5 Sep 2024 10:11:18 +0200 Subject: [PATCH 4/4] slices/libc-bin: fix ordering of essential for bins --- slices/libc-bin.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slices/libc-bin.yaml b/slices/libc-bin.yaml index a9e2ff9d6..db8cba202 100644 --- a/slices/libc-bin.yaml +++ b/slices/libc-bin.yaml @@ -6,8 +6,8 @@ essential: slices: bins: essential: - - libc6_libs - libc-bin_config + - libc6_libs contents: /usr/bin/getconf: /usr/bin/getent: