1#!/bin/bash 2# SPDX-License-Identifier: LGPL-2.1-or-later 3# 4# Basic tests for types creating fifos 5set -eux 6set -o pipefail 7 8rm -fr /tmp/p 9mkdir /tmp/p 10touch /tmp/p/f1 11 12systemd-tmpfiles --create - <<EOF 13p /tmp/p/fifo1 0666 - - - - 14EOF 15 16test -p /tmp/p/fifo1 17test "$(stat -c %U:%G:%a /tmp/p/fifo1)" = "root:root:666" 18 19# Refuse to overwrite an existing file. Error is not propagated. 20systemd-tmpfiles --create - <<EOF 21p /tmp/p/f1 0666 - - - - 22EOF 23 24test -f /tmp/p/f1 25 26# unless '+' prefix is used 27systemd-tmpfiles --create - <<EOF 28p+ /tmp/p/f1 0666 - - - - 29EOF 30 31test -p /tmp/p/f1 32test "$(stat -c %U:%G:%a /tmp/p/f1)" = "root:root:666" 33 34# 35# Must be fixed 36# 37# mkdir /tmp/p/daemon 38# #ln -s /root /tmp/F/daemon/unsafe-symlink 39# chown -R --no-dereference daemon:daemon /tmp/p/daemon 40# 41# systemd-tmpfiles --create - <<EOF 42# p /tmp/p/daemon/fifo2 0666 daemon daemon - - 43# EOF 44