Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP7:GA
grub2.19106
grub2-btrfs-04-grub2-install.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File grub2-btrfs-04-grub2-install.patch of Package grub2.19106
Index: grub-2.02~rc1/grub-core/osdep/unix/config.c =================================================================== --- grub-2.02~rc1.orig/grub-core/osdep/unix/config.c +++ grub-2.02~rc1/grub-core/osdep/unix/config.c @@ -219,6 +219,19 @@ grub_util_load_config (struct grub_util_ if (v) cfg->grub_distributor = xstrdup (v); + v = getenv ("SUSE_BTRFS_SNAPSHOT_BOOTING"); + if (v) + { + if (grub_strncmp(v, "true", sizeof ("true") - 1) == 0) + { + cfg->is_suse_btrfs_snapshot_enabled = 1; + } + else + { + cfg->is_suse_btrfs_snapshot_enabled = 0; + } + } + cfgfile = grub_util_get_config_filename (); if (!grub_util_is_regular (cfgfile)) return; @@ -242,8 +255,8 @@ grub_util_load_config (struct grub_util_ *ptr++ = *iptr; } - strcpy (ptr, "'; printf \"GRUB_ENABLE_CRYPTODISK=%s\\nGRUB_DISTRIBUTOR=%s\\n\" " - "\"$GRUB_ENABLE_CRYPTODISK\" \"$GRUB_DISTRIBUTOR\""); + strcpy (ptr, "'; printf \"GRUB_ENABLE_CRYPTODISK=%s\\nGRUB_DISTRIBUTOR=%s\\nSUSE_BTRFS_SNAPSHOT_BOOTING=%s\\n\" " + "\"$GRUB_ENABLE_CRYPTODISK\" \"$GRUB_DISTRIBUTOR\" \"$SUSE_BTRFS_SNAPSHOT_BOOTING\""); argv[2] = script; argv[3] = '\0'; Index: grub-2.02~rc1/include/grub/emu/config.h =================================================================== --- grub-2.02~rc1.orig/include/grub/emu/config.h +++ grub-2.02~rc1/include/grub/emu/config.h @@ -37,6 +37,7 @@ struct grub_util_config { int is_cryptodisk_enabled; char *grub_distributor; + int is_suse_btrfs_snapshot_enabled; }; void Index: grub-2.02~rc1/util/config.c =================================================================== --- grub-2.02~rc1.orig/util/config.c +++ grub-2.02~rc1/util/config.c @@ -42,6 +42,16 @@ grub_util_parse_config (FILE *f, struct cfg->is_cryptodisk_enabled = 1; continue; } + if (grub_strncmp (ptr, "SUSE_BTRFS_SNAPSHOT_BOOTING=", + sizeof ("SUSE_BTRFS_SNAPSHOT_BOOTING=") - 1) == 0) + { + ptr += sizeof ("SUSE_BTRFS_SNAPSHOT_BOOTING=") - 1; + if (*ptr == '"' || *ptr == '\'') + ptr++; + if (grub_strncmp(ptr, "true", sizeof ("true") - 1) == 0) + cfg->is_suse_btrfs_snapshot_enabled = 1; + continue; + } if (grub_strncmp (ptr, "GRUB_DISTRIBUTOR=", sizeof ("GRUB_DISTRIBUTOR=") - 1) == 0) { Index: grub-2.02~rc1/util/grub-install.c =================================================================== --- grub-2.02~rc1.orig/util/grub-install.c +++ grub-2.02~rc1/util/grub-install.c @@ -828,6 +828,8 @@ fill_core_services (const char *core_ser free (sysv_plist); } +extern int use_relative_path_on_btrfs; + int main (int argc, char *argv[]) { @@ -861,6 +863,9 @@ main (int argc, char *argv[]) grub_util_load_config (&config); + if (config.is_suse_btrfs_snapshot_enabled) + use_relative_path_on_btrfs = 1; + if (!bootloader_id && config.grub_distributor) { char *ptr; @@ -1347,6 +1352,16 @@ main (int argc, char *argv[]) fprintf (load_cfg_f, "set debug='%s'\n", debug_image); } + + if (config.is_suse_btrfs_snapshot_enabled + && grub_strncmp(grub_fs->name, "btrfs", sizeof ("btrfs") - 1) == 0) + { + if (!load_cfg_f) + load_cfg_f = grub_util_fopen (load_cfg, "wb"); + have_load_cfg = 1; + fprintf (load_cfg_f, "set btrfs_relative_path='y'\n"); + } + char *prefix_drive = NULL; char *install_drive = NULL; Index: grub-2.02~rc1/grub-core/osdep/linux/getroot.c =================================================================== --- grub-2.02~rc1.orig/grub-core/osdep/linux/getroot.c +++ grub-2.02~rc1/grub-core/osdep/linux/getroot.c @@ -376,6 +376,7 @@ get_btrfs_fs_prefix (const char *mount_p return NULL; } +int use_relative_path_on_btrfs = 0; char ** grub_find_root_devices_from_mountinfo (const char *dir, char **relroot) @@ -519,6 +520,12 @@ again: { ret = grub_find_root_devices_from_btrfs (dir); fs_prefix = get_btrfs_fs_prefix (entries[i].enc_path); + if (use_relative_path_on_btrfs) + { + if (fs_prefix) + free (fs_prefix); + fs_prefix = xstrdup ("/"); + } } else if (!retry && grub_strcmp (entries[i].fstype, "autofs") == 0) { Index: grub-2.02~rc1/util/grub-mkrelpath.c =================================================================== --- grub-2.02~rc1.orig/util/grub-mkrelpath.c +++ grub-2.02~rc1/util/grub-mkrelpath.c @@ -40,9 +40,12 @@ struct arguments }; static struct argp_option options[] = { + {"relative", 'r', 0, 0, "use relative path on btrfs", 0}, { 0, 0, 0, 0, 0, 0 } }; +extern int use_relative_path_on_btrfs; + static error_t argp_parser (int key, char *arg, struct argp_state *state) { @@ -52,6 +55,9 @@ argp_parser (int key, char *arg, struct switch (key) { + case 'r': + use_relative_path_on_btrfs = 1; + break; case ARGP_KEY_ARG: if (state->arg_num == 0) arguments->pathname = xstrdup (arg);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor