[171] | 1 | /*
|
---|
| 2 | * $Id: main.c 932 2006-11-15 11:40:15Z bruno $
|
---|
[1] | 3 | * *
|
---|
| 4 | * This program is free software; you can redistribute it and/or modify *
|
---|
| 5 | * it under the terms of the GNU General Public License as published by *
|
---|
| 6 | * the Free Software Foundation; either version 2 of the License, or *
|
---|
| 7 | * (at your option) any later version. *
|
---|
| 8 | * *
|
---|
[171] | 9 | ***************************************************************************
|
---|
[1] | 10 | * The main file for mondoarchive.
|
---|
| 11 | */
|
---|
| 12 |
|
---|
| 13 | /************************* #include statements *************************/
|
---|
[142] | 14 | #ifndef S_SPLINT_S
|
---|
[1] | 15 | #include <pthread.h>
|
---|
[142] | 16 | #endif
|
---|
[1] | 17 | #include <stdio.h>
|
---|
| 18 | #include <stdlib.h>
|
---|
[783] | 19 | #include "my-stuff.h"
|
---|
[1] | 20 | #include "../common/mondostructures.h"
|
---|
| 21 | #include "../common/libmondo.h"
|
---|
| 22 | #include "mondo-cli-EXT.h"
|
---|
| 23 |
|
---|
[900] | 24 | #include "mr_mem.h"
|
---|
| 25 |
|
---|
[1] | 26 | // for CVS
|
---|
[59] | 27 | //static char cvsid[] = "$Id: main.c 932 2006-11-15 11:40:15Z bruno $";
|
---|
[1] | 28 |
|
---|
| 29 | /************************* external variables *************************/
|
---|
| 30 | extern void set_signals(int);
|
---|
| 31 | extern int g_current_media_number;
|
---|
[59] | 32 | extern void register_pid(pid_t, char *);
|
---|
[1] | 33 | extern int g_currentY;
|
---|
| 34 | extern bool g_text_mode;
|
---|
| 35 | extern bool g_remount_cdrom_at_end, g_remount_floppy_at_end;
|
---|
| 36 | extern char *g_mondo_home;
|
---|
| 37 | extern char *g_erase_tmpdir_and_scratchdir;
|
---|
| 38 | extern double g_kernel_version;
|
---|
| 39 |
|
---|
| 40 | /***************** global vars, used only by main.c ******************/
|
---|
| 41 | bool g_skip_floppies;
|
---|
| 42 | long diffs;
|
---|
[794] | 43 | char *ps_options = "auxww";
|
---|
[932] | 44 | char *ps_proc_id = "$2";
|
---|
[1] | 45 |
|
---|
| 46 | extern int g_loglevel;
|
---|
| 47 |
|
---|
| 48 | /****************** subroutines used only by main.c ******************/
|
---|
| 49 |
|
---|
[783] | 50 | extern void mr_archive_init_conf(struct s_mr_conf *mr_conf);
|
---|
[1] | 51 |
|
---|
| 52 | /**
|
---|
| 53 | * Print a "don't panic" message to the log and a message about the logfile to the screen.
|
---|
| 54 | */
|
---|
| 55 | void welcome_to_mondoarchive()
|
---|
| 56 | {
|
---|
[59] | 57 | log_msg(0, "Mondo Archive v%s --- http://www.mondorescue.org",
|
---|
[252] | 58 | PACKAGE_VERSION);
|
---|
[59] | 59 | log_msg(0, "running on %s architecture", get_architecture());
|
---|
| 60 | log_msg(0,
|
---|
| 61 | "-----------------------------------------------------------");
|
---|
| 62 | log_msg(0,
|
---|
| 63 | "NB: Mondo logs almost everything, so don't panic if you see");
|
---|
| 64 | log_msg(0,
|
---|
| 65 | "some error messages. Please read them carefully before you");
|
---|
| 66 | log_msg(0,
|
---|
| 67 | "decide to break out in a cold sweat. Despite (or perhaps");
|
---|
| 68 | log_msg(0,
|
---|
| 69 | "because of) the wealth of messages. some users are inclined");
|
---|
| 70 | log_msg(0,
|
---|
| 71 | "to stop reading this log. If Mondo stopped for some reason,");
|
---|
| 72 | log_msg(0,
|
---|
| 73 | "chances are it's detailed here. More than likely there's a");
|
---|
| 74 | log_msg(0,
|
---|
| 75 | "message at the very end of this log that will tell you what");
|
---|
| 76 | log_msg(0,
|
---|
| 77 | "is wrong. Please read it! -Devteam");
|
---|
| 78 | log_msg(0,
|
---|
| 79 | "-----------------------------------------------------------");
|
---|
[1] | 80 |
|
---|
[59] | 81 | log_msg(0, "Zero...");
|
---|
| 82 | log_msg(1, "One...");
|
---|
| 83 | log_msg(2, "Two...");
|
---|
| 84 | log_msg(3, "Three...");
|
---|
| 85 | log_msg(4, "Four...");
|
---|
| 86 | log_msg(5, "Five...");
|
---|
| 87 | log_msg(6, "Six...");
|
---|
| 88 | log_msg(7, "Seven...");
|
---|
| 89 | log_msg(8, "Eight...");
|
---|
| 90 | printf("See %s for details of backup run.\n", MONDO_LOGFILE);
|
---|
[1] | 91 | }
|
---|
| 92 |
|
---|
| 93 |
|
---|
| 94 | /**
|
---|
| 95 | * Do whatever is necessary to insure a successful backup on the Linux distribution
|
---|
| 96 | * of the day.
|
---|
| 97 | */
|
---|
| 98 | void distro_specific_kludges_at_start_of_mondoarchive()
|
---|
| 99 | {
|
---|
[59] | 100 | log_msg(2, "Unmounting old ramdisks if necessary");
|
---|
| 101 | stop_magicdev_if_necessary(); // for RH+Gnome users
|
---|
| 102 | run_program_and_log_output
|
---|
| 103 | ("umount `mount | grep shm | grep mondo | cut -d' ' -f3`", 2);
|
---|
| 104 | unmount_supermounts_if_necessary(); // for Mandrake users whose CD-ROMs are supermounted
|
---|
| 105 | mount_boot_if_necessary(); // for Gentoo users with non-mounted /boot partitions
|
---|
| 106 | clean_up_KDE_desktop_if_necessary(); // delete various misc ~/.* files that get in the way
|
---|
[1] | 107 | }
|
---|
| 108 |
|
---|
| 109 |
|
---|
| 110 | /**
|
---|
| 111 | * Undo whatever was done by distro_specific_kludges_at_start_of_mondoarchive().
|
---|
| 112 | */
|
---|
| 113 | void distro_specific_kludges_at_end_of_mondoarchive()
|
---|
| 114 | {
|
---|
[59] | 115 | log_msg(2, "Restarting magicdev if necessary");
|
---|
| 116 | sync();
|
---|
| 117 | restart_magicdev_if_necessary(); // for RH+Gnome users
|
---|
[1] | 118 |
|
---|
[59] | 119 | log_msg(2, "Restarting supermounts if necessary");
|
---|
| 120 | sync();
|
---|
| 121 | remount_supermounts_if_necessary(); // for Mandrake users
|
---|
[1] | 122 |
|
---|
[59] | 123 | log_msg(2, "Unmounting /boot if necessary");
|
---|
| 124 | sync();
|
---|
| 125 | unmount_boot_if_necessary(); // for Gentoo users
|
---|
[1] | 126 | }
|
---|
| 127 |
|
---|
[815] | 128 | /* Return a string containing the date */
|
---|
| 129 | char *mr_date(void) {
|
---|
| 130 |
|
---|
| 131 | time_t tcurr;
|
---|
[1] | 132 |
|
---|
[815] | 133 | tcurr = time(NULL);
|
---|
| 134 | return(ctime(&tcurr));
|
---|
| 135 | }
|
---|
| 136 |
|
---|
| 137 | /*-----------------------------------------------------------*/
|
---|
| 138 |
|
---|
| 139 |
|
---|
| 140 |
|
---|
[1] | 141 | /**
|
---|
| 142 | * Backup/verify the user's data.
|
---|
| 143 | * What did you think it did, anyway? :-)
|
---|
| 144 | */
|
---|
[59] | 145 | int main(int argc, char *argv[])
|
---|
[1] | 146 | {
|
---|
[59] | 147 | struct s_bkpinfo *bkpinfo;
|
---|
| 148 | char *tmp;
|
---|
[171] | 149 | int res = 0;
|
---|
| 150 | int retval = 0;
|
---|
| 151 | char *say_at_end = NULL;
|
---|
[1] | 152 |
|
---|
[507] | 153 | #ifdef ENABLE_NLS
|
---|
| 154 | setlocale(LC_ALL, "");
|
---|
| 155 | (void) textdomain("mondo");
|
---|
| 156 | #endif
|
---|
[1] | 157 | /* Make sure I'm root; abort if not */
|
---|
[59] | 158 | if (getuid() != 0) {
|
---|
[507] | 159 | fprintf(stderr, _("Please run as root.\n"));
|
---|
[59] | 160 | exit(127);
|
---|
| 161 | }
|
---|
[1] | 162 |
|
---|
[783] | 163 | /* If -V, -v or --version then echo version no. and quit */
|
---|
[59] | 164 | if (argc == 2
|
---|
| 165 | && (!strcmp(argv[argc - 1], "-v") || !strcmp(argv[argc - 1], "-V")
|
---|
| 166 | || !strcmp(argv[argc - 1], "--version"))) {
|
---|
[507] | 167 | printf(_("mondoarchive v%s\nSee man page for help\n"), PACKAGE_VERSION);
|
---|
[59] | 168 | exit(0);
|
---|
| 169 | }
|
---|
[1] | 170 |
|
---|
[783] | 171 | /* Initialize variables */
|
---|
[59] | 172 | malloc_libmondo_global_strings();
|
---|
[1] | 173 |
|
---|
[539] | 174 | res = 0;
|
---|
| 175 | retval = 0;
|
---|
[59] | 176 | diffs = 0;
|
---|
[507] | 177 | printf(_("Initializing...\n"));
|
---|
[59] | 178 | if (!(bkpinfo = malloc(sizeof(struct s_bkpinfo)))) {
|
---|
| 179 | fatal_error("Cannot malloc bkpinfo");
|
---|
| 180 | }
|
---|
[1] | 181 |
|
---|
[783] | 182 | /* Initialize Configuration Structure */
|
---|
| 183 | mr_archive_init_conf(bkpinfo->mr_conf);
|
---|
[1] | 184 |
|
---|
[815] | 185 | /* initialize log file with time stamp */
|
---|
| 186 | unlink(MONDO_LOGFILE);
|
---|
| 187 | log_msg(0, "Time started: %s", mr_date());
|
---|
| 188 |
|
---|
[783] | 189 | /* make sure PATH environmental variable allows access to mkfs, fdisk, etc. */
|
---|
[900] | 190 | mr_asprintf(&tmp, "/sbin:/usr/sbin:%s:/usr/local/sbin", getenv("PATH"));
|
---|
[59] | 191 | setenv("PATH", tmp, 1);
|
---|
[900] | 192 | mr_free(tmp);
|
---|
[1] | 193 |
|
---|
[783] | 194 | /* Add the ARCH environment variable for ia64 purposes */
|
---|
[171] | 195 | setenv("ARCH", get_architecture(), 1);
|
---|
[1] | 196 |
|
---|
[426] | 197 | /* Add MONDO_SHARE environment variable for mindi */
|
---|
| 198 | setenv_mondo_share();
|
---|
[262] | 199 |
|
---|
[808] | 200 | /* Configure the bkpinfo structure, global file paths, etc. */
|
---|
[59] | 201 | g_main_pid = getpid();
|
---|
| 202 | log_msg(9, "This");
|
---|
[1] | 203 |
|
---|
[59] | 204 | register_pid(g_main_pid, "mondo");
|
---|
| 205 | set_signals(TRUE); // catch SIGTERM, etc.
|
---|
[94] | 206 | run_program_and_log_output("date", 1);
|
---|
[59] | 207 | run_program_and_log_output("dmesg -n1", TRUE);
|
---|
[1] | 208 |
|
---|
[59] | 209 | log_msg(9, "Next");
|
---|
| 210 | welcome_to_mondoarchive();
|
---|
| 211 | distro_specific_kludges_at_start_of_mondoarchive();
|
---|
[87] | 212 | // BERLIOS : too early, bkpinfo is not initialized ??
|
---|
[688] | 213 | //s-printf(g_erase_tmpdir_and_scratchdir, "rm -Rf %s %s", bkpinfo->tmpdir, bkpinfo->scratchdir);
|
---|
[59] | 214 | g_kernel_version = get_kernel_version();
|
---|
[1] | 215 |
|
---|
[59] | 216 | if (argc == 4 && !strcmp(argv[1], "getfattr")) {
|
---|
| 217 | g_loglevel = 10;
|
---|
| 218 | g_text_mode = TRUE;
|
---|
| 219 | setup_newt_stuff();
|
---|
| 220 | if (!strstr(argv[2], "filelist")) {
|
---|
[507] | 221 | printf(_("Sorry - filelist goes first\n"));
|
---|
[59] | 222 | finish(1);
|
---|
| 223 | } else {
|
---|
| 224 | finish(get_fattr_list(argv[2], argv[3]));
|
---|
| 225 | }
|
---|
| 226 | finish(0);
|
---|
[1] | 227 | }
|
---|
[59] | 228 | if (argc == 4 && !strcmp(argv[1], "setfattr")) {
|
---|
| 229 | g_loglevel = 10;
|
---|
| 230 | g_text_mode = TRUE;
|
---|
| 231 | setup_newt_stuff();
|
---|
| 232 | finish(set_fattr_list(argv[2], argv[3]));
|
---|
[1] | 233 | }
|
---|
[59] | 234 |
|
---|
| 235 | if (argc == 3 && !strcmp(argv[1], "wildcards")) {
|
---|
| 236 | g_loglevel = 10;
|
---|
| 237 | g_text_mode = TRUE;
|
---|
| 238 | setup_newt_stuff();
|
---|
| 239 | turn_wildcard_chars_into_literal_chars(tmp, argv[2]);
|
---|
| 240 | printf("in=%s; out=%s\n", argv[2], tmp);
|
---|
[900] | 241 | mr_free(tmp);
|
---|
[59] | 242 | finish(1);
|
---|
[1] | 243 | }
|
---|
[59] | 244 |
|
---|
| 245 | if (argc == 4 && !strcmp(argv[1], "getfacl")) {
|
---|
| 246 | g_loglevel = 10;
|
---|
| 247 | g_text_mode = TRUE;
|
---|
| 248 | setup_newt_stuff();
|
---|
| 249 | if (!strstr(argv[2], "filelist")) {
|
---|
[507] | 250 | printf(_("Sorry - filelist goes first\n"));
|
---|
[59] | 251 | finish(1);
|
---|
| 252 | } else {
|
---|
| 253 | finish(get_acl_list(argv[2], argv[3]));
|
---|
| 254 | }
|
---|
| 255 | finish(0);
|
---|
| 256 | }
|
---|
| 257 | if (argc == 4 && !strcmp(argv[1], "setfacl")) {
|
---|
| 258 | g_loglevel = 10;
|
---|
| 259 | g_text_mode = TRUE;
|
---|
| 260 | setup_newt_stuff();
|
---|
| 261 | finish(set_acl_list(argv[2], argv[3]));
|
---|
| 262 | }
|
---|
[1] | 263 |
|
---|
[59] | 264 | if (argc > 2 && !strcmp(argv[1], "find-cd")) {
|
---|
| 265 | g_loglevel = 10;
|
---|
| 266 | g_text_mode = TRUE;
|
---|
| 267 | setup_newt_stuff();
|
---|
[171] | 268 | if ((tmp = find_cdrw_device()) == NULL) {
|
---|
[507] | 269 | printf(_("Failed to find CDR-RW drive\n"));
|
---|
[59] | 270 | } else {
|
---|
[507] | 271 | printf(_("CD-RW is at %s\n"), tmp);
|
---|
[59] | 272 | }
|
---|
[900] | 273 | mr_free(tmp);
|
---|
[171] | 274 |
|
---|
| 275 | if ((tmp = find_cdrom_device(FALSE)) == NULL) {
|
---|
[507] | 276 | printf(_("Failed to find CD-ROM drive\n"));
|
---|
[59] | 277 | } else {
|
---|
[507] | 278 | printf(_("CD-ROM is at %s\n"), tmp);
|
---|
[59] | 279 | }
|
---|
[900] | 280 | mr_free(tmp);
|
---|
[59] | 281 | finish(0);
|
---|
| 282 | }
|
---|
[1] | 283 |
|
---|
[59] | 284 | if (argc > 2 && !strcmp(argv[1], "find-dvd")) {
|
---|
| 285 | g_loglevel = 10;
|
---|
| 286 | g_text_mode = TRUE;
|
---|
| 287 | setup_newt_stuff();
|
---|
[171] | 288 | if ((tmp = find_dvd_device()) == NULL) {
|
---|
[507] | 289 | printf(_("Failed to find DVD drive\n"));
|
---|
[59] | 290 | } else {
|
---|
[507] | 291 | printf(_("DVD is at %s\n"), tmp);
|
---|
[59] | 292 | }
|
---|
[900] | 293 | mr_free(tmp);
|
---|
[59] | 294 | finish(0);
|
---|
| 295 | }
|
---|
[1] | 296 |
|
---|
[59] | 297 | if (argc > 2 && !strcmp(argv[1], "disksize")) {
|
---|
| 298 | printf("%s --> %ld\n", argv[2], get_phys_size_of_drive(argv[2]));
|
---|
| 299 | finish(0);
|
---|
| 300 | }
|
---|
| 301 | if (argc > 2 && !strcmp(argv[1], "test-dev")) {
|
---|
| 302 | if (is_dev_an_NTFS_dev(argv[2])) {
|
---|
[507] | 303 | printf(_("%s is indeed an NTFS dev\n"), argv[2]);
|
---|
[59] | 304 | } else {
|
---|
[507] | 305 | printf(_("%s is _not_ an NTFS dev\n"), argv[2]);
|
---|
[59] | 306 | }
|
---|
| 307 | finish(0);
|
---|
| 308 | }
|
---|
| 309 |
|
---|
| 310 | if (pre_param_configuration(bkpinfo)) {
|
---|
| 311 | fatal_error
|
---|
| 312 | ("Pre-param initialization phase failed. Please review the error messages above, make the specified changes, then try again. Exiting...");
|
---|
| 313 | }
|
---|
| 314 |
|
---|
[1] | 315 | /* Process command line, if there is one. If not, ask user for info. */
|
---|
[59] | 316 | if (argc == 1) {
|
---|
| 317 | g_text_mode = FALSE;
|
---|
| 318 | setup_newt_stuff();
|
---|
| 319 | res = interactively_obtain_media_parameters_from_user(bkpinfo, TRUE); /* yes, archiving */
|
---|
| 320 | if (res) {
|
---|
| 321 | fatal_error
|
---|
| 322 | ("Syntax error. Please review the parameters you have supplied and try again.");
|
---|
| 323 | }
|
---|
| 324 | } else {
|
---|
| 325 | res = handle_incoming_parameters(argc, argv, bkpinfo);
|
---|
| 326 | if (res) {
|
---|
| 327 | printf
|
---|
[507] | 328 | (_("Errors were detected in the command line you supplied.\n"));
|
---|
| 329 | printf(_("Please review the log file - %s \n"),MONDO_LOGFILE);
|
---|
[59] | 330 | log_msg(1, "Mondoarchive will now exit.");
|
---|
| 331 | finish(1);
|
---|
| 332 | }
|
---|
| 333 | setup_newt_stuff();
|
---|
[1] | 334 | }
|
---|
| 335 |
|
---|
| 336 | /* Finish configuring global structures */
|
---|
[59] | 337 | if (post_param_configuration(bkpinfo)) {
|
---|
| 338 | fatal_error
|
---|
| 339 | ("Post-param initialization phase failed. Perhaps bad parameters were supplied to mondoarchive? Please review the documentation, error messages and logs. Exiting...");
|
---|
| 340 | }
|
---|
[1] | 341 |
|
---|
[59] | 342 | log_to_screen
|
---|
[507] | 343 | (_("BusyBox's sources are available from http://www.busybox.net"));
|
---|
[1] | 344 |
|
---|
[59] | 345 | /* If we're meant to backup then backup */
|
---|
| 346 | if (bkpinfo->backup_data) {
|
---|
[783] | 347 | res = backup_data(bkpinfo);
|
---|
[59] | 348 | retval += res;
|
---|
| 349 | if (res) {
|
---|
[900] | 350 | mr_asprintf(&say_at_end,
|
---|
[507] | 351 | _("Data archived. Please check the logs, just as a precaution. "));
|
---|
[59] | 352 | } else {
|
---|
[900] | 353 | mr_asprintf(&say_at_end, _("Data archived OK. "));
|
---|
[59] | 354 | }
|
---|
| 355 | }
|
---|
[1] | 356 |
|
---|
| 357 | /* If we're meant to verify then verify */
|
---|
[59] | 358 | if (bkpinfo->verify_data) {
|
---|
| 359 | res = verify_data(bkpinfo);
|
---|
| 360 | if (res < 0) {
|
---|
[900] | 361 | mr_asprintf(&say_at_end, _("%d difference%c found."), -res,
|
---|
[59] | 362 | (-res != 1) ? 's' : ' ');
|
---|
| 363 | res = 0;
|
---|
| 364 | }
|
---|
| 365 | retval += res;
|
---|
| 366 | }
|
---|
[1] | 367 |
|
---|
[171] | 368 | /* Offer to write floppy disk images to physical disks */
|
---|
[59] | 369 | if (bkpinfo->backup_data && !g_skip_floppies) {
|
---|
| 370 | res = offer_to_write_boot_floppies_to_physical_disks(bkpinfo);
|
---|
| 371 | retval += res;
|
---|
| 372 | }
|
---|
[1] | 373 |
|
---|
[171] | 374 | /* Report result of entire operation (success? errors?) */
|
---|
| 375 | if (retval == 0) {
|
---|
[59] | 376 | mvaddstr_and_log_it(g_currentY++, 0,
|
---|
[507] | 377 | _("Backup and/or verify ran to completion. Everything appears to be fine."));
|
---|
[59] | 378 | } else {
|
---|
| 379 | mvaddstr_and_log_it(g_currentY++, 0,
|
---|
[507] | 380 | _("Backup and/or verify ran to completion. However, errors did occur."));
|
---|
[59] | 381 | }
|
---|
[1] | 382 |
|
---|
[539] | 383 | if (does_file_exist("/var/cache/mindi/mondorescue.iso")) {
|
---|
[59] | 384 | log_to_screen
|
---|
[539] | 385 | (_("/var/cache/mindi/mondorescue.iso, a boot/utility CD, is available if you want it."));
|
---|
[59] | 386 | }
|
---|
[1] | 387 |
|
---|
| 388 |
|
---|
[59] | 389 | if (length_of_file("/tmp/changed.files") > 2) {
|
---|
| 390 | if (g_text_mode) {
|
---|
| 391 | log_to_screen
|
---|
[507] | 392 | (_("Type 'less /tmp/changed.files' to see which files don't match the archives"));
|
---|
[59] | 393 | } else {
|
---|
| 394 | log_msg(1,
|
---|
[507] | 395 | _("Type 'less /tmp/changed.files' to see which files don't match the archives"));
|
---|
[59] | 396 | log_msg(2, "Calling popup_changelist_from_file()");
|
---|
| 397 | popup_changelist_from_file("/tmp/changed.files");
|
---|
| 398 | log_msg(2, "Returned from popup_changelist_from_file()");
|
---|
| 399 | }
|
---|
| 400 | } else {
|
---|
| 401 | unlink("/tmp/changed.files");
|
---|
| 402 | }
|
---|
| 403 | log_to_screen(say_at_end);
|
---|
[900] | 404 | mr_free(say_at_end);
|
---|
[171] | 405 |
|
---|
[900] | 406 | mr_asprintf(&tmp, "umount %s/tmpfs", bkpinfo->tmpdir);
|
---|
[59] | 407 | run_program_and_log_output(tmp, TRUE);
|
---|
[900] | 408 | mr_free(tmp);
|
---|
[171] | 409 |
|
---|
[900] | 410 | mr_asprintf(&g_erase_tmpdir_and_scratchdir, "rm -Rf %s %s", bkpinfo->tmpdir,
|
---|
[171] | 411 | bkpinfo->scratchdir);
|
---|
[59] | 412 | run_program_and_log_output(g_erase_tmpdir_and_scratchdir, TRUE);
|
---|
[1] | 413 |
|
---|
[59] | 414 | run_program_and_log_output("mount", 2);
|
---|
[1] | 415 |
|
---|
[59] | 416 | system("rm -f /var/cache/mondo-archive/last-backup.aborted");
|
---|
[688] | 417 | system("rm -Rf /mondo.tmp* /mondo.scratch.*");
|
---|
[171] | 418 | if (retval == 0) {
|
---|
[507] | 419 | printf(_("Mondoarchive ran OK.\n"));
|
---|
[59] | 420 | } else {
|
---|
[507] | 421 | printf(_("Errors occurred during backup. Please check logfile.\n"));
|
---|
[59] | 422 | }
|
---|
| 423 | distro_specific_kludges_at_end_of_mondoarchive();
|
---|
| 424 | register_pid(0, "mondo");
|
---|
| 425 | set_signals(FALSE);
|
---|
| 426 | chdir("/tmp"); // just in case there's something wrong with g_erase_tmpdir_and_scratchdir
|
---|
| 427 | system(g_erase_tmpdir_and_scratchdir);
|
---|
| 428 | free_libmondo_global_strings();
|
---|
[900] | 429 | mr_free((void *)bkpinfo);
|
---|
[1] | 430 |
|
---|
[59] | 431 | unlink("/tmp/filelist.full");
|
---|
| 432 | unlink("/tmp/filelist.full.gz");
|
---|
[1] | 433 |
|
---|
[94] | 434 | run_program_and_log_output("date", 1);
|
---|
| 435 |
|
---|
[815] | 436 | /* finalize log file with time stamp */
|
---|
| 437 | log_msg(0, "Time finished: %s", mr_date());
|
---|
| 438 |
|
---|
[59] | 439 | if (!g_text_mode) {
|
---|
| 440 | popup_and_OK
|
---|
[507] | 441 | (_("Mondo Archive has finished its run. Please press ENTER to return to the shell prompt."));
|
---|
| 442 | log_to_screen(_("See %s for details of backup run."), MONDO_LOGFILE);
|
---|
[59] | 443 | finish(retval);
|
---|
| 444 | } else {
|
---|
[507] | 445 | printf(_("See %s for details of backup run.\n"), MONDO_LOGFILE);
|
---|
[59] | 446 | exit(retval);
|
---|
| 447 | }
|
---|
| 448 |
|
---|
| 449 | return EXIT_SUCCESS;
|
---|
[1] | 450 | }
|
---|