grub-generator: If OSTREE_BOOT_PARTITION is not set, default to /boot
authorCarlos Alberto Lopez Perez <clopez@igalia.com>
Mon, 6 Nov 2017 16:29:13 +0000 (17:29 +0100)
committerAtomic Bot <atomic-devel@projectatomic.io>
Wed, 15 Nov 2017 14:03:24 +0000 (14:03 +0000)
Closes: #1326
Approved by: cgwalters

src/boot/grub2/ostree-grub-generator

index 5673b26412257486e6410fa8386f8e69d02d4323..82e66bd7a1eb1d6b02b543e41779e276dceb2070 100644 (file)
@@ -61,7 +61,12 @@ read_config()
 
 populate_menu()
 {
-    boot_prefix="${OSTREE_BOOT_PARTITION}"
+    # Default to /boot if OSTREE_BOOT_PARTITION is not set and /boot is on the same device than ostree/repo
+    if [ -z ${OSTREE_BOOT_PARTITION+x} ] && [ -d /boot/ostree ] && [ -d /ostree/repo ] && [ $(stat -c '%d' /boot/ostree) -eq $(stat -c '%d' /ostree/repo) ]; then
+        boot_prefix="/boot"
+    else
+        boot_prefix="${OSTREE_BOOT_PARTITION}"
+    fi
     for config in $(ls ${entries_path}); do
         read_config ${config}
         menu="${menu}menuentry '${title}' {\n"