Changeset 2697


Ignore:
Timestamp:
Jan 25, 2011, 10:44:33 AM (8 years ago)
Author:
bruno
Message:
  • Backport from 2.2.10 the support of a dynamic exclude_path variable. Should help fix #366, #421, #368, #443. To be tested.
Location:
branches/2.2.9/mondo/src/common
Files:
6 edited

Legend:

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

    r2627 r2697  
    1313#include "my-stuff.h"
    1414#include "mr_mem.h"
     15#include "mr_str.h"
    1516#include "mondostructures.h"
    1617#include "libmondo-string-EXT.h"
  • branches/2.2.9/mondo/src/common/libmondo-cli.c

    r2694 r2697  
    612612            log_to_screen("Please supply a sensible value with '-E'\n");
    613613        }
    614         if (bkpinfo->exclude_paths[0]) {
    615             strcat(bkpinfo->exclude_paths, " ");
    616         }
     614        mr_strcat(bkpinfo->exclude_paths, " ");
    617615        mr_asprintf(&tmp1, "%s", flag_val['E']);
    618616
     
    658656    {
    659657        mr_asprintf(&psz, "%s", list_of_NETFS_mounts_only());
    660         if (bkpinfo->exclude_paths[0]) {
    661             strncat(bkpinfo->exclude_paths, " ", 4*MAX_STR_LEN);
    662         }
    663         strncat(bkpinfo->exclude_paths, psz, 4*MAX_STR_LEN);
     658        mr_strcat(bkpinfo->exclude_paths, "%s ", psz);
    664659        mr_free(psz);
    665660
    666         log_msg(3, "-N means we're now excluding %s",
    667                 bkpinfo->exclude_paths);
    668     }
    669 
    670     if (strlen(bkpinfo->exclude_paths) >= 4*MAX_STR_LEN) {
    671         fatal_error
    672             ("Your '-E' parameter is too long. Increase MAX_STR_LEN");
     661        if (bkpinfo->exclude_paths != NULL) {
     662            log_msg(3, "-N means we're now excluding %s", bkpinfo->exclude_paths);
     663        }
    673664    }
    674665
  • branches/2.2.9/mondo/src/common/libmondo-devices.c

    r2683 r2697  
    20642064                log_to_screen("==> %s", mounted_on_dsf);
    20652065                log_msg (5, "Adding to bkpinfo->exclude_paths due to -E option: %s", mounted_on_dsf);
    2066                 strcat(bkpinfo->exclude_paths, " ");
    2067                 strcat(bkpinfo->exclude_paths, mounted_on_dsf);
    2068                 strcat(bkpinfo->exclude_paths, " ");
     2066                mr_strcat(bkpinfo->exclude_paths, " %s ",mounted_on_dsf);
    20692067                mr_strcat(bkpinfo->exclude_devs, " %s ",token);
    20702068            }
     
    20772075                log_to_screen("Not archiving the following file systems:");
    20782076                log_to_screen("==> %s", not_mounted_on_dsf);
    2079                 strcat(bkpinfo->exclude_paths, " ");
    2080                 strcat(bkpinfo->exclude_paths, not_mounted_on_dsf);
    2081                 strcat(bkpinfo->exclude_paths, " ");
     2077                mr_strcat(bkpinfo->exclude_paths, " %s ", not_mounted_on_dsf);
    20822078            }
    20832079        }
     
    20952091            mr_asprintf(&tmp," %s ",bkpinfo->exclude_paths);
    20962092            if (strstr(tmp,tmp1) == NULL) {
    2097                 strcat(bkpinfo->exclude_paths, tmp1);
     2093                mr_strcat(bkpinfo->exclude_paths, tmp1);
    20982094            }
    20992095        } else {
     
    21412137    char *tmp1 = NULL;
    21422138    char *mds = NULL;
     2139    char p[8*MAX_STR_LEN];
    21432140    char *sz_size;
    21442141    char *command;
     
    26582655        mr_asprintf(&tmp, "%s", list_of_NETFS_mounts_only());
    26592656        if (strlen(tmp) > 2) {
    2660             if (bkpinfo->exclude_paths[0]) {
    2661                 strcat(bkpinfo->exclude_paths, " ");
    2662             }
    2663             strncpy(bkpinfo->exclude_paths, tmp, MAX_STR_LEN);
     2657            mr_strcat(bkpinfo->exclude_paths, " %s",tmp);
    26642658        }
    26652659        mr_free(tmp);
     
    26772671        }
    26782672
    2679 
    2680         if (!popup_and_get_string
    2681             ("Exclude paths",
    2682              "Please enter paths which you do NOT want to backup. Separate them with spaces. NB: /tmp and /proc are always excluded. :-) Just hit 'Enter' if you want to do a full system backup.",
    2683              bkpinfo->exclude_paths, (4*MAX_STR_LEN)-1)) {
     2673        strncpy(p,bkpinfo->exclude_paths,(8*MAX_STR_LEN)-1);
     2674        popup_and_get_string("Exclude paths", "Please enter paths which you do NOT want to backup. Separate them with spaces. NB: /tmp and /proc are always excluded. :-) Just hit 'Enter' if you want to do a full system backup.", p, (8*MAX_STR_LEN)-1);
     2675        if (p == NULL) {
    26842676            log_to_screen("User has chosen not to backup the PC");
    26852677            finish(1);
    26862678        }
    2687         /* Always needs to be finished by a space */
    2688         if (bkpinfo->exclude_paths[0]) {
    2689             strcat(bkpinfo->exclude_paths, " ");
    2690         }
     2679        mr_free(bkpinfo->exclude_paths);
     2680        mr_asprintf(&tmp, "%s", p);
     2681        bkpinfo->exclude_paths = tmp;
     2682
    26912683        if (!popup_and_get_string
    26922684            ("Temporary directory",
  • branches/2.2.9/mondo/src/common/libmondo-tools.c

    r2686 r2697  
    787787    bkpinfo->make_filelist = TRUE;  // unless -J supplied to mondoarchive
    788788    bkpinfo->include_paths[0] = '\0';
    789     bkpinfo->exclude_paths[0] = '\0';
    790789    bkpinfo->exclude_devs = NULL;
    791790    bkpinfo->restore_path[0] = '\0';
     
    799798    bkpinfo->netfs_user = NULL;
    800799    bkpinfo->netfs_remote_dir[0] = '\0';
     800    bkpinfo->exclude_paths = NULL;
    801801    bkpinfo->postnuke_tarball[0] = '\0';
    802802    bkpinfo->wipe_media_first = FALSE;
  • branches/2.2.9/mondo/src/common/mondostructures.h

    r2424 r2697  
    522522   * the scratchdir, and the tempdir are automatically excluded.
    523523   */
    524     char exclude_paths[MAX_STR_LEN*4];
     524    char *exclude_paths;
    525525
    526526  /**
  • branches/2.2.9/mondo/src/common/newt-specific.c

    r2424 r2697  
    432432                mr_asprintf(&command, "rm -Rf %s", bkpinfo->tmpdir);
    433433                system(command);
    434                 paranoid_free(command);
     434                mr_free(command);
    435435            }
    436436        }
     
    441441                mr_asprintf(&command, "rm -Rf %s", bkpinfo->scratchdir);
    442442                system(command);
    443                 paranoid_free(command);
     443                mr_free(command);
    444444            }
    445445        }
     
    448448        mr_free(bkpinfo->netfs_proto);
    449449        mr_free(bkpinfo->exclude_devs);
     450        mr_free(bkpinfo->exclude_paths);
    450451
    451452        /* Then free the structure */
Note: See TracChangeset for help on using the changeset viewer.