diff options
author | Daan De Meyer <daan.j.demeyer@gmail.com> | 2024-03-31 22:18:19 +0200 |
---|---|---|
committer | Daan De Meyer <daan.j.demeyer@gmail.com> | 2024-04-04 16:17:38 +0200 |
commit | 8595f578fedb0fa7ee7ae06476aefa87aa094100 (patch) | |
tree | 705023a95c9a5e7fc9036e63a01f93cacdc7a53d /test | |
parent | debug-generator: Drop unnecessary include (diff) | |
download | systemd-8595f578fedb0fa7ee7ae06476aefa87aa094100.tar.xz systemd-8595f578fedb0fa7ee7ae06476aefa87aa094100.zip |
debug-generator: Add unit and drop-in credentials
These allow adding extra units and drop-ins via credentials.
Diffstat (limited to 'test')
-rwxr-xr-x | test/TEST-54-CREDS/test.sh | 15 | ||||
-rwxr-xr-x | test/units/testsuite-54.sh | 4 |
2 files changed, 19 insertions, 0 deletions
diff --git a/test/TEST-54-CREDS/test.sh b/test/TEST-54-CREDS/test.sh index c0a9d7a53d..afcb348166 100755 --- a/test/TEST-54-CREDS/test.sh +++ b/test/TEST-54-CREDS/test.sh @@ -9,6 +9,19 @@ NSPAWN_CREDS=( ) NSPAWN_ARGUMENTS="${NSPAWN_ARGUMENTS:-} ${NSPAWN_CREDS[*]}" +UNIT_CRED=$(base64 -w 0 <<EOF +[Service] +Type=oneshot +ExecStart=touch /tmp/unit-cred +EOF +) +DROPIN_CRED=$(base64 -w 0 <<EOF +[Service] +ExecStart= +ExecStart=touch /tmp/unit-dropin +EOF +) + QEMU_CREDS=( "-fw_cfg name=opt/io.systemd.credentials/myqemucredential,string=othervalue" "-smbios type=11,value=io.systemd.credential:smbioscredential=magicdata" @@ -17,6 +30,8 @@ QEMU_CREDS=( "-smbios type=11,value=io.systemd.credential.binary:tmpfiles.extra=ZiAvdG1wL3NvdXJjZWRmcm9tY3JlZGVudGlhbCAtIC0gLSAtIHRtcGZpbGVzc2VjcmV0Cg==" "-smbios type=11,value=io.systemd.credential.binary:fstab.extra=aW5qZWN0ZWQgL2luamVjdGVkIHRtcGZzIFgtbW91bnQubWtkaXIgMCAwCg==" "-smbios type=11,value=io.systemd.credential:getty.ttys.container=idontexist" + "-smbios type=11,value=io.systemd.credential.binary:systemd.extra-unit.my-service.service=$UNIT_CRED" + "-smbios type=11,value=io.systemd.credential.binary:systemd.unit-dropin.my-service.service=$DROPIN_CRED" ) QEMU_OPTIONS="${QEMU_OPTIONS:-} ${QEMU_CREDS[*]}" diff --git a/test/units/testsuite-54.sh b/test/units/testsuite-54.sh index 7618e92c9f..3fa8822867 100755 --- a/test/units/testsuite-54.sh +++ b/test/units/testsuite-54.sh @@ -200,6 +200,10 @@ elif [ -d /sys/firmware/qemu_fw_cfg/by_name ]; then [ "$(cat /tmp/sourcedfromcredential)" = "tmpfilessecret" ] [ "$(cat /etc/motd.d/50-provision.conf)" = "hello" ] [ "$(cat /etc/issue.d/50-provision.conf)" = "welcome" ] + + # Verify that adding a unit and drop-in via credentials worked + systemctl start my-service + test -f /tmp/unit-dropin else echo "qemu_fw_cfg support missing in kernel. Sniff!" expected_credential="" |