Changeset 99 in MondoRescue for branches/2.04_berlios/mondo/mondo/common/libmondo-devices.c
- Timestamp:
- Nov 5, 2005, 12:51:05 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.04_berlios/mondo/mondo/common/libmondo-devices.c
r85 r99 260 260 extern struct s_bkpinfo *g_bkpinfo_DONTUSETHIS; 261 261 extern char *g_erase_tmpdir_and_scratchdir; 262 extern char *g_selfmounted_isodir; 262 263 263 264 static char g_cdrw_drive_is_here[MAX_STR_LEN/4]=""; … … 1786 1787 char *command; 1787 1788 char *comment; 1789 char *prompt; 1788 1790 int i; 1789 1791 FILE*fin; … … 1793 1795 malloc_string(command); 1794 1796 malloc_string(comment); 1797 malloc_string(prompt); 1795 1798 assert(bkpinfo!=NULL); 1796 1799 sz_size[0] = '\0'; … … 2002 2005 } 2003 2006 } 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); 2005 2013 strcpy(bkpinfo->isodir, call_program_and_get_last_line_of_output(command)); 2006 2014 } … … 2016 2024 if (!is_this_device_mounted(bkpinfo->nfs_mount)) 2017 2025 { 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); 2022 2033 } 2023 2034 if (!is_this_device_mounted(bkpinfo->nfs_mount)) … … 2033 2044 } 2034 2045 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 2035 2066 for(i=0; i<=MAX_NOOF_MEDIA; i++) { bkpinfo->media_size[i] = 650; } 2036 2067 log_msg(3, "Just set nfs_remote_dir to %s", bkpinfo->nfs_remote_dir); … … 2181 2212 paranoid_free(command); 2182 2213 paranoid_free(comment); 2214 paranoid_free(prompt); 2183 2215 return(0); 2184 2216 }
Note:
See TracChangeset
for help on using the changeset viewer.