summaryrefslogtreecommitdiff
path: root/setup-lbu.in
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2011-08-19 20:08:14 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2011-08-19 20:08:14 +0000
commit5e55485de28ca1bb56714e03f80c69920826692c (patch)
treef02924014dde1acfda10e07b39e42fedda8ab089 /setup-lbu.in
parentb468f360fddf61af6d084a33ca9a2d5dd83608e9 (diff)
downloadalpine-conf-5e55485de28ca1bb56714e03f80c69920826692c.zip
setup-lbu: use UUID when UUID was used as alpine_dev
Diffstat (limited to 'setup-lbu.in')
-rwxr-xr-xsetup-lbu.in14
1 files changed, 12 insertions, 2 deletions
diff --git a/setup-lbu.in b/setup-lbu.in
index 1bd1b51..51a165b 100755
--- a/setup-lbu.in
+++ b/setup-lbu.in
@@ -23,10 +23,20 @@ __EOF__
get_mnt_line() {
local mntpoint="$1"
local mnttab="$2"
+ local media=${mntpoint#/media/}
+ local uuid=
+ # replace the device with UUID since the device is in /proc/mounts
+ # and we want the UUID in fstab
+ if [ "${media#UUID}" != "$media" ]; then
+ uuid="$media"
+ fi
+
# we need filter out codepage=... in mount option as it makes
# mount fail if its there.
- awk "\$2 == \"$mntpoint\" {
- gsub(/,codepage=.*,/, ",", \$4);
+ awk -v uuid="$uuid" "\$2 == \"$mntpoint\" {
+ if (uuid)
+ \$1 = uuid;
+ gsub(/,codepage=.*,/, \",\", \$4);
print \$0;
}" "$mnttab"
}