Changeset 1693 in MondoRescue for branches/stable/mondo
- Timestamp:
- Oct 21, 2007, 3:06:22 AM (17 years ago)
- Location:
- branches/stable/mondo
- Files:
-
- 1 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/src/common/libmondo-archive.c
r1671 r1693 533 533 /*@ buffer ************************************************************ */ 534 534 char *tmp = NULL; 535 char *tmp1 = NULL; 536 char *tmp2 = NULL; 535 537 char *command = NULL; 536 538 char *bootldr_str = NULL; … … 1534 1536 } 1535 1537 close_evalcall_form(); 1538 } 1539 1540 1541 /** 1542 * Create a USB image in @c destfile, from files in @c bkpinfo->scratchdir. 1543 * 1544 * @param bkpinfo The backup information structure. Fields used: 1545 * - @c backup_media_type 1546 * - @c nonbootable_backup 1547 * - @c scratchdir 1548 * 1549 * @param destfile Where to put the generated USB image. 1550 * @return The number of errors encountered (0 for success) 1551 */ 1552 int make_usb_fs() 1553 { 1554 /*@ int ********************************************** */ 1555 int retval = 0; 1556 int res; 1557 1558 /*@ buffers ****************************************** */ 1559 char *tmp = NULL; 1560 char *tmp1 = NULL; 1561 char *result_sz = NULL; 1562 char *message_to_screen = NULL; 1563 char *old_pwd; 1564 1565 malloc_string(old_pwd); 1566 assert(bkpinfo != NULL); 1567 1568 log_msg(2, "make_usb_fs --- scratchdir=%s", bkpinfo->scratchdir); 1569 (void) getcwd(old_pwd, MAX_STR_LEN - 1); 1570 asprintf(&tmp, "chmod 755 %s", bkpinfo->scratchdir); 1571 run_program_and_log_output(tmp, FALSE); 1572 paranoid_free(tmp); 1573 chdir(bkpinfo->scratchdir); 1574 1575 asprintf(&message_to_screen, "Copying data to make %s #%d", 1576 media_descriptor_string(bkpinfo->backup_media_type), 1577 g_current_media_number); 1578 log_msg(1, message_to_screen); 1579 1580 if (is_this_device_mounted(bkpinfo->media_device)) { 1581 log_msg(1, "USB device mounted. Remounting it at the right place"); 1582 asprintf(&tmp, "umount %s", bkpinfo->media_device); 1583 run_program_and_log_output(tmp, FALSE); 1584 paranoid_free(tmp); 1585 } 1586 log_msg(1, "Mounting USB device."); 1587 asprintf(&tmp1, "%s/usb", bkpinfo->tmpdir); 1588 asprintf(&tmp, "mkdir -p %s", tmp1); 1589 run_program_and_log_output(tmp, FALSE); 1590 paranoid_free(tmp); 1591 /* Mindi always create one single parition on the USB dev */ 1592 asprintf(&tmp, "mount %s1 %s", bkpinfo->media_device, tmp1); 1593 run_program_and_log_output(tmp, FALSE); 1594 paranoid_free(tmp); 1595 1596 if (bkpinfo->nonbootable_backup) { 1597 log_msg(1, "Making nonbootable USB backup not implemented yet"); 1598 } else { 1599 log_msg(1, "Making bootable backup"); 1600 1601 /* Command to execute */ 1602 asprintf(&tmp,"mv %s/.??* %s/* %s", bkpinfo->scratchdir, bkpinfo->scratchdir, tmp1); 1603 res = eval_call_to_make_USB(tmp, message_to_screen); 1604 if (res) { 1605 asprintf(&result_sz, "%s ...failed",tmp); 1606 } else { 1607 asprintf(&result_sz, "%s ...OK",tmp); 1608 } 1609 log_to_screen(result_sz); 1610 paranoid_free(result_sz); 1611 paranoid_free(tmp); 1612 retval += res; 1613 } 1614 paranoid_free(message_to_screen); 1615 paranoid_free(tmp1); 1616 1617 if (is_this_device_mounted(bkpinfo->media_device)) { 1618 asprintf(&tmp, "umount %s1", bkpinfo->media_device); 1619 run_program_and_log_output(tmp, FALSE); 1620 paranoid_free(tmp); 1621 } 1622 1623 chdir(old_pwd); 1624 if (retval) { 1625 log_msg(1, "WARNING - make_usb_fs returned an error"); 1626 } 1627 paranoid_free(old_pwd); 1628 return (retval); 1536 1629 } 1537 1630 … … 3154 3247 res = make_iso_fs(isofile); 3155 3248 } else { 3249 res = make_usb_fs(); 3156 3250 } 3157 3251 if (g_current_media_number == 1 && !res -
branches/stable/mondo/src/common/libmondo-fork-EXT.h
r1663 r1693 5 5 char *what_i_am_doing); 6 6 extern int run_program_and_log_output(char *program, int); 7 extern int eval_call_to_make_USB(char *call, 8 char *what_i_am_doing); 7 9 extern int eval_call_to_make_ISO(char *basic_call, char *isofile, 8 10 int cd_no, char *logstub, -
branches/stable/mondo/src/common/libmondo-fork.c
r1663 r1693 179 179 180 180 /** 181 * Call copy of data to create an USB image. 182 * @param bkpinfo The backup information structure. Fields used: 183 * - @c bkpinfo->backup_media_type 184 * @return Exit code of @c copy (0 is success, anything else indicates failure). 185 */ 186 int 187 eval_call_to_make_USB(char *command, char *what_i_am_doing) { 188 189 /*@ int's *** */ 190 int retval = 0; 191 192 193 /*@*********** End Variables ***************************************/ 194 195 log_msg(3, "Starting"); 196 assert(bkpinfo != NULL); 197 198 log_to_screen 199 ("Please be patient. Do not be alarmed by on-screen inactivity."); 200 log_msg(4, "Calling open_evalcall_form() with what_i_am_doing='%s'", 201 what_i_am_doing); 202 203 if (!g_text_mode) { 204 newtSuspend(); 205 } 206 log_msg(1, "command = '%s'", command); 207 if (!g_text_mode) { 208 retval = run_external_binary_with_percentage_indicator_NEW 209 (what_i_am_doing, command); 210 } else { 211 retval += system(command); 212 } 213 if (!g_text_mode) { 214 newtResume(); 215 } 216 217 return (retval); 218 } 219 220 221 222 223 /** 181 224 * Run a program and log its output (stdout and stderr) to the logfile. 182 225 * @param program The program to run. Passed to the shell, so you can use pipes etc. -
branches/stable/mondo/src/common/libmondo-fork.h
r1663 r1693 8 8 int run_program_and_log_to_screen(char *basic_call, char *what_i_am_doing); 9 9 int run_program_and_log_output(char *program, int); 10 int eval_call_to_make_USB(char *call, char *what_i_am_doing); 10 11 int eval_call_to_make_ISO(char *basic_call, char *isofile, 11 12 int cd_no, char *logstub, char *what_i_am_doing); -
branches/stable/mondo/src/common/libmondo-string.c
r1663 r1693 929 929 } 930 930 931 switch (type_of_bkp) { 932 case dvd: 933 strcpy(type_of_backup, "DVD"); 934 break; 935 case cdr: 936 strcpy(type_of_backup, "CDR"); 937 break; 938 case cdrw: 939 strcpy(type_of_backup, "CDRW"); 940 break; 941 case tape: 942 strcpy(type_of_backup, "tape"); 943 break; 944 case cdstream: 945 strcpy(type_of_backup, "CDR"); 946 break; 947 case udev: 948 strcpy(type_of_backup, "udev"); 949 break; 950 case iso: 951 strcpy(type_of_backup, "ISO"); 952 break; 953 case nfs: 954 strcpy(type_of_backup, "nfs"); 955 break; 956 case usb: 957 strcpy(type_of_backup, "USB"); 958 break; 959 default: 960 strcpy(type_of_backup, "ISO"); 961 } 962 return (type_of_backup); 963 } 964 931 switch (type_of_bkp) { 932 case dvd: 933 strcpy(type_of_backup, "DVD"); 934 break; 935 case cdr: 936 strcpy(type_of_backup, "CDR"); 937 break; 938 case cdrw: 939 strcpy(type_of_backup, "CDRW"); 940 break; 941 case tape: 942 strcpy(type_of_backup, "tape"); 943 break; 944 case cdstream: 945 strcpy(type_of_backup, "CDR"); 946 break; 947 case udev: 948 strcpy(type_of_backup, "udev"); 949 break; 950 case iso: 951 strcpy(type_of_backup, "ISO"); 952 break; 953 case nfs: 954 strcpy(type_of_backup, "nfs"); 955 break; 956 case usb: 957 strcpy(type_of_backup, "USB"); 958 break; 959 default: 960 strcpy(type_of_backup, "ISO"); 961 } 962 return (type_of_backup); 963 } -
branches/stable/mondo/src/include/my-stuff.h
r1670 r1693 227 227 #ifdef __FreeBSD__ 228 228 #define VANILLA_SCSI_TAPE "/dev/sa" 229 #define VANILLA_USB_DEVICE "tobegivenbybsdguru" 229 230 #define DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE "/dev/vinum/" 230 231 #define RAID_DEVICE_STUB DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE … … 235 236 #else 236 237 #define VANILLA_SCSI_TAPE "/dev/st0" 238 #define VANILLA_USB_DEVICE "/dev/hda" 237 239 #define DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE "/dev/md" 238 240 #define RAID_DEVICE_STUB DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE
Note:
See TracChangeset
for help on using the changeset viewer.