ref: 60821c8ba0118d231cd3b4fd008cd42868337439
parent: 33efee8d373c7b58402305ce3149905708135b9f
author: Natanael Copa <ncopa@alpinelinux.org>
date: Thu Oct 27 04:54:59 CDT 2011
init: try detect alpine_dev filesystem if not specified Note that ext4 will be detected as ext3
--- a/initramfs-init.in
+++ b/initramfs-init.in
@@ -255,6 +255,20 @@
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 @@
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 @@
# 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