Changeset 75 in MondoRescue for trunk/mondo/mondo/common/libmondo-devices.c
- Timestamp:
- Oct 20, 2005, 2:35:15 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/mondo/mondo/common/libmondo-devices.c
r59 r75 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] = ""; … … 1820 1821 char *command; 1821 1822 char *comment; 1823 char *prompt; 1822 1824 int i; 1823 1825 FILE *fin; … … 1827 1829 malloc_string(command); 1828 1830 malloc_string(comment); 1831 malloc_string(prompt); 1829 1832 assert(bkpinfo != NULL); 1830 1833 sz_size[0] = '\0'; … … 2099 2102 } 2100 2103 } 2101 sprintf(command, "mount | grep %s | cut -d' ' -f3", 2102 bkpinfo->nfs_mount); 2104 // check whether already mounted - we better remove 2105 // surrounding spaces and trailing '/' for this 2106 strip_spaces (bkpinfo->nfs_mount); 2107 if (bkpinfo->nfs_mount[strlen(bkpinfo->nfs_mount) - 1] == '/') 2108 bkpinfo->nfs_mount[strlen(bkpinfo->nfs_mount) - 1] = '\0'; 2109 sprintf(command, "mount | grep \"%s \" | cut -d' ' -f3", 2110 bkpinfo->nfs_mount); 2103 2111 strcpy(bkpinfo->isodir, 2104 2112 call_program_and_get_last_line_of_output(command)); … … 2114 2122 } 2115 2123 if (!is_this_device_mounted(bkpinfo->nfs_mount)) { 2116 sprintf(bkpinfo->isodir, "/tmp/isodir"); 2117 run_program_and_log_output("mkdir -p /tmp/isodir", 5); 2118 sprintf(tmp, "mount %s -t nfs -o nolock /tmp/isodir", 2119 bkpinfo->nfs_mount); 2120 run_program_and_log_output(tmp, 5); 2124 sprintf(bkpinfo->isodir, "/tmp/isodir.mondo.%d", (int)(random()%32768)); 2125 sprintf(command, "mkdir -p %s", bkpinfo->isodir); 2126 run_program_and_log_output(command, 5); 2127 sprintf(tmp, "mount %s -t nfs %s", bkpinfo->nfs_mount, bkpinfo->isodir); 2128 run_program_and_log_output(tmp, 5); 2129 malloc_string(g_selfmounted_isodir); 2130 strcpy(g_selfmounted_isodir, bkpinfo->isodir); 2121 2131 } 2122 2132 if (!is_this_device_mounted(bkpinfo->nfs_mount)) { … … 2133 2143 } 2134 2144 strcpy(bkpinfo->nfs_remote_dir, tmp); 2145 // check whether writable - we better remove surrounding spaces for this 2146 strip_spaces (bkpinfo->nfs_remote_dir); 2147 sprintf (command, "echo hi > %s/%s/.dummy.txt", bkpinfo->isodir, 2148 bkpinfo->nfs_remote_dir); 2149 while (run_program_and_log_output (command, FALSE)) { 2150 strcpy(tmp, bkpinfo->nfs_remote_dir); 2151 asprintf (&prompt, 2152 "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.", 2153 bkpinfo->nfs_remote_dir, bkpinfo->isodir); 2154 if(!popup_and_get_string ("Directory", prompt, tmp, MAX_STR_LEN)) { 2155 log_to_screen("User has chosen not to backup the PC"); 2156 finish(1); 2157 } 2158 strcpy(bkpinfo->nfs_remote_dir, tmp); 2159 // check whether writable - we better remove surrounding spaces for this */ 2160 strip_spaces (bkpinfo->nfs_remote_dir); 2161 asprintf (&command, "echo hi > %s/%s/.dummy.txt", bkpinfo->isodir, 2162 bkpinfo->nfs_remote_dir); 2163 } 2135 2164 for (i = 0; i <= MAX_NOOF_MEDIA; i++) { 2136 2165 bkpinfo->media_size[i] = 650; … … 2347 2376 paranoid_free(command); 2348 2377 paranoid_free(comment); 2378 paranoid_free(prompt); 2349 2379 return (0); 2350 2380 }
Note:
See TracChangeset
for help on using the changeset viewer.