Changeset 3867 in MondoRescue
- Timestamp:
- Mar 7, 2024, 2:56:52 PM (7 weeks ago)
- 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 15 15 #include "mr_str.h" 16 16 #include "mondostructures.h" 17 #include "lib-common-externs.h" 17 18 #include "libmondo-files-EXT.h" 18 #include "libmondo-devices.h"19 #include "lib-common-externs.h"20 19 #include "libmondo-string-EXT.h" 21 20 #include "libmondo-tools-EXT.h" … … 484 483 strcpy(dev, g_cdrom_drive_is_here); 485 484 if (!dev[0]) { 486 find_cdrom_device(dev );485 find_cdrom_device(dev, FALSE); 487 486 } 488 487 } … … 619 618 if (!does_device_exist(output)) { 620 619 log_msg(4, "That didn't work. Sorry."); 621 return(1) 620 return(1); 622 621 } else { 623 return(0) 622 return(0); 624 623 } 625 624 } -
branches/3.3/mondo/src/common/libmondo-files.c
r3866 r3867 13 13 #include "mr_file.h" 14 14 #include "mondostructures.h" 15 #include "libmondo-files.h"16 17 15 #include "lib-common-externs.h" 18 19 16 #include "libmondo-tools-EXT.h" 20 17 #include "libmondo-gui-EXT.h" … … 37 34 /* Reference to global bkpinfo */ 38 35 extern 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 */ 42 bool 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 39 61 40 62 /** … … 169 191 } 170 192 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 }196 193 } 197 194 … … 883 880 * @return 0 if it's found, nonzero if not. 884 881 */ 885 int whine_if_not_found(c har *fname)882 int whine_if_not_found(const char *fname) 886 883 { 887 884 /*@ buffers *** */ -
branches/3.3/mondo/src/common/libmondo-string.c
r3859 r3867 11 11 #include "mr_str.h" 12 12 #include "mondostructures.h" 13 #include "libmondo-string.h"14 13 #include "lib-common-externs.h" 15 14 #include "libmondo-files-EXT.h" … … 41 40 { 42 41 char *p, *c; 42 char *partition = NULL; 43 43 44 44 assert_string_is_neither_NULL_nor_zerolength(drive); … … 59 59 mr_strcat(partition, "%c", 60 60 #ifdef BSD 61 's' ;61 's' 62 62 #else 63 'p' ;63 'p' 64 64 #endif 65 65 ); -
branches/3.3/mondo/src/common/libmondo-tools.c
r3856 r3867 14 14 #include "mondostructures.h" 15 15 #include "lib-common-externs.h" 16 #include "libmondo-tools.h"17 16 #include "libmondo-gui-EXT.h" 18 17 #include "libmondo-files-EXT.h" … … 436 435 437 436 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) { 442 438 fatal_error("Please install growisofs."); 443 439 } … … 462 458 mondo_mkisofs_sz = mr_compute_uefi_string(cdr_exe); 463 459 } 460 mr_free(cdr_exe); 461 464 462 if (bkpinfo->manual_cd_tray) { 465 463 fatal_error("Manual CD tray + DVD not supported yet."); … … 496 494 mr_asprintf(extra_cdrom_params, " "); 497 495 } 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); 502 511 } 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 512 516 if (bkpinfo->nonbootable_backup) { 513 517 mr_asprintf(mondo_mkisofs_sz, "%s%s", isofs_cmd, MONDO_MKISOFS); … … 965 969 retval += whine_if_not_found("bzip2"); 966 970 retval += whine_if_not_found("gzip"); 971 retval += whine_if_not_found("cmp"); 967 972 retval += whine_if_not_found("awk"); 968 973 retval += whine_if_not_found("md5sum"); … … 981 986 } 982 987 983 if (!find_home_of_exe("cmp")) {984 whine_if_not_found("cmp");985 }986 988 run_program_and_log_output("umount `mount | grep cdr | cut -d' ' -f3 | tr '\n' ' '`", 5); 987 989 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.