Changeset 2325 in MondoRescue for branches/2.2.10/mondo/src/common/libmondo-cli.c
- Timestamp:
- Aug 18, 2009, 3:19:15 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-cli.c
r2324 r2325 114 114 } 115 115 } 116 mr_asprintf(tmp, "rm -Rf %s/tmp.mondo.*", bkpinfo->tmpdir);117 paranoid_system(tmp);118 mr_free(tmp);119 120 mr_asprintf(tmp, "rm -Rf %s/mondo.scratch.*", bkpinfo->scratchdir);121 paranoid_system(tmp);122 mr_free(tmp);123 124 mr_strcat(bkpinfo->scratchdir, "/mondo.scratch.%ld", random() % 32767);125 126 116 mr_asprintf(tmp, "mkdir -p %s/tmpfs", bkpinfo->tmpdir); 127 117 paranoid_system(tmp); … … 889 879 if ((flag_set['t'] && !flag_set['d']) && (! bkpinfo->restore_data)) { 890 880 log_it("Hmm! No tape drive specified. Let's see what we can do."); 891 p = mr_find_tape_device(); 892 if (!p) { 881 if ((tmp1 = find_tape_device_and_size(NULL)) == NULL) { 893 882 fatal_error("Tape device not specified. I couldn't find it either."); 894 883 } 884 strcpy(flag_val['d'], tmp1); 885 mr_free(tmp1); 895 886 flag_set['d'] = TRUE; 896 887 strcpy(flag_val['d'], p); … … 917 908 } 918 909 if (!flag_set['d']) { 919 if (!find_dvd_device(flag_val['d'], FALSE)) { 910 if ((tmp = find_dvd_device(flag_val['d'])) != NULL) { 911 strcpy(flag_val['d'],tmp); 912 mr_free(tmp); 920 913 flag_set['d'] = TRUE; 921 914 log_to_screen("I guess DVD drive is at %s", flag_val['d']); … … 923 916 } 924 917 if (strchr(flag_val['d'], ',')) { 925 fatal_error 926 ("Please don't give a SCSI node. Give a _device_, preferably a /dev entry, for the parameter of the -d flag."); 918 fatal_error("Please don't give a SCSI node. Give a _device_, preferably a /dev entry, for the parameter of the -d flag."); 927 919 } 928 920 if (! bkpinfo->restore_data) { 929 921 if (!find_home_of_exe("growisofs")) { 930 fatal_error 931 ("Please install growisofs (probably part of dvd+rw-tools). If you want DVD support, you need it."); 922 fatal_error("Please install growisofs (probably part of dvd+rw-tools). If you want DVD support, you need it."); 932 923 } 933 924 if (!find_home_of_exe("dvd+rw-format")) { 934 fatal_error 935 ("Please install dvd+rw-format (probably part of dvd+rw-tools). If you want DVD support, you need it."); 925 fatal_error("Please install dvd+rw-format (probably part of dvd+rw-tools). If you want DVD support, you need it."); 936 926 } 937 927 if (!flag_set['s']) { 938 928 sprintf(flag_val['s'], "%d", DEFAULT_DVD_DISK_SIZE); // 4.7 salesman's GB = 4.482 real GB = 4582 MB 939 929 strcat(flag_val['s'], "m"); 940 log_to_screen 941 ("You did not specify a size (-s) for DVD. I'm guessing %s.", 942 flag_val['s']); 930 log_to_screen("You did not specify a size (-s) for DVD. I'm guessing %s.", flag_val['s']); 943 931 flag_set['s'] = 1; 944 932 } … … 948 936 if (flag_set['t'] || flag_set['u']) { /* tape size */ 949 937 if (strchr(flag_val['d'], ',')) { 950 fatal_error 951 ("Please don't give a SCSI node. Give a _device_, preferably a /dev entry, for the parameter of the -d flag."); 938 fatal_error("Please don't give a SCSI node. Give a _device_, preferably a /dev entry, for the parameter of the -d flag."); 952 939 } 953 940 if ((flag_set['O']) && (! bkpinfo->restore_data)) { … … 981 968 982 969 if (flag_set['n']) { 983 strncpy(bkpinfo->nfs_mount, flag_val['n'], MAX_STR_LEN); 970 mr_free(bkpinfo->nfs_mount); 971 mr_asprintf(bkpinfo->nfs_mount, "%s", flag_val['n']); 984 972 if (!flag_set['d']) { 985 strncpy(bkpinfo->nfs_remote_dir, "/", MAX_STR_LEN); 973 mr_free(bkpinfo->nfs_remote_dir); 974 mr_asprintf(bkpinfo->nfs_remote_dir, "/"); 986 975 } 987 976 /* test if we specified a user for the NFS dialog */ … … 989 978 if (p != NULL) { 990 979 /* User found. Store the 2 values */ 980 bkpinfo->nfs_user = bkpinfo->nfs_mount; 991 981 p++; 992 982 /* new NFS mount */ 993 strcpy(tmp,p);983 bkpinfo->nfs_mount = p; 994 984 p--; 995 985 *p = '\0'; 996 mr_asprintf(bkpinfo->nfs_user,"%s",p);997 strcpy(bkpinfo->nfs_mount,tmp);998 986 } 999 987 mr_asprintf(tmp1, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3", bkpinfo->nfs_mount); … … 1221 1209 mr_free(tmp1); 1222 1210 } else if (flag_set['n']) { 1223 strncpy(bkpinfo->nfs_remote_dir, flag_val['d'], MAX_STR_LEN); 1211 mr_free(bkpinfo->nfs_remote_dir); 1212 mr_asprintf(bkpinfo->nfs_remote_dir, "%s", flag_val['d']); 1224 1213 } else { /* backup device (if tape/CD-R/CD-RW) */ 1225 strncpy(bkpinfo->media_device, flag_val['d'], MAX_STR_LEN / 4); 1214 mr_free(bkpinfo->media_device); 1215 mr_asprintf(bkpinfo->media_device, "%s", flag_val['d']); 1226 1216 } 1227 1217 } … … 1245 1235 } 1246 1236 1247 if (!flag_set['d'] 1248 && (flag_set['c'] || flag_set['w'] || flag_set['C'])) { 1237 if (!flag_set['d'] && (flag_set['c'] || flag_set['w'] || flag_set['C'])) { 1249 1238 if (g_kernel_version >= 2.6) { 1250 1239 tmp2 = popup_and_get_string("Device", "Please specify the device", bkpinfo->media_device); 1251 1240 if (tmp2 == NULL) { 1241 fatal_error("User opted to cancel."); 1242 } 1243 bkpinfo->media_device = tmp2; 1244 } else { 1245 bkpinfo->media_device = find_cdrw_device(); 1246 if (bkpinfo->media_device == NULL) { 1252 1247 retval++; 1253 log_to_screen("User opted to cancel."); 1254 } 1255 mr_free(tmp2); 1256 } else if (find_cdrw_device(bkpinfo->media_device)) { 1257 retval++; 1258 log_to_screen 1259 ("Tried and failed to find CD-R[W] drive automatically.\n"); 1260 } else { 1261 flag_set['d'] = TRUE; 1262 strncpy(flag_val['d'], bkpinfo->media_device, MAX_STR_LEN / 4); 1248 log_to_screen("Tried and failed to find CD-R[W] drive automatically.\n"); 1249 } else { 1250 flag_set['d'] = TRUE; 1251 strncpy(flag_val['d'], bkpinfo->media_device, MAX_STR_LEN / 4); 1252 } 1263 1253 } 1264 1254 } … … 1288 1278 1289 1279 if (i) { 1290 retval++;1291 1280 log_to_screen("Please specify a tempdir which I can write to. :)"); 1292 1281 fatal_error("I cannot write to the tempdir you specified."); … … 1467 1456 /*@ ints ** */ 1468 1457 int opt = 0; 1469 char *tmp = NULL;1470 1458 int i = 0; 1471 1459 int len;
Note:
See TracChangeset
for help on using the changeset viewer.