Changeset 1187 in MondoRescue for branches/stable
- Timestamp:
- Feb 20, 2007, 3:03:33 AM (18 years ago)
- Location:
- branches/stable/mondo/src/mondoarchive
- Files:
-
- 2 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/src/mondoarchive/Makefile.am
r1170 r1187 11 11 ## The program 12 12 sbin_PROGRAMS = mondoarchive 13 mondoarchive_SOURCES = m ain.c mondo-cli.c13 mondoarchive_SOURCES = mondoarchive.c mondo-cli.c 14 14 mondoarchive_LDADD = ${top_builddir}/src/common/libmondo.a ${top_builddir}/src/lib/libmr.a -
branches/stable/mondo/src/mondoarchive/mondo-cli.c
r1164 r1187 10 10 /** @def BOOT_LOADER_CHARS The characters allowed for boot loader on this platform. */ 11 11 12 #include "my-stuff.h" 13 #include "mondostructures.h" 14 #include "mondo-cli-EXT.h" 15 #include "libmondo.h" 12 16 #include <pthread.h> 13 #include "my-stuff.h"14 #include "../common/mondostructures.h"15 #include "mondo-cli-EXT.h"16 #include "../common/libmondo.h"17 17 #include "mr_mem.h" 18 18 #include "mr_msg.h" … … 50 50 */ 51 51 bool g_ISO_restore_mode = FALSE; 52 53 52 54 53 extern double g_kernel_version; … … 80 79 int res = 0; 81 80 int retval = 0; 82 int i = 0, j ;81 int i = 0, j = 0; 83 82 84 83 /*@ buffers *************** */ 85 char *tmp ;84 char *tmp = NULL; 86 85 char flag_val[128][MAX_STR_LEN]; 87 86 bool flag_set[128]; 88 87 89 malloc_string(tmp);90 88 sensibly_set_tmpdir_and_scratchdir(bkpinfo); 89 91 90 for (i = 0; i < 128; i++) { 92 91 flag_val[i][0] = '\0'; 93 92 flag_set[i] = FALSE; 94 93 } 95 // strcpy (bkpinfo->tmpdir, "/root/images/mondo");96 // strcpy (bkpinfo->scratchdir, "/home");97 94 for (j = 1; j <= MAX_NOOF_MEDIA; j++) { 98 95 bkpinfo->media_size[j] = 650; … … 113 110 for (i = 0; i < 128; i++) { 114 111 if (flag_set[i]) { 115 sprintf(tmp, "-%c %s", i, flag_val[i]); 116 mr_msg(3, tmp); 112 mr_msg(3, "-%c %s", i, flag_val[i]); 117 113 } 118 114 } 119 115 // } 120 sprintf(tmp, "rm -Rf %s/tmp.mondo.*", bkpinfo->tmpdir);116 mr_asprintf(&tmp, "rm -Rf %s/tmp.mondo.*", bkpinfo->tmpdir); 121 117 paranoid_system(tmp); 122 sprintf(tmp, "rm -Rf %s/mondo.scratch.*", bkpinfo->scratchdir); 118 mr_free(tmp); 119 120 mr_asprintf(&tmp, "rm -Rf %s/mondo.scratch.*", bkpinfo->scratchdir); 123 121 paranoid_system(tmp); 122 mr_free(tmp); 123 124 124 sprintf(bkpinfo->tmpdir + strlen(bkpinfo->tmpdir), "/tmp.mondo.%ld", 125 125 random() % 32767); 126 126 sprintf(bkpinfo->scratchdir + strlen(bkpinfo->scratchdir), 127 127 "/mondo.scratch.%ld", random() % 32767); 128 sprintf(tmp, "mkdir -p %s/tmpfs", bkpinfo->tmpdir); 128 129 mr_asprintf(&tmp, "mkdir -p %s/tmpfs", bkpinfo->tmpdir); 129 130 paranoid_system(tmp); 130 sprintf(tmp, "mkdir -p %s", bkpinfo->scratchdir); 131 mr_free(tmp); 132 133 mr_asprintf(&tmp, "mkdir -p %s", bkpinfo->scratchdir); 131 134 paranoid_system(tmp); 132 135 mr_free(tmp); 133 136 return (retval); 134 137 } 135 136 137 138 138 139 … … 165 166 bkpinfo->media_size[j] = friendly_sizestr_to_sizelong(p); 166 167 } 167 // bkpinfo->media_size[0] = bkpinfo->media_size[MAX_NOOF_MEDIA];168 168 for (j = 1; j <= MAX_NOOF_MEDIA; j++) { 169 169 if (bkpinfo->media_size[j] <= 0) { … … 174 174 return (0); 175 175 } 176 177 176 178 177 -
branches/stable/mondo/src/mondoarchive/mondoarchive.c
r1183 r1187 22 22 #include "mondo-cli-EXT.h" 23 23 24 #include "mr_mem.h" 24 25 #include "mr_str.h" 25 26 #include "mr_msg.h" … … 112 113 ("umount `mount | grep shm | grep mondo | cut -d' ' -f3`", 2); 113 114 unmount_supermounts_if_necessary(); // for Mandrake users whose CD-ROMs are supermounted 114 // stop_autofs_if_necessary(); // for Xandros users115 115 mount_boot_if_necessary(); // for Gentoo users with non-mounted /boot partitions 116 116 clean_up_KDE_desktop_if_necessary(); // delete various misc ~/.* files that get in the way 117 117 } 118 119 118 120 119 … … 124 123 void distro_specific_kludges_at_end_of_mondoarchive(void) 125 124 { 126 // char tmp[500];127 125 mr_msg(2, "Restarting magicdev if necessary"); 128 126 sync(); 129 127 restart_magicdev_if_necessary(); // for RH+Gnome users 130 128 131 mr_msg(2, "Restarting autofs if necessary");132 sync();133 // restart_autofs_if_necessary(); // for Xandros users134 135 129 mr_msg(2, "Restarting supermounts if necessary"); 136 130 sync(); … … 140 134 sync(); 141 135 unmount_boot_if_necessary(); // for Gentoo users 142 143 // mr_msg( 2, "Cleaning up KDE desktop");144 // clean_up_KDE_desktop_if_necessary();145 136 } 146 137 … … 158 149 struct stat stbuf; 159 150 char *tmp = NULL; 160 int res, retval; 161 char *say_at_end; 162 151 int res = 0; 152 int retval = 0; 153 char *say_at_end = NULL; 154 155 #ifdef ENABLE_NLS 156 setlocale(LC_ALL, ""); 157 (void) textdomain("mondo"); 158 #endif 163 159 /* Make sure I'm root; abort if not */ 164 160 if (getuid() != 0) { 165 fprintf(stderr, "Please run as root.\r\n");161 fprintf(stderr, _("Please run as root.\n")); 166 162 exit(127); 167 163 } 168 164 169 /* If -V, -v or --version then echo version no. and quit */165 /* If -V, -v or --version then echo version no. and quit */ 170 166 if (argc == 2 171 167 && (!strcmp(argv[argc - 1], "-v") || !strcmp(argv[argc - 1], "-V") 172 168 || !strcmp(argv[argc - 1], "--version"))) { 173 printf( "mondoarchive v%s\nSee man page for help\n", PACKAGE_VERSION);169 printf(_("mondoarchive v%s\nSee man page for help\n"), PACKAGE_VERSION); 174 170 exit(0); 175 171 } 176 172 177 /* Initialize variables */ 178 173 /* Initialize variables */ 179 174 malloc_libmondo_global_strings(); 180 malloc_string(say_at_end);181 175 182 176 res = 0; 183 177 retval = 0; 184 178 diffs = 0; 185 say_at_end[0] = '\0'; 186 printf("Initializing...\n"); 179 printf(_("Initializing...\n")); 187 180 188 181 /* initialize log file with time stamp */ … … 225 218 setup_newt_stuff(); 226 219 if (!strstr(argv[2], "filelist")) { 227 printf("Sorry - filelist goes first\n");220 mr_msg(1,_("Sorry - filelist goes first\n")); 228 221 finish(1); 229 222 } else { … … 255 248 setup_newt_stuff(); 256 249 if (!strstr(argv[2], "filelist")) { 257 printf("Sorry - filelist goes first\n");250 mr_msg(1,_("Sorry - filelist goes first\n")); 258 251 finish(1); 259 252 } else { … … 275 268 malloc_string(tmp); 276 269 if (find_cdrw_device(tmp)) { 277 printf("Failed to find CDR-RW drive\n");278 } else { 279 printf("CD-RW is at %s\n", tmp);270 mr_msg(1,_("Failed to find CDR-RW drive\n")); 271 } else { 272 mr_msg(1,_("CD-RW is at %s\n"), tmp); 280 273 } 281 274 tmp[0] = '\0'; 282 275 if (find_cdrom_device(tmp, atoi(argv[2]))) { 283 printf("Failed to find CD-ROM drive\n");284 } else { 285 printf("CD-ROM is at %s\n", tmp);276 mr_msg(1,_("Failed to find CD-ROM drive\n")); 277 } else { 278 mr_msg(1,_("CD-ROM is at %s\n"), tmp); 286 279 } 287 280 mr_free(tmp); … … 295 288 malloc_string(tmp); 296 289 if (find_dvd_device(tmp, atoi(argv[2]))) { 297 printf("Failed to find DVD drive\n");298 } else { 299 printf("DVD is at %s\n", tmp);290 mr_msg(1,_("Failed to find DVD drive\n")); 291 } else { 292 mr_msg(1,_("DVD is at %s\n"), tmp); 300 293 } 301 294 mr_free(tmp); … … 309 302 if (argc > 2 && !strcmp(argv[1], "test-dev")) { 310 303 if (is_dev_an_NTFS_dev(argv[2])) { 311 printf("%s is indeed an NTFS dev\n", argv[2]);312 } else { 313 printf("%s is _not_ an NTFS dev\n", argv[2]);304 mr_msg(1,_("%s is indeed an NTFS dev\n"), argv[2]); 305 } else { 306 mr_msg(1,_("%s is _not_ an NTFS dev\n"), argv[2]); 314 307 } 315 308 finish(0); … … 335 328 res = handle_incoming_parameters(argc, argv, bkpinfo); 336 329 if (res) { 337 printf338 ("Errors were detected in the command line you supplied.\n");339 printf("Please review the log file - " MONDO_LOGFILE "\n");330 mr_msg(1, 331 _("Errors were detected in the command line you supplied.\n")); 332 mr_msg(1,_("Please review the log file - %s \n"),MONDO_LOGFILE); 340 333 mr_msg(1, "Mondoarchive will now exit."); 341 334 finish(1); … … 351 344 352 345 log_to_screen 353 ("BusyBox's sources are available from http://www.busybox.net"); 346 (_("BusyBox's sources are available from http://www.busybox.net")); 347 354 348 sprintf(g_erase_tmpdir_and_scratchdir, "rm -Rf %s %s", bkpinfo->tmpdir, 355 349 bkpinfo->scratchdir); … … 360 354 retval += res; 361 355 if (res) { 362 strcat(say_at_end,363 "Data archived. Please check the logs, just as a precaution. ");364 } else { 365 strcat(say_at_end, "Data archived OK. ");366 } 367 } 368 369 /* If we're meant to verify then verify */356 mr_strcat(say_at_end, 357 _("Data archived. Please check the logs, just as a precaution. ")); 358 } else { 359 mr_strcat(say_at_end, _("Data archived OK. ")); 360 } 361 } 362 363 /* If we're meant to verify then verify */ 370 364 if (bkpinfo->verify_data) { 371 365 res = verify_data(bkpinfo); 372 366 if (res < 0) { 373 mr_ asprintf(&tmp, "%d difference%c found.", -res,367 mr_strcat(say_at_end, _("%d difference%c found."), -res, 374 368 (-res != 1) ? 's' : ' '); 375 strcat(say_at_end, tmp);376 log_to_screen(tmp);377 mr_free(tmp);378 369 res = 0; 379 370 } … … 381 372 } 382 373 383 /* Offer to write floppy disk images to physical disks */374 /* Offer to write floppy disk images to physical disks */ 384 375 if (bkpinfo->backup_data && !g_skip_floppies) { 385 376 res = offer_to_write_boot_floppies_to_physical_disks(bkpinfo); 386 377 retval += res; 387 // res = offer_to_write_boot_ISO_to_physical_CD(bkpinfo); 388 // retval += res; 389 } 390 391 /* Report result of entire operation (success? errors?) */ 378 } 379 380 /* Report result of entire operation (success? errors?) */ 392 381 if (!retval) { 393 382 mvaddstr_and_log_it(g_currentY++, 0, 394 "Backup and/or verify ran to completion. Everything appears to be fine.");383 _("Backup and/or verify ran to completion. Everything appears to be fine.")); 395 384 } else { 396 385 mvaddstr_and_log_it(g_currentY++, 0, 397 "Backup and/or verify ran to completion. However, errors did occur.");386 _("Backup and/or verify ran to completion. However, errors did occur.")); 398 387 } 399 388 400 389 if (does_file_exist("/var/cache/mindi/mondorescue.iso")) { 401 390 log_to_screen 402 ( "/var/cache/mindi/mondorescue.iso, a boot/utility CD, is available if you want it.");391 (_("/var/cache/mindi/mondorescue.iso, a boot/utility CD, is available if you want it.")); 403 392 } 404 393 … … 407 396 if (g_text_mode) { 408 397 log_to_screen 409 ( "Type 'less /tmp/changed.files' to see which files don't match the archives");398 (_("Type 'less /tmp/changed.files' to see which files don't match the archives")); 410 399 } else { 411 400 mr_msg(1, 412 "Type 'less /tmp/changed.files' to see which files don't match the archives");401 _("Type 'less /tmp/changed.files' to see which files don't match the archives")); 413 402 mr_msg(2, "Calling popup_changelist_from_file()"); 414 403 popup_changelist_from_file("/tmp/changed.files"); … … 419 408 } 420 409 log_to_screen(say_at_end); 410 mr_free(say_at_end); 411 421 412 mr_asprintf(&tmp, "umount %s/tmpfs", bkpinfo->tmpdir); 422 413 run_program_and_log_output(tmp, TRUE); … … 429 420 system("rm -Rf /tmp.mondo.* /mondo.scratch.*"); 430 421 if (!retval) { 431 printf( "Mondoarchive ran OK.\n");422 printf(_("Mondoarchive ran OK.\n")); 432 423 } else { 433 printf( "Errors occurred during backup. Please check logfile.\n");424 printf(_("Errors occurred during backup. Please check logfile.\n")); 434 425 } 435 426 distro_specific_kludges_at_end_of_mondoarchive(); … … 439 430 system(g_erase_tmpdir_and_scratchdir); 440 431 free_libmondo_global_strings(); 441 mr_free(say_at_end);442 432 mr_free(bkpinfo); 443 433 … … 453 443 454 444 /* finalize log file with time stamp */ 455 mr_msg( 0, "Time finished: %s", mr_date());445 mr_msg(1, "Time finished: %s", mr_date()); 456 446 mr_msg_close(); 457 447 458 448 if (!g_text_mode) { 459 449 popup_and_OK 460 ( "Mondo Archive has finished its run. Please press ENTER to return to the shell prompt.");461 log_to_screen( "See %s for details of backup run.", MONDO_LOGFILE);450 (_("Mondo Archive has finished its run. Please press ENTER to return to the shell prompt.")); 451 log_to_screen(_("See %s for details of backup run."), MONDO_LOGFILE); 462 452 finish(retval); 463 453 } else { 464 printf( "See %s for details of backup run.\n", MONDO_LOGFILE);454 printf(_("See %s for details of backup run.\n"), MONDO_LOGFILE); 465 455 exit(retval); 466 456 }
Note:
See TracChangeset
for help on using the changeset viewer.