Changeset 2715 in MondoRescue


Ignore:
Timestamp:
Feb 2, 2011, 1:18:23 PM (13 years ago)
Author:
Bruno Cornec
Message:
  • Document in man page and HOWTO the previous syntax modifications for -E/-I options and '|' separator
  • Fix #444. mondoarchive now supports inclusion/exclusion of dirs with spaces in their name. this required a syntax change for the -E/-I options where the list of dirs needs to be separated by '|' now instead of ' '.
  • Fix issus with mindi when launched from a dir containing spaces
  • Fix a but when no -E option is give on CLI (null) string generated
  • Fix #459 by correcting an old README containing info on the edit-mountlist binary which doesn't exist.

svn merge -r 2709:2714 svn+ssh://bruno@svn.mondorescue.org/mondo/svn/mondorescue/branches/2.2.9 .

Location:
branches/2.2.10
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.10/mindi/mindi

    r2708 r2715  
    222222
    223223    mkdir -p $bigdir/etc
    224     tar cf - -C / $mappath 2>> $MINDI_TMP/$$.log | (cd $bigdir ; tar xf -) || LogAll "AKMF -- Could not copy $mappath to $bigdir" $MINDI_TMP/$$.log
     224    tar cf - -C / $mappath 2>> $MINDI_TMP/$$.log | (cd "$bigdir" ; tar xf -) || LogAll "AKMF -- Could not copy $mappath to $bigdir" $MINDI_TMP/$$.log
    225225    if [ "`echo $mappath | grep -F ".gz"`" ] ; then
    226226        included_list=`gzip -dc $mappath | grep -Fi include | sed s/'"'// | sed s/'"'// | cut -d' ' -f2`
     
    266266            find $incoming/* -maxdepth 0 2> /dev/null | CopyDependenciesToDirectory $outdir 0
    267267        elif [ -e "$incoming" ] && [ $found = "false" ]; then
    268             tar cf - -C / $incoming 2>> $MINDI_TMP/$$.log | (cd $outdir ; tar xf -) || Die "Cannot copy $incoming to $outdir - did you run out of disk space?" $MINDI_TMP/$$.log
     268            tar cf - -C / $incoming 2>> $MINDI_TMP/$$.log | (cd "$outdir" ; tar xf -) || Die "Cannot copy $incoming to $outdir - did you run out of disk space?" $MINDI_TMP/$$.log
    269269
    270270            # Only uncompress modules if not using udevd
     
    468468    fi
    469469    # Find all files and links (required for some VMWare VMs)
    470     modpaths=`find $1 -name $2.*o -o -name $2.o.gz -o -name $2.ko.gz -o -name $2 -type f -o -type l`
     470    modpaths=`find "$1" -name $2.*o -o -name $2.o.gz -o -name $2.ko.gz -o -name $2 -type f -o -type l`
    471471    echo "$modpaths"
    472472}
     
    580580            LogAll "\nIncorporating post-nuke tarball"
    581581            old_pwd=`pwd`
    582             cd $bigdir
     582            cd "$bigdir"
    583583            tar -zxf $MINDI_TMP/post-nuke.tgz 2>> $MINDI_TMP/$$.log || LogAll "Error occurred when untarring post-nuke tarball" $MINDI_TMP/$$.log
    584             cd $old_pwd
     584            cd "$old_pwd"
    585585        fi
    586586        cp -f $MINDI_TMP/BOOTLOADER.* $bigdir 2>> $LOGFILE || LogAll "\nMondo v1.2x defaults to LILO as the bootloader, BTW."
     
    14081408    fi
    14091409    old_pwd=`pwd`
    1410     cd $MINDI_TMP/iso
     1410    cd "$MINDI_TMP/iso"
    14111411    LogFile "-------------------"
    14121412    LogFile "Content of the ISO:"
     
    14371437    fi
    14381438    rm -f $MINDI_TMP/mkisofs.log
    1439     cd $old_pwd
     1439    cd "$old_pwd"
    14401440}
    14411441
     
    17831783        echo -en "Kernel size = `du -sk $kernelpath | cut -f1` K\nRamdisk free = $free_space K\n" >> $LOGFILE
    17841784        [ "$mountpoint" != "" ] && rm -f $mountpoint/vmlinuz
    1785         cd $old_pwd
     1785        cd "$old_pwd"
    17861786        umount $mountpoint || Die "Cannot unmount mountpoint ($mountpoint)"
    17871787        rmdir $mountpoint || LogAll "Cannot rmdir (PBDI)"
     
    18941894
    18951895    old_pwd=`pwd`
    1896     cd $bigdir
     1896    cd "$bigdir"
    18971897
    18981898    # Get terminfo content
     
    19091909        tar cf - -C / ./lib/dev-state 2>> $MINDI_TMP/$$.log | tar xf - || LogAll "Unable to handle /lib/dev-state" $MINDI_TMP/$$.log
    19101910    fi
    1911     cd $old_pwd
     1911    cd "$old_pwd"
    19121912    echo -e "$DONE"
    19131913    TOTAL_BIGDIR_SIZE=`du -sk $bigdir | cut -f1`
     
    19291929    echo -en "Tarring and zipping the data content..."
    19301930    size_of_all_tools=`du -sk $bigdir | cut -f1`
    1931     (cd $bigdir ; tar -b 4096 -cf - . 2>> $MINDI_TMP/$$.log | gzip -9 > $imagesdir/all.tar.gz || LogAll "Problem creating all.tar.gz" $MINDI_TMP/$$.log)
     1931    (cd "$bigdir" ; tar -b 4096 -cf - . 2>> $MINDI_TMP/$$.log | gzip -9 > $imagesdir/all.tar.gz || LogAll "Problem creating all.tar.gz" $MINDI_TMP/$$.log)
    19321932    LogFile "Size of the data content"
    19331933    LogFile "------------------------"
     
    23402340    fi
    23412341
    2342     cd $old_pwd
     2342    cd "$old_pwd"
    23432343    if [ _"$MONDO_SHARE" != _"" ]; then
    23442344        MakeMondoConfigFile $MINDI_CACHE/mondorestore.cfg
     
    24032403    LogFile "Content of initial ramdisk:"
    24042404    LogFile "---------------------------"
    2405     (cd $mountpoint ; ls -Rla ) >> $LOGFILE
     2405    (cd "$mountpoint" ; ls -Rla ) >> $LOGFILE
    24062406    LogFile "---------------------------"
    24072407
     
    24142414        LogFile "Creating an $gvFileSystem initrd image..."
    24152415        # kernel expects linuxrc in ext2 filesystem
    2416         ( cd $mountpoint && ln -sf sbin/init linuxrc )
     2416        ( cd "$mountpoint" && ln -sf sbin/init linuxrc )
    24172417        # unmount loop filesystem and create image file using the standard approach
    24182418        umount $mountpoint || Die "Cannot unmount $tempfile"
     
    24302430        which cpio &> /dev/null; [ $? -eq 0 ] || Die "cpio not found. Please install package cpio and try again."
    24312431        # go into filesystem
    2432         cd $mountpoint
     2432        cd "$mountpoint"
    24332433        # kernel expects init in cpio filesystem
    24342434        ln -sf sbin/init init
    24352435        # create cpio image file and unmount loop filesystem
    24362436        find . -print | cpio -o -H newc | gzip -9 > $rdz_fname 2> /dev/null
    2437         cd $old_pwd
     2437        cd "$old_pwd"
    24382438        umount $mountpoint || Die "Cannot unmount $tempfile"
    24392439        # log that we are done
  • branches/2.2.10/mindi/rootfs/README

    r1885 r2715  
    1414
    1515To edit the mountlist, type:-
    16 # edit-mountlist
     16# mondorestore --edit-mountlist
    1717
    1818The archives can be accessed manually using the afio command, like so:-
  • branches/2.2.10/mondo-doc/mondoarchive.8

    r2546 r2715  
    158158.TP
    159159.BI "\-E " "\*(lqpath ...\*(rq"
    160 Exclude path(s) from backup. The paths should be separated with a whitespace and surrounded by quotes.
     160Exclude path(s) from backup. The paths should be separated with a pipe and surrounded by quotes.
    161161This is the prefered and recommended option when doing partial archiving.
    162162Note that mondo automatically excludes removable media (/mnt/floppy,
     
    170170archived so it won't do what you expect.
    171171You may also specify full disk device to this option as with \-E
    172 \*(lq/dev/sda /dev/cciss/c0d0\*(rq
     172\*(lq/dev/sda|/dev/cciss/c0d0\*(rq
    173173
    174174.TP
    175175.BI "-I " "\*(lqpath ...\*(rq"
    176 Include paths(s) in backup. This option is mainly use to perform tests
     176Include paths(s) in backup. The paths should be separated with a pipe and surrounded by quotes.
     177This option is mainly use to perform tests
    177178in order to reduce the time taken by the archiving operation.
    178179The default backup path is \*(lq/\*(rq but you may specify alternatives,
    179 e.g. \-I \*(lq/home /etc\*(rq to override that.
     180e.g. \-I \*(lq/home|/etc\*(rq to override that.
    180181You may also specify full disk device to this option as with \-I
    181 \*(lq/dev/sda /dev/cciss/c0d0\*(rq
     182\*(lq/dev/sda|/dev/cciss/c0d0\*(rq
    182183N.B.: When using the
    183184.BR \-I
  • branches/2.2.10/mondo-doc/mondorescue-howto.sgml

    r2623 r2715  
    13341334<entry>
    13351335
    1336 bash# mondoarchive -E "/mnt/dos /mnt/cdrom" -9 -Oc 8
     1336bash# mondoarchive -E "/mnt/dos|/mnt/cdrom" -9 -Oc 8
    13371337
    13381338</entry>
     
    15611561
    15621562        # mondoarchive -D -Ow 10 -S /home/mondo/ -T /home/mondo/ -g \
    1563         -E "\"/home/cdaly/GIS/W2K /home/mondo/\"" -9
     1563        -E "/home/cdaly/GIS/W2K|/home/mondo" -9
    15641564
    15651565</entry>
     
    15751575    # at now + 5 min
    15761576mondoarchive -D -Ow 10 -S /home/mondo/ -T /home/mondo/ -g \
    1577 -E "\"/home/cdaly/GIS/W2K /home/mondo/\"" -9
     1577-E "/home/cdaly/GIS/W2K|/home/mondo" -9
    15781578&lt;CTRL&gt;-d
    15791579</entry>
     
    16531653}
    16541654screen -m -d mondoarchive -D -Ow 10 -S /home/mondo/ \
    1655 -T /home/mondo/ -g -E "\"/home/cdaly/GIS/W2K /home/mondo/\"" -9
     1655-T /home/mondo/ -g -E "/home/cdaly/GIS/W2K|/home/mondo" -9
    16561656#done
    16571657
     
    16631663<row>
    16641664<entry>
    1665         screen -m -d mondoarchive -D -Ow 10 -S /home/mondo/ -T /home/mondo/ -g -E "\"/home/cdaly/GIS/W2K /home/mondo/\"" -9
     1665        screen -m -d mondoarchive -D -Ow 10 -S /home/mondo/ -T /home/mondo/ -g -E "/home/cdaly/GIS/W2K|/home/mondo" -9
    16661666</entry>
    16671667</row>
  • branches/2.2.10/mondo-doc/mondorestore.8

    r2546 r2715  
    8787.TP
    8888.BI "-E " "\*(lqpath ...\*(rq"
    89 Exclude path(s) from restore (future dev). The paths should be separated with a whitespace.
    90 /mnt/cdrom, /proc, /sys, /tmp). For example, if you are restoring up
     89Exclude path(s) from restore (future dev). The paths should be separated with a pipe.
     90For example, if you are restoring up
    9191from an NFS mount but you do not want to restore some content, exclude it with that switch.
    9292
  • branches/2.2.10/mondo/src/common/libmondo-cli.c

    r2704 r2715  
    268268        /* Cut the flag_val['I'] in parts containing all paths to test them */
    269269        while (p != NULL) {
    270             q = strchr(p, ' ');
     270            q = strchr(p, '|');
    271271            if (q != NULL) {
    272272                *q = '\0';
     
    590590        /* Cut the flag_val['E'] in parts containing all paths to test them */
    591591        while (p != NULL) {
    592             q = strchr(p, ' ');
     592            q = strchr(p, '|');
    593593            if (q != NULL) {
    594594                *q = '\0';
     
    625625    if ((flag_set['N']) && (! bkpinfo->restore_data))       // exclude Network mounts & devices
    626626    {
    627         mr_asprintf(psz, "%s", list_of_NETFS_mounts_only());
    628         mr_strcat(bkpinfo->exclude_paths, " %s ", psz);
    629         mr_free(psz);
     627        psz = list_of_NETFS_mounts_only();
     628        log_msg(5, "-N means we'll exclude %s", psz);
     629        if (bkpinfo->exclude_paths) {
     630            mr_strcat(bkpinfo->exclude_paths, "|%s", psz);
     631            mr_free(psz);
     632        } else {
     633            bkpinfo->exclude_paths = psz;
     634        }
    630635
    631636        if (bkpinfo->exclude_paths != NULL) {
  • branches/2.2.10/mondo/src/common/libmondo-devices-EXT.h

    r2508 r2715  
    4646extern int eject_device(char *);
    4747
    48 extern char *list_of_NETFS_devices_and_mounts();
    4948extern char *list_of_NETFS_mounts_only(void);
    5049
  • branches/2.2.10/mondo/src/common/libmondo-devices.c

    r2704 r2715  
    19561956            log_msg (4, "%s is mounted on %s and is on disk %s", DSFptr->device, DSFptr->mount_point, ndsf);
    19571957            strcat(*included_dsf_list, DSFptr->mount_point);
    1958             strcat(*included_dsf_list, " ");
     1958            strcat(*included_dsf_list, "|");
    19591959        } else {
    19601960            log_msg (4, "%s is mounted on %s and is NOT on disk %s", DSFptr->device, DSFptr->mount_point, ndsf);
    19611961            strcat(*excluded_dsf_list, DSFptr->mount_point);
    1962             strcat(*excluded_dsf_list, " ");
     1962            strcat(*excluded_dsf_list, "|");
    19631963        }
    19641964        DSFptr = DSFptr->next;
     
    19801980char *mounted_on_dsf = NULL;
    19811981char *not_mounted_on_dsf = NULL;
    1982 char token_chars[] =" \t\r\f\a\0\n";
     1982char token_chars[] ="|\t\r\f\a\0\n";
    19831983char *tmp = NULL;
    19841984char *tmp1 = NULL;
     
    20012001                log_to_screen("==> %s", mounted_on_dsf);
    20022002                log_msg (5, "Adding to bkpinfo->exclude_paths due to -E option: %s", mounted_on_dsf);
    2003                 mr_strcat(bkpinfo->exclude_paths, " %s ", mounted_on_dsf);
    2004                 mr_strcat(bkpinfo->exclude_devs, " %s ", token);
     2003                if (bkpinfo->exclude_paths) {
     2004                    mr_strcat(bkpinfo->exclude_paths,"|%s",mounted_on_dsf);
     2005                } else {
     2006                    mr_asprintf(bkpinfo->exclude_paths,"%s",mounted_on_dsf);
     2007                }
     2008                if (bkpinfo->exclude_devs) {
     2009                    mr_strcat(bkpinfo->exclude_devs,"|%s",token);
     2010                } else {
     2011                    mr_asprintf(bkpinfo->exclude_devs,"%s",token);
     2012                }
    20052013            }
    20062014        } else {
     
    20132021                log_to_screen("Not archiving the following file systems:");
    20142022                log_to_screen("==> %s", not_mounted_on_dsf);
    2015                 mr_strcat(bkpinfo->exclude_paths, " %s ", not_mounted_on_dsf);
     2023                if (bkpinfo->exclude_paths) {
     2024                    mr_strcat(bkpinfo->exclude_paths, "|%s",not_mounted_on_dsf);
     2025                } else {
     2026                    mr_asprintf(bkpinfo->exclude_paths,"%s",not_mounted_on_dsf);
     2027                }
    20162028            }
    20172029        }
     
    20232035    /* A device special file was not passed in. Process it as a path. */
    20242036    case -1:
    2025         /* we need to add a space after token to be sure our strstr test works correctly */
    2026         mr_asprintf(tmp1," %s ",token);
     2037        /*  Adds a | to ensure correct detection even at both ends */
     2038        mr_asprintf(tmp1,"|%s",token);
    20272039        if (mode == 'E') {
    20282040            /*  Add the token if not already in the list */
    2029             mr_asprintf(tmp," %s ",bkpinfo->exclude_paths);
     2041            mr_asprintf(tmp,"|%s|",bkpinfo->exclude_paths);
    20302042            if (strstr(tmp,tmp1) == NULL) {
    2031                 mr_strcat(bkpinfo->exclude_paths, "%s", tmp1);
     2043                if (bkpinfo->exclude_paths) {
     2044                    mr_strcat(bkpinfo->exclude_paths,tmp1);
     2045                    mr_free(tmp1);
     2046                } else {
     2047                    bkpinfo->exclude_paths = tmp1;
     2048                }
    20322049            }
    20332050        } else {
    20342051            /*  Add the token if not already in the list */
    2035             mr_asprintf(tmp," %s ",bkpinfo->include_paths);
     2052            mr_asprintf(tmp,"|%s|",bkpinfo->include_paths);
    20362053            if (strstr(tmp,tmp1) == NULL) {
    20372054                mr_strcat(bkpinfo->include_paths, "%s", tmp1);
    20382055            }
     2056            mr_free(tmp1);
    20392057        }
    20402058        mr_free(tmp);
    2041         mr_free(tmp1);
    20422059        break;
    20432060    }
     
    20452062
    20462063    if (bkpinfo->include_paths != NULL) {
    2047         mr_strip_spaces(bkpinfo->include_paths);
    20482064        log_msg(1, "include_paths is now '%s'", bkpinfo->include_paths);
    20492065    }
    20502066    if (bkpinfo->exclude_paths != NULL) {
    2051         mr_strip_spaces(bkpinfo->exclude_paths);
    20522067        log_msg(1, "exclude_paths is now '%s'", bkpinfo->exclude_paths);
    20532068    }
    20542069    if (bkpinfo->exclude_devs != NULL) {
    2055         mr_strip_spaces(bkpinfo->exclude_devs);
    20562070        log_msg(1, "exclude_devs is now '%s'", bkpinfo->exclude_devs);
    20572071    }
     
    20612075
    20622076/**
    2063  * @addtogroup utilityGroup
    2064  * @{
    2065  */
    2066 /**
    2067  * Get a space-separated list of NETFS devices and mounts.
     2077 * Get a |-separated list of NETFS mounts.
    20682078 * @return The list created.
    2069  * @note The return value points to static data that will be overwritten with each call.
    2070  */
    2071 char *list_of_NETFS_devices_and_mounts(void)
    2072 {
    2073     char *exclude_these_devices = NULL;
     2079 * @note The return value points to allocated string that needs to be freed
     2080 * @bug Even though we only want the mounts, the devices are still checked.
     2081 */
     2082char *list_of_NETFS_mounts_only(void)
     2083{
    20742084    char *exclude_these_directories = NULL;
    2075     static char result_sz[1024];
    2076 
    2077     mr_asprintf(exclude_these_directories,"%s",list_of_NETFS_mounts_only());
    2078     exclude_these_devices = call_program_and_get_last_line_of_output("tr -s '\t' ' ' < /etc/fstab | grep -E '( (coda|ncpfs|sshfs|nfs|nfs4|smbfs|cifs|afs|gfs|ocfs|ocfs2|mvfs|nsspool|nsvol) )' | cut -d' ' -f1 | tr -s '\n' ' ' | awk '{print $0;}'",TRUE);
    2079     snprintf(result_sz, 1023, "%s %s", exclude_these_directories, exclude_these_devices);
    2080     mr_free(exclude_these_devices);
    2081     mr_free(exclude_these_directories);
    2082     return (result_sz);
    2083 }
    2084 
    2085 
    2086 
    2087 
    2088 /**
    2089  * Get a space-separated list of NETFS mounts.
    2090  * @return The list created.
    2091  * @note The return value points to static data that will be overwritten with each call.
    2092  * @bug Even though we only want the mounts, the devices are still checked.
    2093  */
    2094 char *list_of_NETFS_mounts_only(void)
    2095 {
    2096     char *exclude_these_directories = NULL;
    2097     static char result_sz[512];
    2098 
    2099     exclude_these_directories = call_program_and_get_last_line_of_output("mount -t coda,ncpfs,fuse.sshfs,nfs,nfs4,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' ' ' | awk '{print $0;}'",TRUE);
    2100     snprintf(result_sz, 511, "%s", exclude_these_directories);
    2101     mr_free(exclude_these_directories);
    2102     return (result_sz);
     2085
     2086    exclude_these_directories = call_program_and_get_last_line_of_output("mount -t coda,ncpfs,fuse.sshfs,nfs,nfs4,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' '|' | awk '{print $0;}'",TRUE);
     2087    log_msg(9,"list_of_NETFS_mounts_only returns %s\n",exclude_these_directories);
     2088    return(exclude_these_directories);
    21032089}
    21042090
     
    31063092        bkpinfo->include_paths = p;
    31073093
    3108         p = popup_and_get_string("Backup paths", "Please enter paths which you want me to backup. The default is '/' (i.e. everything).", bkpinfo->include_paths);
     3094        p = popup_and_get_string("Backup paths", "Please enter paths which you want me to backup separated by '|'. The default is '/' (i.e. everything).", bkpinfo->include_paths);
    31093095        if (p == NULL) {
    31103096            log_to_screen("User has chosen not to backup the PC");
     
    31143100        bkpinfo->include_paths = p;
    31153101
    3116         mr_asprintf(tmp, "%s", list_of_NETFS_mounts_only());
     3102        tmp = list_of_NETFS_mounts_only();
    31173103        if (strlen(tmp) > 2) {
    3118             mr_strcat(bkpinfo->exclude_paths, " %s",tmp);
     3104            mr_strcat(bkpinfo->exclude_paths, "|%s",tmp);
    31193105        }
    31203106        mr_free(tmp);
     
    31333119
    31343120
    3135         p = 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.", bkpinfo->exclude_paths);
     3121        p = popup_and_get_string("Exclude paths", "Please enter paths which you do NOT want to backup. Separate them with pipes. NB: /tmp and /proc are always excluded. :-) Just hit 'Enter' if you want to do a full system backup.", bkpinfo->exclude_paths);
    31363122        if (p == NULL) {
    31373123            log_to_screen("User has chosen not to backup the PC");
     
    31403126        mr_free(bkpinfo->exclude_paths);
    31413127        bkpinfo->exclude_paths = p;
    3142         /* Always needs to be finished by a space */
    3143         mr_strcat(bkpinfo->exclude_paths, " ");
     3128        /* Always needs to be finished by a pipe */
     3129        mr_strcat(bkpinfo->exclude_paths, "|");
    31443130
    31453131        p = popup_and_get_string("Temporary directory", "Please enter your temporary directory.", bkpinfo->tmpdir);
     
    32173203    /*  the mr_make_devlist_from_pathlist function appends
    32183204    *  to the *_paths variables so copy before */
    3219     mr_asprintf(tmp, "%s ", bkpinfo->exclude_paths);
     3205    mr_asprintf(tmp, "%s|", bkpinfo->exclude_paths);
    32203206    mr_make_devlist_from_pathlist(tmp, 'E');
    32213207    mr_free(tmp);
    3222     mr_asprintf(tmp, "%s ", bkpinfo->include_paths);
     3208    mr_asprintf(tmp, "%s|", bkpinfo->include_paths);
    32233209    mr_make_devlist_from_pathlist(tmp, 'I');
    32243210    mr_free(tmp);
  • branches/2.2.10/mondo/src/common/libmondo-devices.h

    r2508 r2715  
    3838int eject_device(char *);
    3939
    40 char *list_of_NETFS_devices_and_mounts();
    4140char *list_of_NETFS_mounts_only();
    4241
  • branches/2.2.10/mondo/src/common/libmondo-filelist.c

    r2704 r2715  
    12831283    mr_asprintf(sz_res, "%s", incoming);
    12841284    p = sz_res;
    1285     while ((*p != ' ' || in_quotes) && *p != '\0') {
     1285    while ((*p != '|' || in_quotes) && *p != '\0') {
    12861286        if (*p == '\"') {
    12871287            in_quotes = !in_quotes;
     
    13111311int open_and_list_dir(char *dir1, char *sth, FILE * fout, time_t time_of_last_full_backup) {
    13121312
    1313     const char delims[] = " ";
     1313    const char delims[] = "|";
    13141314
    13151315    DIR *dip;
     
    13221322    static int percentage = 0;
    13231323    char *skip_these = NULL;
    1324     char *new_with_spaces = NULL;
     1324    char *new_with_pipe;
    13251325    char *strtmp;
    13261326    char *token;
     
    13471347        }
    13481348    }
     1349    mr_asprintf(&find_excludes, "|");
    13491350
    13501351    if (!depth) {
    1351         mr_asprintf(find_excludes, " ");
     1352        mr_asprintf(find_excludes, "|");
    13521353        if (sth != NULL) {
    13531354            while((token = mr_strtok(sth, delims, &lastpos))) {
     
    14171418
    14181419//  log_msg(0, "Cataloguing %s", dir);
    1419     if (sth[0] == ' ') {
    1420         mr_asprintf(skip_these, "%s", sth);
    1421     } else {
    1422         mr_asprintf(skip_these, " %s ", sth);
    1423     }
    1424     mr_asprintf(new_with_spaces, " %s ", dir1);
     1420    mr_asprintf(skip_these, "|%s|", sth);
     1421    mr_asprintf(new_with_pipe, "|%s|", dir1);
    14251422    if ((dip = opendir(dir1)) == NULL) {
    14261423        mr_asprintf(tmp,"opendir %s", dir1);
    14271424        log_OS_error(tmp);
    14281425        mr_free(tmp);
    1429     } else if (strstr(skip_these, new_with_spaces)) {
     1426    } else if (strstr(skip_these, new_with_pipe)) {
    14301427        log_msg(10, "Found dir ***%s**** excluded", dir1);
    14311428        fprintf(fout, "%s\n", dir1);    // if excluded dir then print dir ONLY
     
    14401437                mr_asprintf(new,"%s%s",dir1,dit->d_name);
    14411438            }
    1442             mr_free(new_with_spaces);
    1443             mr_asprintf(new_with_spaces, " %s ", new);
    1444             if (strstr(skip_these, new_with_spaces)) {
     1439            mr_free(new_with_pipe);
     1440            mr_asprintf(new_with_spaces, "|%s|", new);
     1441            if (strstr(skip_these, new_with_pipe)) {
    14451442                fprintf(fout, "%s\n", new);
    14461443                log_msg(10, "Found child dir ***%s**** excluded", new);
    1447                 mr_free(new_with_spaces);
     1444                mr_free(new_with_pipe);
    14481445            } else {
    1449                 mr_free(new_with_spaces);
     1446                mr_free(new_with_pipe);
    14501447                if (!lstat(new, &statbuf)) {
    14511448                    if (!S_ISLNK(statbuf.st_mode)
     
    14741471        }
    14751472    }
    1476     mr_free(new_with_spaces);
     1473    mr_free(new_with_pipe);
    14771474    mr_free(skip_these);
    14781475    mr_free(dir);
     
    15841581        mr_free(tmp1);
    15851582
    1586         mr_asprintf(exclude_paths, " %s %s %s %s %s . ..  " MNT_CDROM " " MNT_FLOPPY " /media /tmp  /proc /sys /dev/shm " MINDI_CACHE, MONDO_CACHE, (excp == NULL) ? "" : excp, tmp2, (bkpinfo->tmpdir[0] == '/' && bkpinfo->tmpdir[1] == '/') ? (bkpinfo->tmpdir + 1) : bkpinfo->tmpdir, (bkpinfo->scratchdir[0] == '/' && bkpinfo->scratchdir[1] == '/') ? (bkpinfo->scratchdir + 1) : bkpinfo->scratchdir);
    1587         mr_free(tmp2);
     1583        mr_asprintf(exclude_paths, MONDO_CACHE"|%s|%s|%s|%s|.|..|"MNT_CDROM"|"MNT_FLOPPY"|/media|/tmp|/proc|/sys|/dev/shm|"MINDI_CACHE,(excp == NULL) ? "" : excp, tmp2, (bkpinfo->tmpdir[0] == '/' && bkpinfo->tmpdir[1] == '/') ? (bkpinfo->tmpdir + 1) : bkpinfo->tmpdir, (bkpinfo->scratchdir[0] == '/' && bkpinfo->scratchdir[1] == '/') ? (bkpinfo->scratchdir + 1) : bkpinfo->scratchdir);
    15881584
    15891585        log_msg(2, "Excluding paths = '%s'", exclude_paths);
     
    16101606                p += strlen(q);
    16111607                paranoid_free(q);
    1612                 while (*p == ' ') {
     1608                while (*p == '|') {
    16131609                    p++;
    16141610                }
Note: See TracChangeset for help on using the changeset viewer.