This commit is contained in:
Félix Baylac-Jacqué 2021-01-10 16:08:55 +01:00
parent 91737e1453
commit 15d1e0badf
Signed by: picnoir
GPG Key ID: EFD315F31848DBA4
2 changed files with 33 additions and 0 deletions

View File

@ -4861,6 +4861,7 @@ int exec_context_destroy_runtime_directory(const ExecContext *c, const char *run
/* We execute this synchronously, since we need to be sure this is gone when we start the /* We execute this synchronously, since we need to be sure this is gone when we start the
* service next. */ * service next. */
// here
(void) rm_rf(p, REMOVE_ROOT); (void) rm_rf(p, REMOVE_ROOT);
} }

View File

@ -74,6 +74,38 @@ systemctl clean testservice --what=all
! test -e /var/cache/testservice ! test -e /var/cache/testservice
! test -e /var/log/testservice ! test -e /var/log/testservice
cat > /etc/systemd/system/testservice.service <<EOF
[Service]
ConfigurationDirectory=testservice
RuntimeDirectory=testservice
StateDirectory=testservice
CacheDirectory=testservice
LogsDirectory=testservice
RuntimeDirectoryPreserve=no
ExecStart=sh -x -c 'touch "\$RUNTIME_DIRECTORY"/ro-file && chmod 400 "\$RUNTIME_DIRECTORY"/ro-file && /bin/sleep infinity'
Type=exec
EOF
systemctl daemon-reload
! test -e /etc/testservice
! test -e /run/testservice
! test -e /var/lib/testservice
! test -e /var/cache/testservice
! test -e /var/log/testservice
systemctl start testservice
ls -l /run/testservice
test -e /run/testservice/ro-file
systemctl stop testservice
! test -e /run/testservice
systemctl clean testservice --what=all
cat > /etc/systemd/system/testservice.service <<EOF cat > /etc/systemd/system/testservice.service <<EOF
[Service] [Service]
DynamicUser=yes DynamicUser=yes