Ignore:
Timestamp:
Nov 5, 2005, 12:51:05 AM (18 years ago)
Author:
bcornec
Message:

Apply patch from Andree Leidenfrost <aleidenf_AT_bigpond.net.au>
(-r72:75 of trunk) for :
+ correcting NFS handling in interactive mode
+ growisofs and sudo pb

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.04_berlios/mondo/mondo/common/libmondo-devices.c

    r85 r99  
    260260extern struct s_bkpinfo *g_bkpinfo_DONTUSETHIS;
    261261extern char *g_erase_tmpdir_and_scratchdir;
     262extern char *g_selfmounted_isodir;
    262263
    263264static char g_cdrw_drive_is_here[MAX_STR_LEN/4]="";
     
    17861787  char *command;
    17871788  char *comment;
     1789  char *prompt;
    17881790  int i;
    17891791  FILE*fin;
     
    17931795  malloc_string(command);
    17941796  malloc_string(comment);
     1797  malloc_string(prompt);
    17951798  assert(bkpinfo!=NULL);
    17961799  sz_size[0] = '\0';
     
    20022005                  }
    20032006              }
    2004             sprintf(command, "mount | grep %s | cut -d' ' -f3", bkpinfo->nfs_mount);
     2007            // check whether already mounted - we better remove
     2008            // surrounding spaces and trailing '/' for this
     2009            strip_spaces (bkpinfo->nfs_mount);
     2010            if (bkpinfo->nfs_mount[strlen(bkpinfo->nfs_mount) - 1] == '/')
     2011               bkpinfo->nfs_mount[strlen(bkpinfo->nfs_mount) - 1] = '\0';
     2012            sprintf(command, "mount | grep \"%s \" | cut -d' ' -f3",bkpinfo->nfs_mount);
    20052013            strcpy(bkpinfo->isodir, call_program_and_get_last_line_of_output(command));
    20062014      }
     
    20162024        if (!is_this_device_mounted(bkpinfo->nfs_mount))
    20172025          {
    2018             sprintf(bkpinfo->isodir, "/tmp/isodir");
    2019         run_program_and_log_output("mkdir -p /tmp/isodir", 5);
    2020         sprintf(tmp, "mount %s -t nfs -o nolock /tmp/isodir", bkpinfo->nfs_mount);
    2021         run_program_and_log_output(tmp, 5);
     2026                  sprintf(bkpinfo->isodir, "/tmp/isodir.mondo.%d", (int)(random(%32768)));
     2027                  sprintf(command, "mkdir -p %s", bkpinfo->isodir);
     2028                  run_program_and_log_output(command, 5);
     2029                  sprintf(tmp, "mount %s -t nfs %s", bkpinfo->nfs_mount, bkpinfo->isodir);
     2030                  run_program_and_log_output(tmp, 5);
     2031                  malloc_string(g_selfmounted_isodir);
     2032                  strcpy(g_selfmounted_isodir, bkpinfo->isodir);
    20222033          }
    20232034    if (!is_this_device_mounted(bkpinfo->nfs_mount))
     
    20332044          }
    20342045        strcpy(bkpinfo->nfs_remote_dir, tmp);
     2046        // check whether writable - we better remove surrounding spaces for this
     2047        strip_spaces (bkpinfo->nfs_remote_dir);
     2048        sprintf (command, "echo hi > %s/%s/.dummy.txt", bkpinfo->isodir,
     2049                                  bkpinfo->nfs_remote_dir);
     2050        while (run_program_and_log_output (command, FALSE)) {
     2051            strcpy(tmp, bkpinfo->nfs_remote_dir);
     2052            sprintf (prompt,
     2053                     "Directory '%s' under mountpoint '%s' does not exist or is not writable. You can fix this or change the directory and retry or cancel the backup.",
     2054                     bkpinfo->nfs_remote_dir, bkpinfo->isodir);
     2055            if(!popup_and_get_string ("Directory", prompt, tmp, MAX_STR_LEN)) {
     2056                log_to_screen("User has chosen not to backup the PC");
     2057                finish(1);
     2058            }
     2059            strcpy(bkpinfo->nfs_remote_dir, tmp);
     2060            // check whether writable - we better remove surrounding space s for this
     2061            strip_spaces (bkpinfo->nfs_remote_dir);
     2062            sprintf (command, "echo hi > %s/%s/.dummy.txt", bkpinfo->isodir,
     2063                                    bkpinfo->nfs_remote_dir);
     2064        }
     2065
    20352066    for(i=0; i<=MAX_NOOF_MEDIA; i++) { bkpinfo->media_size[i] = 650; }
    20362067        log_msg(3, "Just set nfs_remote_dir to %s", bkpinfo->nfs_remote_dir);
     
    21812212  paranoid_free(command);
    21822213  paranoid_free(comment);
     2214  paranoid_free(prompt);
    21832215  return(0);
    21842216}
Note: See TracChangeset for help on using the changeset viewer.