blob: 01cb2c2e3b88f895399842a4ab770beba3eee596 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
From 60821c8ba0118d231cd3b4fd008cd42868337439 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Thu, 27 Oct 2011 09:54:59 +0000
Subject: [PATCH 1/2] init: try detect alpine_dev filesystem if not specified
Note that ext4 will be detected as ext3
---
initramfs-init.in | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/initramfs-init.in b/initramfs-init.in
index 0e30137..7c477c7 100755
--- a/initramfs-init.in
+++ b/initramfs-init.in
@@ -255,6 +255,20 @@ relocate_alpine_mnt() {
fi
}
+# detect filesystem type on given device/UUID
+find_fs_type() {
+ local dev=$(findfs $1)
+ local i=
+ for i in $(blkid $dev); do
+ case $i in
+ TYPE=*) eval "$i"
+ echo $TYPE
+ return
+ ;;
+ esac
+ done
+}
+
# gotta start from somewhere :)
echo "Alpine Init $VERSION"
@@ -314,7 +328,7 @@ case "$ALPINE_DEV" in
UUID=*|LABEL=*) ;;
*) ALPINE_DEV=/dev/$ALPINE_DEV ;;
esac
-
+
# look for standard mountpoint locations
ALPINE_MNT=$(find_mnt $ALPINE_DEV /etc/fstab)
[ -z "$ALPINE_MNT" ] && ALPINE_MNT=/media/${ALPINE_DEV##*/}
@@ -398,6 +412,12 @@ start_lvm
# locate boot media and mount it
ebegin "Mounting boot media"
mkdir -p $ALPINE_MNT
+
+# try detect the filesystem
+if [ -z "$ALPINE_DEV_FS" ]; then
+ ALPINE_DEV_FS=$(find_fs_type $ALPINE_DEV)
+fi
+
if [ -n "$ALPINE_DEV_FS" ]; then
mount_opts="-t $ALPINE_DEV_FS"
fi
--
1.7.7.1
|