From a7fb778415a264a0f40e7580217cbd5616fb0cfe Mon Sep 17 00:00:00 2001 From: William Wilhelm Date: Sun, 1 Jan 2023 10:51:47 +0000 Subject: setup-disk: NO_DISK_UUID for fstab --- setup-disk.in | 6 ++++++ tests/setup_disk_test | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/setup-disk.in b/setup-disk.in index 28ef857..258a494 100644 --- a/setup-disk.in +++ b/setup-disk.in @@ -44,6 +44,12 @@ _blkid() { # if given device have an UUID display it, otherwise return the device uuid_or_device() { local i= + # NO_DISK_UUID can be set to a list of space-separated devices to avoid using UUIDs + for i in $NO_DISK_UUID; do + if [ "$i" = "$1" ]; then + echo "$1" && return 0 + fi + done case "$1" in /dev/md*) echo "$1" && return 0;; esac diff --git a/tests/setup_disk_test b/tests/setup_disk_test index b3c714a..5fcb535 100755 --- a/tests/setup_disk_test +++ b/tests/setup_disk_test @@ -221,6 +221,13 @@ setup_disk_func_uuid_or_device_body() { -o match:"UUID=1db12961-31ce-420f-94f0-559a1f6592ff" \ setup-disk /dev/sda1 + SETUP_DISK_TESTFUNC=uuid_or_device \ + NO_DISK_UUID="/dev/sda1 /dev/sda3" \ + atf_check -s exit:0 \ + -o not-match:"UUID" \ + -o match:"/dev/sda1" \ + setup-disk /dev/sda1 + } setup_disk_non_existing_block_dev_body() { -- cgit v1.2.3