2 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
3 # ex: ts=8 sw=4 sts=4 et filetype=sh
5 TEST_DESCRIPTION
="Ensure %j Wants directives work"
6 RUN_IN_UNPRIVILEGED_CONTAINER
=yes
8 .
$TEST_BASE_DIR/test-functions
12 mkdir
-p $TESTDIR/root
13 mount
${LOOPDEV}p1
$TESTDIR/root
15 # Create what will eventually be our root filesystem onto an overlay
18 eval $
(udevadm info
--export --query=env
--name=${LOOPDEV}p2
)
20 setup_basic_environment
22 # Set up the services.
23 cat >$initdir/etc
/systemd
/system
/specifier-j-wants.service
<< EOF
25 Description=Wants with percent-j specifier
26 Wants=specifier-j-depends-%j.service
27 After=specifier-j-depends-%j.service
31 ExecStart=test -f /tmp/test-specifier-j-%j
32 ExecStart=/bin/sh -c 'echo OK > /testok'
34 cat >$initdir/etc
/systemd
/system
/specifier-j-depends-wants.service
<< EOF
36 Description=Dependent service for percent-j specifier
40 ExecStart=touch /tmp/test-specifier-j-wants
42 cat >$initdir/etc
/systemd
/system
/testsuite.service
<< EOF
44 Description=Testsuite: Ensure %j Wants directives work
45 Wants=specifier-j-wants.service
46 After=specifier-j-wants.service
57 # mask some services that we do not want to run in these tests
58 ln -s /dev
/null
$initdir/etc
/systemd
/system
/systemd-hwdb-update.service
59 ln -s /dev
/null
$initdir/etc
/systemd
/system
/systemd-journal-catalog-update.service
60 ln -s /dev
/null
$initdir/etc
/systemd
/system
/systemd-networkd.service
61 ln -s /dev
/null
$initdir/etc
/systemd
/system
/systemd-networkd.socket
62 ln -s /dev
/null
$initdir/etc
/systemd
/system
/systemd-resolved.service
64 ddebug
"umount $TESTDIR/root"