udevadm: Propagate return code from verb result

udevadm lock did not propagate the return code from the child process
because all positive values were treated as success.

v2:
Now 'udevadm test-builtin' ignores all positive return values from the
builtin commands. Otherwise, as the hwdb builtin returns an positive value
when a matching entry found, 'udevadm test-builtin hwdb' will fail.

v3:
Initialize partition table before calling 'sfdisk --delete'.

Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
This commit is contained in:
Joakim Nohlgård
2023-12-30 05:26:59 +09:00
committed by Yu Watanabe
co-authored by Yu Watanabe
parent 6b9cac874c
commit ba340e2a75
3 changed files with 10 additions and 2 deletions
+5
View File
@@ -396,6 +396,11 @@ EOF
udevadm control --reload
# initialize partition table
for disk in {0..9}; do
echo 'label: gpt' | udevadm lock --device="${devices[$disk]}" sfdisk -q "${devices[$disk]}"
done
# Delete the partitions, immediately recreate them, wait for udev to settle
# down, and then check if we have any dangling symlinks in /dev/disk/. Rinse
# and repeat.