summaryrefslogtreecommitdiffstats
path: root/test/units/TEST-17-UDEV.06.sh
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2024-11-01 21:27:08 +0100
committerDaan De Meyer <daan.j.demeyer@gmail.com>2024-11-02 20:43:19 +0100
commit29a8e71d9c0858aef502f091a0ef58d5569b1c70 (patch)
treed216dcb3ea6ad79b80c871edda9dc990ff920f37 /test/units/TEST-17-UDEV.06.sh
parentpam: quiet a spurious debug message (diff)
downloadsystemd-29a8e71d9c0858aef502f091a0ef58d5569b1c70.tar.xz
systemd-29a8e71d9c0858aef502f091a0ef58d5569b1c70.zip
TEST-17-UDEV: Don't hardcode root device name
There's no guarantee the root device will be /dev/sda, so let's use bootctl to get the actual path instead of harcoding it.
Diffstat (limited to 'test/units/TEST-17-UDEV.06.sh')
-rwxr-xr-xtest/units/TEST-17-UDEV.06.sh10
1 files changed, 6 insertions, 4 deletions
diff --git a/test/units/TEST-17-UDEV.06.sh b/test/units/TEST-17-UDEV.06.sh
index 6d83645303..c9493becbd 100755
--- a/test/units/TEST-17-UDEV.06.sh
+++ b/test/units/TEST-17-UDEV.06.sh
@@ -46,8 +46,10 @@ EOF
check
-MAJOR=$(udevadm info /dev/sda | grep -e '^E: MAJOR=' | sed -e 's/^E: MAJOR=//')
-MINOR=$(udevadm info /dev/sda | grep -e '^E: MINOR=' | sed -e 's/^E: MINOR=//')
+ROOTDEV="$(bootctl -RR)"
+
+MAJOR="$(udevadm info "$ROOTDEV" | grep -e '^E: MAJOR=' | sed -e 's/^E: MAJOR=//')"
+MINOR="$(udevadm info "$ROOTDEV" | grep -e '^E: MINOR=' | sed -e 's/^E: MINOR=//')"
test -L "/run/udev/watch/b${MAJOR}:${MINOR}"
cat >/run/udev/rules.d/50-testsuite.rules <<EOF
@@ -56,8 +58,8 @@ EOF
check
-MAJOR=$(udevadm info /dev/sda | grep -e '^E: MAJOR=' | sed -e 's/^E: MAJOR=//')
-MINOR=$(udevadm info /dev/sda | grep -e '^E: MINOR=' | sed -e 's/^E: MINOR=//')
+MAJOR="$(udevadm info "$ROOTDEV" | grep -e '^E: MAJOR=' | sed -e 's/^E: MAJOR=//')"
+MINOR="$(udevadm info "$ROOTDEV" | grep -e '^E: MINOR=' | sed -e 's/^E: MINOR=//')"
test ! -e "/run/udev/watch/b${MAJOR}:${MINOR}"
rm /run/udev/rules.d/00-debug.rules