]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - test/units/testsuite-50.sh
service: add new RootImageOptions feature
[thirdparty/systemd.git] / test / units / testsuite-50.sh
index 81e48e0ad191cfa1a1c92aadbad84622d2cf05bd..28144b378fdd73b40d0b6b3ef04755e6d355b181 100755 (executable)
@@ -124,6 +124,37 @@ umount ${image_dir}/mount
 
 systemd-run -t --property RootImage=${image}.gpt --property RootHash=${roothash} /usr/bin/cat /usr/lib/os-release | grep -q -F "MARKER=1"
 
+systemd-run -t --property RootImage=${image}.raw --property RootImageOptions="1:ro,noatime 2:ro,dev nosuid,dev" --property MountAPIVFS=yes mount | grep -F "squashfs" | grep -q -F "nosuid"
+systemd-run -t --property RootImage=${image}.gpt --property RootImageOptions="1:ro,noatime 1:ro,dev" --property MountAPIVFS=yes mount | grep -F "squashfs" | grep -q -F "noatime"
+
+cat > /run/systemd/system/testservice-50a.service <<EOF
+[Service]
+Type=oneshot
+ExecStart=mount
+MountAPIVFS=yes
+RootImage=${image}.raw
+RootImageOptions=1:ro,noatime,nosuid 2:ro,dev noatime,dev
+RootImageOptions=nosuid,dev
+EOF
+systemctl start testservice-50a.service
+journalctl -b -u testservice-50a.service | grep -F "squashfs" | grep -q -F "noatime"
+journalctl -b -u testservice-50a.service | grep -F "squashfs" | grep -q -F -v "nosuid"
+
+cat > /run/systemd/system/testservice-50b.service <<EOF
+[Service]
+Type=oneshot
+ExecStart=mount
+MountAPIVFS=yes
+RootImage=${image}.gpt
+RootImageOptions=1:ro,noatime,nosuid 2:ro,dev nosuid,dev
+RootImageOptions=2:ro,dev nosuid,dev,%%foo
+EOF
+systemctl start testservice-50b.service
+journalctl -b -u testservice-50b.service | grep -F "squashfs" | grep -q -F "noatime"
+
+# Check that specifier escape is applied %%foo -> %foo
+busctl get-property org.freedesktop.systemd1 /org/freedesktop/systemd1/unit/testservice_2d50b_2eservice org.freedesktop.systemd1.Service RootImageOptions | grep -F "nosuid,dev,%foo"
+
 echo OK > /testok
 
 exit 0