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