Changeset 1663 in MondoRescue for branches/stable/mondo/src/common/libmondo-devices.c
- Timestamp:
- Sep 27, 2007, 12:21:18 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/src/common/libmondo-devices.c
r1638 r1663 50 50 extern struct mr_ar_conf *mr_conf; 51 51 52 extern void setup_tmpdir(char *path); 53 52 54 static char g_cdrw_drive_is_here[MAX_STR_LEN / 4] = ""; 53 55 static char g_cdrom_drive_is_here[MAX_STR_LEN / 4] = ""; … … 63 65 extern t_bkptype g_backup_media_type; // set by main() 64 66 65 66 67 68 void set_g_cdrom_and_g_dvd_to_bkpinfo_value(struct s_bkpinfo *bkpinfo) 67 /* Reference to global bkpinfo */ 68 extern struct s_bkpinfo *bkpinfo; 69 70 71 72 73 void set_g_cdrom_and_g_dvd_to_bkpinfo_value() 69 74 { 70 75 strcpy(g_cdrom_drive_is_here, bkpinfo->media_device); // just in case … … 502 507 * @see mount_CDROM_here 503 508 */ 504 int find_and_mount_actual_cd( struct s_bkpinfo *bkpinfo,char *mountpoint)509 int find_and_mount_actual_cd(char *mountpoint) 505 510 { 506 511 /*@ buffers ***************************************************** */ … … 690 695 } 691 696 692 sprintf(mountpoint, " /tmp/cd.%d", (int) (random() % 32767));697 sprintf(mountpoint, "%s/cd.mnt", bkpinfo->tmpdir); 693 698 make_hole_for_dir(mountpoint); 694 699 … … 1321 1326 */ 1322 1327 void 1323 insist_on_this_cd_number( struct s_bkpinfo *bkpinfo,int cd_number_i_want)1328 insist_on_this_cd_number(int cd_number_i_want) 1324 1329 { 1325 1330 … … 1355 1360 run_program_and_log_output("umount " MNT_CDROM, 5); 1356 1361 } 1357 system("mkdir -p /tmp/isodir &> /dev/null"); 1362 sprintf(tmp, "mkdir -p %s/isodir &> /dev/null", bkpinfo->tmpdir); 1363 system(tmp); 1358 1364 mr_asprintf(&tmp, "%s/%s/%s-%d.iso", bkpinfo->isodir, 1359 1365 bkpinfo->nfs_remote_dir, bkpinfo->prefix, … … 1361 1367 if (!does_file_exist(tmp)) { 1362 1368 mr_free(tmp); 1363 mr_asprintf(&tmp, " /tmp/isodir/%s/%s-%d.iso",1369 mr_asprintf(&tmp, "%s/isodir/%s/%s-%d.iso", bkpinfo->tmpdir, 1364 1370 bkpinfo->nfs_remote_dir, bkpinfo->prefix, 1365 1371 cd_number_i_want); 1366 1372 if (does_file_exist(tmp)) { 1367 1373 mr_msg(1, 1368 "FIXME - hacking bkpinfo->isodir from '%s' to /tmp/isodir",1369 bkpinfo->isodir );1370 s trcpy(bkpinfo->isodir, "/tmp/isodir");1374 "FIXME - hacking bkpinfo->isodir from '%s' to %s/isodir", 1375 bkpinfo->isodir, bkpinfo->tmpdir); 1376 sprintf(bkpinfo->isodir, "%s/isodir", bkpinfo->tmpdir); 1371 1377 } 1372 1378 } … … 1377 1383 mr_free(tmp); 1378 1384 } 1379 if ((res = what_number_cd_is_this( bkpinfo)) != cd_number_i_want) {1385 if ((res = what_number_cd_is_this()) != cd_number_i_want) { 1380 1386 mr_msg(3, "Currently, we hold %d but we want %d", res, 1381 1387 cd_number_i_want); … … 1389 1395 mr_free(tmp); 1390 1396 1391 while (what_number_cd_is_this( bkpinfo) != cd_number_i_want) {1397 while (what_number_cd_is_this() != cd_number_i_want) { 1392 1398 sync(); 1393 1399 if (is_this_device_mounted(MNT_CDROM)) { … … 1432 1438 * @ingroup archiveGroup 1433 1439 */ 1434 int interactively_obtain_media_parameters_from_user(struct s_bkpinfo 1435 *bkpinfo, 1436 bool 1437 archiving_to_media) 1440 int interactively_obtain_media_parameters_from_user(bool archiving_to_media) 1438 1441 // archiving_to_media is TRUE if I'm being called by mondoarchive 1439 1442 // archiving_to_media is FALSE if I'm being called by mondorestore … … 1465 1468 bkptype_to_string(bkpinfo->backup_media_type)); 1466 1469 if (archiving_to_media) { 1467 sensibly_set_tmpdir_and_scratchdir( bkpinfo);1470 sensibly_set_tmpdir_and_scratchdir(); 1468 1471 } 1469 1472 bkpinfo->compression_level = … … 1566 1569 mr_msg(1, "bkpinfo->media_device = %s", bkpinfo->media_device); 1567 1570 mr_asprintf(&comment, 1568 _("Please specify your %s drive's /dev entry"), bkpinfo->backup_media_string);1571 _("Please specify your %s drive's /dev entry"), media_descriptor_string(bkpinfo->backup_media)); 1569 1572 mr_asprintf(&tmp,"/dev/cdrom"); 1570 1573 if (!popup_and_get_string … … 1731 1734 } 1732 1735 if (bkpinfo->disaster_recovery) { 1733 system("umount /tmp/isodir 2> /dev/null"); 1736 sprintf(command ,"umount %s/isodir 2> /dev/null", bkpinfo->tmpdir); 1737 system(command); 1734 1738 if (!popup_and_get_string 1735 1739 ("NFS share", "Which remote NFS share should I mount?", … … 1740 1744 } 1741 1745 if (!is_this_device_mounted(bkpinfo->nfs_mount)) { 1742 sprintf(bkpinfo->isodir, "/tmp/isodir.mondo.%d", 1743 (int) (random() % 32768)); 1746 sprintf(bkpinfo->isodir, "%s/nfsdir", bkpinfo->tmpdir); 1744 1747 mr_asprintf(&command, "mkdir -p %s", bkpinfo->isodir); 1745 1748 run_program_and_log_output(command, 5); … … 2070 2073 * @ingroup utilityGroup 2071 2074 */ 2072 void sensibly_set_tmpdir_and_scratchdir( struct s_bkpinfo *bkpinfo)2075 void sensibly_set_tmpdir_and_scratchdir() 2073 2076 { 2074 2077 char *tmp = NULL; … … 2083 2086 mr_asprintf(&tmp, 2084 2087 call_program_and_get_last_line_of_output 2085 (" df -m -P -t nonfs,msdosfs,ntfs,smbfs,smb,cifs,afs,ocfs,ocfs2,mvfs | tr -s '\t' ' ' | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));2088 ("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,smbfs,smb,cifs,afs,ocfs,ocfs2,mvfs | tr -s '\t' ' ' | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'")); 2086 2089 #else 2087 2090 mr_asprintf(&tmp, 2088 2091 call_program_and_get_last_line_of_output 2089 (" df -m -P -x nfs -x vfat -x ntfs -x smbfs -x smb -x cifs -x afs -x ocfs -x ocfs2 -x mvfs | sed 's/ /devdev/' | tr -s '\t' ' ' | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));2092 ("LANGUAGE=C df -m -P -x nfs -x vfat -x ntfs -x smbfs -x smb -x cifs -x afs -x ocfs -x ocfs2 -x mvfs | sed 's/ /devdev/' | tr -s '\t' ' ' | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'")); 2090 2093 #endif 2091 2094 … … 2098 2101 fatal_error("I couldn't figure out the tempdir!"); 2099 2102 } 2100 i = (int) (random() % 32768); 2101 sprintf(bkpinfo->tmpdir, "%s/tmp.mondo.%d", tmp, i); 2103 setup_tmpdir(tmp); 2102 2104 log_it("bkpinfo->tmpdir is being set to %s", bkpinfo->tmpdir); 2103 2105 2104 2106 sprintf(bkpinfo->scratchdir, "%s/mondo.scratch.%d", tmp, i); 2105 2107 log_it("bkpinfo->scratchdir is being set to %s", bkpinfo->scratchdir); 2106 2107 sprintf(g_erase_tmpdir_and_scratchdir, "rm -Rf %s %s", bkpinfo->tmpdir,2108 bkpinfo->scratchdir);2109 2108 2110 2109 mr_asprintf(&command, "rm -Rf %s/tmp.mondo.* %s/mondo.scratch.*", tmp, tmp); … … 2165 2164 * (and remain mounted after this function returns). 2166 2165 */ 2167 int what_number_cd_is_this( struct s_bkpinfo *bkpinfo)2166 int what_number_cd_is_this() 2168 2167 { 2169 2168 int cd_number = -1;
Note:
See TracChangeset
for help on using the changeset viewer.