Changeset 99 in MondoRescue
- Timestamp:
- Nov 5, 2005, 12:51:05 AM (20 years ago)
- Location:
- branches/2.04_berlios/mondo/mondo/common
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.04_berlios/mondo/mondo/common/libmondo-archive.c
r30 r99 1 1 /* libmondo-archive.c 2 $Id : libmondo-archive.c,v 1.19 2004/06/21 20:20:36 hugo Exp$2 $Id$ 3 3 4 4 subroutines to handle the archiving of files … … 220 220 221 221 /*@unused@*/ 222 //static char cvsid[] = "$Id : libmondo-archive.c,v 1.19 2004/06/21 20:20:36 hugo Exp$";222 //static char cvsid[] = "$Id$"; 223 223 224 224 /* *************************** external global vars ******************/ … … 1281 1281 } 1282 1282 1283 sprintf (command, "rm -f %s/%s-[1-9]*.iso", bkpinfo->prefix, bkpinfo->isodir); 1283 sprintf (command, "rm -f %s/%s/%s-[1-9]*.iso", bkpinfo->isodir, 1284 bkpinfo->nfs_remote_dir, bkpinfo->prefix); 1284 1285 paranoid_system (command); 1285 1286 wipe_archives (bkpinfo->scratchdir); -
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 } -
branches/2.04_berlios/mondo/mondo/common/libmondo-tools.c
r30 r99 1 1 /* libmondo-tools.c misc tools 2 $Id : libmondo-tools.c,v 1.14 2004/06/19 01:36:07 hugo Exp$2 $Id$ 3 3 . 4 4 … … 186 186 187 187 /*@unused@*/ 188 //static char cvsid[] = "$Id : libmondo-tools.c,v 1.14 2004/06/19 01:36:07 hugo Exp$";188 //static char cvsid[] = "$Id$"; 189 189 190 190 extern int g_tape_buffer_size_MB; … … 867 867 } 868 868 } 869 store_nfs_config (bkpinfo); 869 870 } 870 871 -
branches/2.04_berlios/mondo/mondo/common/newt-specific.c
r30 r99 1 1 /* newt-specific.c 2 $Id : newt-specific.c,v 1.8 2004/06/10 17:13:33 hugo Exp$2 $Id$ 3 3 4 4 subroutines which do display-type things … … 122 122 123 123 /*@unused@*/ 124 //static char cvsid[] = "$Id : newt-specific.c,v 1.8 2004/06/10 17:13:33 hugo Exp$";124 //static char cvsid[] = "$Id$"; 125 125 126 126 extern pid_t g_mastermind_pid; … … 188 188 bool g_called_by_xmondo=FALSE; ///< @bug Unneeded w/current XMondo. 189 189 char *g_erase_tmpdir_and_scratchdir; ///< The command to run to erase the tmpdir and scratchdir at the end of Mondo. 190 char *g_selfmounted_isodir; ///< Holds the NFS mountpoint if mounted via mondoarchive. 190 191 191 192 /* @} - end of globalGroup */ … … 363 364 char fatalstr[MAX_NEWT_COMMENT_LEN] = "-------FATAL ERROR---------"; 364 365 char *tmp; 366 char *command; 365 367 static bool already_exiting=FALSE; 366 368 int i; … … 368 370 /*@ end vars *****************************************************/ 369 371 372 malloc_string(command); 370 373 tmp = malloc(MAX_NEWT_COMMENT_LEN); 371 374 set_signals(FALSE); // link to external func … … 419 422 { run_program_and_log_output(g_erase_tmpdir_and_scratchdir, 5); } 420 423 424 if (g_selfmounted_isodir) { 425 sprintf(command, "umount %s", g_selfmounted_isodir); 426 run_program_and_log_output(command, 5); 427 sprintf(command, "rmdir %s", g_selfmounted_isodir); 428 run_program_and_log_output(command, 5); 429 } 430 421 431 if (!g_text_mode) 422 432 { … … 454 464 if (!g_main_pid) { log_msg(3, "FYI - g_main_pid is blank"); } 455 465 paranoid_free(tmp); 466 paranoid_free(command); 456 467 finish (254); 457 468 } … … 468 479 finish (int signal) 469 480 { 481 char *command; 482 malloc_string(command); 470 483 471 484 /* if (signal==0) { popup_and_OK("Please press <enter> to quit."); } */ … … 481 494 run_program_and_log_output(g_erase_tmpdir_and_scratchdir, 1); 482 495 } 496 if (g_selfmounted_isodir) { 497 sprintf(command, "umount %s", g_selfmounted_isodir); 498 run_program_and_log_output(command, 1); 499 sprintf(command, "rmdir %s", g_selfmounted_isodir); 500 run_program_and_log_output(command, 1); 501 } 483 502 484 503 // iamhere("foo");
Note:
See TracChangeset
for help on using the changeset viewer.