Changeset 99 in MondoRescue


Ignore:
Timestamp:
Nov 5, 2005, 12:51:05 AM (18 years ago)
Author:
bcornec
Message:

Apply patch from Andree Leidenfrost <aleidenf_AT_bigpond.net.au>
(-r72:75 of trunk) for :
+ correcting NFS handling in interactive mode
+ growisofs and sudo pb

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  
    11/* libmondo-archive.c
    2    $Id: libmondo-archive.c,v 1.19 2004/06/21 20:20:36 hugo Exp $
     2   $Id$
    33
    44subroutines to handle the archiving of files
     
    220220
    221221/*@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$";
    223223
    224224/* *************************** external global vars ******************/
     
    12811281    }
    12821282
    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);
    12841285  paranoid_system (command);
    12851286  wipe_archives (bkpinfo->scratchdir);
  • branches/2.04_berlios/mondo/mondo/common/libmondo-devices.c

    r85 r99  
    260260extern struct s_bkpinfo *g_bkpinfo_DONTUSETHIS;
    261261extern char *g_erase_tmpdir_and_scratchdir;
     262extern char *g_selfmounted_isodir;
    262263
    263264static char g_cdrw_drive_is_here[MAX_STR_LEN/4]="";
     
    17861787  char *command;
    17871788  char *comment;
     1789  char *prompt;
    17881790  int i;
    17891791  FILE*fin;
     
    17931795  malloc_string(command);
    17941796  malloc_string(comment);
     1797  malloc_string(prompt);
    17951798  assert(bkpinfo!=NULL);
    17961799  sz_size[0] = '\0';
     
    20022005                  }
    20032006              }
    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);
    20052013            strcpy(bkpinfo->isodir, call_program_and_get_last_line_of_output(command));
    20062014      }
     
    20162024        if (!is_this_device_mounted(bkpinfo->nfs_mount))
    20172025          {
    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);
    20222033          }
    20232034    if (!is_this_device_mounted(bkpinfo->nfs_mount))
     
    20332044          }
    20342045        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
    20352066    for(i=0; i<=MAX_NOOF_MEDIA; i++) { bkpinfo->media_size[i] = 650; }
    20362067        log_msg(3, "Just set nfs_remote_dir to %s", bkpinfo->nfs_remote_dir);
     
    21812212  paranoid_free(command);
    21822213  paranoid_free(comment);
     2214  paranoid_free(prompt);
    21832215  return(0);
    21842216}
  • branches/2.04_berlios/mondo/mondo/common/libmondo-tools.c

    r30 r99  
    11/* libmondo-tools.c                                  misc tools
    2    $Id: libmondo-tools.c,v 1.14 2004/06/19 01:36:07 hugo Exp $
     2   $Id$
    33.
    44
     
    186186
    187187/*@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$";
    189189
    190190extern int g_tape_buffer_size_MB;
     
    867867      }
    868868      }
     869      store_nfs_config (bkpinfo);
    869870  }
    870871
  • branches/2.04_berlios/mondo/mondo/common/newt-specific.c

    r30 r99  
    11/* newt-specific.c
    2    $Id: newt-specific.c,v 1.8 2004/06/10 17:13:33 hugo Exp $
     2   $Id$
    33
    44  subroutines which do display-type things
     
    122122
    123123/*@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$";
    125125
    126126extern pid_t g_mastermind_pid;
     
    188188bool g_called_by_xmondo=FALSE; ///< @bug Unneeded w/current XMondo.
    189189char *g_erase_tmpdir_and_scratchdir; ///< The command to run to erase the tmpdir and scratchdir at the end of Mondo.
     190char *g_selfmounted_isodir; ///< Holds the NFS mountpoint if mounted via mondoarchive.
    190191
    191192/* @} - end of globalGroup */
     
    363364  char fatalstr[MAX_NEWT_COMMENT_LEN] = "-------FATAL ERROR---------";
    364365  char *tmp;
     366  char *command;
    365367  static bool already_exiting=FALSE;
    366368  int i;
     
    368370    /*@ end vars *****************************************************/
    369371
     372  malloc_string(command);
    370373  tmp = malloc(MAX_NEWT_COMMENT_LEN);
    371374  set_signals(FALSE); // link to external func
     
    419422    { run_program_and_log_output(g_erase_tmpdir_and_scratchdir, 5); }
    420423
     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
    421431  if (!g_text_mode)
    422432    {
     
    454464  if (!g_main_pid) { log_msg(3, "FYI - g_main_pid is blank"); }
    455465  paranoid_free(tmp);
     466  paranoid_free(command);
    456467  finish (254);
    457468}
     
    468479finish (int signal)
    469480{
     481        char *command;
     482        malloc_string(command);
    470483
    471484  /*  if (signal==0) { popup_and_OK("Please press <enter> to quit."); } */
     
    481494      run_program_and_log_output(g_erase_tmpdir_and_scratchdir, 1);
    482495    }
     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    }
    483502   
    484503//  iamhere("foo");
Note: See TracChangeset for help on using the changeset viewer.