Changeset 2436 in MondoRescue


Ignore:
Timestamp:
Sep 29, 2009, 1:48:32 AM (15 years ago)
Author:
Bruno Cornec
Message:
  • Improve deplist.d/* files
  • adds libnss for ssh support in boot disk
  • Solve a memory management issue in DSF module (strtok => mr_strtok)
  • DSF now also supports partitions in addition to full disks
  • Adds debug in open_and_list_dir
Location:
branches/2.2.9
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mindi/deplist.d/base.conf

    r2409 r2436  
    3232
    3333/usr/bin/bzip2
     34# is a link => No additional place
    3435/usr/bin/bunzip2
    3536/usr/bin/lzop
     37/usr/bin/lzma
    3638
     39/bin/bash
    3740/bin/date
    3841/sbin/ctrlaltdel
  • branches/2.2.9/mindi/deplist.d/minimal.conf

    r2433 r2436  
    77
    88# Base Unix commands
    9 /bin/bash
    109/bin/mt
    1110/bin/awk
     
    1817
    1918# Compression
    20 /bin/gunzip
    2119/bin/gzip
    2220
     
    3432/sbin/mount.fuse
    3533/usr/bin/fusermount
     34/usr/bin/ssh
    3635# Required by ssh as dlopened
    3736/usr/lib/libnss_compat.so
  • branches/2.2.9/mindi/deplist.d/net.conf

    r2410 r2436  
    66# SSH support
    77/usr/sbin/sshd
    8 /usr/bin/ssh
    98/usr/bin/scp
    109
  • branches/2.2.9/mindi/mindi

    r2432 r2436  
    22562256        # We want to use the real mount and all the supported variants (nfs, cifs, ...)
    22572257        rm -f bin/mount $MINDI_TMP/busy.lis
    2258         mountlis=`grep -E "mount|fuse|ssh" $DEPLIST_FILE $DEPLIST_DIR/* | cut -d: -f2`
     2258        mountlis=`grep -E "mount|fuse|ssh|libnss" $DEPLIST_FILE $DEPLIST_DIR/* | cut -d: -f2`
    22592259        for f in $MINDI_LIB/rootfs/bin/busybox $mountlis ; do
    22602260            if [ -f $f ]; then
  • branches/2.2.9/mondo/src/common/libmondo-devices.c

    r2434 r2436  
    15501550    int i = 0;
    15511551    int mount_cnt = 0;
     1552    int lastpos = 0;
    15521553    char *mounted_file_system = NULL;
    15531554    char *command = NULL;
     
    15801581
    15811582        log_msg (5, "mounted_file_system: %s", mounted_file_system);
    1582         if ((token = strtok(mounted_file_system, token_chars)) == NULL) {
     1583        if ((token = mr_strtok(mounted_file_system, token_chars, &lastpos)) == NULL) {
    15831584            log_msg (4, "Could not get the list of mounted file systems");
    15841585            paranoid_free(mounted_file_system);
     
    15971598            strcpy(DSFptr->device, token);
    15981599            mr_free(token);
    1599             if ((token = strtok(NULL, token_chars)) == NULL) {
     1600            if ((token = mr_strtok(mounted_file_system, token_chars, &lastpos)) == NULL) {
    16001601                log_msg (5, "Ran out of entries on the mounted file systems list");
    1601                 paranoid_free(mounted_file_system);
     1602                mr_free(mounted_file_system);
    16021603                mr_free(token);
    16031604                return (1);
     
    16061607            strcpy(DSFptr->mount_point, token);
    16071608            mr_free(token);
    1608             token = strtok(NULL, token_chars);
    1609         }
    1610         paranoid_free(mounted_file_system);
     1609            token = mr_strtok(mounted_file_system, token_chars, &lastpos);
     1610        }
     1611        mr_free(mounted_file_system);
    16111612    }
    16121613    /********
     
    16441645    char *mount_list = NULL;
    16451646    char *token = NULL;
     1647    char *ndsf = NULL;
    16461648    char token_chars[] =" \t\r\f\a\0";
    16471649    MOUNTED_FS_STRUCT *DSFptr = NULL;
     
    16931695    if (!strlen(partition_list)) {
    16941696        /* There were no partitions on the disk */
    1695         log_msg(4, "Cannot find any partitions on device special file %s", dsf);
    1696         return (-2);
    1697     }
    1698 
    1699     /* Fill the partition list */
    1700     i = 0;
    1701     lastpos = 0;
    1702     while ((token = mr_strtok(partition_list, token_chars, &lastpos)) != NULL) {
    1703         log_msg (5, "Found partition: %s", token);
    1704         strcpy(partitions[i++], token);
    1705         mr_free(token);
    1706     }
    1707     paranoid_free(partition_list);
     1697        log_msg(4, "No partitions on device special file %s", dsf);
     1698        log_msg(4, "I guess it's a partiion itself");
     1699        strcpy(partitions[0], dsf);
     1700        ndsf = truncate_to_drive_name(dsf);
     1701    } else {
     1702        /* Fill the partition list */
     1703        i = 0;
     1704        lastpos = 0;
     1705        while ((token = mr_strtok(partition_list, token_chars, &lastpos)) != NULL) {
     1706            log_msg (5, "Found partition: %s", token);
     1707            strcpy(partitions[i++], token);
     1708            mr_free(token);
     1709        }
     1710        mr_asprintf(ndsf, "%s", dsf);
     1711    }
     1712    mr_free(partition_list);
    17081713 
     1714    /*  For the rest ndsf is the new dsf to deal with */
    17091715    /********
    17101716     * At this point, we have a list of all of the partitions on the dsf. Now try to
     
    17401746        /* See if it's swap. If it is, ignore it. */
    17411747        mr_asprintf(&command, "parted2fdisk -l %s 2>/dev/null | awk '{if(($1==\"%s\")&&(toupper($0) ~ \"SWAP\")){print $1;exit}}'",
    1742           dsf, partitions[i]);
     1748          ndsf, partitions[i]);
    17431749        log_msg(4, "  Running: %s", command);
    17441750        mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     
    17701776        log_msg(4, "  It's not mounted. Checking to see if it's LVM...");
    17711777        /* Get the partition ID; 8e for LVM */
    1772         mr_asprintf(&command, "parted2fdisk -l %s |awk '{if($1 ~ \"^%s\"){print $5}}'", dsf, partitions[i]);
     1778        mr_asprintf(&command, "parted2fdisk -l %s |awk '{if($1 ~ \"^%s\"){print $5}}'", ndsf, partitions[i]);
    17731779        log_msg(4, "  Running: %s", command);
    17741780        mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     
    18091815                     *******/
    18101816                    paranoid_free(mount_list);
     1817
    18111818                    mr_asprintf(&command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");
    18121819                    log_msg (5, "Running: %s", command);
     
    18901897        }
    18911898        paranoid_free(tmp);
    1892     }
    1893     paranoid_free(partition_list);
    1894     paranoid_free(mount_list);
     1899        paranoid_free(mount_list);
     1900    }
    18951901
    18961902    /* Determine how much memory to allocate for included_dsf_list and excluded_dsf_list */
     
    19111917    while (DSFptr != NULL) {
    19121918        if (DSFptr->check) {
    1913             log_msg (5, "%s is mounted on %s and is on disk %s\n", DSFptr->device, DSFptr->mount_point, dsf);
     1919            log_msg (5, "%s is mounted on %s and is on disk %s\n", DSFptr->device, DSFptr->mount_point, ndsf);
    19141920            strcat(*included_dsf_list, DSFptr->mount_point);
    19151921            strcat(*included_dsf_list, " ");
    19161922        } else {
    1917             log_msg (4, "%s is mounted on %s and is NOT on disk %s\n", DSFptr->device, DSFptr->mount_point, dsf);
     1923            log_msg (4, "%s is mounted on %s and is NOT on disk %s\n", DSFptr->device, DSFptr->mount_point, ndsf);
    19181924            strcat(*excluded_dsf_list, DSFptr->mount_point);
    19191925            strcat(*excluded_dsf_list, " ");
     
    19211927        DSFptr = DSFptr->next;
    19221928    }
     1929    mr_free(ndsf);
     1930
    19231931    log_msg (5, "included_dsf_list: %s", *included_dsf_list);
    19241932    log_msg (5, "excluded_dsf_list: %s", *excluded_dsf_list);
  • branches/2.2.9/mondo/src/common/libmondo-filelist.c

    r2418 r2436  
    13501350    /* dir is needed when we pass it to the shell */
    13511351    dir = mr_stresc(dir1, "`$\\\"(){}'[]&*?|!#~", '\\');
    1352     p = strrchr(dir, '/');
     1352    p = strrchr(dir1, '/');
    13531353    if (p) {
    13541354        if (!strcmp(p, "/.") || !strcmp(p, "/..")) {
     
    14041404                    g_skeleton_filelist, g_skeleton_filelist);
    14051405//        log_msg(6, "fsm = %s", find_skeleton_marker);
    1406             run_program_and_log_output(find_skeleton_marker, 8);
     1406            paranoid_system(find_skeleton_marker);
    14071407            time(&this_time);
    14081408            if (this_time != last_time) {
     
    14341434        paranoid_free(tmp);
    14351435    } else if (strstr(skip_these, new_with_spaces)) {
     1436        log_msg(10, "Found dir ***%s**** excluded", dir1);
    14361437        fprintf(fout, "%s\n", dir1);    // if excluded dir then print dir ONLY
    14371438    } else {
     1439        log_msg(10, "Found dir ***%s**** parsed", dir1);
    14381440        fprintf(fout, "%s\n", dir1);
    14391441        while ((dit = readdir(dip)) != NULL) {
     
    14481450            if (strstr(skip_these, new_with_spaces)) {
    14491451                fprintf(fout, "%s\n", new);
     1452                log_msg(10, "Found child dir ***%s**** excluded", new);
    14501453                paranoid_free(new_with_spaces);
    14511454            } else {
     
    14541457                    if (!S_ISLNK(statbuf.st_mode)
    14551458                        && S_ISDIR(statbuf.st_mode)) {
     1459                        log_msg(10, "Found child dir ***%s**** parsed", new);
    14561460                        open_and_list_dir(new, skip_these, fout,
    14571461                                          time_of_last_full_backup);
     
    14601464                            || time_of_last_full_backup <
    14611465                            statbuf.st_ctime) {
     1466                            log_msg(10, "Found child file ***%s**** parsed", new);
    14621467                            fprintf(fout, "%s\n", new);
    14631468                            if ((counter++) > 128) {
Note: See TracChangeset for help on using the changeset viewer.