bcm27xx: base-files: properly detect boot partition
authorÁlvaro Fernández Rojas <noltari@gmail.com>
Tue, 30 Jan 2024 20:41:26 +0000 (21:41 +0100)
committerÁlvaro Fernández Rojas <noltari@gmail.com>
Thu, 1 Feb 2024 08:58:17 +0000 (09:58 +0100)
Automatically detect boot partition instead of forcing /dev/mmcblk0p1.
This way users can still get /boot mounted when booting from USB.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
target/linux/bcm27xx/base-files/lib/preinit/79_move_config

index c9fb59a64fe62e3fa9ca69d688a10f820c077d2a..db5bf93b626b00bc3c6efcce75571d78d0c8ca24 100644 (file)
@@ -2,16 +2,20 @@
 
 . /lib/upgrade/common.sh
 
-BOOTPART=/dev/mmcblk0p1
-
 move_config() {
-       if [ -b $BOOTPART ]; then
+       local partdev
+
+       export_bootdevice && export_partdevice partdev 1 || {
+               partdev=mmcblk0p1
+       }
+
+       if [ -b "/dev/$partdev" ]; then
                insmod nls_cp437
                insmod nls_iso8859-1
                insmod fat
                insmod vfat
                mkdir -p /boot
-               mount -t vfat -o rw,noatime $BOOTPART /boot
+               mount -t vfat -o rw,noatime /dev/$partdev /boot
                [ -f "/boot/$BACKUP_FILE" ] && mv -f "/boot/$BACKUP_FILE" /
        fi
 }