From fcc84190cc00ac71841741f0e074b1f3fba73c9e Mon Sep 17 00:00:00 2001 From: Petr Cizmar Date: Sun, 23 Oct 2022 17:07:08 +0200 Subject: [PATCH] pinebookpro-uboot: fixed kernel.d script The original (rev. 2) does not work e. g. with encrypted root and also fails if there are certain commented out lines in /etc/fstab. This proposed version fixes both issues. If the / line in fstab does not include UUID, the device is taken directly from fstab. --- srcpkgs/pinebookpro-uboot/files/kernel.d/uboot | 11 +++++++++-- srcpkgs/pinebookpro-uboot/template | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/srcpkgs/pinebookpro-uboot/files/kernel.d/uboot b/srcpkgs/pinebookpro-uboot/files/kernel.d/uboot index f184ced22d53..73adec540b27 100755 --- a/srcpkgs/pinebookpro-uboot/files/kernel.d/uboot +++ b/srcpkgs/pinebookpro-uboot/files/kernel.d/uboot @@ -1,20 +1,27 @@ #!/bin/sh kver=${2} -uuid=$(cat /etc/fstab | awk '$2 == "/" { print $1 }' | sed 's/^UUID=//') +uuid=$(cat /etc/fstab | sed -r '/^\s*#/d' | awk '$2 == "/" { print $1 }' | sed 's/^UUID=//') dev=$(blkid -U "${uuid}") partuuid=$(blkid -o value -s PARTUUID "${dev}") bootpart=$(df -P /boot | tail -1 | awk '{ print $6 }') bootstrip() { echo ${1} | sed "s,^${bootpart}/,/," } +root="PARTUUID=$partuuid" + +[ -z "$partuuid" ] && { + # UUID search failed, trying fstab directly + root=$(cat /etc/fstab | sed -r '/^\s*#/d;s/UUID=/PARTUUID=/' | awk '$2 == "/" {print $1}') +} + cat > /boot/boot.txt <