Ignore:
Timestamp:
Nov 19, 2005, 1:53:52 AM (18 years ago)
Author:
bcornec
Message:

This patch avoids useless invocations of `cat <file> |' where the second
process in the pipe can more efficiently read its input file itself.
It replaces also some grep'+sed' commands by an unique `sed' command.
This patch also improves readability of shell commands by
replacing \" by ' where possible.
This patch instructs mondo to say DVD' instead of CD' when appropriate.
This patch forces growisofs to use speed=1 for DVD burning. In my
experience, DVD burning time is only a small part of the total backup
time so this should not make a big difference in backup time, but
a big one in reliability of mondo. On my installation, without
the option `speed=1', mondo/growisofs is unable to burn a DVD. With
the option `speed=1', mondo works.
(Philippe De Muyter)

File:
1 edited

Legend:

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

    r99 r126  
    501501  paranoid_system (command);
    502502
    503   sprintf (command, "cat %s | afio -o -b %ld -M 16m %s %s 2>> %s", filelist, TAPE_BLOCK_SIZE, zipparams, fname, MONDO_LOGFILE);
     503  sprintf (command, "afio -o -b %ld -M 16m %s %s < %s 2>> %s", TAPE_BLOCK_SIZE, zipparams, fname, filelist, MONDO_LOGFILE);
    504504
    505505  sprintf(tmp, "echo hi > %s 2> /dev/null", fname);
     
    701701  strcpy( scratchdir, bkpinfo->scratchdir);
    702702  sprintf (tmp,
    703        "echo \"%s\" | tr -s ' ' '\n' | grep -x \"/dev/.*\" | tr -s '\n' ' ' | awk '{print $0\"\\n\";}'",
     703       "echo '%s' | tr -s ' ' '\n' | grep -x '/dev/.*' | tr -s '\n' ' ' | awk '{print $0\"\\n\";}'",
    704704       bkpinfo->exclude_paths);
    705705  strcpy (devs_to_exclude, call_program_and_get_last_line_of_output (tmp));
     
    935935       
    936936       
    937     "mindi --custom %s %s/images \"%s\" \"%s\" \
    938 \"%s\" %ld \"%s\" \"%s\" \"%s\" \
    939 \"%s\" %s %ld \"%s\" \"%s\" \"%s\" \"%s\" %ld %d",
     937    "mindi --custom %s %s/images '%s' '%s' \
     938'%s' %ld '%s' '%s' '%s' \
     939'%s' %s %ld '%s' '%s' '%s' '%s' %ld %d",
    940940
    941941       bkpinfo->tmpdir,         // parameter #2
     
    990990    {
    991991      log_to_screen ("Mindi failed to create your boot+data disks.");
    992       sprintf (command, "cat %s | grep \"Fatal error\"", "/var/log/mindi.log");
     992      sprintf (command, "grep 'Fatal error' %s", "/var/log/mindi.log");
    993993      strcpy (tmp, call_program_and_get_last_line_of_output (command));
    994994      if (strlen (tmp) > 1)
     
    18181818            {
    18191819              log_to_screen ("%s...OK", message_to_screen);
    1820           if (!run_program_and_log_output("tail -n10 /var/log/mondo-archive.log | fgrep \":-(\"", 1))
     1820          if (!run_program_and_log_output("tail -n10 /var/log/mondo-archive.log | fgrep ':-('", 1))
    18211821            {
    18221822          log_to_screen("Despite nonfatal errors, growisofs confirms the write was successful.");
     
    18251825          retval += res;
    18261826#ifdef DVDRWFORMAT
    1827           sprintf(tmp, "cat %s | tail -n8 | grep \"blank=full.*dvd-compat.*DAO\"", MONDO_LOGFILE);
     1827          sprintf(tmp, "tail -n8 %s | grep 'blank=full.*dvd-compat.*DAO'", MONDO_LOGFILE);
    18281828      if (g_backup_media_type == dvd && (res || !run_program_and_log_output(tmp, 1)))
    18291829            {
     
    32623262    {
    32633263      file_to_openin = biggie_filename;
    3264       sprintf (command, "md5sum \"%s\"", biggie_filename);
     3264      sprintf (command, "md5sum '%s'", biggie_filename);
    32653265      if (!(fin = popen (command, "r"))) { log_OS_error("Unable to popen-in command"); return(1); }
    32663266      (void) fgets (checksum_line, MAX_STR_LEN, fin);
     
    36413641    {
    36423642      log_to_screen
    3643         ("Please reboot from the 1st CD in Compare Mode, as a precaution.");
     3643        ("Please reboot from the 1st %s in Compare Mode, as a precaution.", media_descriptor_string(g_backup_media_type));
    36443644      chdir ("/");
    36453645      iamhere("Before calling verify_cd_image()");
     
    37933793*/
    37943794          sprintf (tmp,
    3795        "cat %s | grep \"afio: \" | sed 's/afio: //' | grep -vx \"/dev/.*\" >> /tmp/changed.files",
     3795       "sed -n -e 's/afio: //p' %s | grep -vx '/dev/.*' >> /tmp/changed.files",
    37963796       MONDO_LOGFILE);
    37973797      system (tmp);
    37983798         
    37993799      sprintf (tmp,
    3800        "cat %s | grep \"star: \" | sed 's/star: //' | grep -vx \"/dev/.*\" >> /tmp/changed.files",
     3800       "sed -n -e 's/star: //p' %s | grep -vx '/dev/.*' >> /tmp/changed.files",
    38013801       MONDO_LOGFILE);
    38023802      system (tmp);
Note: See TracChangeset for help on using the changeset viewer.