From c5af5808f670e294f6efcac9af28ec9a533bba13 Mon Sep 17 00:00:00 2001 From: sakaki Date: Sat, 13 Oct 2018 13:43:51 +0100 Subject: [PATCH] Prevent multi-line inferred CMDLINE_ROOTFSTYPE (closes #21) With btrfs, findmnt can output multiple entries (one per line). (Which in turn will then break KERNEL_CMD_LINE.) Thanks to leezu for reporting. --- buildkernel | 3 ++- buildkernel.8 | 2 +- buildkernel.conf.5 | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/buildkernel b/buildkernel index 0570e93..c5a89b5 100755 --- a/buildkernel +++ b/buildkernel @@ -31,7 +31,7 @@ shopt -s nullglob # ********************** variables ********************* PROGNAME="$(basename "${0}")" CONFFILE="/etc/${PROGNAME}.conf" -VERSION="1.0.31" +VERSION="1.0.32" ETCPROFILE="/etc/profile" DEFAULTEFIBOOTFILE="bootx64.efi" EFIBOOTFILE="${DEFAULTEFIBOOTFILE}" @@ -481,6 +481,7 @@ setup_final_variables() { # falling back to ext4 if the findmnt-based lookup fails if [[ ! -v CMDLINE_ROOTFSTYPE ]]; then CMDLINE_ROOTFSTYPE="$(/bin/findmnt -n -o FSTYPE -S ${CMDLINE_REAL_ROOT} 2>/dev/null || echo ext4)" + CMDLINE_ROOTFSTYPE="$(head -n 1 <<<"${CMDLINE_ROOTFSTYPE}")" fi # we use path syntax rather than "=PARTUUID=" syntax, as more reliable KERNEL_CMD_LINE="root=${CMDLINE_ROOT} crypt_root=${CRYPTPATHMAP} dolvm " diff --git a/buildkernel.8 b/buildkernel.8 index 078989d..8c61ee4 100644 --- a/buildkernel.8 +++ b/buildkernel.8 @@ -1,4 +1,4 @@ -.TH BUILDKERNEL 8 "Version 1.0.31: October 2018" +.TH BUILDKERNEL 8 "Version 1.0.32: October 2018" .SH NAME buildkernel \- build secure boot kernel, save to EFI system partition .SH SYNOPSIS diff --git a/buildkernel.conf.5 b/buildkernel.conf.5 index 3e1a409..657fc97 100644 --- a/buildkernel.conf.5 +++ b/buildkernel.conf.5 @@ -1,4 +1,4 @@ -.TH BUILDKERNEL 5 "Version 1.0.31: October 2018" +.TH BUILDKERNEL 5 "Version 1.0.32: October 2018" .SH NAME buildkernel.conf \- a configuration file for \fBbuildkernel\fR(8) .SH SYNOPSIS