Changeset 2382 in MondoRescue for branches/2.2.10/mondo/src


Ignore:
Timestamp:
Sep 10, 2009, 2:07:16 AM (15 years ago)
Author:
Bruno Cornec
Message:
  • Change NFS support into a NetFS support to allow for multiple protocol in addition to NFS (NEEDS TESTING)

(Backport from 2.2.9)

Location:
branches/2.2.10/mondo/src
Files:
21 edited

Legend:

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

    r2376 r2382  
    759759        mr_asprintf(value, "iso");
    760760        break;
    761     case nfs:
    762         mr_asprintf(value, "nfs");
     761    case netfs:
     762        mr_asprintf(value, "netfs");
    763763        break;
    764764    case dvd:
     
    824824    }
    825825
    826     estimated_total_noof_slices =
    827         size_of_all_biggiefiles_K(bkpinfo) / bkpinfo->optimal_set_size + 1;
    828     /* BERLIOS: add nfs stuff here? */
     826    estimated_total_noof_slices = size_of_all_biggiefiles_K(bkpinfo) / bkpinfo->optimal_set_size + 1;
     827
     828    /* BERLIOS: add netfs stuff here? */
    829829    mr_asprintf(command, "mkdir -p %s/images", bkpinfo->scratchdir);
    830830    if (system(command)) {
     
    12181218
    12191219    if ((bkpinfo->isodir != NULL) && (bkpinfo->prefix != NULL)) {
    1220         if (bkpinfo->nfs_remote_dir) {
     1220        if (bkpinfo->netfs_remote_dir) {
    12211221            // NFS
    1222             mr_asprintf(command, "rm -f %s/%s/%s-[1-9]*.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix);
     1222            mr_asprintf(command, "rm -f %s/%s/%s-[1-9]*.iso", bkpinfo->isodir, bkpinfo->netfs_remote_dir, bkpinfo->prefix);
    12231223        } else {
    12241224            // ISO
     
    31313131 * - @c manual_cd_tray
    31323132 * - @c media_size
    3133  * - @c nfs_mount
    3134  * - @c nfs_remote_dir
     3133 * - @c netfs_mount
     3134 * - @c netfs_remote_dir
    31353135 * - @c scratchdir
    31363136 * - @c verify_data
     
    32033203        log_to_screen("Warning! CD is too big. It occupies %ld KB, which is more than the %ld KB allowed.", (long) space_occupied_by_cd(bkpinfo->scratchdir), (long) bkpinfo->media_size[g_current_media_number]);
    32043204    }
    3205     if (((bkpinfo->isodir == NULL) && (bkpinfo->nfs_remote_dir == NULL)) || (bkpinfo->prefix == NULL)) {
     3205    if (((bkpinfo->isodir == NULL) && (bkpinfo->netfs_remote_dir == NULL)) || (bkpinfo->prefix == NULL)) {
    32063206        fatal_error("Something wrong in your environement. Report to dev team");
    32073207    }
    3208     if (bkpinfo->nfs_remote_dir) {
    3209         // NFS
    3210         mr_asprintf(isofile, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number);
     3208    if (bkpinfo->netfs_remote_dir) {
     3209        // Network
     3210        mr_asprintf(isofile, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->netfs_remote_dir, bkpinfo->prefix, g_current_media_number);
    32113211    } else {
    32123212        // ISO
    32133213        mr_asprintf(isofile, "%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->prefix, g_current_media_number);
    32143214    }
     3215
    32153216    for (that_one_was_ok = FALSE; !that_one_was_ok;) {
    32163217        if (bkpinfo->backup_media_type != usb) {
  • branches/2.2.10/mondo/src/common/libmondo-cli.c

    r2338 r2382  
    5555static void free_mounted_fs_list (void);
    5656static int get_dsf_mount_list (const char *dsf, char **included_dsf_list, char **excluded_dsf_list);
    57 static int create_list_of_non_NFS_mounted_file_systems (void);
     57static int create_list_of_non_NETFS_mounted_file_systems (void);
    5858static MOUNTED_FS_STRUCT *find_mount_point_in_list (const char *mount_point);
    5959static MOUNTED_FS_STRUCT *find_device_in_list (const char *device);
     
    162162/**
    163163 * Frees the memory for all of the structures on the linked list of
    164  * all of the non-NFS mounted file systems.
     164 * all of the non-NETFS mounted file systems.
    165165 */
    166166static void free_mounted_fs_list (void) {
     
    179179
    180180/**
    181  * Creates a singly linked list of all of the non-NFS mounted file systems.
     181 * Creates a singly linked list of all of the non-NETFS mounted file systems.
    182182 * @param DSFptr A pointer  to the structure MOUNTED_FS_STRUCT used to hold
    183183 * the list of mounted file systems.
     
    197197
    198198/**
    199  * Find the structure, in the singly linked list of all of the non-NFS
     199 * Find the structure, in the singly linked list of all of the non-NETFS
    200200 * mounted file systems, that contains the specified device.
    201201 * @param device The device to find
     
    218218
    219219/**
    220  * Find the structure, in the singly linked list of all of the non-NFS
     220 * Find the structure, in the singly linked list of all of the non-NETFS
    221221 * mounted file systems, that contains the specified mount point.
    222222 * @param mount_point The mount point to find
     
    239239
    240240/**
    241  * Creates a linked list of all of the non-NFS mounted file systems.
     241 * Creates a linked list of all of the non-NETFS mounted file systems.
    242242 * We use a linked list because we don't know how many  mounted file
    243243 * there are (and there can be a lot).
    244244 * @return 0 on success and greated than 0 on failure.
    245245 */
    246 static int create_list_of_non_NFS_mounted_file_systems (void)
     246static int create_list_of_non_NETFS_mounted_file_systems (void)
    247247{
    248248    int i = 0;
     
    372372
    373373    /* Get a list of the mounted file systems */
    374     if (create_list_of_non_NFS_mounted_file_systems()) {
     374    if (create_list_of_non_NETFS_mounted_file_systems()) {
    375375        log_to_screen ("Could not get the list of mounted file systems");
    376376        return (1);
     
    967967
    968968    if (flag_set['n']) {
    969         mr_free(bkpinfo->nfs_mount);
    970         mr_asprintf(bkpinfo->nfs_mount, "%s", flag_val['n']);
     969        mr_free(bkpinfo->netfs_mount);
     970        mr_asprintf(bkpinfo->netfs_mount, "%s", flag_val['n']);
    971971        if (!flag_set['d']) {
    972             mr_free(bkpinfo->nfs_remote_dir);
    973             mr_asprintf(bkpinfo->nfs_remote_dir, "/");
    974         }
    975         /* test if we specified a user for the NFS dialog */
    976         p = strchr(bkpinfo->nfs_mount, '@');
     972            mr_free(bkpinfo->netfs_remote_dir);
     973            mr_asprintf(bkpinfo->netfs_remote_dir, "/");
     974        }
     975        /* test for protocol */
     976        p = strchr(bkpinfo->netfs_mount, ':');
     977        if (p == NULL) {
     978            /* protocol not found abort */
     979            fatal_error("No protocol specified for remote share mount. Please do man mondoarchive as syntax changed");
     980        } else {
     981            /* Proto found. Store the 2 values */
     982            bkpinfo->netfs_proto = bkpinfo->netfs_mount;
     983            p++;
     984            if (*p != '/') {
     985                fatal_error("No protocol correctly specified for remote share mount. Use protocol://server:share");
     986            }
     987            p++;
     988            if (*p != '/') {
     989                fatal_error("No protocol correctly specified for remote share mount. Use protocol://server:share");
     990            }
     991            bkpinfo->netfs_mount = p;
     992            /* new netfs mount - remove :// from proto */
     993            p--;
     994            p--;
     995            p--;
     996            *p = '\0';
     997        }
     998        /* test if we specified a user */
     999        p = strchr(bkpinfo->netfs_mount, '@');
    9771000        if (p != NULL) {
    9781001            /* User found. Store the 2 values */
    979             bkpinfo->nfs_user = bkpinfo->nfs_mount;
     1002            bkpinfo->netfs_user = bkpinfo->netfs_mount;
    9801003            p++;
    981             /* new NFS mount */
    982             bkpinfo->nfs_mount = p;
     1004            /* new netfs mount */
     1005            bkpinfo->netfs_mount = p;
    9831006            p--;
    9841007            *p = '\0';
    9851008        }
    986         mr_asprintf(tmp1, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3", bkpinfo->nfs_mount);
     1009        mr_asprintf(tmp1, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3", bkpinfo->netfs_mount);
    9871010        mr_free(bkpinfo->isodir);
    9881011        mr_asprintf(bkpinfo->isodir, "%s", call_program_and_get_last_line_of_output(tmp1));
     
    9901013
    9911014        if (strlen(bkpinfo->isodir) < 3) {
    992             log_to_screen("NFS share is not mounted. Trying to mount it for you.\n");
    993             mr_asprintf(tmp1, "mount %s", bkpinfo->nfs_mount);
     1015            log_to_screen("Network share is not mounted. Trying to mount it for you.\n");
     1016            if (strstr(bkpinfo->netfs_proto, "sshfs")) {
     1017                mr_asprintf(tmp1, "sshfs %s", bkpinfo->netfs_mount);
     1018            } else {
     1019                mr_asprintf(tmp1, "mount %s", bkpinfo->netfs_mount);
     1020            }
    9941021            i = system(tmp1);
    9951022            mr_free(tmp1);
    9961023            if (i) {
    997                 log_to_screen("Unable to mount NFS share %s. Please mount manually.\n", bkpinfo->nfs_mount);
     1024                log_to_screen("Unable to mount Network share %s. Please mount manually.\n", bkpinfo->netfs_mount);
    9981025                retval++;
    9991026            } else {
    1000                 mr_asprintf(tmp1, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3", bkpinfo->nfs_mount);
     1027                mr_asprintf(tmp1, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3", bkpinfo->netfs_mount);
    10011028                mr_free(bkpinfo->isodir);
    10021029                mr_asprintf(bkpinfo->isodir, "%s", call_program_and_get_last_line_of_output(tmp1));
     
    10051032                if (strlen(bkpinfo->isodir) < 3) {
    10061033                    retval++;
    1007                     log_to_screen("NFS share %s is strangely not mounted. Please mount manually...\n", bkpinfo->nfs_mount);
     1034                    log_to_screen("Network share %s is strangely not mounted. Please mount manually...\n", bkpinfo->netfs_mount);
    10081035                }
    10091036            }
    10101037        }
    1011         log_msg(3, "mount = %s", bkpinfo->nfs_mount);
     1038        log_msg(3, "mount = %s", bkpinfo->netfs_mount);
    10121039        log_msg(3, "isodir= %s", bkpinfo->isodir);
    10131040    }
     
    10231050    }
    10241051    if (flag_set['n']) {
    1025         bkpinfo->backup_media_type = nfs;
    1026         /* Never try to eject a NFS device */
     1052        bkpinfo->backup_media_type = netfs;
     1053        /* Never try to eject a Network device */
    10271054        bkpinfo->please_dont_eject = TRUE;
    10281055    }
     
    11341161    }
    11351162
    1136     if ((flag_set['N']) && (! bkpinfo->restore_data))       // exclude NFS mounts & devices
     1163    if ((flag_set['N']) && (! bkpinfo->restore_data))       // exclude Network mounts & devices
    11371164    {
    1138         mr_asprintf(psz, "%s", list_of_NFS_mounts_only());
     1165        mr_asprintf(psz, "%s", list_of_NETFS_mounts_only());
    11391166        mr_strcat(bkpinfo->exclude_paths, " %s ", psz);
    11401167        mr_free(psz);
     
    12011228    }
    12021229
    1203     if (flag_set['d']) {        /* backup directory (if ISO/NFS) */
     1230    if (flag_set['d']) {        /* backup directory (if ISO/NETFS) */
    12041231        if (flag_set['i']) {
    12051232            mr_free(bkpinfo->isodir);
     
    12121239            mr_free(tmp1);
    12131240        } else if (flag_set['n']) {
    1214             mr_free(bkpinfo->nfs_remote_dir);
    1215             mr_asprintf(bkpinfo->nfs_remote_dir, "%s", flag_val['d']);
     1241            mr_free(bkpinfo->netfs_remote_dir);
     1242            mr_asprintf(bkpinfo->netfs_remote_dir, "%s", flag_val['d']);
    12161243        } else {                /* backup device (if tape/CD-R/CD-RW) */
    12171244            mr_free(bkpinfo->media_device);
     
    12211248
    12221249    if ((flag_set['n']) && (! bkpinfo->restore_data)) {
    1223         mr_asprintf(tmp1,"%s/%s/.dummy.txt", bkpinfo->isodir,bkpinfo->nfs_remote_dir);
    1224         if (bkpinfo->nfs_user) {
    1225             mr_asprintf(tmp2, "su - %s -c \"echo hi > %s\"", bkpinfo->nfs_user, tmp1);
     1250        mr_asprintf(tmp1,"%s/%s/.dummy.txt", bkpinfo->isodir,bkpinfo->netfs_remote_dir);
     1251        if ((bkpinfo->netfs_user) && (strstr(bkpinfo->netfs_proto,"nfs"))) {
     1252            mr_asprintf(tmp2, "su - %s -c \"echo hi > %s\"", bkpinfo->netfs_user, tmp1);
    12261253        } else {
    12271254            mr_asprintf(tmp2, "echo hi > %s", tmp1);
     
    12321259        if (i) {
    12331260            retval++;
    1234             log_to_screen(tmp2, "Are you sure directory '%s' exists in remote dir '%s'?\nIf so, do you have rights to write to it?\n", bkpinfo->nfs_remote_dir, bkpinfo->nfs_mount);
     1261            log_to_screen(tmp2, "Are you sure directory '%s' exists in remote dir '%s'?\nIf so, do you have rights to write to it?\n", bkpinfo->netfs_remote_dir, bkpinfo->netfs_mount);
    12351262        }
    12361263        unlink(tmp1);
  • branches/2.2.10/mondo/src/common/libmondo-devices-EXT.h

    r2330 r2382  
    4646extern int eject_device(char *);
    4747
    48 extern char *list_of_NFS_devices_and_mounts();
    49 extern char *list_of_NFS_mounts_only(void);
     48extern char *list_of_NETFS_devices_and_mounts();
     49extern char *list_of_NETFS_mounts_only(void);
    5050
    5151extern void sensibly_set_scratchdir();
  • branches/2.2.10/mondo/src/common/libmondo-devices.c

    r2376 r2382  
    5454 */
    5555bool g_restoring_live_from_cd = FALSE;
    56 bool g_restoring_live_from_nfs = FALSE;
     56bool g_restoring_live_from_netfs = FALSE;
    5757
    5858extern t_bkptype g_backup_media_type;   // set by main()
     
    164164        mr_asprintf(output, "cdstream");
    165165        break;
    166     case nfs:
    167         mr_asprintf(output, "nfs");
     166    case netfs:
     167        mr_asprintf(output, "netfs");
    168168        break;
    169169    case tape:
     
    12981298    mr_free(tmp);
    12991299
    1300     if (g_ISO_restore_mode || bkpinfo->backup_media_type == iso || bkpinfo->backup_media_type == nfs) {
     1300    if (g_ISO_restore_mode || bkpinfo->backup_media_type == iso || bkpinfo->backup_media_type == netfs) {
    13011301        // BERLIOS --- I'm tempted to do something about this...
    13021302        // Why unmount and remount again and again?
     
    13101310        mr_free(tmp);
    13111311
    1312         if (((bkpinfo->isodir == NULL) && (bkpinfo->nfs_remote_dir == NULL)) || (bkpinfo->prefix == NULL)) {
     1312        if (((bkpinfo->isodir == NULL) && (bkpinfo->netfs_remote_dir == NULL)) || (bkpinfo->prefix == NULL)) {
    13131313            fatal_error("Unable to prepare ISO file name. Please report to dev team");
    13141314        }
    1315         if (bkpinfo->nfs_remote_dir) {
    1316             // NFS
    1317             mr_asprintf(tmp, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, cd_number_i_want);
     1315        if (bkpinfo->netfs_remote_dir) {
     1316            // NETFS
     1317            mr_asprintf(tmp, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->netfs_remote_dir, bkpinfo->prefix, cd_number_i_want);
    13181318        } else {
    13191319            // ISO
     
    13221322        if (!does_file_exist(tmp)) {
    13231323            mr_free(tmp);
    1324             if (bkpinfo->nfs_remote_dir) {
    1325                 // NFS
    1326                 mr_asprintf(tmp, "%s/isodir/%s/%s-%d.iso", bkpinfo->tmpdir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, cd_number_i_want);
     1324            if (bkpinfo->netfs_remote_dir) {
     1325                // NETFS
     1326                mr_asprintf(tmp, "%s/isodir/%s/%s-%d.iso", bkpinfo->tmpdir, bkpinfo->netfs_remote_dir, bkpinfo->prefix, cd_number_i_want);
    13271327            } else {
    13281328                // ISO
     
    14131413    bkpinfo->nonbootable_backup = FALSE;
    14141414
    1415     // Tape, CD, NFS, ...?
     1415    // Tape, CD, NETFS, ...?
    14161416    srandom(getpid());
    14171417    bkpinfo->backup_media_type =
     
    16471647
    16481648
    1649     case nfs:
    1650         /* Never try to eject a NFS device */
     1649    case netfs:
     1650        /* Never try to eject a NETFS device */
    16511651        bkpinfo->please_dont_eject = TRUE;
    16521652
    1653         /* Initiate bkpinfo nfs_mount path from running environment if not already done */
    1654         if (bkpinfo->nfs_mount == NULL) {
    1655             mr_asprintf(bkpinfo->nfs_mount, "%s", call_program_and_get_last_line_of_output("mount | grep \":\" | cut -d' ' -f1 | head -n1"));
     1653        /* Initiate bkpinfo netfs_mount path from running environment if not already done */
     1654        if (bkpinfo->netfs_mount == NULL) {
     1655            mr_asprintf(bkpinfo->netfs_mount, "%s", call_program_and_get_last_line_of_output("mount | grep \":\" | cut -d' ' -f1 | head -n1"));
    16561656        }
    16571657#ifdef __FreeBSD__
     
    16611661#endif
    16621662        {
    1663             p = popup_and_get_string("NFS dir.", "Please enter path and directory where archives are stored remotely. (Mondo has taken a guess at the correct value. If it is incorrect, delete it and type the correct one.)", bkpinfo->nfs_mount);
     1663            p = popup_and_get_string("Network shared dir.", "Please enter path and directory where archives are stored remotely. (Mondo has taken a guess at the correct value. If it is incorrect, delete it and type the correct one.)", bkpinfo->netfs_mount);
    16641664            if (p == NULL) {
    16651665                log_to_screen("User has chosen not to backup the PC");
    16661666                finish(1);
    16671667            }
    1668             mr_free(bkpinfo->nfs_mount);
    1669             bkpinfo->nfs_mount = p;
     1668            mr_free(bkpinfo->netfs_mount);
     1669            bkpinfo->netfs_mount = p;
    16701670            if (!bkpinfo->restore_data) {
    16711671                if ((bkpinfo->compression_level =
     
    16771677            // check whether already mounted - we better remove
    16781678            // surrounding spaces and trailing '/' for this
    1679             mr_strip_spaces(bkpinfo->nfs_mount);
    1680             if (bkpinfo->nfs_mount[strlen(bkpinfo->nfs_mount) - 1] == '/')
    1681                 bkpinfo->nfs_mount[strlen(bkpinfo->nfs_mount) - 1] = '\0';
    1682             mr_asprintf(command, "mount | grep \"%s \" | cut -d' ' -f3", bkpinfo->nfs_mount);
     1679            mr_strip_spaces(bkpinfo->netfs_mount);
     1680            if (bkpinfo->netfs_mount[strlen(bkpinfo->netfs_mount) - 1] == '/')
     1681                bkpinfo->netfs_mount[strlen(bkpinfo->netfs_mount) - 1] = '\0';
     1682            mr_asprintf(command, "mount | grep \"%s \" | cut -d' ' -f3", bkpinfo->netfs_mount);
    16831683            mr_free(bkpinfo->isodir);
    16841684            mr_asprintf(bkpinfo->isodir, "%s", call_program_and_get_last_line_of_output(command));
     
    17111711            mr_free(command);
    17121712
    1713             p = popup_and_get_string("NFS share", "Which remote NFS share should I mount?", bkpinfo->nfs_mount);
     1713            p = popup_and_get_string("Network share", "Which remote Network share should I mount?", bkpinfo->netfs_mount);
    17141714            if (p == NULL) {
    17151715                log_to_screen("User has chosen not to backup the PC");
    17161716                finish(1);
    17171717            }
    1718             mr_free(bkpinfo->nfs_mount);
    1719             bkpinfo->nfs_mount = p;
     1718            mr_free(bkpinfo->netfs_mount);
     1719            bkpinfo->netfs_mount = p;
    17201720        }
    17211721        /* Initiate bkpinfo isodir path from running environment if mount already done */
    17221722        mr_free(bkpinfo->isodir);
    1723         if (is_this_device_mounted(bkpinfo->nfs_mount)) {
     1723        if (is_this_device_mounted(bkpinfo->netfs_mount)) {
    17241724            mr_asprintf(bkpinfo->isodir, "%s", call_program_and_get_last_line_of_output("mount | grep \":\" | cut -d' ' -f3 | head -n1"));
    17251725
    17261726        } else {
    1727             mr_asprintf(bkpinfo->isodir, "%s/nfsdir", bkpinfo->tmpdir);
     1727            mr_asprintf(bkpinfo->isodir, "%s/netfsdir", bkpinfo->tmpdir);
    17281728            mr_asprintf(command, "mkdir -p %s", bkpinfo->isodir);
    17291729            run_program_and_log_output(command, 5);
     
    17311731
    17321732            if (bkpinfo->restore_data) {
    1733                 mr_asprintf(tmp, "mount -t nfs -o nolock,ro %s %s", bkpinfo->nfs_mount, bkpinfo->isodir);
     1733                if (strstr(bkpinfo->netfs_proto, "sshfs")) {
     1734                    mr_asprintf(tmp, "sshfs -o ro %s %s", bkpinfo->netfs_mount, bkpinfo->isodir);
     1735                } else {
     1736                    mr_asprintf(tmp, "mount -t %s -o nolock,ro %s %s", bkpinfo->netfs_proto, bkpinfo->netfs_mount, bkpinfo->isodir);
     1737                }
    17341738            } else {
    1735                 mr_asprintf(tmp, "mount -t nfs -o nolock %s %s", bkpinfo->nfs_mount, bkpinfo->isodir);
     1739                if (strstr(bkpinfo->netfs_proto, "sshfs")) {
     1740                    mr_asprintf(tmp, "sshfs %s %s", bkpinfo->netfs_mount, bkpinfo->isodir);
     1741                } else {
     1742                    mr_asprintf(tmp, "mount -t %s -o nolock %s %s", bkpinfo->netfs_proto, bkpinfo->netfs_mount, bkpinfo->isodir);
     1743                }
    17361744            }
    17371745            run_program_and_log_output(tmp, 3);
     
    17411749            strcpy(g_selfmounted_isodir, bkpinfo->isodir);
    17421750        }
    1743         if (!is_this_device_mounted(bkpinfo->nfs_mount)) {
     1751        if (!is_this_device_mounted(bkpinfo->netfs_mount)) {
    17441752            popup_and_OK("Please mount that partition before you try to backup to or restore from it.");
    17451753            finish(1);
    17461754        }
    1747         p = popup_and_get_string("Directory", "Which directory within that mountpoint?", bkpinfo->nfs_remote_dir);
     1755        p = popup_and_get_string("Directory", "Which directory within that mountpoint?", bkpinfo->netfs_remote_dir);
    17481756        if (p == NULL) {
    17491757            log_to_screen("User has chosen not to backup the PC");
    17501758            finish(1);
    17511759        }
    1752         mr_free(bkpinfo->nfs_remote_dir);
    1753         bkpinfo->nfs_remote_dir = p;
     1760        mr_free(bkpinfo->netfs_remote_dir);
     1761        bkpinfo->netfs_remote_dir = p;
    17541762
    17551763        // check whether writable - we better remove surrounding spaces for this
    1756         mr_strip_spaces(bkpinfo->nfs_remote_dir);
     1764        mr_strip_spaces(bkpinfo->netfs_remote_dir);
    17571765
    17581766        p = popup_and_get_string("Prefix.", "Please enter the prefix that will be prepended to your ISO filename.  Example: machine1 to obtain machine1-[1-9]*.iso files", bkpinfo->prefix);
     
    17651773        log_msg(3, "prefix set to %s", bkpinfo->prefix);
    17661774
    1767         log_msg(3, "Just set nfs_remote_dir to %s", bkpinfo->nfs_remote_dir);
     1775        log_msg(3, "Just set netfs_remote_dir to %s", bkpinfo->netfs_remote_dir);
    17681776        log_msg(3, "isodir is still %s", bkpinfo->isodir);
    17691777        break;
     
    18731881        bkpinfo->include_paths = p;
    18741882
    1875         mr_asprintf(tmp, "%s", list_of_NFS_mounts_only());
     1883        mr_asprintf(tmp, "%s", list_of_NETFS_mounts_only());
    18761884        if (strlen(tmp) > 2) {
    18771885            mr_strcat(bkpinfo->exclude_paths, " %s",tmp);
     
    19461954
    19471955    if (bkpinfo->backup_media_type == iso
    1948         || bkpinfo->backup_media_type == nfs) {
     1956        || bkpinfo->backup_media_type == netfs) {
    19491957        g_ISO_restore_mode = TRUE;
    19501958    }
     
    19521960// skip
    19531961#else
    1954     if (bkpinfo->backup_media_type == nfs) {
    1955         log_msg(3, "I think the NFS mount is mounted at %s", bkpinfo->isodir);
     1962    if (bkpinfo->backup_media_type == netfs) {
     1963        log_msg(3, "I think the Remote mount is mounted at %s", bkpinfo->isodir);
    19561964    }
    19571965    log_it("isodir = %s", bkpinfo->isodir);
    1958     if (bkpinfo->nfs_mount) {
    1959         log_it("nfs_mount = '%s'", bkpinfo->nfs_mount);
    1960     }
    1961     if (bkpinfo->nfs_user) {
    1962         log_it("nfs_user = '%s'", bkpinfo->nfs_user);
     1966    if (bkpinfo->netfs_mount) {
     1967        log_it("netfs_mount = '%s'", bkpinfo->netfs_mount);
     1968    }
     1969    if (bkpinfo->netfs_user) {
     1970        log_it("netfs_user = '%s'", bkpinfo->netfs_user);
     1971    }
     1972    if (bkpinfo->netfs_proto) {
     1973        log_it("netfs_proto = '%s'", bkpinfo->netfs_proto);
    19631974    }
    19641975#endif
     
    20082019 */
    20092020/**
    2010  * Get a space-separated list of NFS devices and mounts.
     2021 * Get a space-separated list of NETFS devices and mounts.
    20112022 * @return The list created.
    20122023 * @note The return value points to static data that will be overwritten with each call.
    20132024 */
    2014 char *list_of_NFS_devices_and_mounts(void)
     2025char *list_of_NETFS_devices_and_mounts(void)
    20152026{
    20162027    char *exclude_these_devices = NULL;
     
    20182029    static char result_sz[1024];
    20192030
    2020     mr_asprintf(exclude_these_directories,"%s",list_of_NFS_mounts_only());
    2021     mr_asprintf(exclude_these_devices,"%s", call_program_and_get_last_line_of_output("tr -s '\t' ' ' < /etc/fstab | grep -E '( (coda|ncpfs|nfs|nfs4|smbfs|cifs|afs|gfs|ocfs|ocfs2|mvfs|nsspool|nsvol) )' | cut -d' ' -f1 | tr -s '\n' ' ' | awk '{print $0;}'"));
     2031    mr_asprintf(exclude_these_directories,"%s",list_of_NETFS_mounts_only());
     2032    mr_asprintf(exclude_these_devices,"%s", 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;}'"));
    20222033    snprintf(result_sz, 1023, "%s %s", exclude_these_directories, exclude_these_devices);
    20232034    mr_free(exclude_these_devices);
     
    20302041
    20312042/**
    2032  * Get a space-separated list of NFS mounts.
     2043 * Get a space-separated list of NETFS mounts.
    20332044 * @return The list created.
    20342045 * @note The return value points to static data that will be overwritten with each call.
    20352046 * @bug Even though we only want the mounts, the devices are still checked.
    20362047 */
    2037 char *list_of_NFS_mounts_only(void)
     2048char *list_of_NETFS_mounts_only(void)
    20382049{
    20392050    char *exclude_these_directories = NULL;
    20402051    static char result_sz[512];
    20412052
    2042     mr_asprintf(exclude_these_directories,"%s", call_program_and_get_last_line_of_output("mount -t coda,ncpfs,nfs,nfs4,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' ' ' | awk '{print $0;}'"));
     2053    mr_asprintf(exclude_these_directories,"%s", 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;}'"));
    20432054    snprintf(result_sz, 511, "%s", exclude_these_directories);
    20442055    mr_free(exclude_these_directories);
     
    20942105    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,ntfs-3g,smbfs,smb,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));
    20952106#else
    2096     mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -x nfs -x nfs4 -x vfat -x ntfs -x ntfs-3g -x smbfs -x smb -x cifs -x afs -x gfs -x ocfs -x ocfs2 -x mvfs -x nsspool -x nssvol -x iso9660 | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));
     2107    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -x nfs -x nfs4 -x fuse.sshfs -x vfat -x ntfs -x ntfs-3g -x smbfs -x smb -x cifs -x afs -x gfs -x ocfs -x ocfs2 -x mvfs -x nsspool -x nssvol -x iso9660 | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));
    20972108#endif
    20982109
     
    25352546    struct stat buf;
    25362547#endif
    2537     log_msg(0, "Looking for partition table format type");
    25382548    mr_asprintf(fdisk, "/sbin/parted2fdisk");
    2539     log_msg(1, "Using %s", fdisk);
    25402549    mr_asprintf(command, "%s -l %s | grep 'EFI GPT'", fdisk, drive);
    25412550    mr_free(fdisk);
  • branches/2.2.10/mondo/src/common/libmondo-devices.h

    r2325 r2382  
    3838int eject_device(char *);
    3939
    40 char *list_of_NFS_devices_and_mounts();
    41 char *list_of_NFS_mounts_only();
     40char *list_of_NETFS_devices_and_mounts();
     41char *list_of_NETFS_mounts_only();
    4242
    4343void sensibly_set_scratchdir();
  • branches/2.2.10/mondo/src/common/libmondo-filelist.c

    r2370 r2382  
    12991299    *p = '\0';
    13001300    return (sz_res);
    1301 }
    1302 
    1303 
    1304 
    1305 /**
    1306  * Create the filelist for the backup. It will be stored in [scratchdir]/archives/filelist.full.
    1307  * @param logfile Unused.
    1308  * @param include_paths The paths to back up, or NULL if you're using a user-defined filelist.
    1309  * @param excp The paths to NOT back up.
    1310  * @param differential The differential level (currently only 0 and 1 are supported).
    1311  * @param userdef_filelist The user-defined filelist, or NULL if you're using @p include_paths.
    1312  * @return 0, always.
    1313  * @bug @p logfile is unused.
    1314  * @bug Return value is meaningless.
    1315  */
    1316 int mondo_makefilelist(char *logfile, char *include_paths, char *excp, int differential, char *userdef_filelist)
    1317 {
    1318     char *p, *q;
    1319     char *sz_datefile;
    1320     char *sz_filelist;
    1321     char *exclude_paths = NULL;
    1322     char *tmp;
    1323     int i;
    1324     FILE *fout;
    1325     char *command = NULL;
    1326     time_t time_of_last_full_backup = 0;
    1327     struct stat statbuf;
    1328     char *tmp1 = NULL;
    1329     char *tmp2 = NULL;
    1330 
    1331     malloc_string(tmp);
    1332     malloc_string(g_skeleton_filelist);
    1333     mr_asprintf(sz_datefile,MONDO_CACHE"/difflevel.%d" , 0);
    1334     if (!include_paths && !userdef_filelist) {
    1335         fatal_error("Please supply either include_paths or userdef_filelist");
    1336     }
    1337     // make hole for filelist
    1338     mr_asprintf(command, "mkdir -p %s/archives", bkpinfo->scratchdir);
    1339     paranoid_system(command);
    1340     mr_free(command);
    1341 
    1342     mr_asprintf(sz_filelist, "%s/tmpfs/filelist.full", bkpinfo->tmpdir);
    1343     make_hole_for_file(sz_filelist);
    1344 
    1345     if (differential == 0) {
    1346         // restore last good datefile if it exists
    1347         mr_asprintf(command, "cp -f %s.aborted %s", sz_datefile, sz_datefile);
    1348         run_program_and_log_output(command, 3);
    1349         mr_free(command);
    1350 
    1351         // backup last known good datefile just in case :)
    1352         if (does_file_exist(sz_datefile)) {
    1353             mr_asprintf(command, "mv -f %s %s.aborted", sz_datefile, sz_datefile);
    1354             paranoid_system(command);
    1355             mr_free(command);
    1356         }
    1357         make_hole_for_file(sz_datefile);
    1358         write_one_liner_data_file(sz_datefile,
    1359                                   call_program_and_get_last_line_of_output
    1360                                   ("date +%s"));
    1361     } else if (lstat(sz_datefile, &statbuf)) {
    1362         log_msg(2, "Warning - unable to find date of previous backup. Full backup instead.");
    1363         differential = 0;
    1364         time_of_last_full_backup = 0;
    1365     } else {
    1366         time_of_last_full_backup = statbuf.st_mtime;
    1367         log_msg(2, "Differential backup. Yay.");
    1368     }
    1369     paranoid_free(sz_datefile);
    1370 
    1371 // use user-specified filelist (if specified)
    1372     if (userdef_filelist) {
    1373         log_msg(1, "Using the user-specified filelist - %s - instead of calculating one", userdef_filelist);
    1374         mr_asprintf(command, "cp -f %s %s", userdef_filelist, sz_filelist);
    1375         if (run_program_and_log_output(command, 3)) {
    1376             mr_free(command);
    1377             fatal_error("Failed to copy user-specified filelist");
    1378         }
    1379         mr_free(command);
    1380     } else {
    1381         if (include_paths) {
    1382             log_msg(2, "include_paths = '%s'", include_paths);
    1383         }
    1384         log_msg(1, "Calculating filelist");
    1385         mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output("mount | grep -Ew 'ntfs|ntfs-3g|fat|vfat|dos' | awk '{print $3}'"));
    1386         if (strlen(tmp2) < 1) {
    1387             mr_asprintf(tmp1," ");
    1388         } else {
    1389             log_msg(2, "Found windows FS: %s",tmp2);
    1390             mr_asprintf(tmp1, "find %s -name '/win386.swp' -o -name '/hiberfil.sys' -o -name '/pagefile.sys' 2> /dev/null\n",tmp2);
    1391             mr_free(tmp2);
    1392             mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output(tmp1));
    1393             log_msg(2, "Found windows files: %s",tmp2);
    1394         }
    1395         mr_free(tmp1);
    1396 
    1397         mr_asprintf(exclude_paths, " %s %s %s %s %s . ..  " MNT_CDROM " " MNT_FLOPPY " /media /tmp  /proc /sys " 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);
    1398         mr_free(tmp2);
    1399 
    1400         log_msg(2, "Excluding paths = '%s'", exclude_paths);
    1401         log_msg(2, "Generating skeleton filelist so that we can track our progress");
    1402         sprintf(g_skeleton_filelist, "%s/tmpfs/skeleton.txt", bkpinfo->tmpdir);
    1403         make_hole_for_file(g_skeleton_filelist);
    1404         log_msg(4, "g_skeleton_entries = %ld", g_skeleton_entries);
    1405         log_msg(2, "Opening out filelist to %s", sz_filelist);
    1406         if (!(fout = fopen(sz_filelist, "w"))) {
    1407             fatal_error("Cannot openout to sz_filelist");
    1408         }
    1409         i = 0;
    1410         if ((!include_paths) || (strlen(include_paths) == 0)) {
    1411             log_msg(1, "Including only '/' in %s", sz_filelist);
    1412             open_and_list_dir("/", exclude_paths, fout,
    1413                               time_of_last_full_backup);
    1414         } else {
    1415             p = include_paths;
    1416             while (*p) {
    1417                 q = next_entry(p);
    1418                 log_msg(1, "Including %s in filelist %s", q, sz_filelist);
    1419                 open_and_list_dir(q, exclude_paths, fout,
    1420                                   time_of_last_full_backup);
    1421                 p += strlen(q);
    1422                 paranoid_free(q);
    1423                 while (*p == ' ') {
    1424                     p++;
    1425                 }
    1426             }
    1427         }
    1428         mr_free(exclude_paths);
    1429         paranoid_fclose(fout);
    1430     }
    1431     log_msg(2, "Copying new filelist to scratchdir");
    1432     mr_asprintf(command, "mkdir -p %s/archives", bkpinfo->scratchdir);
    1433     paranoid_system(command);
    1434     mr_free(command);
    1435 
    1436     mr_asprintf(command, "cp -f %s %s/archives/", sz_filelist, bkpinfo->scratchdir);
    1437     paranoid_system(command);
    1438     mr_free(command);
    1439 
    1440     mr_asprintf(command, "mv -f %s %s", sz_filelist, bkpinfo->tmpdir);
    1441     paranoid_system(command);
    1442     mr_free(command);
    1443 
    1444     paranoid_free(sz_filelist);
    1445     log_msg(2, "Freeing variables");
    1446     paranoid_free(tmp);
    1447     paranoid_free(g_skeleton_filelist);
    1448     log_msg(2, "Exiting");
    1449     return (0);
    1450 }
    1451 
    1452 
    1453 
    1454 /**
    1455  * Wrapper around mondo_makefilelist().
    1456  * @param bkpinfo The backup information structure. Fields used:
    1457  * - @c bkpinfo->differential
    1458  * - @c bkpinfo->exclude_paths
    1459  * - @c bkpinfo->include_paths
    1460  * - @c bkpinfo->make_filelist
    1461  * - @c bkpinfo->scratchdir
    1462  * - @c bkpinfo->tmpdir
    1463  * @return 0 for success, nonzero for failure.
    1464  * @see mondo_makefilelist
    1465  */
    1466 int prepare_filelist()
    1467 {
    1468 
    1469     /*@ int **************************************************** */
    1470     int res = 0;
    1471 
    1472     assert(bkpinfo != NULL);
    1473     log_it("tmpdir=%s; scratchdir=%s", bkpinfo->tmpdir, bkpinfo->scratchdir);
    1474     if (bkpinfo->make_filelist) {
    1475         mvaddstr_and_log_it(g_currentY, 0,
    1476                             "Making catalog of files to be backed up");
    1477     } else {
    1478         mvaddstr_and_log_it(g_currentY, 0,
    1479                             "Using supplied catalog of files to be backed up");
    1480     }
    1481 
    1482     if (bkpinfo->make_filelist) {
    1483         res =
    1484             mondo_makefilelist(MONDO_LOGFILE, bkpinfo->include_paths, bkpinfo->exclude_paths, bkpinfo->differential, NULL);
    1485     } else {
    1486         res =
    1487             mondo_makefilelist(MONDO_LOGFILE, NULL, bkpinfo->exclude_paths, bkpinfo->differential, bkpinfo->include_paths);
    1488     }
    1489 
    1490     if (res) {
    1491         log_OS_error("Call to mondo_makefilelist failed");
    1492         mvaddstr_and_log_it(g_currentY++, 74, "Failed.");
    1493     } else {
    1494         mvaddstr_and_log_it(g_currentY++, 74, "Done.");
    1495     }
    1496     return (res);
    14971301}
    14981302
     
    16751479
    16761480
     1481
     1482/**
     1483 * Create the filelist for the backup. It will be stored in [scratchdir]/archives/filelist.full.
     1484 * @param logfile Unused.
     1485 * @param include_paths The paths to back up, or NULL if you're using a user-defined filelist.
     1486 * @param excp The paths to NOT back up.
     1487 * @param differential The differential level (currently only 0 and 1 are supported).
     1488 * @param userdef_filelist The user-defined filelist, or NULL if you're using @p include_paths.
     1489 * @return 0, always.
     1490 * @bug @p logfile is unused.
     1491 * @bug Return value is meaningless.
     1492 */
     1493int mondo_makefilelist(char *logfile, char *include_paths, char *excp, int differential, char *userdef_filelist)
     1494{
     1495    char *p, *q;
     1496    char *sz_datefile;
     1497    char *sz_filelist;
     1498    char *exclude_paths = NULL;
     1499    char *tmp;
     1500    int i;
     1501    FILE *fout;
     1502    char *command = NULL;
     1503    time_t time_of_last_full_backup = 0;
     1504    struct stat statbuf;
     1505    char *tmp1 = NULL;
     1506    char *tmp2 = NULL;
     1507
     1508    malloc_string(tmp);
     1509    malloc_string(g_skeleton_filelist);
     1510    mr_asprintf(sz_datefile,MONDO_CACHE"/difflevel.%d" , 0);
     1511    if (!include_paths && !userdef_filelist) {
     1512        fatal_error("Please supply either include_paths or userdef_filelist");
     1513    }
     1514    // make hole for filelist
     1515    mr_asprintf(command, "mkdir -p %s/archives", bkpinfo->scratchdir);
     1516    paranoid_system(command);
     1517    mr_free(command);
     1518
     1519    mr_asprintf(sz_filelist, "%s/tmpfs/filelist.full", bkpinfo->tmpdir);
     1520    make_hole_for_file(sz_filelist);
     1521
     1522    if (differential == 0) {
     1523        // restore last good datefile if it exists
     1524        mr_asprintf(command, "cp -f %s.aborted %s", sz_datefile, sz_datefile);
     1525        run_program_and_log_output(command, 3);
     1526        mr_free(command);
     1527
     1528        // backup last known good datefile just in case :)
     1529        if (does_file_exist(sz_datefile)) {
     1530            mr_asprintf(command, "mv -f %s %s.aborted", sz_datefile, sz_datefile);
     1531            paranoid_system(command);
     1532            mr_free(command);
     1533        }
     1534        make_hole_for_file(sz_datefile);
     1535        write_one_liner_data_file(sz_datefile,
     1536                                  call_program_and_get_last_line_of_output
     1537                                  ("date +%s"));
     1538    } else if (lstat(sz_datefile, &statbuf)) {
     1539        log_msg(2, "Warning - unable to find date of previous backup. Full backup instead.");
     1540        differential = 0;
     1541        time_of_last_full_backup = 0;
     1542    } else {
     1543        time_of_last_full_backup = statbuf.st_mtime;
     1544        log_msg(2, "Differential backup. Yay.");
     1545    }
     1546    paranoid_free(sz_datefile);
     1547
     1548// use user-specified filelist (if specified)
     1549    if (userdef_filelist) {
     1550        log_msg(1, "Using the user-specified filelist - %s - instead of calculating one", userdef_filelist);
     1551        mr_asprintf(command, "cp -f %s %s", userdef_filelist, sz_filelist);
     1552        if (run_program_and_log_output(command, 3)) {
     1553            mr_free(command);
     1554            fatal_error("Failed to copy user-specified filelist");
     1555        }
     1556        mr_free(command);
     1557    } else {
     1558        if (include_paths) {
     1559            log_msg(2, "include_paths = '%s'", include_paths);
     1560        }
     1561        log_msg(1, "Calculating filelist");
     1562        mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output("mount | grep -Ew 'ntfs|ntfs-3g|fat|vfat|dos' | awk '{print $3}'"));
     1563        if (strlen(tmp2) < 1) {
     1564            mr_asprintf(tmp1," ");
     1565        } else {
     1566            log_msg(2, "Found windows FS: %s",tmp2);
     1567            mr_asprintf(tmp1, "find %s -name '/win386.swp' -o -name '/hiberfil.sys' -o -name '/pagefile.sys' 2> /dev/null\n",tmp2);
     1568            mr_free(tmp2);
     1569            mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output(tmp1));
     1570            log_msg(2, "Found windows files: %s",tmp2);
     1571        }
     1572        mr_free(tmp1);
     1573
     1574        mr_asprintf(exclude_paths, " %s %s %s %s %s . ..  " MNT_CDROM " " MNT_FLOPPY " /media /tmp  /proc /sys " 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);
     1575        mr_free(tmp2);
     1576
     1577        log_msg(2, "Excluding paths = '%s'", exclude_paths);
     1578        log_msg(2, "Generating skeleton filelist so that we can track our progress");
     1579        sprintf(g_skeleton_filelist, "%s/tmpfs/skeleton.txt", bkpinfo->tmpdir);
     1580        make_hole_for_file(g_skeleton_filelist);
     1581        log_msg(4, "g_skeleton_entries = %ld", g_skeleton_entries);
     1582        log_msg(2, "Opening out filelist to %s", sz_filelist);
     1583        if (!(fout = fopen(sz_filelist, "w"))) {
     1584            fatal_error("Cannot openout to sz_filelist");
     1585        }
     1586        i = 0;
     1587        if ((!include_paths) || (strlen(include_paths) == 0)) {
     1588            log_msg(1, "Including only '/' in %s", sz_filelist);
     1589            open_and_list_dir("/", exclude_paths, fout,
     1590                              time_of_last_full_backup);
     1591        } else {
     1592            p = include_paths;
     1593            while (*p) {
     1594                q = next_entry(p);
     1595                log_msg(1, "Including %s in filelist %s", q, sz_filelist);
     1596                open_and_list_dir(q, exclude_paths, fout,
     1597                                  time_of_last_full_backup);
     1598                p += strlen(q);
     1599                paranoid_free(q);
     1600                while (*p == ' ') {
     1601                    p++;
     1602                }
     1603            }
     1604        }
     1605        mr_free(exclude_paths);
     1606        paranoid_fclose(fout);
     1607    }
     1608    log_msg(2, "Copying new filelist to scratchdir");
     1609    mr_asprintf(command, "mkdir -p %s/archives", bkpinfo->scratchdir);
     1610    paranoid_system(command);
     1611    mr_free(command);
     1612
     1613    mr_asprintf(command, "cp -f %s %s/archives/", sz_filelist, bkpinfo->scratchdir);
     1614    paranoid_system(command);
     1615    mr_free(command);
     1616
     1617    mr_asprintf(command, "mv -f %s %s", sz_filelist, bkpinfo->tmpdir);
     1618    paranoid_system(command);
     1619    mr_free(command);
     1620
     1621    paranoid_free(sz_filelist);
     1622    log_msg(2, "Freeing variables");
     1623    paranoid_free(tmp);
     1624    paranoid_free(g_skeleton_filelist);
     1625    log_msg(2, "Exiting");
     1626    return (0);
     1627}
     1628
     1629
     1630
     1631/**
     1632 * Wrapper around mondo_makefilelist().
     1633 * @param bkpinfo The backup information structure. Fields used:
     1634 * - @c bkpinfo->differential
     1635 * - @c bkpinfo->exclude_paths
     1636 * - @c bkpinfo->include_paths
     1637 * - @c bkpinfo->make_filelist
     1638 * - @c bkpinfo->scratchdir
     1639 * - @c bkpinfo->tmpdir
     1640 * @return 0 for success, nonzero for failure.
     1641 * @see mondo_makefilelist
     1642 */
     1643int prepare_filelist()
     1644{
     1645
     1646    /*@ int **************************************************** */
     1647    int res = 0;
     1648
     1649    assert(bkpinfo != NULL);
     1650    log_it("tmpdir=%s; scratchdir=%s", bkpinfo->tmpdir, bkpinfo->scratchdir);
     1651    if (bkpinfo->make_filelist) {
     1652        mvaddstr_and_log_it(g_currentY, 0,
     1653                            "Making catalog of files to be backed up");
     1654    } else {
     1655        mvaddstr_and_log_it(g_currentY, 0,
     1656                            "Using supplied catalog of files to be backed up");
     1657    }
     1658
     1659    if (bkpinfo->make_filelist) {
     1660        res =
     1661            mondo_makefilelist(MONDO_LOGFILE, bkpinfo->include_paths, bkpinfo->exclude_paths, bkpinfo->differential, NULL);
     1662    } else {
     1663        res =
     1664            mondo_makefilelist(MONDO_LOGFILE, NULL, bkpinfo->exclude_paths, bkpinfo->differential, bkpinfo->include_paths);
     1665    }
     1666
     1667    if (res) {
     1668        log_OS_error("Call to mondo_makefilelist failed");
     1669        mvaddstr_and_log_it(g_currentY++, 74, "Failed.");
     1670    } else {
     1671        mvaddstr_and_log_it(g_currentY++, 74, "Done.");
     1672    }
     1673    return (res);
     1674}
     1675
     1676
    16771677/**
    16781678 * Locate the string @p string_to_find in the tree rooted at @p startnode.
  • branches/2.2.10/mondo/src/common/libmondo-files-EXT.h

    r2334 r2382  
    3333extern long size_of_all_biggiefiles_K();
    3434extern void copy_mondo_and_mindi_stuff_to_scratchdir();
    35 extern void store_nfs_config();
     35extern void store_netfs_config();
    3636
    3737
  • branches/2.2.10/mondo/src/common/libmondo-files.c

    r2379 r2382  
    10591059
    10601060/**
    1061  * Store the client's NFS configuration in files to be restored at restore-time.
    1062  * Assumes that @c bkpinfo->media_type = nfs, but does not check for this.
     1061 * Store the client's NETFS configuration in files to be restored at restore-time.
     1062 * Assumes that @c bkpinfo->media_type = netfs, but does not check for this.
    10631063 * @param bkpinfo The backup information structure. Fields used:
    1064  * - @c nfs_mount
    1065  * - @c nfs_remote_dir
     1064 * - @c netfs_mount
     1065 * - @c netfs_remote_dir
    10661066 * - @c tmpdir
    10671067 */
    1068 void store_nfs_config()
     1068void store_netfs_config()
    10691069{
    10701070
    10711071    /*@ buffers ******** */
    1072     char *nfs_dev = NULL;
     1072    char *netfs_dev = NULL;
    10731073    char *mac_addr = NULL;
    1074     char *nfs_mount = NULL;
    1075     char *nfs_client_ipaddr = NULL;
    1076     char *nfs_client_netmask = NULL;
    1077     char *nfs_client_broadcast = NULL;
    1078     char *nfs_client_defgw = NULL;
    1079     char *nfs_server_ipaddr = NULL;
     1074    char *netfs_mount = NULL;
     1075    char *netfs_client_ipaddr = NULL;
     1076    char *netfs_client_netmask = NULL;
     1077    char *netfs_client_broadcast = NULL;
     1078    char *netfs_client_defgw = NULL;
     1079    char *netfs_server_ipaddr = NULL;
    10801080    char *tmp = NULL;
    10811081    char *command = NULL;
     
    10841084    char *p;
    10851085
    1086     if (! bkpinfo->nfs_mount) {
    1087         fatal_error("No nfs_mount found !");
    1088     }
    1089 
    1090     log_it("Storing NFS configuration");
    1091     mr_asprintf(tmp, "%s", bkpinfo->nfs_mount);
     1086    if (! bkpinfo->netfs_mount) {
     1087        fatal_error("No netfs_mount found !");
     1088    }
     1089
     1090    log_it("Storing Network configuration");
     1091    mr_asprintf(tmp, "%s", bkpinfo->netfs_mount);
    10921092    p = strchr(tmp, ':');
    10931093    if (!p) {
    1094         fatal_error("NFS mount doesn't have a colon in it, e.g. 192.168.1.4:/home/nfs");
     1094        fatal_error("Network mount doesn't have a colon in it, e.g. 192.168.1.4:/home/nfs");
    10951095    }
    10961096    *(p++) = '\0';
    1097     mr_asprintf(nfs_server_ipaddr, "%s", tmp);
    1098     mr_asprintf(nfs_mount, "%s", p);
     1097    mr_asprintf(netfs_server_ipaddr, "%s", tmp);
     1098    mr_asprintf(netfs_mount, "%s", p);
    10991099    mr_free(tmp);
    11001100
    11011101    /* BERLIOS : there is a bug #67 here as it only considers the first NIC */
    11021102    mr_asprintf(command, "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\n' | head -n1 | cut -d' ' -f1");
    1103     mr_asprintf(nfs_dev, "%s", call_program_and_get_last_line_of_output(command));
     1103    mr_asprintf(netfs_dev, "%s", call_program_and_get_last_line_of_output(command));
    11041104    mr_free(command);
    11051105
    11061106    mr_asprintf(command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f7 | cut -d':' -f2");
    1107     mr_asprintf(nfs_client_ipaddr, "%s", call_program_and_get_last_line_of_output(command));
     1107    mr_asprintf(netfs_client_ipaddr, "%s", call_program_and_get_last_line_of_output(command));
    11081108    mr_free(command);
    11091109
    11101110    mr_asprintf(command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f9 | cut -d':' -f2");
    1111     mr_asprintf(nfs_client_netmask, "%s", call_program_and_get_last_line_of_output(command));
     1111    mr_asprintf(netfs_client_netmask, "%s", call_program_and_get_last_line_of_output(command));
    11121112    mr_free(command);
    11131113
    11141114    mr_asprintf(command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f8 | cut -d':' -f2");
    1115     mr_asprintf(nfs_client_broadcast, "%s", call_program_and_get_last_line_of_output(command));
     1115    mr_asprintf(netfs_client_broadcast, "%s", call_program_and_get_last_line_of_output(command));
    11161116    mr_free(command);
    11171117
    11181118    mr_asprintf(command, "%s", "route -n | grep '^0.0.0.0' | awk '{print $2}'");
    1119     mr_asprintf(nfs_client_defgw, "%s", call_program_and_get_last_line_of_output(command));
    1120     mr_free(command);
    1121 
    1122     if (strlen(nfs_dev) < 2) {
    1123         fatal_error
    1124             ("Unable to find ethN (eth0, eth1, ...) adapter via NFS mount you specified.");
    1125     }
     1119    mr_asprintf(netfs_client_defgw, "%s", call_program_and_get_last_line_of_output(command));
     1120    mr_free(command);
     1121
     1122    if (strlen(netfs_dev) < 2) {
     1123        fatal_error("Unable to find ethN (eth0, eth1, ...) adapter via Network mount you specified.");
     1124    }
     1125
    11261126    /********
    1127     * If the NFS device that found above is a bonded device,
     1127    * If the Network device that found above is a bonded device,
    11281128    * we need to replace it with an ethN device or the
    1129     * networking will not start during an NFS restore.
     1129    * networking will not start during an Network restore.
    11301130    *
    1131     * If the NFS device in nfs_dev begins with the word "bond", or alb or aft
    1132     * look for the corresponding slave ethN device and copy it to nfs_dev.
     1131    * If the Network device in netfs_dev begins with the word "bond", or alb or aft
     1132    * look for the corresponding slave ethN device and copy it to netfs_dev.
    11331133    * Using the common MAC address
    11341134    ********/
    1135     if (!strncmp(nfs_dev, "bond", 4) || !strncmp(nfs_dev, "alb", 3) || !strncmp(nfs_dev, "aft", 3)) {
    1136         log_to_screen("Found bonding device %s; looking for corresponding ethN slave device\n", nfs_dev);
    1137         mr_asprintf(command, "%s", "ifconfig %s | awk '{print $5}' | head -n1", nfs_dev);
     1135    if (!strncmp(netfs_dev, "bond", 4) || !strncmp(netfs_dev, "alb", 3) || !strncmp(netfs_dev, "aft", 3)) {
     1136        log_to_screen("Found bonding device %s; looking for corresponding ethN slave device\n", netfs_dev);
     1137        mr_asprintf(command, "%s", "ifconfig %s | awk '{print $5}' | head -n1", netfs_dev);
    11381138        mr_asprintf(mac_addr, "%s", call_program_and_get_last_line_of_output(command));
    11391139        mr_free(command);
    11401140
    1141         mr_asprintf(command, "ifconfig | grep -E '%s' | grep -v '%s' | head -n1 | cut -d' ' -f1", mac_addr,nfs_dev);
     1141        mr_asprintf(command, "ifconfig | grep -E '%s' | grep -v '%s' | head -n1 | cut -d' ' -f1", mac_addr,netfs_dev);
    11421142        mr_free(mac_addr);
    1143         mr_free(nfs_dev);
    1144 
    1145         mr_asprintf(nfs_dev, "%s", call_program_and_get_last_line_of_output(command));
     1143        mr_free(netfs_dev);
     1144
     1145        mr_asprintf(netfs_dev, "%s", call_program_and_get_last_line_of_output(command));
    11461146        mr_free(command);
    11471147
    1148         log_to_screen("Replacing it with %s\n", nfs_dev);
    1149     }
    1150 
    1151     mr_asprintf(tmp, "%s/NFS-DEV", bkpinfo->tmpdir);
    1152     write_one_liner_data_file(tmp, nfs_dev);
    1153     mr_free(nfs_dev);
    1154     mr_free(tmp);
    1155 
    1156     mr_asprintf(tmp, "%s/NFS-CLIENT-IPADDR", bkpinfo->tmpdir);
    1157     write_one_liner_data_file(tmp, nfs_client_ipaddr);
    1158     mr_free(nfs_client_ipaddr);
    1159     mr_free(tmp);
    1160 
    1161     mr_asprintf(tmp, "%s/NFS-CLIENT-NETMASK", bkpinfo->tmpdir);
    1162     write_one_liner_data_file(tmp, nfs_client_netmask);
    1163     mr_free(nfs_client_netmask);
    1164     mr_free(tmp);
    1165 
    1166     mr_asprintf(tmp, "%s/NFS-CLIENT-BROADCAST", bkpinfo->tmpdir);
    1167     write_one_liner_data_file(tmp, nfs_client_broadcast);
    1168     mr_free(nfs_client_broadcast);
    1169     mr_free(tmp);
    1170 
    1171     mr_asprintf(tmp, "%s/NFS-CLIENT-DEFGW", bkpinfo->tmpdir);
    1172     write_one_liner_data_file(tmp, nfs_client_defgw);
    1173     mr_free(nfs_client_defgw);
    1174     mr_free(tmp);
    1175 
    1176     mr_asprintf(tmp, "%s/NFS-SERVER-IPADDR", bkpinfo->tmpdir);
    1177     write_one_liner_data_file(tmp, nfs_server_ipaddr);
    1178     mr_free(tmp);
    1179     mr_free(nfs_server_ipaddr);
    1180 
    1181     mr_asprintf(tmp, "%s/NFS-SERVER-MOUNT", bkpinfo->tmpdir);
    1182     write_one_liner_data_file(tmp, bkpinfo->nfs_mount);
    1183     mr_free(tmp);
    1184     mr_free(nfs_mount);
    1185 
    1186     mr_asprintf(tmp, "%s/NFS-SERVER-PATH", bkpinfo->tmpdir);
    1187     write_one_liner_data_file(tmp, bkpinfo->nfs_remote_dir);
     1148        log_to_screen("Replacing it with %s\n", netfs_dev);
     1149    }
     1150
     1151    mr_asprintf(tmp, "%s/NETFS-DEV", bkpinfo->tmpdir);
     1152    write_one_liner_data_file(tmp, netfs_dev);
     1153    mr_free(netfs_dev);
     1154    mr_free(tmp);
     1155
     1156    mr_asprintf(tmp, "%s/NETFS-PROTO", bkpinfo->tmpdir);
     1157    write_one_liner_data_file(tmp, bkpinfo->netfs_proto);
     1158
     1159    mr_asprintf(tmp, "%s/NETFS-CLIENT-IPADDR", bkpinfo->tmpdir);
     1160    write_one_liner_data_file(tmp, netfs_client_ipaddr);
     1161    mr_free(netfs_client_ipaddr);
     1162    mr_free(tmp);
     1163
     1164    mr_asprintf(tmp, "%s/NETFS-CLIENT-NETMASK", bkpinfo->tmpdir);
     1165    write_one_liner_data_file(tmp, netfs_client_netmask);
     1166    mr_free(netfs_client_netmask);
     1167    mr_free(tmp);
     1168
     1169    mr_asprintf(tmp, "%s/NETFS-CLIENT-BROADCAST", bkpinfo->tmpdir);
     1170    write_one_liner_data_file(tmp, netfs_client_broadcast);
     1171    mr_free(netfs_client_broadcast);
     1172    mr_free(tmp);
     1173
     1174    mr_asprintf(tmp, "%s/NETFS-CLIENT-DEFGW", bkpinfo->tmpdir);
     1175    write_one_liner_data_file(tmp, netfs_client_defgw);
     1176    mr_free(netfs_client_defgw);
     1177    mr_free(tmp);
     1178
     1179    mr_asprintf(tmp, "%s/NETFS-SERVER-IPADDR", bkpinfo->tmpdir);
     1180    write_one_liner_data_file(tmp, netfs_server_ipaddr);
     1181    mr_free(tmp);
     1182    mr_free(netfs_server_ipaddr);
     1183
     1184    mr_asprintf(tmp, "%s/NETFS-SERVER-MOUNT", bkpinfo->tmpdir);
     1185    write_one_liner_data_file(tmp, bkpinfo->netfs_mount);
     1186    mr_free(tmp);
     1187    mr_free(netfs_mount);
     1188
     1189    mr_asprintf(tmp, "%s/NETFS-SERVER-PATH", bkpinfo->tmpdir);
     1190    write_one_liner_data_file(tmp, bkpinfo->netfs_remote_dir);
    11881191    mr_free(tmp);
    11891192
     
    11921195    mr_free(tmp);
    11931196
    1194     log_it("Finished storing NFS configuration");
     1197    log_it("Finished storing Network configuration");
    11951198}
    11961199
  • branches/2.2.10/mondo/src/common/libmondo-files.h

    r2334 r2382  
    3333
    3434void copy_mondo_and_mindi_stuff_to_scratchdir();
    35 void store_nfs_config();
     35void store_netfs_config();
    3636void estimate_noof_media_required(long);
    3737bool is_this_file_compressed(char *);
  • branches/2.2.10/mondo/src/common/libmondo-fork.c

    r2375 r2382  
    117117    old_stderr[0] = '\0';
    118118
    119     if (bkpinfo->nfs_user) {
    120         mr_asprintf(tmp1, "su - %s -c \"%s\"", bkpinfo->nfs_user, basic_call);
     119    if ((bkpinfo->netfs_user) && (strstr(bkpinfo->netfs_proto,"nfs"))) {
     120        mr_asprintf(tmp1, "su - %s -c \"%s\"", bkpinfo->netfs_user, basic_call);
    121121    } else {
    122122        mr_asprintf(tmp1, "%s", basic_call);
  • branches/2.2.10/mondo/src/common/libmondo-mountlist.c

    r2372 r2382  
    406406            continue;
    407407        }
     408        log_msg(2, "Processing partition %s on %s #%d in mountlist", device, drive, pos);
    408409        /* gap in the partition list? */
    409410        if (curr_part_no - prev_part_no > 1) {
     
    502503    if (res == 0) {
    503504        mr_free(flaws_str);
     505        log_msg(2, "Fine, no error in evaluate_drive_within_mountlist");
    504506        return (NULL);
    505507    } else {
     508        log_msg(2, "Error in evaluate_drive_within_mountlist: %s", flaws_str);
    506509        return (flaws_str);
    507510    }
  • branches/2.2.10/mondo/src/common/libmondo-string.c

    r2377 r2382  
    11021102        mr_asprintf(type_of_backup, "ISO");
    11031103        break;
    1104     case nfs:
    1105         mr_asprintf(type_of_backup, "nfs");
     1104    case netfs:
     1105        mr_asprintf(type_of_backup, "netfs");
    11061106        break;
    11071107    case usb:
  • branches/2.2.10/mondo/src/common/libmondo-tools.c

    r2357 r2382  
    373373 * - Used: @c bkpinfo->make_cd_use_lilo
    374374 * - Used: @c bkpinfo->media_device
    375  * - Used: @c bkpinfo->nfs_mount
     375 * - Used: @c bkpinfo->netfs_mount
    376376 * - Used: @c bkpinfo->nonbootable_backup
    377377 * - Used: @c bkpinfo->scratchdir
     
    657657    }                           // end of iso code
    658658
    659     if (bkpinfo->backup_media_type == nfs) {
    660         if (bkpinfo->nfs_mount) {
    661             mr_asprintf(hostname, "%s", bkpinfo->nfs_mount);
     659    if (bkpinfo->backup_media_type == netfs) {
     660        if (bkpinfo->netfs_mount) {
     661            mr_asprintf(hostname, "%s", bkpinfo->netfs_mount);
    662662        } else {
    663             log_it("nfs_mount is NULL");
     663            log_it("netfs_mount is NULL");
    664664            retval++;
    665665            mr_asprintf(hostname, "");
     
    667667        colon = strchr(hostname, ':');
    668668        if (!colon) {
    669             log_it("nfs mount doesn't have a colon in it");
     669            log_it("netfs mount doesn't have a colon in it");
    670670            retval++;
    671671        } else {
     
    675675            hent = gethostbyname(hostname);
    676676            if (!hent) {
    677                 log_it("Can't resolve NFS mount (%s): %s", hostname, hstrerror(h_errno));
     677                log_it("Can't resolve Network mount (%s): %s", hostname, hstrerror(h_errno));
    678678                retval++;
    679679            } else {
    680680                mr_asprintf(ip_address, "%s", inet_ntoa((struct in_addr) *((struct in_addr *) hent->h_addr)));
    681                 mr_strcat(ip_address, strchr(bkpinfo->nfs_mount, ':'));
    682                 mr_free(bkpinfo->nfs_mount);
    683                 bkpinfo->nfs_mount = ip_address;
     681                mr_strcat(ip_address, strchr(bkpinfo->netfs_mount, ':'));
     682                mr_free(bkpinfo->netfs_mount);
     683                bkpinfo->netfs_mount = ip_address;
    684684            }
    685685        }
    686686        mr_free(hostname);
    687         store_nfs_config();
     687        store_netfs_config();
    688688    }
    689689
     
    797797    mr_free(bkpinfo->call_after_iso);
    798798    mr_free(bkpinfo->kernel_path);
    799     mr_free(bkpinfo->nfs_mount);
    800     mr_free(bkpinfo->nfs_remote_dir);
    801     mr_free(bkpinfo->nfs_user);
     799    mr_free(bkpinfo->netfs_mount);
     800    mr_free(bkpinfo->netfs_remote_dir);
     801    mr_free(bkpinfo->netfs_user);
     802    mr_free(bkpinfo->netfs_proto);
    802803    mr_free(bkpinfo->postnuke_tarball);
    803804
     
    855856    bkpinfo->call_after_iso = NULL;
    856857    bkpinfo->kernel_path = NULL;
    857     bkpinfo->nfs_mount = NULL;
    858     bkpinfo->nfs_remote_dir = NULL;
    859     bkpinfo->nfs_user = NULL;
     858    bkpinfo->netfs_mount = NULL;
     859    bkpinfo->netfs_remote_dir = NULL;
     860    bkpinfo->netfs_user = NULL;
     861    bkpinfo->netfs_proto = NULL;
    860862    bkpinfo->postnuke_tarball = NULL;
    861863    bkpinfo->wipe_media_first = FALSE;
  • branches/2.2.10/mondo/src/common/libmondo-verify.c

    r2376 r2382  
    10141014 * - @c bkpinfo->manual_cd_tray
    10151015 * - @c bkpinfo->media_device
    1016  * - @c bkpinfo->nfs_remote_dir
     1016 * - @c bkpinfo->netfs_remote_dir
    10171017 * - @c bkpinfo->tmpdir
    10181018 * - @c bkpinfo->verify_data
     
    10481048
    10491049    mr_asprintf(mountpoint, "%s/cdrom", bkpinfo->tmpdir);
    1050     if (((bkpinfo->isodir == NULL) && (bkpinfo->nfs_remote_dir == NULL)) || (bkpinfo->prefix == NULL)) {
     1050    if (((bkpinfo->isodir == NULL) && (bkpinfo->netfs_remote_dir == NULL)) || (bkpinfo->prefix == NULL)) {
    10511051        fatal_error("No iso filename preparation possible");
    10521052    }
    1053     if (bkpinfo->nfs_remote_dir) {
    1054         // NFS
    1055         mr_asprintf(fname, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number);
     1053    if (bkpinfo->netfs_remote_dir) {
     1054        // NETFS
     1055        mr_asprintf(fname, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->netfs_remote_dir, bkpinfo->prefix, g_current_media_number);
    10561056    } else {
    10571057        // ISO
  • branches/2.2.10/mondo/src/common/mondostructures.h

    r2338 r2382  
    182182    dvd,                        ///< Back up to DVD+R[W] or DVD-R[W] disks.
    183183    cdstream,                   ///< Back up to recordable CDs but treat them like a tape streamer.
    184     nfs,                        ///< Back up to an NFS mount on the local subnet.
     184    netfs,                      ///< Back up to an NETFS mount on the local subnet.
    185185    tape,                       ///< Back up to tapes.
    186186    usb,                        ///< Back up to USB devices.
     
    557557
    558558  /**
    559    * The NFS mount to back up to/restore from.
    560    * If backup_media_type is not @b nfs, this is ignored.
     559   * The NETFS mount to back up to/restore from.
     560   * If backup_media_type is not @b netfs, this is ignored.
    561561   * It must contain a colon, and the server's address should be in dotted-decimal IP
    562562   * address form. (Domain names will be resolved in post_param_configuration().)
    563563   */
    564     char *nfs_mount;
    565 
    566   /**
    567    * The directory, relative to the root of @p nfs_mount, to put
     564    char *netfs_mount;
     565
     566  /**
     567   * The directory, relative to the root of @p netfs_mount, to put
    568568   * the backups in.
    569569   */
    570     char *nfs_remote_dir;
    571 
    572   /**
    573    * The potential user to use for NFS backup
    574    */
    575     char *nfs_user;
     570    char *netfs_remote_dir;
     571
     572  /**
     573   * The potential user to use for NETFS backup
     574   */
     575    char *netfs_user;
     576
     577  /**
     578   * The protocol to use for Network backup (NFS, SSHFS, ...)
     579   */
     580    char *netfs_proto;
    576581
    577582  /**
  • branches/2.2.10/mondo/src/common/newt-specific.c

    r2377 r2382  
    2020#include "my-stuff.h"
    2121#include "mr_mem.h"
     22#include "mr_str.h"
    2223#include "mondostructures.h"
    2324#include "newt-specific.h"
     
    99100    long g_start_time = 0L;     ///< The time (in seconds since the epoch) that the progress form was opened.
    100101    bool g_text_mode = TRUE;    ///< If FALSE, use a newt interface; if TRUE, use an ugly (but more compatible) dumb terminal interface.
    101     char *g_selfmounted_isodir; ///< Holds the NFS mountpoint if mounted via mondoarchive.
     102    char *g_selfmounted_isodir; ///< Holds the NETFS mountpoint if mounted via mondoarchive.
    102103
    103104/* @} - end of globalGroup */
     
    11061107 * Ask the user which backup media type they would like to use.
    11071108 * The choices are @p none (exit to shell), @c cdr, @c cdrw, @c dvd,
    1108  * @c tape, @c cdstream, @c udev (only when @p g_text_mode is TRUE), @c nfs,
     1109 * @c tape, @c cdstream, @c udev (only when @p g_text_mode is TRUE), @c netfs,
    11091110 * and @c iso.
    11101111 * @param restoring TRUE if we're restoring, FALSE if we're backing up.
     
    11201121        char *title_sz = NULL;
    11211122        char *minimsg_sz = NULL;
    1122         static t_bkptype possible_bkptypes[] = { none, cdr, cdrw, dvd, tape, cdstream, udev, nfs, iso };
    1123         static char *possible_responses[] = { "none", "cdr", "cdrw", "dvd", "tape", "cdstream", "udev", "nfs", "iso", NULL };
     1123        static t_bkptype possible_bkptypes[] = { none, cdr, cdrw, dvd, tape, cdstream, udev, netfs, iso };
     1124        static char *possible_responses[] = { "none", "cdr", "cdrw", "dvd", "tape", "cdstream", "udev", "netfs", "iso", NULL };
    11241125        char *outstr = NULL;
    11251126        t_bkptype backup_type;
     
    11711172        b4 = newtButton(17, 5, "USB Key/Disk");
    11721173        b5 = newtButton(1, 5, " DVD disks ");
    1173         b6 = newtButton(17, 9, " NFS mount ");
     1174        b6 = newtButton(17, 9, " Net mount ");
    11741175        b7 = newtButton(1, 13, " Hard disk ");
    11751176        b8 = newtButton(17, 13, "    Exit   ");
     
    11911192            output = dvd;
    11921193        } else if (b_res == b6) {
    1193             output = nfs;
     1194            output = netfs;
    11941195        } else if (b_res == b7) {
    11951196            output = iso;
     
    14531454        for (i = 0; i < filelist->entries; i++) {
    14541455            keylist[i] = (void *) i;
    1455             tmp = filelist_entry_to_string(&(filelist->el[i])), keylist[i];
    1456             newtListboxAppendEntry(fileListbox, tmp);
     1456            tmp = filelist_entry_to_string(&(filelist->el[i]));
     1457            newtListboxAppendEntry(fileListbox, tmp, keylist[i]);
    14571458            mr_free(tmp);
    14581459        }
  • branches/2.2.10/mondo/src/include/my-stuff.h

    r2340 r2382  
    319319#define DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE  "/dev/md"
    320320#define RAID_DEVICE_STUB    DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE
    321 #define SANE_FORMATS        "swap image vfat ext2 ext3 ext4 xfs vfs jfs reiserfs vmfs dos minix coda nfs nfs4 ntfs ntfs-3g hpfs raid lvm cifs ocfs ocfs2"
     321#define SANE_FORMATS        "swap image vfat ext2 ext3 ext4 xfs vfs jfs reiserfs vmfs dos minix coda fuse.sshfs nfs nfs4 ntfs ntfs-3g hpfs raid lvm cifs ocfs ocfs2"
    322322#define ALT_TAPE        "/dev/ht0"
    323323#define MKE2FS_OR_NEWFS "mke2fs"
  • branches/2.2.10/mondo/src/mondorestore/mondo-rstr-newt.c

    r2357 r2382  
    22892289    }
    22902290
    2291     if (does_file_exist("/tmp/NFS-SERVER-PATH")) {
     2291    if (does_file_exist("/tmp/NETFS-SERVER-PATH")) {
    22922292        mr_free(idev);
    2293         idev = last_line_of_file("/tmp/NFS-SERVER-MOUNT");
    2294         mr_asprintf(isodir_format, "nfs");
     2293        idev = last_line_of_file("/tmp/NETFS-SERVER-MOUNT");
     2294        mr_asprintf(isodir_format, "netfs");
    22952295        mr_free(isodir_path);
    2296         isodir_path = last_line_of_file("/tmp/NFS-SERVER-PATH");
     2296        isodir_path = last_line_of_file("/tmp/NETFS-SERVER-PATH");
    22972297    }
    22982298
  • branches/2.2.10/mondo/src/mondorestore/mondo-rstr-tools.c

    r2376 r2382  
    77#include "my-stuff.h"
    88#include "mr_mem.h"
     9#include "mr_str.h"
    910#include "../common/mondostructures.h"
    1011#include "../common/libmondo.h"
     
    562563    }
    563564
    564     if (bkpinfo->backup_media_type == nfs) {
    565         log_msg(2, "Mounting for NFS thingy");
     565    if (bkpinfo->backup_media_type == netfs) {
     566        log_msg(2, "Mounting for Network thingy");
    566567        log_msg(2, "isodir = %s", bkpinfo->isodir);
    567568        if (!strcmp(bkpinfo->isodir, "/") && am_I_in_disaster_recovery_mode()) {
     
    570571            log_msg(1, "isodir is being set to %s", bkpinfo->isodir);
    571572        }
    572         if ((bkpinfo->isodir == NULL) || (bkpinfo->nfs_remote_dir == NULL) || (bkpinfo->prefix == NULL)) {
     573        if ((bkpinfo->isodir == NULL) || (bkpinfo->netfs_remote_dir == NULL) || (bkpinfo->prefix == NULL)) {
    573574            fatal_error("Unable to prepare the iso filename");
    574575        }
    575576#ifdef __FreeBSD__
    576         mr_asprintf(mount_cmd, "/mnt/isodir/%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number);
     577        mr_asprintf(mount_cmd, "/mnt/isodir/%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->netfs_remote_dir, bkpinfo->prefix, g_current_media_number);
    577578        mddev = make_vn(mount_cmd);
    578579        mr_free(mount_cmd);
     
    580581        mr_asprintf(mount_cmd, "mount_cd9660 -r %s " MNT_CDROM, mddev);
    581582#else
    582         mr_asprintf(mount_cmd, "mount %s/%s/%s-%d.iso -t iso9660 -o loop,ro %s", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number, MNT_CDROM);
     583        mr_asprintf(mount_cmd, "mount %s/%s/%s-%d.iso -t iso9660 -o loop,ro %s", bkpinfo->isodir, bkpinfo->netfs_remote_dir, bkpinfo->prefix, g_current_media_number, MNT_CDROM);
    583584#endif
    584585
     
    744745            mr_asprintf(bkpinfo->prefix, "%s", STD_PREFIX);
    745746        }
    746     } else if (!strcmp(value, "nfs")) {
    747         bkpinfo->backup_media_type = nfs;
     747    } else if (!strcmp(value, "netfs")) {
     748        bkpinfo->backup_media_type = netfs;
    748749        bkpinfo->please_dont_eject = TRUE;
    749750        mr_free(bkpinfo->prefix);
     
    757758        if (strstr(call_program_and_get_last_line_of_output("cat " CMDLINE), "pxe")) {
    758759            /* We need to override prefix value in PXE mode as it's
    759             * already done in start-nfs */
     760            * already done in start-netfs */
    760761            envtmp1 = getenv("imgname");
    761762            if (envtmp1 == NULL) {
     
    944945mr_free(tmp);
    945946
    946 if (bkpinfo->backup_media_type == nfs) {
     947if (bkpinfo->backup_media_type == netfs) {
    947948    if (!cfgf) {
    948         if (bkpinfo->nfs_mount) {
    949             log_msg(2, "nfs_mount remains %s", bkpinfo->nfs_mount);
    950         }
    951         if (bkpinfo->nfs_remote_dir) {
    952             log_msg(2, "nfs_remote_dir remains %s", bkpinfo->nfs_remote_dir);
     949        if (bkpinfo->netfs_mount) {
     950            log_msg(2, "netfs_mount remains %s", bkpinfo->netfs_mount);
     951        }
     952        if (bkpinfo->netfs_remote_dir) {
     953            log_msg(2, "netfs_remote_dir remains %s", bkpinfo->netfs_remote_dir);
    953954        }
    954955        log_msg(2, "...cos it wouldn't make sense to abandon the values that GOT ME to this config file in the first place");
    955956    } else {
    956         mr_free(bkpinfo->nfs_mount);
    957         bkpinfo->nfs_mount = read_cfg_var(g_mondo_cfg_file, "nfs-server-mount");
    958 
    959         mr_free(bkpinfo->nfs_remote_dir);
    960         bkpinfo->nfs_remote_dir = read_cfg_var(g_mondo_cfg_file, "nfs-server-path");
    961 
    962         if (bkpinfo->nfs_mount != NULL) {
    963             log_msg(2, "nfs_mount is %s", bkpinfo->nfs_mount);
    964         }
    965         if (bkpinfo->nfs_remote_dir != NULL) {
    966             log_msg(2, "nfs_remote_dir is %s", bkpinfo->nfs_remote_dir);
     957        mr_free(bkpinfo->netfs_mount);
     958        bkpinfo->netfs_mount = read_cfg_var(g_mondo_cfg_file, "netfs-server-mount");
     959
     960        mr_free(bkpinfo->netfs_remote_dir);
     961        bkpinfo->netfs_remote_dir = read_cfg_var(g_mondo_cfg_file, "netfs-server-path");
     962
     963        if (bkpinfo->netfs_mount != NULL) {
     964            log_msg(2, "netfs_mount is %s", bkpinfo->netfs_mount);
     965        }
     966        if (bkpinfo->netfs_remote_dir != NULL) {
     967            log_msg(2, "netfs_remote_dir is %s", bkpinfo->netfs_remote_dir);
     968        }
     969        if (bkpinfo->netfs_proto != NULL) {
     970            log_msg(2, "netfs_proto is %s", bkpinfo->netfs_proto);
    967971        }
    968972    }
    969973    if (strstr(call_program_and_get_last_line_of_output("cat " CMDLINE), "pxe")) {
    970974        /* We need to override values in PXE mode as it's
    971         * already done in start-nfs */
    972         envtmp1 = getenv("nfsmount");
     975        * already done in start-netfs */
     976        envtmp1 = getenv("netfsmount");
    973977        if (envtmp1 == NULL) {
    974             fatal_error("no nfsmount variable in environment");
     978            fatal_error("no netfsmount variable in environment");
    975979        }
    976980        envtmp2 = getenv("dirimg");
     
    978982            fatal_error("no dirimg variable in environment");
    979983        }
    980         mr_free(bkpinfo->nfs_mount);
    981         mr_asprintf(bkpinfo->nfs_mount, "%s", envtmp1);
    982 
    983         mr_free(bkpinfo->nfs_remote_dir);
    984         mr_asprintf(bkpinfo->nfs_remote_dir, "%s", envtmp2);
     984        mr_free(bkpinfo->netfs_mount);
     985        mr_asprintf(bkpinfo->netfs_mount, "%s", envtmp1);
     986
     987        mr_free(bkpinfo->netfs_remote_dir);
     988        mr_asprintf(bkpinfo->netfs_remote_dir, "%s", envtmp2);
    985989    }
    986990} else if (bkpinfo->backup_media_type == iso) {
  • branches/2.2.10/mondo/src/mondorestore/mondorestore.c

    r2376 r2382  
    919919    mr_free(bkpinfo->restore_path);
    920920    mr_asprintf(bkpinfo->restore_path, "/");
    921     if (!g_restoring_live_from_cd && !g_restoring_live_from_nfs) {
     921    if (!g_restoring_live_from_cd && !g_restoring_live_from_netfs) {
    922922        popup_and_OK
    923923            ("Please insert tape/CD/USB Key, then hit 'OK' to continue.");
    924924        sleep(1);
    925925    }
    926     if (!g_restoring_live_from_nfs) {
     926    if (!g_restoring_live_from_netfs) {
    927927        interactively_obtain_media_parameters_from_user(FALSE);
    928928    }
     
    946946    load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
    947947
    948     if (!g_restoring_live_from_nfs && (filelist = process_filelist_and_biggielist())) {
     948    if (!g_restoring_live_from_netfs && (filelist = process_filelist_and_biggielist())) {
    949949        save_filelist(filelist, "/tmp/selected-files.txt");
    950950        mr_asprintf(old_restpath, "%s", bkpinfo->restore_path);
     
    28282828        mount_boot_if_necessary();  /* for Gentoo users */
    28292829        log_msg(2, "Still here.");
    2830         if (bkpinfo->backup_media_type == nfs) {
    2831             g_restoring_live_from_nfs = TRUE;
     2830        if (bkpinfo->backup_media_type == netfs) {
     2831            g_restoring_live_from_netfs = TRUE;
    28322832        }
    28332833        /* Adding an initialisation in order to avoid to hndle NULL pointer later */
     
    28612861        // BCO:To be reviewed
    28622862        if ((bkpinfo->restore_mode == compare) || (bkpinfo->restore_mode == nuke)) {
    2863             if (bkpinfo->backup_media_type == nfs && bkpinfo->nfs_mount && !is_this_device_mounted(bkpinfo->nfs_mount)) {
    2864                 log_msg(1, "Mounting nfs dir");
     2863            if (bkpinfo->backup_media_type == netfs && bkpinfo->netfs_mount && !is_this_device_mounted(bkpinfo->netfs_mount)) {
     2864                log_msg(1, "Mounting remote %s dir", bkpinfo->netfs_proto);
    28652865                mr_free(bkpinfo->isodir);
    28662866                mr_asprintf(bkpinfo->isodir, "/tmp/isodir");
    28672867                run_program_and_log_output("mkdir -p /tmp/isodir", 5);
    2868                 mr_asprintf(tmp, "mount %s -t nfs -o nolock,ro /tmp/isodir", bkpinfo->nfs_mount);
     2868                if (strstr(bkpinfo->netfs_proto, "sshfs")) {
     2869                    mr_asprintf(tmp, "sshfs -o ro %s /tmp/isodir", bkpinfo->netfs_mount);
     2870                } else {
     2871                    mr_asprintf(tmp, "mount %s -o nolock,ro /tmp/isodir", bkpinfo->netfs_mount);
     2872                }
    28692873                run_program_and_log_output(tmp, 1);
    28702874                mr_free(tmp);
  • branches/2.2.10/mondo/src/mondorestore/mr-externs.h

    r2352 r2382  
    107107extern bool g_text_mode;
    108108extern bool g_restoring_live_from_cd;
    109 extern bool g_restoring_live_from_nfs;
     109extern bool g_restoring_live_from_netfs;
    110110extern int fput_string_one_char_at_a_time(FILE *, char *);
    111111extern char *evaluate_mountlist(struct mountlist_itself *mountlist, int *res);
Note: See TracChangeset for help on using the changeset viewer.