Changeset 2329 in MondoRescue for branches/2.2.10/mondo


Ignore:
Timestamp:
Aug 18, 2009, 3:20:46 PM (15 years ago)
Author:
Bruno Cornec
Message:

r3340@localhost: bruno | 2009-08-12 00:17:29 +0200
Improve portability by defining all cmdline usage in 1 include (/tmp for FreeBSD and /proc fior LInux). Also doing tht for scripts.

Location:
branches/2.2.10/mondo/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.10/mondo/src/common/libmondo-devices.c

    r2328 r2329  
    732732
    733733    if (found_it) {
    734         mr_asprintf(tmp1, "grep \"%s=ide-scsi\" /proc/cmdline &> /dev/null", strrchr(output, '/') + 1);
     734        mr_asprintf(tmp1, "grep \"%s=ide-scsi\" " CMDLINE " &> /dev/null", strrchr(output, '/') + 1);
    735735        if (system(tmp1) == 0) {
    736736            log_msg(4, "%s is not right. It's being SCSI-emulated. Continuing.", output);
  • branches/2.2.10/mondo/src/common/libmondo-tools.c

    r2328 r2329  
    745745    }
    746746    g_current_media_number = 1;
    747     bkpinfo->postnuke_tarball[0] = '\0';
    748747    return (res);
    749748}
  • branches/2.2.10/mondo/src/include/my-stuff.h

    r2237 r2329  
    9393 */
    9494#define MONDO_TRACEFILE "/var/log/mondo-tracefile.log"
     95
     96#ifdef __FreeBSD__
     97#define CMDLINE "/tmp/cmdline"
     98#else
     99// Default Linux
     100#define CMDLINE "/proc/cmdline"
     101#endif
    95102
    96103#undef assert
  • branches/2.2.10/mondo/src/mondorestore/mondo-rstr-tools.c

    r2327 r2329  
    784784        }
    785785   
    786         if (strstr(call_program_and_get_last_line_of_output("cat /proc/cmdline"), "pxe")) {
     786        if (strstr(call_program_and_get_last_line_of_output("cat " CMDLINE), "pxe")) {
    787787            /* We need to override prefix value in PXE mode as it's
    788788            * already done in start-nfs */
     
    948948
    949949tmp = read_cfg_var(g_mondo_cfg_file, "please-dont-eject");
    950 if (tmp || strstr(call_program_and_get_last_line_of_output("cat /proc/cmdline"), "donteject")) {
     950if (tmp || strstr(call_program_and_get_last_line_of_output("cat " CMDLINE), "donteject")) {
    951951    bkpinfo->please_dont_eject = TRUE;
    952952    log_msg(2, "Ok, I shan't eject when restoring! Groovy.");
     
    977977        }
    978978    }
    979     if (strstr(call_program_and_get_last_line_of_output("cat /proc/cmdline"), "pxe")) {
     979    if (strstr(call_program_and_get_last_line_of_output("cat " CMDLINE), "pxe")) {
    980980        /* We need to override values in PXE mode as it's
    981981        * already done in start-nfs */
  • branches/2.2.10/mondo/src/mondorestore/mondorestore.c

    r2327 r2329  
    471471    log_it("Done loading config file; resizing ML");
    472472
    473 #ifdef __FreeBSD__
    474     if (strstr(call_program_and_get_last_line_of_output("cat /tmp/cmdline"), "noresize"))
    475 #else
    476     if (strstr(call_program_and_get_last_line_of_output("cat /proc/cmdline"), "noresize"))
    477 #endif
    478     {
     473    if (strstr(call_program_and_get_last_line_of_output("cat " CMDLINE), "noresize")) {
    479474        log_msg(1, "Not resizing mountlist.");
    480475    } else {
     
    773768    get_cfg_file_from_archive_or_bust();
    774769    load_mountlist(mountlist, g_mountlist_fname);   // in case read_cfg_file_into_bkpinfo updated the mountlist
    775 #ifdef __FreeBSD__
    776     if (strstr
    777         (call_program_and_get_last_line_of_output("cat /tmp/cmdline"),
    778          "noresize"))
    779 #else
    780     if (strstr
    781         (call_program_and_get_last_line_of_output("cat /proc/cmdline"),
    782          "noresize"))
    783 #endif
    784     {
     770    if (strstr(call_program_and_get_last_line_of_output("cat " CMDLINE), "noresize")) {
    785771        log_msg(2, "Not resizing mountlist.");
    786772    } else {
     
    811797            twenty_seconds_til_yikes();
    812798            g_fprep = fopen("/tmp/prep.sh", "w");
    813 #ifdef __FreeBSD__
    814             if (strstr
    815                 (call_program_and_get_last_line_of_output
    816                  ("cat /tmp/cmdline"), "nopart"))
    817 #else
    818             if (strstr
    819                 (call_program_and_get_last_line_of_output
    820                  ("cat /proc/cmdline"), "nopart"))
    821 #endif
    822             {
     799            if (strstr(call_program_and_get_last_line_of_output("cat " CMDLINE), "nopart")) {
    823800                log_msg(2,
    824801                        "Not partitioning drives due to 'nopart' option.");
     
    894871    if (retval) {
    895872        log_to_screen("Errors occurred during the nuke phase.");
    896     } else if (strstr(call_program_and_get_last_line_of_output("cat /proc/cmdline"), "RESTORE")) {
     873    } else if (strstr(call_program_and_get_last_line_of_output("cat " CMDLINE), "RESTORE")) {
    897874        log_to_screen
    898875            ("PC was restored successfully. Thank you for using Mondo Rescue.");
     
    26672644    /* Configure global variables */
    26682645    malloc_libmondo_global_strings();
    2669 #ifdef __FreeBSD__
    2670     if (strstr(call_program_and_get_last_line_of_output("cat /tmp/cmdline"), "textonly"))
    2671 #else
    2672     if (strstr(call_program_and_get_last_line_of_output("cat /proc/cmdline"), "textonly"))
    2673 #endif
     2646    if (strstr(call_program_and_get_last_line_of_output("cat " CMDLINE), "textonly"))
    26742647    {
    26752648        g_text_mode = TRUE;
Note: See TracChangeset for help on using the changeset viewer.