Changeset 3746 in MondoRescue for branches/3.3/mondo/src


Ignore:
Timestamp:
Nov 19, 2019, 1:25:56 PM (4 years ago)
Author:
Bruno Cornec
Message:

Reinstall mbr.bin (or pgtmbr.bin) from syslinux before calling boot loader restoration to avoid having nothing if we boot from a partition
(tested with SLES 12)

Location:
branches/3.3/mondo/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/3.3/mondo/src/common/libmondo-archive.c

    r3650 r3746  
    629629        }
    630630        bootldr_ver = call_program_and_get_last_line_of_output("grub --version 2> /dev/null");
    631         if (strcmp(bootldr_ver,"") ==0) {
     631        if (strcmp(bootldr_ver,"") == 0) {
    632632            mr_free(bootldr_ver);
    633633            bootldr_ver = call_program_and_get_last_line_of_output("grub2-install --version");
  • branches/3.3/mondo/src/common/libmondo-devices.c

    r3719 r3746  
    25152515            }
    25162516        }
     2517        /*  TODO: Useless I think */
    25172518        if (bkpinfo->disaster_recovery) {
    25182519            mr_asprintf(command ,"umount %s/isodir 2> /dev/null", bkpinfo->tmpdir);
  • branches/3.3/mondo/src/mondorestore/mondo-rstr-tools.c

    r3743 r3746  
    99#include "mr_str.h"
    1010#include "mr_file.h"
     11#include "mr_sys.h"
    1112#include "../common/mondostructures.h"
    1213#include "../common/libmondo.h"
     
    12821283  /** malloc *******/
    12831284    char *device = NULL;
     1285    char *disk = NULL;
    12841286    char *name = NULL;
     1287    char *type = NULL;
    12851288    char *cmd = NULL;
    12861289
    12871290    malloc_string(device);
    12881291    malloc_string(name);
     1292    malloc_string(type);
    12891293
    12901294    /* In order to have a working bootloader, we need to have all devices
     
    12941298    mr_asprintf(cmd,"tar cf - /dev | ( cd %s ; tar xf - )",MNT_RESTORING);
    12951299    run_program_and_log_output(cmd, 3);
    1296     paranoid_free(cmd);
     1300    mr_free(cmd);
    12971301
    12981302    backup_crucial_file(MNT_RESTORING, "/etc/fstab");
     
    13071311    read_cfg_var(g_mondo_cfg_file, "bootloader.device", device);
    13081312    read_cfg_var(g_mondo_cfg_file, "bootloader.name", name);
    1309     log_msg(2, "run_boot_loader: device='%s', name='%s'", device, name);
     1313    read_cfg_var(g_mondo_cfg_file, "boot-type", type);
     1314    log_msg(2, "run_boot_loader: device='%s', name='%s', type='%s'", device, name, type);
    13101315    sync();
    13111316
    13121317    offer_to_make_initrd();
     1318
     1319    disk = truncate_to_drive_name(device);
     1320    if (strcmp(type,"BIOS") == 0) {
     1321        // Force installation of a MBR bootloader brought by mindi on the disk
     1322        // in case none was available and we then start from a partition
     1323        log_msg(2, "Reinstalling mbr.bin on %s", disk);
     1324        mr_system("dd bs=440 count=1 conv=notrunc if=/tmp/mbr.bin of=%s &> /dev/null",disk);
     1325    } else {
     1326        // Same for GPT
     1327        log_msg(2, "Reinstalling gptmbr.bin on %s", disk);
     1328        mr_system("dd bs=440 count=1 conv=notrunc if=/tmp/gptmbr.bin of=%s &> /dev/null",disk);
     1329    }
     1330
     1331    // Now reinstall bootloader
    13131332    if (!strcmp(name, "LILO")) {
    13141333        res = run_lilo(offer_to_hack_scripts);
Note: See TracChangeset for help on using the changeset viewer.