Changeset 3867 in MondoRescue


Ignore:
Timestamp:
Mar 7, 2024, 2:56:52 PM (7 weeks ago)
Author:
Bruno Cornec
Message:

Fix find_home_of_exe calls + errors

Location:
branches/3.3/mondo/src/common
Files:
4 edited

Legend:

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

    r3866 r3867  
    1515#include "mr_str.h"
    1616#include "mondostructures.h"
     17#include "lib-common-externs.h"
    1718#include "libmondo-files-EXT.h"
    18 #include "libmondo-devices.h"
    19 #include "lib-common-externs.h"
    2019#include "libmondo-string-EXT.h"
    2120#include "libmondo-tools-EXT.h"
     
    484483        strcpy(dev, g_cdrom_drive_is_here);
    485484        if (!dev[0]) {
    486             find_cdrom_device(dev);
     485            find_cdrom_device(dev, FALSE);
    487486        }
    488487    }
     
    619618        if (!does_device_exist(output)) {
    620619            log_msg(4, "That didn't work. Sorry.");
    621             return(1)
     620            return(1);
    622621        } else {
    623             return(0)
     622            return(0);
    624623        }
    625624    }
  • branches/3.3/mondo/src/common/libmondo-files.c

    r3866 r3867  
    1313#include "mr_file.h"
    1414#include "mondostructures.h"
    15 #include "libmondo-files.h"
    16 
    1715#include "lib-common-externs.h"
    18 
    1916#include "libmondo-tools-EXT.h"
    2017#include "libmondo-gui-EXT.h"
     
    3734/* Reference to global bkpinfo */
    3835extern struct s_bkpinfo *bkpinfo;
     36
     37/**
     38 * Check for existence of given @p filename.
     39 * @param filename The file to check for.
     40 * @return TRUE if it exists, FALSE otherwise.
     41 */
     42bool does_file_exist(const char *filename)
     43{
     44
     45    /*@ structures ************************************************** */
     46    struct stat buf;
     47
     48    /*@************************************************************** */
     49
     50    assert(filename != NULL);
     51    //  assert_string_is_neither_NULL_nor_zerolength(filename);
     52    if (lstat(filename, &buf)) {
     53        log_msg(20, "%s does not exist", filename);
     54        return (FALSE);
     55    } else {
     56        log_msg(20, "%s exists", filename);
     57        return (TRUE);
     58    }
     59}
     60
    3961
    4062/**
     
    169191    }
    170192    return (noof_lines);
    171 }
    172 
    173 
    174 /**
    175  * Check for existence of given @p filename.
    176  * @param filename The file to check for.
    177  * @return TRUE if it exists, FALSE otherwise.
    178  */
    179 bool does_file_exist(const char *filename)
    180 {
    181 
    182     /*@ structures ************************************************** */
    183     struct stat buf;
    184 
    185     /*@************************************************************** */
    186 
    187     assert(filename != NULL);
    188     //  assert_string_is_neither_NULL_nor_zerolength(filename);
    189     if (lstat(filename, &buf)) {
    190         log_msg(20, "%s does not exist", filename);
    191         return (FALSE);
    192     } else {
    193         log_msg(20, "%s exists", filename);
    194         return (TRUE);
    195     }
    196193}
    197194
     
    883880 * @return 0 if it's found, nonzero if not.
    884881 */
    885 int whine_if_not_found(char *fname)
     882int whine_if_not_found(const char *fname)
    886883{
    887884    /*@ buffers *** */
  • branches/3.3/mondo/src/common/libmondo-string.c

    r3859 r3867  
    1111#include "mr_str.h"
    1212#include "mondostructures.h"
    13 #include "libmondo-string.h"
    1413#include "lib-common-externs.h"
    1514#include "libmondo-files-EXT.h"
     
    4140{
    4241    char *p, *c;
     42    char *partition = NULL;
    4343
    4444    assert_string_is_neither_NULL_nor_zerolength(drive);
     
    5959            mr_strcat(partition, "%c",
    6060#ifdef BSD
    61                 's';
     61                's'
    6262#else
    63                 'p';
     63                'p'
    6464#endif
    6565                );
  • branches/3.3/mondo/src/common/libmondo-tools.c

    r3856 r3867  
    1414#include "mondostructures.h"
    1515#include "lib-common-externs.h"
    16 #include "libmondo-tools.h"
    1716#include "libmondo-gui-EXT.h"
    1817#include "libmondo-files-EXT.h"
     
    436435
    437436    if (bkpinfo->backup_media_type == dvd) {
    438         if (find_home_of_exe("growisofs")) {
    439             mr_asprintf(cdr_exe, "growisofs");
    440         }                       // unlikely to be used
    441         else {
     437        if ((cdr_exe = find_home_of_exe("growisofs")) == NULL) {
    442438            fatal_error("Please install growisofs.");
    443439        }
     
    462458            mondo_mkisofs_sz = mr_compute_uefi_string(cdr_exe);
    463459        }
     460        mr_free(cdr_exe);
     461
    464462        if (bkpinfo->manual_cd_tray) {
    465463            fatal_error("Manual CD tray + DVD not supported yet.");
     
    496494            mr_asprintf(extra_cdrom_params, " ");
    497495        }
    498         if (find_home_of_exe("cdrecord")) {
    499             mr_asprintf(cdr_exe, "cdrecord");
    500         } else if (find_home_of_exe("dvdrecord")) {
    501             mr_asprintf(cdr_exe, "dvdrecord");
     496        if ((cdr_exe = find_home_of_exe("cdrecord")) == NULL) {
     497            if ((cdr_exe = find_home_of_exe("wodim")) == NULL) {
     498                if ((cdr_exe = find_home_of_exe("dvdrecord")) == NULL) {
     499                    fatal_error("Please install either cdrecord, wodim or dvdrecord.");
     500                }
     501            }
     502        }
     503        if ((tmp = find_home_of_exe("xorriso")) != NULL) {
     504            mr_asprintf(isofs_cmd, "%s %s", tmp, MONDO_XORRISO_OPT);
     505        } else if ((tmp = find_home_of_exe("genisoimage")) != NULL) {
     506            mr_asprintf(isofs_cmd, "%s %s", tmp, MONDO_GENISOIMAGE_OPT);
     507        } else if ((tmp = find_home_of_exe("mkisofs")) != NULL) {
     508            mr_asprintf(isofs_cmd, "%s %s", tmp, MONDO_MKISOFS_OPT);
     509        } else if ((tmp = find_home_of_exe("wodim")) != NULL) {
     510            mr_asprintf(isofs_cmd, "%s %s", tmp, MONDO_WODIM_OPT);
    502511        } else {
    503             fatal_error("Please install either cdrecord or dvdrecord.");
    504         }
    505         if (find_home_of_exe("xorriso")) {
    506             mr_asprintf(isofs_cmd, "%s", MONDO_XORRISO_CMD);
    507         } else if (find_home_of_exe("genisoimage")) {
    508             mr_asprintf(isofs_cmd, "%s", MONDO_GENISOIMAGE_CMD);
    509         } else {
    510             mr_asprintf(isofs_cmd, "%s", MONDO_MKISOFS_CMD);
    511         }
     512            fatal_error("Unable to find a command to create ISO among xorriso, genisoimage, mksiofs or wodim, please install one");
     513        }
     514        mr_free(tmp);
     515
    512516        if (bkpinfo->nonbootable_backup) {
    513517            mr_asprintf(mondo_mkisofs_sz, "%s%s", isofs_cmd, MONDO_MKISOFS);
     
    965969    retval += whine_if_not_found("bzip2");
    966970    retval += whine_if_not_found("gzip");
     971    retval += whine_if_not_found("cmp");
    967972    retval += whine_if_not_found("awk");
    968973    retval += whine_if_not_found("md5sum");
     
    981986    }
    982987
    983     if (!find_home_of_exe("cmp")) {
    984         whine_if_not_found("cmp");
    985     }
    986988    run_program_and_log_output("umount `mount | grep cdr | cut -d' ' -f3 | tr '\n' ' '`", 5);
    987989    tmp = call_program_and_get_last_line_of_output("mount | grep -E 'cdr(om|w)'");
Note: See TracChangeset for help on using the changeset viewer.