summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2022-11-18 20:02:34 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2022-11-18 20:02:34 +0100
commit7c06e144ad9a18d7fd7b06346a11a1e2633ee063 (patch)
treeae4e18b9ac98bb05e967bb3aace03f6cba84752e
parent849d495c54c5634ec6dfd1011406018b56f721fd (diff)
downloadalpine-conf-7c06e144ad9a18d7fd7b06346a11a1e2633ee063.zip
setup-lbu: fix UUID= prefix in /etc/fstab
-rw-r--r--setup-lbu.in3
-rwxr-xr-xtests/setup_lbu_test22
2 files changed, 24 insertions, 1 deletions
diff --git a/setup-lbu.in b/setup-lbu.in
index 3a942d5..7c3c21e 100644
--- a/setup-lbu.in
+++ b/setup-lbu.in
@@ -97,6 +97,9 @@ set_media() {
echo "$media: Could not find filesystem type" >&2
exit 1
fi
+ if [ -n "$UUID" ]; then
+ UUID="UUID=$UUID"
+ fi
# use LABEL= if it was specifically selected, otherwise use UUID
case "$media" in
LABEL=*|UUID=*) UUID="$media";;
diff --git a/tests/setup_lbu_test b/tests/setup_lbu_test
index 018dcad..0b07ac3 100755
--- a/tests/setup_lbu_test
+++ b/tests/setup_lbu_test
@@ -3,7 +3,8 @@
. $(atf_get_srcdir)/test_env.sh
init_tests \
setup_lbu_usage \
- setup_lbu_label
+ setup_lbu_label \
+ setup_lbu_uuid
setup_lbu_usage_body() {
test_usage setup-lbu
@@ -23,3 +24,22 @@ setup_lbu_label_body() {
cat etc/fstab
}
+setup_lbu_uuid_body() {
+ init_env
+ mkdir -p proc media/mmcblk0p1
+ echo "/dev/mmcblk0p1 /media/mmcblk0p1 vfat ro,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro 0 0" > proc/mounts
+ atf_check -s exit:0 \
+ -o empty \
+ -e empty \
+ setup-lbu mmcblk0p1
+ atf_check \
+ -o match:"LBU_MEDIA=mmcblk0p1" \
+ cat etc/lbu/lbu.conf
+
+ test -d media/mmcblk0p1 || atf_fail "directory /media/mmcblk0p1 was not created"
+
+ atf_check -s exit:0 \
+ -o match:"^UUID=" \
+ cat etc/fstab
+}
+