Changeset 1548 in MondoRescue
- Timestamp:
- Jul 24, 2007, 1:39:36 AM (18 years ago)
- Location:
- branches/stable/mondo/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/src/common/libmondo-devices.c
r1543 r1548 1930 1930 ("Exclude paths", 1931 1931 "Please enter paths which you do NOT want to backup. Separate them with spaces. NB: /tmp and /proc are always excluded. :-) Just hit 'Enter' if you want to do a full system backup.", 1932 bkpinfo->exclude_paths, MAX_STR_LEN)) {1932 bkpinfo->exclude_paths, (4*MAX_STR_LEN)-1)) { 1933 1933 log_to_screen("User has chosen not to backup the PC"); 1934 1934 finish(1); -
branches/stable/mondo/src/common/libmondo-filelist.c
r1543 r1548 1525 1525 1526 1526 malloc_string(sz_datefile); 1527 malloc_string(exclude_paths); 1527 if (!(exclude_paths = malloc(8*MAX_STR_LEN))) { 1528 fatal_error("Cannot malloc exclude_paths"); 1529 } 1528 1530 malloc_string(g_skeleton_filelist); 1529 1531 // The pathname to the skeleton filelist, used to give better progress reporting for mondo_makefilelist(). … … 1583 1585 mr_msg(2, "include_paths = '%s'", include_paths); 1584 1586 mr_msg(1, "Calculating filelist"); 1585 s printf(exclude_paths," %s %s %s %s %s %s . .. \1587 snprintf(exclude_paths, (size_t)8*MAX_STR_LEN," %s %s %s %s %s %s . .. \ 1586 1588 " MNT_CDROM " " MNT_FLOPPY " /media \ 1587 1589 /proc /sys /tmp /var/log/lastlog /root/images/mondo " MINDI_CACHE " " MONDO_CACHE, excp, call_program_and_get_last_line_of_output("locate /win386.swp 2> /dev/null"), call_program_and_get_last_line_of_output("locate /hiberfil.sys 2> /dev/null"), call_program_and_get_last_line_of_output("locate /pagefile.sys 2> /dev/null"), (tmpdir[0] == '/' && tmpdir[1] == '/') ? (tmpdir + 1) : tmpdir, (scratchdir[0] == '/' && scratchdir[1] == '/') ? (scratchdir + 1) : scratchdir); -
branches/stable/mondo/src/common/libmondo-fork.c
r1344 r1548 6 6 #include "mr_msg.h" 7 7 #include "mr_str.h" 8 #include "mr_gettext.h" 8 9 9 10 #include "mondostructures.h" -
branches/stable/mondo/src/common/libmondo-mountlist.c
r1440 r1548 17 17 #include "libmondo-string-EXT.h" 18 18 #include "newt-specific-EXT.h" 19 19 20 #include "mr_mem.h" 20 21 #include "mr_msg.h" 22 #include "mr_gettext.h" 21 23 22 24 /*@unused@*/ -
branches/stable/mondo/src/common/libmondo-stream.c
r1424 r1548 16 16 #include "mr_msg.h" 17 17 #include "mr_list.h" 18 #include "mr_gettext.h" 18 19 19 20 #include "mondostructures.h" … … 1352 1353 int write_backcatalog_to_tape(struct s_bkpinfo *bkpinfo) 1353 1354 { 1354 int i, last,res = 0;1355 int res = 0; 1355 1356 char *fname = NULL; 1356 1357 struct mr_list_elt *elt = NULL; -
branches/stable/mondo/src/mondoarchive/mondo-cli.c
r1529 r1548 577 577 mr_asprintf(&psz, list_of_NFS_mounts_only()); 578 578 if (bkpinfo->exclude_paths[0]) { 579 strncat(bkpinfo->exclude_paths, " ", MAX_STR_LEN);580 } 581 strncat(bkpinfo->exclude_paths, psz, MAX_STR_LEN);579 strncat(bkpinfo->exclude_paths, " ", 4*MAX_STR_LEN); 580 } 581 strncat(bkpinfo->exclude_paths, psz, 4*MAX_STR_LEN); 582 582 mr_free(psz); 583 583 mr_msg(3, "-N means we're now excluding %s", 584 584 bkpinfo->exclude_paths); 585 585 } 586 if (strlen(bkpinfo->exclude_paths) >= MAX_STR_LEN) {586 if (strlen(bkpinfo->exclude_paths) >= 4*MAX_STR_LEN) { 587 587 fatal_error 588 ("Your '-E' parameter is too long. Please use '-J'. (See manual.)");588 ("Your '-E' parameter is too long. Increase MAX_STR_LEN"); 589 589 } 590 590 if (flag_set['b']) { -
branches/stable/mondo/src/mondorestore/mondo-rstr-tools.c
r1500 r1548 1410 1410 mvaddstr_and_log_it(g_currentY, 1411 1411 0, 1412 _ 1413 ("Modifying fstab and grub.conf, and running GRUB... ")); 1412 ("Modifying fstab, mtab, device.map and grub.conf, and running GRUB... ")); 1414 1413 for (done = FALSE; !done;) { 1415 1414 popup_and_get_string(_("Boot device"), … … 1430 1429 done = TRUE; 1431 1430 } 1432 popup_and_OK(_("You will now edit fstab and grub.conf"));1431 popup_and_OK(_("You will now edit fstab, mtab, device.map and grub.conf")); 1433 1432 if (!g_text_mode) { 1434 1433 newtSuspend(); … … 1438 1437 mr_free(tmp); 1439 1438 1439 mr_asprintf(&tmp, "chroot %s %s /etc/mtab", MNT_RESTORING, editor); 1440 paranoid_system(tmp); 1441 mr_free(tmp); 1442 1440 1443 mr_asprintf(&tmp, "chroot %s %s /etc/grub.conf", MNT_RESTORING, editor); 1444 paranoid_system(tmp); 1445 mr_free(tmp); 1446 1447 mr_asprintf(&tmp, "chroot %s %s /boot/grub/device.map", MNT_RESTORING, editor); 1441 1448 paranoid_system(tmp); 1442 1449 mr_free(tmp); -
branches/stable/mondo/src/mondorestore/mondorestore.c
r1458 r1548 345 345 *END_ EXTRACT_CONFIG_FILE_FROM_RAMDISK * 346 346 **************************************************************************/ 347 348 static void clean_blkid(struct s_bkpinfo *bkpinfo) { 349 350 char *tmp1 = NULL; 351 352 /* Clean up blkid cache file if they exist */ 353 mr_asprintf(&tmp1,"%s/etc/blkid.tab",bkpinfo->restore_path); 354 (void)unlink(tmp1); 355 mr_free(tmp1); 356 mr_asprintf(&tmp1,"%s/etc/blkid.tab.old",bkpinfo->restore_path); 357 (void)unlink(tmp1); 358 mr_free(tmp1); 359 } 347 360 348 361 … … 586 599 } 587 600 601 clean_blkid(bkpinfo); 588 602 protect_against_braindead_sysadmins(); 589 603 retval += unmount_all_devices(mountlist); … … 839 853 boot_loader_installed = TRUE; 840 854 } 855 clean_blkid(bkpinfo); 841 856 protect_against_braindead_sysadmins(); 842 857 retval += unmount_all_devices(mountlist); -
branches/stable/mondo/src/restore-scripts/mondo/hack-fstab
r1039 r1548 3 3 # $Id$ 4 4 # 5 # Recreate /etc/fstab from first mountlist analysis 6 # and then complement wirh old fstab content. 5 7 6 8 LogIt() { … … 10 12 11 13 AddFancyParams() { 12 local incoming device mountpoint format size original_fstab_line 13 # echo "AddFancyParams '$1'" >> /dev/stderr 14 local incoming device mountpoint format size original_fstab_line label uuid 15 14 16 incoming=`echo "$1" | tr -s '\t' ' '` 15 17 [ "$incoming" = "" ] && return 16 18 device=`echo "$incoming" | cut -d' ' -f1` 17 [ "`echo "$device" | grep "/dev/"`" = "" ] && return18 19 mountpoint=`echo "$incoming" | cut -d' ' -f2` 19 20 format=`echo "$incoming" | cut -d' ' -f3` 20 21 size=`echo "$incoming" | cut -d' ' -f4` 21 # echo "'$device' '$mountpoint' '$format' '$size'" > /dev/stderr 22 label=`echo "$incoming" | cut -d' ' -f5` 23 uuid=`echo "$incoming" | cut -d' ' -f6` 22 24 original_fstab_line=`grep " $mountpoint " $old_fstab | grep -v "#" | tr -s ' ' ' '` 23 # echo "original_fstab_line = $original_fstab_line" >> /dev/stderr 24 if [ "`grep "LABEL=" $old_fstab`" != "" ] ; then 25 if [ "$format" = "ext2" ] || [ "$format" = "ext3" ] ; then 26 device="LABEL=$mountpoint" 25 if [ "$format" = "ext2" ] || [ "$format" = "ext3" ] ; then 26 if [ "`echo "$original_fstab_line" | grep "LABEL="`" != "" ] ; then 27 device="LABEL=$label" 28 fi 29 if [ "`echo "$original_fstab_line" | grep "UUID="`" != "" ] ; then 30 device="UUID=$uuid" 27 31 fi 28 32 fi 29 30 # LogIt "my_res = $my_res"31 33 32 34 echo -e -n "$device $mountpoint $format " 33 35 34 36 if [ "$original_fstab_line" != "" ] ; then 35 # echo $original_fstab_line | gawk '{i=index($0,$4); print substr($0,i);}' 36 echo "$original_fstab_line" | cut -d' ' -f4-19 | tr -s ' ' ' ' 37 echo "$original_fstab_line" | cut -d' ' -f4- | tr -s ' ' ' ' 37 38 else 38 39 echo -e "defaults 0 0" … … 43 44 ProcessFstab() { 44 45 local incoming dev mountlist_entry blanklines new_i 46 45 47 read incoming 46 48 blanklines=0 47 49 while [ "$blanklines" -lt "5" ] ; do 48 if [ "$incoming" = "" ] ; then 49 blanklines=$(($blanklines+1)) 50 read incoming 51 continue 52 fi 53 incoming=`echo "$incoming" | tr -s '\t' ' '` 54 # new_i=`HackIncomingIfLABELused "$incoming"` 55 # if [ ! "$new_i" ] ; then 56 if [ "`echo "$incoming" | grep -v "LABEL="`" ] ; then 57 dev=`echo "$incoming" | cut -d' ' -f1` 58 # echo "OK, $dev isn't a label" >> /dev/stderr 59 mountlist_entry=`grep "$dev " $old_mountlist` 60 # echo "MLE($dev) = '$mountlist_entry'" >> /dev/stderr 61 if [ "$mountlist_entry" = "" ] ; then 62 # echo "(PF) '$incoming'" >> /dev/stderr 63 echo "$incoming" 64 fi 65 # else 66 # echo "Skipping '$incoming'" >> /dev/stderr 67 fi 68 read incoming 50 if [ "$incoming" = "" ] ; then 51 blanklines=$(($blanklines+1)) 52 read incoming 53 continue 54 fi 55 incoming=`echo "$incoming" | tr -s '\t' ' '` 56 if [ "`echo "$incoming" | grep -vE "LABEL=|UUID="`" ] ; then 57 dev=`echo "$incoming" | cut -d' ' -f1` 58 mountlist_entry=`grep "$dev " $old_mountlist` 59 if [ "$mountlist_entry" = "" ] ; then 60 echo "$incoming" 61 fi 62 fi 63 read incoming 69 64 done 70 65 } … … 73 68 HackIncomingIfLABELused() { 74 69 local incoming col1 col2 col_rest orig out result 70 71 # Keep LABEL or UUID if originally there in fstab 75 72 result="" 76 73 incoming=`echo "$1" | tr -s '\t' ' '` 77 col1=`echo "$incoming" | cut - f1`78 col2=`echo "$incoming" | cut - f2`79 col_rest=`echo "$incoming" | cut - f3-19| tr -s ' ' ' '`80 orig="`grep " $col2 " $old_fstab | cut - f1`"81 if [ "`echo "$orig" | grep "LABEL="`" != "" ] ; then82 echo "orig = $orig" >> /dev/stderr83 echo -e "$orig $col2 $col_rest | tr -s ' ' ' '"74 col1=`echo "$incoming" | cut -d' ' -f1` 75 col2=`echo "$incoming" | cut -d' ' -f2` 76 col_rest=`echo "$incoming" | cut -d' ' -f3- | tr -s ' ' ' '` 77 orig="`grep " $col2 " $old_fstab | cut -d' ' -f1`" 78 if [ "`echo "$orig" | grep -E "LABEL=|UUID="`" != "" ] ; then 79 echo "orig = $orig" >> /dev/stderr 80 echo -e "$orig $col2 $col_rest" | tr -s ' ' ' ' 84 81 fi 85 82 } … … 93 90 ProcessMountlist() { 94 91 local incoming outstr res spc 92 95 93 read incoming 96 94 while [ "$incoming" != "" ] ; do 97 incoming=`echo "$incoming" | tr -s '\t' ' '` 98 # echo "(PM) incoming = '$incoming'" >> /dev/stderr 99 res=`HackIncomingIfLABELused "$incoming"` 100 if [ ! "$res" ] ; then 101 outstr=`AddFancyParams "$incoming"` 102 else 103 outstr=`AddFancyParams "$res"` 104 fi 105 spc="`echo "$outstr" | tr -s '\t' ' '`" 106 if [ "$spc" != "" ] && [ "$spc" != " " ] && [ "`echo "$spc" | grep "raid raid"`" = "" ] ; then 107 echo "$spc" 108 # echo "(PM) outgoing = '$outstr'" >> /dev/stderr 109 fi 110 read incoming 95 incoming=`echo "$incoming" | tr -s '\t' ' '` 96 res=`HackIncomingIfLABELused "$incoming"` 97 if [ ! "$res" ] ; then 98 outstr=`AddFancyParams "$incoming"` 99 else 100 outstr=`AddFancyParams "$res"` 101 fi 102 spc="`echo "$outstr" | tr -s '\t' ' '`" 103 if [ "$spc" != "" ] && [ "$spc" != " " ] && [ "`echo "$spc" | grep "raid raid"`" = "" ] ; then 104 echo "$spc" 105 fi 106 read incoming 111 107 done 112 108 }
Note:
See TracChangeset
for help on using the changeset viewer.