summaryrefslogtreecommitdiffstats
path: root/test/units/TEST-07-PID1.issue-33672.sh
blob: 370497c346df280f3061d4539c274a9da73d6e43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env bash
# SPDX-License-Identifier: LGPL-2.1-or-later
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

set -eux
set -o pipefail

# shellcheck source=test/units/util.sh
. "$(dirname "$0")"/util.sh

# systemctl status always shows daemon-reload warning for a masked service with drop-ins
# Issue: https://github.com/systemd/systemd/issues/33672

UNIT=test-23-NeedDaemonReload.service

cleanup() {
    rm -rf /run/systemd/system/"$UNIT" /run/systemd/system/"$UNIT".d
    systemctl daemon-reload
}

trap cleanup EXIT

cat > /run/systemd/system/"$UNIT" <<EOF
[Service]
ExecStart=/usr/bin/true
EOF

mkdir /run/systemd/system/"$UNIT".d
cat > /run/systemd/system/"$UNIT".d/desc.conf <<EOF
[Unit]
Description=Test NeedDaemonReload status of a masked unit with drop-ins
EOF

systemctl daemon-reload
systemctl unmask "$UNIT"
assert_eq "$(systemctl show -P NeedDaemonReload "$UNIT")" no

systemctl mask "$UNIT"
assert_eq "$(systemctl show -P NeedDaemonReload "$UNIT")" no