Changeset 1315 in MondoRescue for branches/2.2.2/mondo/src


Ignore:
Timestamp:
Apr 16, 2007, 4:13:59 PM (17 years ago)
Author:
Bruno Cornec
Message:

Log files are now consistent: mondoarchive.log for mondoarchive (containing also mindi.log) and mondorestore.log for mondorestore (copied from /tmp (ram) to /var/log (disk) at the end of the restore)
One include has been created for each bianry containing only that declaration ofr the moment, but which will be extended to include all local definitions (ps_* e.g.)
Doc updated accordingly
LOGFILE in restore process is now passed in the environment and not duplicated anymore
LogIt is not redifined either
LOGFILE should be put in environment by mondoarchive for mindi's usage but that's a step left for later.

Location:
branches/2.2.2/mondo/src
Files:
2 added
16 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.2/mondo/src/common/libmondo-archive.c

    r1299 r1315  
    19521952            } else {
    19531953                log_to_screen("%s...OK", message_to_screen);
    1954                 if (!run_program_and_log_output
    1955                     ("tail -n10 /var/log/mondo-archive.log | grep -F ':-('",
    1956                      1)) {
     1954                sprintf(tmp, "tail -n10 %s | grep -F ':-('", MONDO_LOGFILE);
     1955                if (!run_program_and_log_output(tmp, 1)) {
    19571956                    log_to_screen
    19581957                        ("Despite nonfatal errors, growisofs confirms the write was successful.");
  • branches/2.2.2/mondo/src/common/my-stuff.h

    r1236 r1315  
    381381//#define strcpy(y,x) strncpy(y, x, sizeof(y)-1)
    382382
    383 
    384 /**
    385  * Compatibility #define to ease the transition to logfile-in-a-variable.
    386  */
    387 #define MONDO_LOGFILE    "/var/log/mondo-archive.log"
    388383
    389384/**
  • branches/2.2.2/mondo/src/common/newt-specific.c

    r1294 r1315  
    435435
    436436        printf("---FATALERROR--- %s\n", error_string);
    437         system
    438             ("gzip -9c /var/log/mondo-archive.log > /tmp/MA.log.gz 2> /dev/null");
     437        sprintf(command, "gzip -9c %s > /tmp/MA.log.gz 2> /dev/null", MONDO_LOGFILE);
     438        system(command);
    439439        printf
    440440                ("If you require technical support, please contact the mailing list.\n");
  • branches/2.2.2/mondo/src/mondoarchive/Makefile.am

    r899 r1315  
    44
    55## Headers
    6 noinst_HEADERS       = mondo-cli-EXT.h mondo-cli.h
     6noinst_HEADERS       = mondo-cli-EXT.h mondo-cli.h mondoarchive.h
    77
    88## The program
  • branches/2.2.2/mondo/src/mondoarchive/main.c

    r1274 r1315  
    117117#include "../common/libmondo.h"
    118118#include "mondo-cli-EXT.h"
     119#include "mondoarchive.h"
    119120
    120121// for CVS
  • branches/2.2.2/mondo/src/mondorestore/Makefile.am

    r899 r1315  
    77                        mondo-restore-EXT.h mr-externs.h \
    88                        mondo-rstr-compare-EXT.h mondo-rstr-tools-EXT.h mondoprep.h
     9                        mondorestore.h
    910
    1011## The program
  • branches/2.2.2/mondo/src/mondorestore/mondo-prep.c

    r1303 r1315  
    337337    /**  buffers **********************************************/
    338338    char *tmp;
     339    char *tmp1 = NULL;
    339340    char *incoming;
    340341    char *command;
     
    486487            log_it("%s... so I'll get creative.", tmp);
    487488            if (lvmversion == 2) {
    488                 strcpy(tmp, call_program_and_get_last_line_of_output
    489                        ("tail -n5 /var/log/mondo-archive.log | grep Insufficient | tail -n1"));
     489                asprintf(&tmp1, "tail -n5 %s | grep Insufficient | tail -n1", MONDO_LOGFILE);
     490                strcpy(tmp, call_program_and_get_last_line_of_output(tmp1));
     491                free(tmp1);
    490492            } else {
    491                 strcpy(tmp, call_program_and_get_last_line_of_output
    492                        ("tail -n5 /var/log/mondo-archive.log | grep lvcreate | tail -n1"));
     493                asprintf(&tmp1, "tail -n5 %s | grep lvcreate | tail -n1", MONDO_LOGFILE);
     494                strcpy(tmp, call_program_and_get_last_line_of_output(tmp1));
     495                free(tmp1);
    493496            }
    494497            for (p = tmp; *p != '\0' && !isdigit(*p); p++);
  • branches/2.2.2/mondo/src/mondorestore/mondo-restore.c

    r1295 r1315  
    1818#include "mr-externs.h"
    1919#include "mondo-restore.h"
     20#include "mondorestore.h"
    2021#include "mondo-rstr-compare-EXT.h"
    2122#include "mondo-rstr-tools-EXT.h"
     
    29862987    make_hole_for_dir("/tmp/tmpfs");    /* just in case... */
    29872988    run_program_and_log_output("umount " MNT_CDROM, FALSE);
    2988     run_program_and_log_output
    2989         ("ln -sf /var/log/mondo-archive.log /tmp/mondo-restore.log",
     2989    /*
     2990    run_program_and_log_output("ln -sf /var/log/mondo-archive.log /tmp/mondo-restore.log",
    29902991         FALSE);
     2992         */
    29912993
    29922994    run_program_and_log_output("rm -Rf /tmp/tmpfs/mondo.tmp.*", FALSE);
     
    33433345    sprintf(tmp, "rm -Rf %s", bkpinfo->tmpdir);
    33443346    run_program_and_log_output(tmp, FALSE);
    3345     log_to_screen
    3346         ("Restore log copied to /tmp/mondo-restore.log on your hard disk");
     3347    log_to_screen("Restore log (%s) copied to /var/log on your hard disk", MONDO_LOGFILE);
    33473348    sprintf(tmp,
    33483349            "Mondo-restore is exiting (retval=%d)                                      ",
  • branches/2.2.2/mondo/src/mondorestore/mondo-rstr-compare.c

    r1294 r1315  
    162162    } else {
    163163        sprintf(command_ptr,
    164                 "md5sum \"%s%s\" > /tmp/md5sum.txt 2> /tmp/errors.txt",
     164                "md5sum \"%s%s\" > /tmp/md5sum.txt 2> /tmp/errors",
    165165                MNT_RESTORING, bigfile_fname_ptr);
    166166    }
    167167    log_msg(2, command_ptr);
    168168    paranoid_system
    169         ("cat /tmp/errors >> /tmp/mondo-restore.log 2> /dev/null");
     169        ("cat /tmp/errors >> %s 2> /dev/null", MONDO_LOGFILE);
    170170    if (system(command_ptr)) {
    171171        log_OS_error("Warning - command failed");
  • branches/2.2.2/mondo/src/mondorestore/mondo-rstr-tools.c

    r1242 r1315  
    17271727        mvaddstr_and_log_it(g_currentY++, 74, "Failed.");
    17281728        log_to_screen
    1729             ("GRUB ran w/error(s). See /tmp/mondo-restore.log for more info.");
     1729            ("GRUB ran w/error(s). See %s for more info.", MONDO_LOGFILE);
    17301730        log_msg(1, "Type:-");
    17311731        log_msg(1, "    mount-me");
     
    20032003        mvaddstr_and_log_it(g_currentY++, 74, "Failed.");
    20042004        log_to_screen
    2005             ("MBR+fstab processed w/error(s). See /tmp/mondo-restore.log for more info.");
     2005            ("MBR+fstab processed w/error(s). See %s for more info.", MONDO_LOGFILE);
    20062006    } else {
    20072007        mvaddstr_and_log_it(g_currentY++, 74, "Done.");
     
    22482248
    22492249    if (run_program_and_log_output
    2250         ("cp -f /tmp/mondo-restore.log " MNT_RESTORING "/tmp/", FALSE)) {
     2250        ("cp -f " MONDO_LOGFILE " " MNT_RESTORING "/var/log", FALSE)) {
    22512251        log_msg(1,
    2252                 "Error. Failed to copy log to PC's /tmp dir. (Mounted read-only?)");
    2253     }
    2254     if (run_program_and_log_output
    2255         ("cp -f /tmp/mondo-restore.log " MNT_RESTORING "/root/", FALSE)) {
    2256         log_msg(1,
    2257                 "Error. Failed to copy log to PC's /root dir. (Mounted read-only?)");
     2252                "Error. Failed to copy log to PC's /var/log dir. (Mounted read-only?)");
    22582253    }
    22592254    if (does_file_exist("/tmp/DUMBASS-GENTOO")) {
  • branches/2.2.2/mondo/src/restore-scripts/mondo/grub-MR

    r567 r1315  
    11#!/bin/sh
    2 
    3 
     2#
     3# $Id$
     4#
    45# grub-MR ------ a rudimentary replacement for grub-install
    56#
    67#
    7 #
    8 # 2005/11/25
    9 # - try_grub_hack : do not return success when grub wrote 'Error '
    10 #
    11 # 2004/06/28
    12 # - added support for /dev/md0==GRUB
    13 #
    14 # 2004/06/27
    15 # - re-enable the call to grub-install and the 'echo' thing as a backup
    16 # - hacked the hack :) to improve MDK9.2 support
    17 # - added try_grub_hack()
    18 #
    19 # 2004/06/14
    20 # - just use grub-install.patched; nothing else
    21 #
    22 # 2004/05/05
    23 # - try EVERYTHING - grub-install, grub --batch, etc.
    24 #
    25 # 2004/04/18
    26 # - try grub --batch < /etc/grub.conf first
    27 # - if it fails, grub-install.patched instead
    28 # - if _that_ fails, fail.
    29 #
    30 # 2004/04/15
    31 # - added grub-install.patched to the mix
    32 #
    33 # 2004/04/01
    34 # - use grub-install if there's an NTFS partition on the disk
    35 #
    36 # 2004/03/31
    37 # - disabled direct call to grub
    38 #
    39 # 2004/03/28
    40 # - call grub directly if possible
    41 #
    42 # 2004/03/26
    43 # - find stage 1 if possible; more stable, reliable call to grub
    44 #
    45 # 2003/08/24
    46 # - fixed line 26 (Christian)
    47 #
    48 # 2002/11/18
    49 # - first incarnation
    50 
    51 
    52 LOGFILE=/var/log/mondo-archive.log
    53 
    548
    559Die() {
  • branches/2.2.2/mondo/src/restore-scripts/mondo/hack-lilo

    r567 r1315  
    11#!/bin/sh
    2 
    3 
    4 LogIt() {
    5     echo "$1" >> /tmp/mondo-restore.log
    6 }
    7 
     2#
     3# $Id$
     4#
    85
    96
  • branches/2.2.2/mondo/src/restore-scripts/mondo/make-me-bootable

    r911 r1315  
    11#!/bin/sh
    2 
    3 
    4 LOGFILE=/tmp/mondo-restore.log
    5 
    62
    73
  • branches/2.2.2/mondo/src/restore-scripts/mondo/raw-MR

    r567 r1315  
    77LogIt "Restoring MBR..." 2
    88if uname -a | grep -q FreeBSD; then
    9     echo -e 'y\ny' | /mnt/RESTORING/sbin/fdisk -b /BOOTLOADER.MBR -B $1 >/dev/null 2>>/tmp/mondo-restore.log
     9    echo -e 'y\ny' | /mnt/RESTORING/sbin/fdisk -b /BOOTLOADER.MBR -B $1 >/dev/null 2>> $LOGFILE
    1010else
    11     dd if=/BOOTLOADER.MBR of=$1 bs=446 count=1 2>> /tmp/mondo-restore.log
     11    dd if=/BOOTLOADER.MBR of=$1 bs=446 count=1 2>> $LOGFILE
    1212fi
    1313exit $?
  • branches/2.2.2/mondo/src/restore-scripts/mondo/stabgrub-me

    r1001 r1315  
    11#!/bin/sh
    22#
    3 # stabgrub-me
    4 #
    5 # 04/08/2003
    6 # - cleaned up backup func a bit
    7 #
    8 #
    9 #
    10 # forked from stablilo-me on 2002/11/20
     3# $Id$
    114#
    125#####################################################################
    136
    14 
    15 LOGFILE=/tmp/mondo-restore.log
    167
    178QuitIfNotFound() {
  • branches/2.2.2/mondo/src/restore-scripts/mondo/stabraw-me

    r567 r1315  
    11#!/bin/sh
    22#
    3 # stabraw-me
    4 #
    5 # forked from stablilo-me on 2002/11/21
     3# $Id$
    64#
    75#####################################################################
    86
    9 
    10 LOGFILE=/tmp/mondo-restore.log
    117
    128QuitIfNotFound() {
     
    1612    fi
    1713}
    18 
    19 
    20 
    21 
    2214
    2315LocateOldFstab() {
Note: See TracChangeset for help on using the changeset viewer.