Changeset 2382 in MondoRescue


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
Files:
1 deleted
28 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/2.2.10/mindi/README.pxe

    r2191 r2382  
    1111label mondo
    1212        kernel vmlinuz-mondo
    13         append initrd=initrd-mondo load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=131072 rw root=/dev/ram iso acpi=off apm=off devfs=nomount exec-shield=0 pxe [prefix=machine] [ipconf=(ipdev:ipadr:netmask:broadcast:gateway|ipdev:dhcp)] [nfsmount=server:mountpoint] [nfspath=local_path] [ping=#] ...
     13        append initrd=initrd-mondo load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=131072 rw root=/dev/ram iso acpi=off apm=off devfs=nomount exec-shield=0 pxe [proto=nfs|sshfs] [prefix=machine] [ipconf=(ipdev:ipadr:netmask:broadcast:gateway|ipdev:dhcp)] [netfsmount=server:mountpoint] [netfspath=local_path] [ping=#] ...
    1414
    1515ipdev is the device name (e.g. eth2)
     
    1919gateway is the default gateway (e.g. 192.168.1.254)
    2020dhcp is a keyword. Using it will provide all the previous 4 values to activate the LAN interface.
    21 server is the ip addr of the NFS server
    22 mountpoint is the mount point on the NFS server to use (should be in /etc/exports of the NFS server)
     21proto is the protocol to use for mounting the remote share (default is NFS, sshfs is also available)
     22server is the ip addr of the Remote Network server
     23mountpoint is the mount point on the Remote Network server to use (if NFS, should be in /etc/exports of the NFS server)
     24netfsmount is the server and mountpoint on which the ISO is available, if different from the one at backup time. For SSHFS the server part can be of the form user@server.
     25netfspath is the local path on the remote server where the image is located, if different from the one at backup time.
    2326local_path is the local directory under which the mage was made (with the -d option)
    2427rmadisk_size may have to be increase to 131072 on more recent distributions such as rhel 5
     
    4043Without prefix keyword, the name of the images used during archiving with the -p option will be used (they may differ). If -p wasn't used then the name mondorescue-1.iso, ... will be used.
    4144
    42 During boot mondorestore will start your NFS configuration and mount mondo's content from the network rather than from a physical media. You may alter the IP configuration stored from the original machine by passing the ipconf option describing respectively the IP address, netmask, broadcast and default gateway you want to setup for the machine, separated by ':'. Or alternatively, you may specify the dhcp keyword so that a DHCP request is made to get those information. In the 2 cases, you have to mention on which physical interface those parameters should apply. On some configurations, you may also want to increase the number of ping queries made before the NFS mount, which is of 3 by default, using the ping option and give the number you want. If you have a different NFS server for the deployment than for the archiving, you can also precise it through the nfsmount option. The structure on both server under the mountpoint has to be the same.
     45During boot mondorestore will start your NFS configuration and mount mondo's content from the network rather than from a physical media. You may alter the IP configuration stored from the original machine by passing the ipconf option describing respectively the IP address, netmask, broadcast and default gateway you want to setup for the machine, separated by ':'. Or alternatively, you may specify the dhcp keyword so that a DHCP request is made to get those information. In the 2 cases, you have to mention on which physical interface those parameters should apply. On some configurations, you may also want to increase the number of ping queries made before the NFS mount, which is of 3 by default, using the ping option and give the number you want. If you have a different NFS server for the deployment than for the archiving, you can also precise it through the netfsmount option. The structure on both server under the mountpoint has to be the same.
    4346
    4447CAVEAT: the limit to the number of char on the append line is 255. Use symlinks to reduce the size of your path if needed.
     
    4649Please report any problem around that tool to bruno@mondorescue.org
    4750
     512009-09-09 Changed to netfs for multi protocol support (nfs, sshfs, ...)
    48522009-05-07 nfspath added to allow redeployment from another NFS directory
    49532006-06-10 nfsmount added to allow redeployment from another NFS server
  • branches/2.2.10/mindi/deplist.txt

    r2222 r2382  
    4646/bin/mount
    4747/sbin/mount.nfs /sbin/mount.nfs4
    48 /sbin/mount.fuse
     48/usr/bin/sshfs
     49/sbin/mount.fuse /usr/bin/fusermount /usr/bin/ulockmgr_server
    4950/sbin/mount.cifs /sbin/mount.cifs3
    5051/sbin/mount.smb /sbin/mount.smb3
  • branches/2.2.10/mindi/mindi

    r2345 r2382  
    5757PCMCIA_MODS="pcmcia_core ds yenta_socket"
    5858USB_MODS="usb-storage usb-ohci usb-uhci usbcore usb_storage input hid uhci_hcd ehci_hcd uhci-hcd ehci-hcd ohci-hcd ohci_hcd usbkbd usbhid keybdev mousedev libusual scsi_mod ff-memless"
    59 NET_MODS="sunrpc nfs nfs_acl lockd fscache loop mii 3c59x e100 bcm5700 bnx2 e1000 e1000e igb eepro100 ne2k-pci tg3 libphy pcnet32 8139cp 8139too 8390 forcedeth vmxnet vmnet exportfs"
     59NET_MODS="sunrpc nfs nfs_acl lockd fscache loop mii 3c59x e100 bcm5700 bnx2 e1000 e1000e igb eepro100 ne2k-pci tg3 libphy pcnet32 8139cp 8139too 8390 forcedeth vmxnet vmnet exportfs fuse"
    6060CDROM_MODS="$TAPE_MODS $IDE_MODS $USB_MODS $PCMCIA_MODS $SCSI_MODS $NET_MODS af_packet cdrom isocd isofs inflate_fs nls_iso8859-1 nls_base nls_cp437 nls_utf8 sg sr_mod zlib_inflate iso9660"
    6161# Those modules will only go on the backup media, not the boot media.
    62 EXTRA_MODS="$CDROM_MODS vfat fat loop md-mod linear raid0 raid1 xor raid10 raid5 raid456 lvm-mod dm-mod dm_mod dm-snapshot dm_snapshot dm-zero dm_zero dm-mirror dm_mirror dm-multipath dm-round-robin dm-emc dm-hp-sw dm-rdac multipath jfs xfs xfs_support pagebuf reiserfs ext2 ext3 minix nfs nfs_acl nfsd lockd sunrpc jbd mbcache ext4 jbd2 crc16 fuse"
     62EXTRA_MODS="$CDROM_MODS vfat fat loop md-mod linear raid0 raid1 xor raid10 raid5 raid456 lvm-mod dm-mod dm_mod dm-snapshot dm_snapshot dm-zero dm_zero dm-mirror dm_mirror dm-multipath dm-round-robin dm-emc dm-hp-sw dm-rdac multipath jfs xfs xfs_support pagebuf reiserfs ext2 ext3 minix nfs nfs_acl nfsd lockd sunrpc jbd mbcache ext4 jbd2 crc16"
    6363# Replace with that line for HP OCMP e.g.
    6464#DENY_MODS="MPS_Driver_Mapper mps octtldrv tscttl streams kqemu fdomain"
     
    565565        fi
    566566        cp -f $MINDI_TMP/BOOTLOADER.* $bigdir 2>> $LOGFILE || LogAll "\nMondo v1.2x defaults to LILO as the bootloader, BTW."
    567         if [ -e "$MINDI_TMP/NFS-DEV" ] ; then
     567        if [ -e "$MINDI_TMP/NETFS-DEV" ] ; then
    568568            LogAll "\nIncorporating NFS-related settings"
    569             for r in NFS-* ISO-PREFIX ; do
     569            for r in NETFS-* ISO-PREFIX ; do
    570570                cp -f $MINDI_TMP/$r $bigdir/tmp 2>> $LOGFILE || Die "Cannot copy $r - did you run out of disk space?"
    571571                LogFile "Copying $r to ramdisk"
     
    923923    echo "datestamp `date`" >> $outfile
    924924    [ "$ESTIMATED_TOTAL_NOOF_SLICES" ] && echo "total-slices $ESTIMATED_TOTAL_NOOF_SLICES" >> $outfile
    925     AddFileToCfgIfExists $MINDI_TMP/NFS-CLIENT-IPADDR nfs-client-ipaddr $outfile
    926     AddFileToCfgIfExists $MINDI_TMP/NFS-CLIENT-NETMASK nfs-client-netmask $outfile
    927     AddFileToCfgIfExists $MINDI_TMP/NFS-CLIENT-BROADCAST nfs-client-broadcast $outfile
    928     AddFileToCfgIfExists $MINDI_TMP/NFS-CLIENT-DEFGW  nfs-client-defgw  $outfile
    929     AddFileToCfgIfExists $MINDI_TMP/NFS-SERVER-MOUNT  nfs-server-mount  $outfile
    930     AddFileToCfgIfExists $MINDI_TMP/NFS-SERVER-PATH   nfs-server-path   $outfile
    931     AddFileToCfgIfExists $MINDI_TMP/NFS-DEV           nfs-dev           $outfile
    932     AddFileToCfgIfExists $MINDI_TMP/NFS-SERVER-IPADDR nfs-server-ipaddr $outfile
     925    AddFileToCfgIfExists $MINDI_TMP/NETFS-CLIENT-IPADDR netfs-client-ipaddr $outfile
     926    AddFileToCfgIfExists $MINDI_TMP/NETFS-CLIENT-NETMASK netfs-client-netmask $outfile
     927    AddFileToCfgIfExists $MINDI_TMP/NETFS-CLIENT-BROADCAST netfs-client-broadcast $outfile
     928    AddFileToCfgIfExists $MINDI_TMP/NETFS-CLIENT-DEFGW  netfs-client-defgw  $outfile
     929    AddFileToCfgIfExists $MINDI_TMP/NETFS-SERVER-MOUNT  netfs-server-mount  $outfile
     930    AddFileToCfgIfExists $MINDI_TMP/NETFS-SERVER-PATH   netfs-server-path   $outfile
     931    AddFileToCfgIfExists $MINDI_TMP/NETFS-DEV           netfs-dev           $outfile
     932    AddFileToCfgIfExists $MINDI_TMP/NETFS-PROTO         netfs-proto           $outfile
     933    AddFileToCfgIfExists $MINDI_TMP/NETFS-SERVER-IPADDR netfs-server-ipaddr $outfile
    933934    AddFileToCfgIfExists $MINDI_TMP/ISO-DEV           iso-dev           $outfile
    934935    AddFileToCfgIfExists $MINDI_TMP/ISO-MNT           iso-mnt           $outfile
     
    15111512    if [ _"$MONDO_SHARE" != _"" ]; then
    15121513        if [ "$CDRECOVERY" != "yes" ] ; then
    1513             if [ -e "$MINDI_TMP/NFS-DEV" ] ; then
     1514            if [ -e "$MINDI_TMP/NETFS-DEV" ] ; then
    15141515                echo -en "Press <enter> to continue.\n"
    15151516            elif [ ! "$MINDI_TMP" ] ; then
     
    15541555    # In case it's mondoarchive
    15551556    elif [ _"$MONDO_SHARE" != _"" ]; then
    1556         if [ -e "$MINDI_TMP/NFS-DEV" ] ; then
     1557        if [ -e "$MINDI_TMP/NETFS-DEV" ] ; then
    15571558            echo -en "default${sep}iso\n"
    15581559        else
     
    23412342    list_of_groovy_mods="$CDROM_MODS $FORCE_MODS"
    23422343
    2343     if [ -e "$MINDI_TMP/NFS-DEV" ] ; then
     2344    if [ -e "$MINDI_TMP/NETFS-DEV" ] ; then
    23442345        # For PXE boot
    23452346        list_of_groovy_mods="$list_of_groovy_mods $NET_MODS"
  • branches/2.2.10/mindi/rootfs/sbin/init

    r2362 r2382  
    724724fi
    725725if [ "`grep -i pxe $CMDLINE`" ] || [ "`grep -i net $CMDLINE`" ]; then
    726     # We need to get here exported variables from start-nfs
    727     . /sbin/start-nfs
     726    # We need to get here exported variables from start-netfs
     727    . /sbin/start-netfs
    728728fi
    729729
     
    737737    ExtractDataDisksAndLoadModules
    738738    # Fake the conf file to force it to NFS mode, even if we made originally a CD (mandatory for mondorestore to work correctly)
    739     sed -i "s/backup-media-type.*/backup-media-type nfs/" /tmp/mondo-restore.cfg
     739    sed -i "s/backup-media-type.*/backup-media-type netfs/" /tmp/mondo-restore.cfg
    740740elif [ "`grep -i usb= $CMDLINE`" ] || [ "`grep -i usb /tmp/mondo-restore.cfg 2>/dev/null | grep media-type`" ]; then
    741741    . /sbin/start-usb
     
    748748    HandleCDROM
    749749    ExtractDataDisksAndLoadModules
    750     # We need to get here exported variables from start-nfs
    751     . /sbin/start-nfs
     750    # We need to get here exported variables from start-netfs
     751    . /sbin/start-netfs
    752752fi
    753753res=$?
     
    848848    LogIt "backup-media-type is specified in config file - great."
    849849    LogIt "Calling post-init"
    850     # start-nfs moved it under /tmp as the NFS share is already unmounted
     850    # start-netfs moved it under /tmp as the NFS share is already unmounted
    851851    if [ "`echo $pre | grep -E '^/tmp/isodir'`" ]; then
    852852        post=`echo $pre | sed 's|^/tmp/isodir|/tmp|'`
     
    866866        echo $i | grep -qi post= && post=`echo $i | cut -d= -f2`
    867867    done
    868     # start-nfs moved it under /tmp as the NFS share is already unmounted
     868    # start-netfs moved it under /tmp as the NFS share is already unmounted
    869869    if [ "`echo $post | grep -E '^/tmp/isodir'`" ]; then
    870870        post=`echo $post | sed 's|^/tmp/isodir|/tmp|'`
  • branches/2.2.10/mindi/rootfs/sbin/start-netfs

    r2380 r2382  
    3131
    3232# info from cmdline are predominent
    33 for i in `cat /proc/cmdline` ; do
     33for i in `cat $CMDLINE` ; do
    3434    echo $i | grep -qi ping= && ipcount=`echo $i | cut -d= -f2`
    3535    echo $i | grep -qi ipconf= && ipconf=`echo $i | cut -d= -f2`
  • branches/2.2.10/mondo-doc/mondoarchive.8

    r2341 r2382  
    119119.TP
    120120.BI "-n " mount
    121 Use files residing on NFS partition as backup media.
     121Use files residing on a remote share as backup media.
    122122.I mount
    123 is the remote mount-point, e.g. '192.168.1.3:/home/nfs'
     123is the remote mount-point, e.g. 'nfs://192.168.1.3:/home/nfs'
    124124for my file server. If not mounted, mondoarchive will do it for you. So nice ;-)
    125125If your NFS server only accept write from a backup user, you may specify it with the syntax:
    126 .B user@machine:/mount/path
     126.B nfs://user@machine:/mount/path
    127127and mondoarchive will try to do its best to support it.
     128Other protocols are available such as sshfs for fuse SSH based filesystem
     129mount, with the same syntax e.g. 'sshfs://user@192.168.1.3:/home/nfs'
    128130
    129131.TP
     
    426428Backup to an NFS mount:
    427429.br
    428 .I "mondoarchive -On 192.168.1.2:/home/nfs -d /Monday -E /mnt/nfs"
     430.I "mondoarchive -On nfs://192.168.1.2:/home/nfs -d /Monday -E /mnt/nfs"
    429431
    430432Verify existing NFS backup:-
    431433.br
    432 .I "mondoarchive -Vn 192.168.1.2:/home/nfs -d /Monday"
     434.I "mondoarchive -Vn nfs://192.168.1.2:/home/nfs -d /Monday"
    433435
    434436.BI USB:
  • branches/2.2.10/mondo-doc/mondorescue-howto.sgml

    r2087 r2382  
    560560<row>
    561561<entry>
    562         bash# mount 192.168.1.28:/home/nfs /mnt/nfs
     562        bash# mount nfs://192.168.1.28:/home/nfs /mnt/nfs
    563563        </entry>
    564564</row>
    565565<row>
    566566<entry>
    567 bash# mondoarchive -OVn 192.168.1.28:/home/nfs -gF[...]
     567        bash# mondoarchive -OVn nfs://192.168.1.28:/home/nfs -gF[...]
    568568        </entry>
    569569</row>
     
    15081508<entry>
    15091509
    1510         bash# mount 192.168.1.3:/home/nfs -t nfs /mnt/nfs
     1510        bash# mount nfs://192.168.1.3:/home/nfs -t nfs /mnt/nfs
    15111511</entry>
    15121512</row>
    15131513<row>
    15141514        <entry>
    1515         bash# mondoarchive -OVn 192.168.1.3:/home/nfs -g -s 200m
     1515        bash# mondoarchive -OVn nfs://192.168.1.3:/home/nfs -g -s 200m
    15161516</entry>
    15171517</row>
     
    31193119<entry>
    31203120
    3121 bash# mondoarchive -On 192.168.1.3:/home/nfs
     3121        bash# mondoarchive -On nfs://192.168.1.3:/home/nfs
    31223122
    31233123</entry>
  • branches/2.2.10/mondo-doc/mondorestore.8

    r2295 r2382  
    6262Use files residing on NFS partition as restore media.
    6363.I mount
    64 is the remote mount-point, e.g. '192.168.1.3:/home/nfs'
     64is the remote mount-point, e.g. nfs://192.168.1.3:/home/nfs'
    6565for my file server. Please mount it before restoring/verifying.
    6666
  • 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.