Changeset 1188 in MondoRescue for trunk/mondo


Ignore:
Timestamp:
Feb 20, 2007, 3:03:55 AM (17 years ago)
Author:
Bruno Cornec
Message:

Stable merges again

Location:
trunk/mondo/src/mondoarchive
Files:
3 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/mondo/src/mondoarchive/Makefile.am

    r1079 r1188  
    1 ## $Id$
    21##
    32## $Id$
     
    54## Process with Automake to generate Makefile.in
    65##
    7 AM_CPPFLAGS = -DMONDO_CONF_DIR=\"$(sysconfdir)\" -I${top_builddir}/src/include
     6AM_CPPFLAGS = -DMONDO_CONF_DIR=\"$(sysconfdir)\" -I${top_builddir}/src/include -I${top_builddir}/src/common
    87
    98## Headers
     
    1211## The program
    1312sbin_PROGRAMS        = mondoarchive
    14 mondoarchive_SOURCES = main.c mondo-cli.c
     13mondoarchive_SOURCES = mondoarchive.c mondo-cli.c
    1514mondoarchive_LDADD   = ${top_builddir}/src/common/libmondo.a ${top_builddir}/src/lib/libmr.a
  • trunk/mondo/src/mondoarchive/mondo-cli-EXT.h

    r171 r1188  
    1111                                               *flag_val[128],
    1212                                               bool flag_set[128]);
    13 extern void help_screen();
     13extern void help_screen(void);
    1414extern void terminate_daemon(int sig);
    1515extern void set_signals(int on);
  • trunk/mondo/src/mondoarchive/mondo-cli.c

    r1086 r1188  
    1111
    1212#include "my-stuff.h"
    13 #include "../common/mondostructures.h"
     13#include "mondostructures.h"
    1414#include "mondo-cli-EXT.h"
    15 #include "../common/libmondo.h"
     15#include "libmondo.h"
    1616#ifndef S_SPLINT_S
    1717#include <pthread.h>
    1818#endif
    1919#include "mr_mem.h"
     20#include "mr_msg.h"
     21
     22//static char cvsid[] = "$Id$";
    2023
    2124extern int g_loglevel;
     
    2326extern bool g_skip_floppies;    ///< Whether to skip the creation of boot disks
    2427extern bool g_cd_recovery;
    25 extern double g_kernel_version;
    26 extern char *resolve_softlinks_to_get_to_actual_device_file(char *);
    2728
    2829/**
     
    6364    int res = 0;
    6465    int retval = 0;
    65     int i = 0, j;
     66    int i = 0, j = 0;
    6667
    6768    /*@ buffers *************** */
    68     char *tmp;
     69    char *tmp = NULL;
    6970    char *flag_val[128];
    7071    bool flag_set[128];
     
    9596    for (i = 0; i < 128; i++) {
    9697        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]);
    10099        }
    101100    }
  • trunk/mondo/src/mondoarchive/mondoarchive.c

    r1176 r1188  
    2626#include "mr_mem.h"
    2727#include "mr_str.h"
     28#include "mr_msg.h"
    2829#include "mr_file.h"
    2930
     
    5758 * Print a "don't panic" message to the log and a message about the logfile to the screen.
    5859 */
    59 void welcome_to_mondoarchive()
     60void welcome_to_mondoarchive(void)
    6061{
    6162    mr_msg(0, "Mondo Archive v%s --- http://www.mondorescue.org",
     
    100101 * of the day.
    101102 */
    102 void distro_specific_kludges_at_start_of_mondoarchive()
     103void distro_specific_kludges_at_start_of_mondoarchive(void)
    103104{
    104105    mr_msg(2, "Unmounting old ramdisks if necessary");
     
    115116 * Undo whatever was done by distro_specific_kludges_at_start_of_mondoarchive().
    116117 */
    117 void distro_specific_kludges_at_end_of_mondoarchive()
     118void distro_specific_kludges_at_end_of_mondoarchive(void)
    118119{
    119120    mr_msg(2, "Restarting magicdev if necessary");
     
    142143    struct s_bkpinfo *bkpinfo;
    143144    struct stat stbuf;
    144     char *tmp;
     145    char *tmp = NULL;
    145146    int res = 0;
    146147    int retval = 0;
     
    172173    diffs = 0;
    173174    printf(_("Initializing...\n"));
    174     bkpinfo = mr_malloc(sizeof(struct s_bkpinfo));
    175 
    176     /* Initialize Configuration Structure */
    177     mr_archive_init_conf(bkpinfo->mr_conf);
    178175
    179176    /* initialize log file with time stamp */
     
    182179    mr_msg(0, "Time started: %s", mr_date());
    183180
    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);
    188185
    189186    /* Add the ARCH environment variable for ia64 purposes */
     
    191188
    192189    /* Add MONDO_SHARE + others environment variable for mindi */
    193     setenv_mondo_share();
     190    setenv_mondo_var();
    194191
    195192    if (stat(MONDO_CACHE, &stbuf) != 0) {
    196193        mr_mkdir(MONDO_CACHE,0x755);
    197194    }
     195
     196    /* BERLIOS: Hardcoded to be improved */
     197    unlink(MONDO_CACHE"/mindi.conf");
     198    unlink(MONDORESTORECFG);
    198199
    199200    /* Configure the bkpinfo structure, global file paths, etc. */
     
    203204    register_pid(g_main_pid, "mondo");
    204205    set_signals(TRUE);          // catch SIGTERM, etc.
    205     run_program_and_log_output("date", 1);
    206206    run_program_and_log_output("dmesg -n1", TRUE);
    207207
     
    209209    welcome_to_mondoarchive();
    210210    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);
    213211    g_kernel_version = get_kernel_version();
    214212
     
    218216        setup_newt_stuff();
    219217        if (!strstr(argv[2], "filelist")) {
    220             printf(_("Sorry - filelist goes first\n"));
     218            mr_msg(1,_("Sorry - filelist goes first\n"));
    221219            finish(1);
    222220        } else {
     
    247245        setup_newt_stuff();
    248246        if (!strstr(argv[2], "filelist")) {
    249             printf(_("Sorry - filelist goes first\n"));
     247            mr_msg(1,_("Sorry - filelist goes first\n"));
    250248            finish(1);
    251249        } else {
     
    266264        setup_newt_stuff();
    267265        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);
    271269        }
    272270        mr_free(tmp);
    273271
    274272        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);
    278276        }
    279277        mr_free(tmp);
     
    286284        setup_newt_stuff();
    287285        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);
    291289        }
    292290        mr_free(tmp);
     
    300298    if (argc > 2 && !strcmp(argv[1], "test-dev")) {
    301299        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]);
    305303        }
    306304        finish(0);
     
    312310    }
    313311
    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. */
    315313    if (argc == 1) {
    316314        g_text_mode = FALSE;
     
    324322        res = handle_incoming_parameters(argc, argv, bkpinfo);
    325323        if (res) {
    326             printf
    327                 (_("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);
    329327            mr_msg(1, "Mondoarchive will now exit.");
    330328            finish(1);
     
    347345        retval += res;
    348346        if (res) {
    349             mr_asprintf(&say_at_end,
     347            mr_strcat(say_at_end,
    350348                   _("Data archived. Please check the logs, just as a precaution. "));
    351349        } 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 */
    357355    if (bkpinfo->verify_data) {
    358356        res = verify_data(bkpinfo);
    359357        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,
    361359                    (-res != 1) ? 's' : ' ');
    362360            res = 0;
     
    426424    system(g_erase_tmpdir_and_scratchdir);
    427425    free_libmondo_global_strings();
    428     mr_free((void *)bkpinfo);
     426    mr_free(bkpinfo);
    429427
    430428    unlink("/tmp/filelist.full");
    431429    unlink("/tmp/filelist.full.gz");
    432430
    433     run_program_and_log_output("date", 1);
    434431
    435432    /* 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();
    437435
    438436    if (!g_text_mode) {
Note: See TracChangeset for help on using the changeset viewer.