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