File: TEST-74-AUX-UTILS.mute-console.sh

package info (click to toggle)
systemd-udeb 259-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 104,120 kB
  • sloc: ansic: 726,480; xml: 121,118; python: 35,852; sh: 33,447; cpp: 946; awk: 102; makefile: 89; lisp: 13; sed: 1
file content (40 lines) | stat: -rwxr-xr-x 1,067 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
32
33
34
35
36
37
38
39
40
#!/usr/bin/env bash
# SPDX-License-Identifier: LGPL-2.1-or-later
set -eux
set -o pipefail

if ! command -v systemd-mute-console >/dev/null; then
    echo "systemd-mute-console is not installed, skipping the test"
    exit 0
fi

PID="$(systemd-notify --fork -- systemd-mute-console)"
sleep .5
kill "$PID"
unset PID

(! systemd-mute-console --kernel=no --pid1=no)

PID="$(systemd-notify --fork -- systemd-mute-console --kernel=yes --pid1=yes)"
sleep .5
kill "$PID"
unset PID

varlinkctl introspect "$(which systemd-mute-console)"

PID="$(systemd-notify --fork -- varlinkctl call -E "$(which systemd-mute-console)" io.systemd.MuteConsole.Mute '{}')"
sleep .5
kill "$PID"
unset PID

PID="$(systemd-notify --fork -- varlinkctl call -E "$(which systemd-mute-console)" io.systemd.MuteConsole.Mute '{"pid1":true, "kernel":true}')"
sleep .5
kill "$PID"
unset PID

varlinkctl introspect /run/systemd/io.systemd.MuteConsole

PID="$(systemd-notify --fork -- varlinkctl call -E /run/systemd/io.systemd.MuteConsole io.systemd.MuteConsole.Mute '{}')"
sleep .5
kill "$PID"
unset PID