File: TEST-23-UNIT-FILE.exec-command-ex.sh

package info (click to toggle)
systemd 259.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 113,388 kB
  • sloc: ansic: 727,211; xml: 121,125; python: 36,732; sh: 34,990; cpp: 946; makefile: 278; awk: 102; lisp: 13; sed: 1
file content (31 lines) | stat: -rwxr-xr-x 1,257 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/env bash
# SPDX-License-Identifier: LGPL-2.1-or-later
set -eux
set -o pipefail

# Test ExecXYZEx= service unit dbus hookups

declare -A property

property[1_one]=ExecCondition
property[2_two]=ExecStartPre
property[3_three]=ExecStart
property[4_four]=ExecStartPost
property[5_five]=ExecReload
property[6_six]=ExecStop
property[7_seven]=ExecStopPost

# These should all get upgraded to the corresponding Ex property as the non-Ex variant
# does not support the ":" prefix (no-env-expand).
for c in "${!property[@]}"; do
    systemd-run --unit="$c" -r -p "Type=oneshot" -p "${property[$c]}=:echo \${$c}" true
    systemctl show -p "${property[$c]}" "$c" | grep -F "path=echo ; argv[]=echo \${$c} ; ignore_errors=no"
    systemctl show -p "${property[$c]}Ex" "$c" | grep -F "path=echo ; argv[]=echo \${$c} ; flags=no-env-expand"
done

# Ex names on the commandline are supported for backward compat.
for c in "${!property[@]}"; do
    systemd-run --unit="${c}_ex" -r -p "Type=oneshot" -p "${property[$c]}Ex=:echo \${$c}" true
    systemctl show -p "${property[$c]}" "$c" | grep -F "path=echo ; argv[]=echo \${$c} ; ignore_errors=no"
    systemctl show -p "${property[$c]}Ex" "$c" | grep -F "path=echo ; argv[]=echo \${$c} ; flags=no-env-expand"
done