mirror of
https://github.com/systemd/systemd
synced 2024-09-06 16:56:43 +00:00
test: backup /etc/udev/udev.conf only if it exists
On Fedora systemd recently moved all of its configuration files to
/usr/lib/ [0], so make sure we account for this case as well.
[ 42.450325] testsuite-17.sh[800]: + mkdir -p /run/udev/rules.d
[ 42.466504] testsuite-17.sh[800]: + cp -f /etc/udev/udev.conf /etc/udev/udev.conf.bckp
[ 42.503348] testsuite-17.sh[802]: cp: cannot stat '/etc/udev/udev.conf': No such file or directory
[0] 29eb35530b
?branch=rawhide
This commit is contained in:
parent
ad23ff13de
commit
e23fc070e2
|
@ -2,17 +2,18 @@
|
|||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
set -ex
|
||||
|
||||
test_rule="/run/udev/rules.d/49-test.rules"
|
||||
TEST_RULE="/run/udev/rules.d/49-test.rules"
|
||||
KILL_PID=
|
||||
|
||||
setup() {
|
||||
mkdir -p "${test_rule%/*}"
|
||||
cp -f /etc/udev/udev.conf /etc/udev/udev.conf.bckp
|
||||
cat >"${test_rule}" <<EOF
|
||||
mkdir -p "${TEST_RULE%/*}"
|
||||
[[ -e /etc/udev/udev.conf ]] && cp -f /etc/udev/udev.conf /etc/udev/udev.conf.bak
|
||||
|
||||
cat >"${TEST_RULE}" <<EOF
|
||||
ACTION=="add", SUBSYSTEM=="mem", KERNEL=="null", OPTIONS="log_level=debug"
|
||||
ACTION=="add", SUBSYSTEM=="mem", KERNEL=="null", PROGRAM=="/bin/sleep 60"
|
||||
EOF
|
||||
cat >>/etc/udev/udev.conf <<EOF
|
||||
cat >/etc/udev/udev.conf <<EOF
|
||||
event_timeout=10
|
||||
timeout_signal=SIGABRT
|
||||
EOF
|
||||
|
@ -29,9 +30,8 @@ teardown() {
|
|||
fi
|
||||
|
||||
rm -rf "$TMPDIR"
|
||||
|
||||
mv -f /etc/udev/udev.conf.bckp /etc/udev/udev.conf
|
||||
rm -f "$test_rule"
|
||||
rm -f "$TEST_RULE"
|
||||
[[ -e /etc/udev/udev.conf.bak ]] && mv -f /etc/udev/udev.conf.bak /etc/udev/udev.conf
|
||||
systemctl restart systemd-udevd.service
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue