summaryrefslogtreecommitdiffstats
path: root/test/units
diff options
context:
space:
mode:
authorLuca Boccassi <bluca@debian.org>2024-08-30 18:55:18 +0200
committerLuca Boccassi <luca.boccassi@gmail.com>2024-09-02 16:33:29 +0200
commit1e2d1a7202400e08a00782f32804fdc503259806 (patch)
treedd7418cd40d1f62e5c51a183fd2fd224ddfba0f3 /test/units
parentnetwork/route: fix typo (diff)
downloadsystemd-1e2d1a7202400e08a00782f32804fdc503259806.tar.xz
systemd-1e2d1a7202400e08a00782f32804fdc503259806.zip
portable: ensure PORTABLE_FORCE_ATTACH works even when there is a leftover unit
Force means force, we skip checks with PID1 for existing units, but then bail out with EEXIST if the files are actually there. Overwrite everything instead.
Diffstat (limited to 'test/units')
-rwxr-xr-xtest/units/TEST-29-PORTABLE.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/units/TEST-29-PORTABLE.sh b/test/units/TEST-29-PORTABLE.sh
index 41dce4d48a..501d492c7d 100755
--- a/test/units/TEST-29-PORTABLE.sh
+++ b/test/units/TEST-29-PORTABLE.sh
@@ -73,6 +73,21 @@ busctl tree org.freedesktop.portable1 --no-pager | grep -q -F '/org/freedesktop/
# Ensure we don't regress (again) when using --force
+mkdir -p /run/systemd/system.attached/minimal-app0.service.d/
+cat <<EOF >/run/systemd/system.attached/minimal-app0.service
+[Unit]
+Description=Minimal App 0
+EOF
+cat <<EOF >/run/systemd/system.attached/minimal-app0.service.d/10-profile.conf
+[Unit]
+Description=Minimal App 0
+EOF
+cat <<EOF >/run/systemd/system.attached/minimal-app0.service.d/20-portable.conf
+[Unit]
+Description=Minimal App 0
+EOF
+systemctl daemon-reload
+
portablectl "${ARGS[@]}" attach --force --now --runtime /usr/share/minimal_0.raw minimal-app0
portablectl is-attached --force minimal-app0
@@ -302,6 +317,28 @@ systemctl is-active app1.service
portablectl detach --now --runtime overlay app1
+# Ensure --force works also when symlinking
+mkdir -p /run/systemd/system.attached/app1.service.d
+cat <<EOF >/run/systemd/system.attached/app1.service
+[Unit]
+Description=App 1
+EOF
+cat <<EOF >/run/systemd/system.attached/app1.service.d/10-profile.conf
+[Unit]
+Description=App 1
+EOF
+cat <<EOF >/run/systemd/system.attached/app1.service.d/20-portable.conf
+[Unit]
+Description=App 1
+EOF
+systemctl daemon-reload
+
+portablectl "${ARGS[@]}" attach --force --copy=symlink --now --runtime /tmp/overlay app1
+
+systemctl is-active app1.service
+
+portablectl detach --now --runtime overlay app1
+
umount /tmp/overlay
portablectl "${ARGS[@]}" attach --copy=symlink --now --runtime --extension /tmp/app0 --extension /tmp/app1 /tmp/rootdir app0 app1