From fc47af17b3fc866717946f107777fecea7aa86e5 Mon Sep 17 00:00:00 2001 From: illiliti Date: Wed, 19 Feb 2020 19:25:45 +0300 Subject: [PATCH] parse fstab --- generate | 20 +++++++++++++++----- init | 2 +- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/generate b/generate index ee7cde4..1f8b718 100755 --- a/generate +++ b/generate @@ -85,10 +85,20 @@ create_symlinks() { } ) } -#parse_fstab() { -# TODO parse fstab -#while [ "$fstab" -eq 1 ] && read fs dir type opts; do thing; done < /etc/fstab -#} +parse_fstab() { + msg info "parsing fstab" + + while read -r fs dir type opts dump pass; do + # ignore comments + if [ ! "${fs##"#"*}" ]; then + continue + elif [ "$dir" = / ]; then + root="${root:-$fs}" + root_type="${root_type:-$type}" + root_args="${root_args:-$opts}" + fi + done < /etc/fstab +} #parse_crypttab() { # TODO parse crypttab @@ -355,7 +365,7 @@ moddir="/lib/modules" create_structure create_symlinks -#parse_fstab +[ "$fstab" = 1 ] && parse_fstab #parse_crypttab install_requirements diff --git a/init b/init index 691aef2..be81f03 100644 --- a/init +++ b/init @@ -85,7 +85,7 @@ trigger_lvm() { } mnt_rootfs() { - mount ${root_type:+-t $root_type} $root_args $(findfs_sh "$root") /mnt/root || panic "failed to mount rootfs" + mount ${root_type:+-t $root_type} ${root_args:+-o $root_args} $(findfs_sh "$root") /mnt/root || panic "failed to mount rootfs" } cleanup() {