Changeset 1326 in MondoRescue for branches/stable/mondo/src/mondorestore


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/mondo/src/mondorestore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • 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.