From 307a33aa8d5da8277b342baef6befdaa59077fbd Mon Sep 17 00:00:00 2001 From: framps Date: Tue, 9 Apr 2024 19:56:26 +0200 Subject: [PATCH] Make cmdline.txt dir discovery regex more robust and use mount instead of /etc/fstab contents --- rpi-clone | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rpi-clone b/rpi-clone index 22e53a4..904ceeb 100755 --- a/rpi-clone +++ b/rpi-clone @@ -940,7 +940,12 @@ then exit 1 fi -cmdlinedir=$(awk '$1 !~ "^#" && $2 ~ "^/boot" && $3 == "vfat" { print substr($2, 2); exit }' /etc/fstab) +# Starting with bookworm /boot/firmware/cmdline.txt is used. All previous RaspbianOS releases use /boot/cmdline.txt +cmdlinedir=$(mount | awk '$3 ~ "^/boot(/firmware)?$" && $5 == "vfat" { print substr($3, 2); exit }' ) +if [[ -z "$cmdlinedir" ]]; then + echo "Unable to locate boot device" + exit 1 +fi if ((convert_to_partuuid)) then