- Timestamp:
- Feb 20, 2007, 3:03:55 AM (18 years ago)
- Location:
- trunk/mondo/src/mondoarchive
- Files:
-
- 3 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/mondo/src/mondoarchive/Makefile.am
r1079 r1188 1 ## $Id$2 1 ## 3 2 ## $Id$ … … 5 4 ## Process with Automake to generate Makefile.in 6 5 ## 7 AM_CPPFLAGS = -DMONDO_CONF_DIR=\"$(sysconfdir)\" -I${top_builddir}/src/include 6 AM_CPPFLAGS = -DMONDO_CONF_DIR=\"$(sysconfdir)\" -I${top_builddir}/src/include -I${top_builddir}/src/common 8 7 9 8 ## Headers … … 12 11 ## The program 13 12 sbin_PROGRAMS = mondoarchive 14 mondoarchive_SOURCES = m ain.c mondo-cli.c13 mondoarchive_SOURCES = mondoarchive.c mondo-cli.c 15 14 mondoarchive_LDADD = ${top_builddir}/src/common/libmondo.a ${top_builddir}/src/lib/libmr.a -
trunk/mondo/src/mondoarchive/mondo-cli-EXT.h
r171 r1188 11 11 *flag_val[128], 12 12 bool flag_set[128]); 13 extern void help_screen( );13 extern void help_screen(void); 14 14 extern void terminate_daemon(int sig); 15 15 extern void set_signals(int on); -
trunk/mondo/src/mondoarchive/mondo-cli.c
r1086 r1188 11 11 12 12 #include "my-stuff.h" 13 #include " ../common/mondostructures.h"13 #include "mondostructures.h" 14 14 #include "mondo-cli-EXT.h" 15 #include " ../common/libmondo.h"15 #include "libmondo.h" 16 16 #ifndef S_SPLINT_S 17 17 #include <pthread.h> 18 18 #endif 19 19 #include "mr_mem.h" 20 #include "mr_msg.h" 21 22 //static char cvsid[] = "$Id$"; 20 23 21 24 extern int g_loglevel; … … 23 26 extern bool g_skip_floppies; ///< Whether to skip the creation of boot disks 24 27 extern bool g_cd_recovery; 25 extern double g_kernel_version;26 extern char *resolve_softlinks_to_get_to_actual_device_file(char *);27 28 28 29 /** … … 63 64 int res = 0; 64 65 int retval = 0; 65 int i = 0, j ;66 int i = 0, j = 0; 66 67 67 68 /*@ buffers *************** */ 68 char *tmp ;69 char *tmp = NULL; 69 70 char *flag_val[128]; 70 71 bool flag_set[128]; … … 95 96 for (i = 0; i < 128; i++) { 96 97 if (flag_set[i]) { 97 mr_asprintf(&tmp, "-%c %s", i, flag_val[i]); 98 mr_msg(3, tmp); 99 mr_free(tmp); 98 mr_msg(3, "-%c %s", i, flag_val[i]); 100 99 } 101 100 } -
trunk/mondo/src/mondoarchive/mondoarchive.c
r1176 r1188 26 26 #include "mr_mem.h" 27 27 #include "mr_str.h" 28 #include "mr_msg.h" 28 29 #include "mr_file.h" 29 30 … … 57 58 * Print a "don't panic" message to the log and a message about the logfile to the screen. 58 59 */ 59 void welcome_to_mondoarchive( )60 void welcome_to_mondoarchive(void) 60 61 { 61 62 mr_msg(0, "Mondo Archive v%s --- http://www.mondorescue.org", … … 100 101 * of the day. 101 102 */ 102 void distro_specific_kludges_at_start_of_mondoarchive( )103 void distro_specific_kludges_at_start_of_mondoarchive(void) 103 104 { 104 105 mr_msg(2, "Unmounting old ramdisks if necessary"); … … 115 116 * Undo whatever was done by distro_specific_kludges_at_start_of_mondoarchive(). 116 117 */ 117 void distro_specific_kludges_at_end_of_mondoarchive( )118 void distro_specific_kludges_at_end_of_mondoarchive(void) 118 119 { 119 120 mr_msg(2, "Restarting magicdev if necessary"); … … 142 143 struct s_bkpinfo *bkpinfo; 143 144 struct stat stbuf; 144 char *tmp ;145 char *tmp = NULL; 145 146 int res = 0; 146 147 int retval = 0; … … 172 173 diffs = 0; 173 174 printf(_("Initializing...\n")); 174 bkpinfo = mr_malloc(sizeof(struct s_bkpinfo));175 176 /* Initialize Configuration Structure */177 mr_archive_init_conf(bkpinfo->mr_conf);178 175 179 176 /* initialize log file with time stamp */ … … 182 179 mr_msg(0, "Time started: %s", mr_date()); 183 180 184 /* make sure PATH environmental variable allows access to mkfs, fdisk, etc. */185 mr_asprintf(&tmp, "/sbin:/usr/sbin:%s:/usr/local/sbin", getenv("PATH")); 186 setenv("PATH", tmp, 1);187 mr_ free(tmp);181 bkpinfo = mr_malloc(sizeof(struct s_bkpinfo)); 182 183 /* Initialize Configuration Structure */ 184 mr_archive_init_conf(bkpinfo->mr_conf); 188 185 189 186 /* Add the ARCH environment variable for ia64 purposes */ … … 191 188 192 189 /* Add MONDO_SHARE + others environment variable for mindi */ 193 setenv_mondo_ share();190 setenv_mondo_var(); 194 191 195 192 if (stat(MONDO_CACHE, &stbuf) != 0) { 196 193 mr_mkdir(MONDO_CACHE,0x755); 197 194 } 195 196 /* BERLIOS: Hardcoded to be improved */ 197 unlink(MONDO_CACHE"/mindi.conf"); 198 unlink(MONDORESTORECFG); 198 199 199 200 /* Configure the bkpinfo structure, global file paths, etc. */ … … 203 204 register_pid(g_main_pid, "mondo"); 204 205 set_signals(TRUE); // catch SIGTERM, etc. 205 run_program_and_log_output("date", 1);206 206 run_program_and_log_output("dmesg -n1", TRUE); 207 207 … … 209 209 welcome_to_mondoarchive(); 210 210 distro_specific_kludges_at_start_of_mondoarchive(); 211 // BERLIOS : too early, bkpinfo is not initialized ??212 //s-printf(g_erase_tmpdir_and_scratchdir, "rm -Rf %s %s", bkpinfo->tmpdir, bkpinfo->scratchdir);213 211 g_kernel_version = get_kernel_version(); 214 212 … … 218 216 setup_newt_stuff(); 219 217 if (!strstr(argv[2], "filelist")) { 220 printf(_("Sorry - filelist goes first\n"));218 mr_msg(1,_("Sorry - filelist goes first\n")); 221 219 finish(1); 222 220 } else { … … 247 245 setup_newt_stuff(); 248 246 if (!strstr(argv[2], "filelist")) { 249 printf(_("Sorry - filelist goes first\n"));247 mr_msg(1,_("Sorry - filelist goes first\n")); 250 248 finish(1); 251 249 } else { … … 266 264 setup_newt_stuff(); 267 265 if ((tmp = find_cdrw_device()) == NULL) { 268 printf(_("Failed to find CDR-RW drive\n"));269 } else { 270 printf(_("CD-RW is at %s\n"), tmp);266 mr_msg(1,_("Failed to find CDR-RW drive\n")); 267 } else { 268 mr_msg(1,_("CD-RW is at %s\n"), tmp); 271 269 } 272 270 mr_free(tmp); 273 271 274 272 if ((tmp = find_cdrom_device(FALSE)) == NULL) { 275 printf(_("Failed to find CD-ROM drive\n"));276 } else { 277 printf(_("CD-ROM is at %s\n"), tmp);273 mr_msg(1,_("Failed to find CD-ROM drive\n")); 274 } else { 275 mr_msg(1,_("CD-ROM is at %s\n"), tmp); 278 276 } 279 277 mr_free(tmp); … … 286 284 setup_newt_stuff(); 287 285 if ((tmp = find_dvd_device()) == NULL) { 288 printf(_("Failed to find DVD drive\n"));289 } else { 290 printf(_("DVD is at %s\n"), tmp);286 mr_msg(1,_("Failed to find DVD drive\n")); 287 } else { 288 mr_msg(1,_("DVD is at %s\n"), tmp); 291 289 } 292 290 mr_free(tmp); … … 300 298 if (argc > 2 && !strcmp(argv[1], "test-dev")) { 301 299 if (is_dev_an_NTFS_dev(argv[2])) { 302 printf(_("%s is indeed an NTFS dev\n"), argv[2]);303 } else { 304 printf(_("%s is _not_ an NTFS dev\n"), argv[2]);300 mr_msg(1,_("%s is indeed an NTFS dev\n"), argv[2]); 301 } else { 302 mr_msg(1,_("%s is _not_ an NTFS dev\n"), argv[2]); 305 303 } 306 304 finish(0); … … 312 310 } 313 311 314 /* Process command line, if there is one. If not, ask user for info. */312 /* Process command line, if there is one. If not, ask user for info. */ 315 313 if (argc == 1) { 316 314 g_text_mode = FALSE; … … 324 322 res = handle_incoming_parameters(argc, argv, bkpinfo); 325 323 if (res) { 326 printf327 (_("Errors were detected in the command line you supplied.\n"));328 printf(_("Please review the log file - %s \n"),MONDO_LOGFILE);324 mr_msg(1, 325 _("Errors were detected in the command line you supplied.\n")); 326 mr_msg(1,_("Please review the log file - %s \n"),MONDO_LOGFILE); 329 327 mr_msg(1, "Mondoarchive will now exit."); 330 328 finish(1); … … 347 345 retval += res; 348 346 if (res) { 349 mr_ asprintf(&say_at_end,347 mr_strcat(say_at_end, 350 348 _("Data archived. Please check the logs, just as a precaution. ")); 351 349 } else { 352 mr_ asprintf(&say_at_end, _("Data archived OK. "));353 } 354 } 355 356 /* If we're meant to verify then verify */350 mr_strcat(say_at_end, _("Data archived OK. ")); 351 } 352 } 353 354 /* If we're meant to verify then verify */ 357 355 if (bkpinfo->verify_data) { 358 356 res = verify_data(bkpinfo); 359 357 if (res < 0) { 360 mr_ asprintf(&say_at_end, _("%d difference%c found."), -res,358 mr_strcat(say_at_end, _("%d difference%c found."), -res, 361 359 (-res != 1) ? 's' : ' '); 362 360 res = 0; … … 426 424 system(g_erase_tmpdir_and_scratchdir); 427 425 free_libmondo_global_strings(); 428 mr_free( (void *)bkpinfo);426 mr_free(bkpinfo); 429 427 430 428 unlink("/tmp/filelist.full"); 431 429 unlink("/tmp/filelist.full.gz"); 432 430 433 run_program_and_log_output("date", 1);434 431 435 432 /* finalize log file with time stamp */ 436 mr_msg(0, "Time finished: %s", mr_date()); 433 mr_msg(1, "Time finished: %s", mr_date()); 434 mr_msg_close(); 437 435 438 436 if (!g_text_mode) {
Note:
See TracChangeset
for help on using the changeset viewer.