Changeset 1326 in MondoRescue for branches/stable


Ignore:
Timestamp:
Apr 17, 2007, 12:08:14 AM (17 years ago)
Author:
Bruno Cornec
Message:
  • MONDO_LOGFILE is rather a char* exported by each main program (consolidation of those mecanisms in .h files with ps_*)
  • One include has been created for each binary containing only the specific declarations
  • 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)
  • Doc updated accordingly
  • LOGFILE in restore process is now passed in the environment and not duplicated a nymore
  • 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.
  • label-partitions-as-necessary should now work correctly for LABEL and UUID (grep -w removed)
  • Remove useless script compare-me

(All coming from 2.2.2) (remains changes in my-stuff.h coming later on)

Location:
branches/stable
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mindi/mindi

    r1312 r1326  
    426426    echo "Mindi $MINDI_VERSION is exiting" >> $LOGFILE
    427427    echo "End date : `date`" >> $LOGFILE
     428    if [ "`DidMondoCallMe`" ] ; then
     429        cat $LOGFILE >> /var/log/mondoarchive.log
     430    fi
    428431
    429432    sync
     
    448451    fi
    449452
    450     # Creates a tar file containing all required files
    451     for i in $MY_FSTAB /etc/lilo.conf /etc/raidtab $LOGFILE /var/log/mondo-archive.log ; do
    452         [ -e "$i" ] && cp -f $i $MINDI_TMP 2>> $LOGFILE
    453     done
    454     rm -f $TMPDIR/mindi.err.*.tgz
    455     tar -cf - $MINDI_TMP | gzip -9 > $TMPDIR/mindi.err.$$.tgz
    456     LogIt "Please e-mail a copy of $TMPDIR/mindi.err.$$.tgz to the mailing list."
     453    LogIt "Please e-mail a copy of $LOGFILE to the mailing list."
    457454    LogIt "See http://www.mondorescue.org for more information."
    458455    LogIt "WE CANNOT HELP unless you enclose that file.\n"
     
    30283025mount >> $LOGFILE
    30293026echo "-------------" >> $LOGFILE
     3027if [ -e /etc/raidtab ]; then
     3028    echo "-------------" >> $LOGFILE
     3029    echo "/etc/raidtab content:" >> $LOGFILE
     3030    echo "-------------" >> $LOGFILE
     3031    cat /etc/raidtab >> $LOGFILE
     3032fi
     3033echo "-------------" >> $LOGFILE
    30303034echo "lsmod result:" >> $LOGFILE
    30313035echo "-------------" >> $LOGFILE
     
    31823186    LogIt "BusyBox sources are available from http://www.busybox.net"
    31833187else
    3184     echo "You are using Mindi-Linux v$MINDI_VERSION to make boot+data disks" >> /var/log/mondo-archive.log
     3188    echo "You are using Mindi-Linux v$MINDI_VERSION to make boot+data disks" >> $LOGFILE
    31853189fi
    31863190if [ -f $MINDI_LIB/rootfs/bin/busybox ]; then
  • branches/stable/mondo/src/common/libmondo-archive.c

    r1302 r1326  
    8484extern char *g_getfacl;
    8585extern char *g_getfattr;
     86extern char *MONDO_LOGFILE;
    8687
    8788
     
    17891790            } else {
    17901791                log_to_screen("%s...OK", message_to_screen);
    1791                 if (!run_program_and_log_output
    1792                     ("tail -n10 /var/log/mondo-archive.log | grep -F ':-('",
    1793                      1)) {
     1792                sprintf(tmp, "tail -n10 %s | grep -F ':-('", MONDO_LOGFILE);
     1793                if (!run_program_and_log_output(tmp, 1)) {
    17941794                    log_to_screen
    17951795                        ("Despite nonfatal errors, growisofs confirms the write was successful.");
  • branches/stable/mondo/src/common/libmondo-filelist.c

    r1283 r1326  
    3535#define MAX_SKEL_DEPTH 3
    3636
     37
     38extern char *MONDO_LOGFILE;
    3739
    3840int mondo_makefilelist(char *logfile, char *tmpdir, char *scratchdir,
  • branches/stable/mondo/src/common/newt-specific.c

    r1293 r1326  
    3131#include "libmondo-fork-EXT.h"
    3232#include "newt-specific-EXT.h"
     33
     34extern char *MONDO_LOGFILE;
    3335
    3436/*@unused@*/
     
    344346    printf(_("The list's members can help you, if you attach that file to your e-mail.\n"));
    345347    printf(_("Log file: %s\n"), MONDO_LOGFILE);
    346 /*
    347     system
    348         ("gzip -9c /var/log/mondo-archive.log > /tmp/MA.log.gz 2> /dev/null");
    349     if (does_file_exist("/tmp/MA.log.gz")) {
    350         printf
    351             ("FYI, I have gzipped the log and saved it to /tmp/MA.log.gz\n");
    352         }
    353 */
    354348    printf(_("Mondo has aborted.\n"));
    355349    register_pid(0, "mondo");   // finish() does this too, FYI
  • branches/stable/mondo/src/mondoarchive/mondoarchive.c

    r1269 r1326  
    5757bool g_skip_floppies;
    5858long diffs;
    59 char *ps_options = "auxww";
    60 char *ps_proc_id = "$2";
    6159
    6260/****************** subroutines used only here ******************/
  • branches/stable/mondo/src/mondoarchive/mondoarchive.h

    r1256 r1326  
    1212#define MONDO_CONF_DIR "/usr/local/etc/mondo"
    1313#endif
     14
     15/**
     16 * Compatibility #define to ease the transition to logfile-in-a-variable.
     17 */
     18char *MONDO_LOGFILE = "/var/log/mondoarchive.log";
     19
     20/* No restriction on ps options */
     21char *ps_options = "auxww";
     22char *ps_proc_id = "$2";
  • branches/stable/mondo/src/mondorestore/mondo-prep.c

    r1304 r1326  
    4646extern bool g_text_mode;
    4747extern void pause_for_N_seconds(int, char *);
     48extern char *MONDO_LOGFILE;
    4849
    4950FILE *g_fprep = NULL;
     
    218219    }
    219220    mr_asprintf(&command,
    220             "for i in `%s | cut -d\"'\" -f2 | sort -r` ; do echo \"Shutting down lv $i\" >> "
    221             MONDO_LOGFILE "; %s -f $i; done", lvscan_sz, lvremove_sz);
     221            "for i in `%s | cut -d\"'\" -f2 | sort -r` ; do echo \"Shutting down lv $i\" >> %s ; %s -f $i; done", lvscan_sz, MONDO_LOGFILE, lvremove_sz);
    222222    mr_free(lvscan_sz);
    223223    mr_free(lvremove_sz);
     
    228228    sleep(1);
    229229    mr_asprintf(&command,
    230             "for i in `%s | grep -i lvm | cut -d'\"' -f2` ; do %s -a n $i ; %s $i; echo \"Shutting down vg $i\" >> "
    231             MONDO_LOGFILE "; done", vgscan_sz, vgchange_sz, vgremove_sz);
     230            "for i in `%s | grep -i lvm | cut -d'\"' -f2` ; do %s -a n $i ; %s $i; echo \"Shutting down vg $i\" >> %s ; done", vgscan_sz, vgchange_sz, vgremove_sz, MONDO_LOGFILE);
    232231    mr_free(vgchange_sz);
    233232    mr_free(vgremove_sz);
     
    311310                lvmversion = 2;
    312311            if (lvmversion == 2) {
    313                 mr_asprintf(&tmp, call_program_and_get_last_line_of_output
    314                        ("tail -n5 " MONDO_LOGFILE " | grep Insufficient | tail -n1"));
     312                mr_asprintf(&tmp1, "tail -n5 %s | grep Insufficient | tail -n1", MONDO_LOGFILE);
     313                mr_asprintf(&tmp, call_program_and_get_last_line_of_output(tmp1));
     314                free(tmp1);
    315315            } else {
    316                 mr_asprintf(&tmp, call_program_and_get_last_line_of_output
    317                        ("tail -n5 " MONDO_LOGFILE " | grep lvcreate | tail -n1"));
     316                mr_asprintf(&tmp1, "tail -n5 %s | grep lvcreate | tail -n1", MONDO_LOGFILE);
     317                mr_asprintf(&tmp, call_program_and_get_last_line_of_output(tmp1));
     318                free(tmp1);
    318319            }
    319320            for (p = tmp; *p != '\0' && !isdigit(*p); p++);
  • branches/stable/mondo/src/mondorestore/mondo-rstr-compare.c

    r1293 r1326  
    1515#include "mondo-rstr-tools-EXT.h"
    1616
     17extern char *MONDO_LOGFILE;
     18
    1719//static char cvsid[] = "$Id$";
    1820
     
    9092    }
    9193    mr_asprintf(&command,
    92             "md5sum \"%s%s\" > /tmp/md5sum.txt 2> /tmp/errors.txt",
     94            "md5sum \"%s%s\" > /tmp/md5sum.txt 2> /tmp/errors",
    9395            MNT_RESTORING, bigfile_fname);
    9496    mr_msg(2, command);
    9597    if (system(command)) {
    9698        log_OS_error("Warning - command failed");
    97         paranoid_system("cat /tmp/errors >> /tmp/mondo-restore.log 2> /dev/null");
     99        mr_asprintf(&tmp, "cat /tmp/errors >> %s 2> /dev/null", MONDO_LOGFILE);
     100        paranoid_system(tmp);
     101        mr_free(tmp);
    98102        mr_free(command);
    99103        mr_free(bigfile_fname);
  • branches/stable/mondo/src/mondorestore/mondo-rstr-tools.c

    r1275 r1326  
    4444
    4545extern int g_partition_table_locked_up;
     46extern char *MONDO_LOGFILE;
    4647
    4748/* Should we use or not extended attributes and acl when restoring */
     
    14761477        mvaddstr_and_log_it(g_currentY++, 74, _("Failed."));
    14771478        log_to_screen
    1478             (_
    1479              ("GRUB ran w/error(s). See /tmp/mondo-restore.log for more info."));
     1479            (_("GRUB ran w/error(s). See %s for more info.", MONDO_LOGFILE));
    14801480        mr_msg(1, "Type:-");
    14811481        mr_msg(1, "    mount-me");
     
    17451745        mvaddstr_and_log_it(g_currentY++, 74, _("Failed."));
    17461746        log_to_screen
    1747             (_
    1748              ("MBR+fstab processed w/error(s). See /tmp/mondo-restore.log for more info."));
     1747            (_("MBR+fstab processed w/error(s). See %s for more info.", MONDO_LOGFILE));
    17491748    } else {
    17501749        mvaddstr_and_log_it(g_currentY++, 74, _("Done."));
     
    19761975    sync();
    19771976
    1978     if (run_program_and_log_output
    1979         ("cp -f /tmp/mondo-restore.log " MNT_RESTORING "/tmp/", FALSE)) {
     1977    sprintf(tmp, "cp -f %s " MNT_RESTORING "/var/log", MONDO_LOGFILE);
     1978    if (run_program_and_log_output(tmp, FALSE)) {
    19801979        mr_msg(1,
    1981                 "Error. Failed to copy log to PC's /tmp dir. (Mounted read-only?)");
    1982     }
    1983     if (run_program_and_log_output
    1984         ("cp -f /tmp/mondo-restore.log " MNT_RESTORING "/root/", FALSE)) {
    1985         mr_msg(1,
    1986                 "Error. Failed to copy log to PC's /root dir. (Mounted read-only?)");
     1980                "Error. Failed to copy log to PC's /var/log dir. (Mounted read-only?)");
    19871981    }
    19881982    if (does_file_exist("/tmp/DUMBASS-GENTOO")) {
  • branches/stable/mondo/src/mondorestore/mondorestore.c

    r1297 r1326  
    2626#include "mr-externs.h"
    2727#include "mondo-restore.h"
     28#include "mondorestore.h"
    2829#include "mondo-rstr-compare-EXT.h"
    2930#include "mondo-rstr-tools-EXT.h"
     
    119120 */
    120121char *g_mountlist_fname = NULL;
    121 
    122 /* Busybox ps has no option and PID in first pos */
    123 char *ps_options = "";
    124 char *ps_proc_id = "$1";
    125122
    126123extern char *g_getfacl;
     
    28742871    make_hole_for_dir("/tmp/tmpfs");    /* just in case... */
    28752872    run_program_and_log_output("umount " MNT_CDROM, FALSE);
    2876     run_program_and_log_output
    2877         ("ln -sf /var/log/mondo-archive.log /tmp/mondo-restore.log",
    2878          FALSE);
    28792873
    28802874    run_program_and_log_output("rm -Rf /tmp/tmpfs/mondo.tmp.*", FALSE);
     
    32253219
    32263220    log_to_screen
    3227         (_("Restore log copied to /tmp/mondo-restore.log on your hard disk"));
     3221        (_("Restore log (%s) copied to /var/log on your hard disk"), MONDO_LOGFILE);
    32283222    log_to_screen(_("Mondo-restore is exiting (retval=%d)"), retval);
    32293223
Note: See TracChangeset for help on using the changeset viewer.