Changeset 2223 in MondoRescue


Ignore:
Timestamp:
Jun 17, 2009, 3:38:48 AM (15 years ago)
Author:
Bruno Cornec
Message:

mount the NFS dir in mondoarchive, if not already mounted, but present in fstab. Also avoids issue with trailing /. Should fix #304.

File:
1 edited

Legend:

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

    r2222 r2223  
    988988            strncpy(bkpinfo->nfs_remote_dir, "/", MAX_STR_LEN);
    989989        }
    990         sprintf(tmp, "mount | grep -E \"^%s .*\" | cut -d' ' -f3",
     990        sprintf(tmp, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3",
    991991                bkpinfo->nfs_mount);
    992992        strncpy(bkpinfo->isodir,
     
    994994                MAX_STR_LEN / 4);
    995995        if (strlen(bkpinfo->isodir) < 3) {
    996             retval++;
    997             log_to_screen("NFS share is not mounted. Please mount it.\n");
     996            log_to_screen("NFS share is not mounted. Trying to mount it for you.\n");
     997            sprintf(tmp, "mount %s", bkpinfo->nfs_mount);
     998            if (system(tmp)) {
     999                log_to_screen("Unable to mount NFS share %s. Please mount manually.\n", bkpinfo->nfs_mount);
     1000                retval++;
     1001            } else {
     1002                sprintf(tmp, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3",
     1003                    bkpinfo->nfs_mount);
     1004                strncpy(bkpinfo->isodir,
     1005                        call_program_and_get_last_line_of_output(tmp),
     1006                        MAX_STR_LEN / 4);
     1007                if (strlen(bkpinfo->isodir) < 3) {
     1008                    retval++;
     1009                    log_to_screen("NFS share %s is strangely not mounted. Please mount manually...\n", bkpinfo->nfs_mount);
     1010                }
     1011            }
    9981012        }
    9991013        log_msg(3, "mount = %s", bkpinfo->nfs_mount);
Note: See TracChangeset for help on using the changeset viewer.