Changeset 3154 in MondoRescue
- Timestamp:
- Jun 23, 2013, 12:34:33 AM (11 years ago)
- Location:
- branches/3.0
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.0/mindi/mindi
r3149 r3154 841 841 ### Sq-Mod End 842 842 ### 843 noof_lines=0844 843 # Get rid of duplicates, so that if a live kernel module also appears 845 844 # in $EXTRA_MODS that it won't get reported as "live module file not found" twice. 846 for module in `echo $module_list $EXTRA_MODS | tr ' ' '\n' | sort -u` ; do847 noof_lines=$(($noof_lines+1))848 done849 progress=0850 845 for module in `echo $module_list $EXTRA_MODS | tr ' ' '\n' | sort -u` ; do 851 846 r=`find /lib/modules/$kern -type f | grep "/${module}\..*o" | tail -n1` … … 860 855 fi 861 856 LogFile "INFO: module $module --> $r" 862 progress=$(($progress+1))863 LogProgress $progress $noof_lines864 857 done 865 858 find /lib/modules/$kern/modules.* -type f 2> /dev/null -
branches/3.0/mindi/rootfs/etc/init.d/rcS
r3153 r3154 52 52 umount -d /mnt/cdrom 2> /dev/null 53 53 mount / -o rw,remount > /dev/null 2> /dev/null 54 LogIt "Launching Shell"55 54 for i in `cat /proc/cmdline`; do 56 55 echo $i | grep -qi console= && console=`echo $i | cut -d= -f2` -
branches/3.0/mondo/configure.in
r3150 r3154 37 37 AC_ARG_ENABLE(static-mr, AS_HELP_STRING(--enable-static-mr,Link mondorestore statically), do_static_mr=$withval, do_static_mr= ) 38 38 AC_ARG_ENABLE(debug, AS_HELP_STRING(--enable-debug,Add debugging flags), CFLAGS="$CFLAGS -g", ) 39 AC_ARG_WITH(max-noof-media, AS_HELP_STRING(--with-max-noof-media=NUM,Compile for a certain maximum number of media (default 50)), max_noof_media=$withval, max_noof_media=50)40 39 AC_ARG_WITH(tape-block-size, AS_HELP_STRING(--with-tape-block-size=NUM,Set tape block size in kilobytes (default 131072)), exttape=${withval:=131072}, exttape=131072) 41 40 if test x$do_static_mr = xyes; then -
branches/3.0/mondo/src/common/libmondo-cli.c
r3150 r3154 39 39 40 40 extern void setup_tmpdir(char *path); 41 extern void setup_scratchdir(char *path); 41 42 void mr_make_devlist_from_pathlist(char *pathlist, char mode); 42 43 extern double g_kernel_version; … … 77 78 78 79 /*@ buffers *************** */ 79 char *tmp ;80 char *tmp = NULL; 80 81 char flag_val[128][MAX_STR_LEN]; 81 82 bool flag_set[128]; 82 83 83 tmp = malloc(9*MAX_STR_LEN);84 84 for (i = 0; i < 128; i++) { 85 85 flag_val[i][0] = '\0'; … … 93 93 retval += res; 94 94 } 95 /* 96 if (!retval) 97 { 98 */ 95 99 96 log_msg(3, "Switches:-"); 100 97 for (i = 0; i < 128; i++) { 101 98 if (flag_set[i]) { 102 sprintf(tmp, "-%c %s", i, flag_val[i]);99 mr_asprintf(&tmp, "-%c %s", i, flag_val[i]); 103 100 log_msg(3, tmp); 104 } 105 } 106 // } 107 /* Before erasing dirs go into a safe place */ 108 if (chdir("/tmp")) { 109 // FIXME 110 } 111 sprintf(tmp, "rm -Rf %s/tmp.mondo.*", bkpinfo->tmpdir); 112 paranoid_system(tmp); 113 sprintf(tmp, "rm -Rf %s/mondo.scratch.*", bkpinfo->scratchdir); 114 paranoid_system(tmp); 115 sprintf(bkpinfo->scratchdir + strlen(bkpinfo->scratchdir), 116 "/mondo.scratch.%ld", random() % 32767); 117 sprintf(tmp, "mkdir -p %s/tmpfs", bkpinfo->tmpdir); 118 paranoid_system(tmp); 119 sprintf(tmp, "mkdir -p %s", bkpinfo->scratchdir); 120 paranoid_system(tmp); 121 paranoid_free(tmp); 101 mr_free(tmp); 102 } 103 } 104 122 105 return (retval); 123 106 } 124 125 126 107 127 108 … … 135 116 int process_the_s_switch(char *value) 136 117 { 137 int j;138 char tmp[MAX_STR_LEN], *p, comment[MAX_STR_LEN];139 140 118 assert(bkpinfo != NULL); 141 119 assert(value != NULL); 142 120 143 121 bkpinfo->media_size = -1; /* dummy value */ 144 bkpinfo->media_size = friendly_sizestr_to_sizelong( p);122 bkpinfo->media_size = friendly_sizestr_to_sizelong(value); 145 123 log_msg(3, "media_size = %ld", bkpinfo->media_size); 146 124 if (bkpinfo->media_size <= 0) { 147 log_msg(1, "You gave media an invalid size %s\n", p);125 log_msg(1, "You gave media an invalid size %s\n", value); 148 126 return (-1); 149 127 } … … 802 780 803 781 if (flag_set['S']) { 804 /* Before changing remove old ones if any */ 805 if (bkpinfo->scratchdir) { 806 if (chdir("/tmp")) { 807 // FIXME 808 } 809 mr_asprintf(&tmp1, "rm -Rf %s", bkpinfo->scratchdir); 810 paranoid_system(tmp1); 811 mr_free(tmp1); 812 } 813 sprintf(bkpinfo->scratchdir, "%s/mondo.scratch.%ld", flag_val['S'], 814 random() % 32768); 782 setup_scratchdir(flag_val['S']); 783 sprintf(tmp, "touch %s/.foo.dat", bkpinfo->scratchdir); 784 if (run_program_and_log_output(tmp, 1)) { 785 retval++; 786 log_to_screen("Please specify a scratchdir which I can write to. :)"); 787 fatal_error("I cannot write to the scratchdir you specified."); 788 } 789 sprintf(tmp, "ln -sf %s/.foo.dat %s/.bar.dat", bkpinfo->scratchdir, bkpinfo->scratchdir); 790 if (run_program_and_log_output(tmp, 1)) { 791 retval++; 792 log_to_screen("Please don't specify a SAMBA or VFAT or NFS scratchdir."); 793 fatal_error("I cannot write to the scratchdir you specified."); 794 } 815 795 } 816 796 … … 820 800 if (run_program_and_log_output(tmp, 1)) { 821 801 retval++; 822 log_to_screen 823 ("Please specify a tempdir which I can write to. :)"); 802 log_to_screen("Please specify a tempdir which I can write to. :)"); 824 803 fatal_error("I cannot write to the tempdir you specified."); 825 804 } … … 827 806 if (run_program_and_log_output(tmp, 1)) { 828 807 retval++; 829 log_to_screen 830 ("Please don't specify a SAMBA or VFAT or NFS tmpdir."); 808 log_to_screen("Please don't specify a SAMBA or VFAT or NFS tmpdir."); 831 809 fatal_error("I cannot write to the tempdir you specified."); 832 810 } -
branches/3.0/mondo/src/common/libmondo-devices-EXT.h
r2713 r3154 48 48 extern char *list_of_NETFS_mounts_only(void); 49 49 50 extern void sensibly_set_tmpdir_and_scratchdir();51 52 53 50 extern bool set_dev_to_this_if_rx_OK(char *, char *); 54 51 -
branches/3.0/mondo/src/common/libmondo-devices.c
r3152 r3154 50 50 51 51 extern void setup_tmpdir(char *path); 52 extern void setup_scratchdir(char *path); 52 53 53 54 static char g_cdrw_drive_is_here[MAX_STR_LEN / 4] = ""; … … 2174 2175 { 2175 2176 char *tmp = NULL; 2177 char *sz = NULL; 2176 2178 char *tmpro = NULL; 2177 2179 char *tmp1 = NULL; … … 2210 2212 } 2211 2213 */ 2214 if (archiving_to_media) { 2215 setup_tmpdir(NULL); 2216 /* 2217 * Set the scratchdir to reside on the partition with the most free space. 2218 * Automatically excludes DOS, NTFS, SMB, and NFS filesystems. 2219 */ 2220 #ifdef __FreeBSD__ 2221 mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,ntfs-3g,vmhgfs,smbfs,smb,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -nr | awk '{print $NF;}' | while read x ; do test -w $x && echo $x && break ; done")); 2222 #else 2223 mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -x nfs -x nfs4 -x fuse.sshfs -x fuse -x vfat -x ntfs -x ntfs-3g -x vmhgfs -x smbfs -x smb -x cifs -x afs -x gfs -x ocfs -x ocfs2 -x mvfs -x nsspool -x nssvol -x iso9660 | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -nr | awk '{print $NF;}' | while read x ; do test -w $x && echo $x && break ; done")); 2224 #endif 2225 2226 if (tmp[0] != '/') { 2227 mr_asprintf(&sz, "%s", tmp); 2228 mr_free(tmp); 2229 mr_asprintf(&tmp, "/%s", sz); 2230 mr_free(sz); 2231 } 2232 setup_scratchdir(tmp); 2233 } 2212 2234 log_msg(3, "media type = %s", 2213 2235 bkptype_to_string(bkpinfo->backup_media_type)); 2214 if (archiving_to_media) {2215 sensibly_set_tmpdir_and_scratchdir();2216 }2217 2236 bkpinfo->cdrw_speed = (bkpinfo->backup_media_type == cdstream) ? 2 : 4; 2218 2237 bkpinfo->compression_level = … … 2774 2793 finish(1); 2775 2794 } 2795 /* if modified to another path */ 2796 if (strstr(bkpinfo->tmpdir,"mondo.tmp.") != NULL) { 2797 setup_tmpdir(bkpinfo->tmpdir); 2798 } 2776 2799 if (!popup_and_get_string 2777 2800 ("Scratch directory", … … 2780 2803 log_to_screen("User has chosen not to backup the PC"); 2781 2804 finish(1); 2805 } 2806 /* if modified to another path */ 2807 if (strstr(bkpinfo->scratchdir,"mondo.scratch.") != NULL) { 2808 setup_scratchdir(bkpinfo->scratchdir); 2782 2809 } 2783 2810 if (ask_me_yes_or_no("Do you want to backup extended attributes?")) { … … 2934 2961 paranoid_free(tmp); 2935 2962 } 2936 2937 2938 2939 2940 2941 2942 /**2943 * Set the tmpdir and scratchdir to reside on the partition with the most free space.2944 * Automatically excludes DOS, NTFS, SMB, and NFS filesystems.2945 * @param bkpinfo The backup information structure. @c bkpinfo->tmpdir and @c bkpinfo->scratchdir will be set.2946 * @ingroup utilityGroup2947 */2948 void sensibly_set_tmpdir_and_scratchdir()2949 {2950 char *tmp = NULL;2951 char *tmp1 = NULL;2952 char *command = NULL;2953 char *sz = NULL;2954 2955 assert(bkpinfo != NULL);2956 2957 #ifdef __FreeBSD__2958 mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,ntfs-3g,vmhgfs,smbfs,smb,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -nr | awk '{print $NF;}' | while read x ; do test -w $x && echo $x && break ; done"));2959 #else2960 mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -x nfs -x nfs4 -x fuse.sshfs -x fuse -x vfat -x ntfs -x ntfs-3g -x vmhgfs -x smbfs -x smb -x cifs -x afs -x gfs -x ocfs -x ocfs2 -x mvfs -x nsspool -x nssvol -x iso9660 | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -nr | awk '{print $NF;}' | while read x ; do test -w $x && echo $x && break ; done"));2961 #endif2962 2963 if (tmp[0] != '/') {2964 mr_asprintf(&sz, "%s", tmp);2965 paranoid_free(tmp);2966 mr_asprintf(&tmp, "/%s", sz);2967 mr_free(sz);2968 }2969 if (!tmp[0]) {2970 fatal_error("I couldn't figure out the tempdir!");2971 }2972 setup_tmpdir(tmp);2973 log_it("bkpinfo->tmpdir is being set to %s", bkpinfo->tmpdir);2974 2975 /* Before changing remove old ones if any */2976 if (bkpinfo->scratchdir) {2977 if (chdir("/tmp")) {2978 // FIXME2979 }2980 mr_asprintf(&tmp1, "rm -Rf %s", bkpinfo->scratchdir);2981 paranoid_system(tmp1);2982 mr_free(tmp1);2983 }2984 sprintf(bkpinfo->scratchdir, "%s/mondo.scratch.%d", tmp,2985 (int) (random() % 32768));2986 log_it("bkpinfo->scratchdir is being set to %s", bkpinfo->scratchdir);2987 2988 mr_asprintf(&command, "rm -Rf %s/tmp.mondo.* %s/mondo.scratch.*", tmp, tmp);2989 paranoid_free(tmp);2990 2991 paranoid_system(command);2992 mr_free(command);2993 }2994 2995 2996 2997 2963 2998 2964 -
branches/3.0/mondo/src/common/libmondo-devices.h
r2713 r3154 40 40 char *list_of_NETFS_mounts_only(); 41 41 42 void sensibly_set_tmpdir_and_scratchdir();43 44 45 42 bool set_dev_to_this_if_rx_OK(char *output, char *dev); 46 43 -
branches/3.0/mondo/src/common/libmondo-raid.c
r3060 r3154 1054 1054 raidlist->el[raidlist->entries].additional_vars.entries = v; 1055 1055 // skip ':' and status 1056 token = mr_strtok 1056 token = mr_strtok(string, delims, &lastpos); 1057 1057 if (token == NULL) { 1058 1058 // should not happen ! … … 1060 1060 } 1061 1061 mr_free(token); 1062 token = mr_strtok 1062 token = mr_strtok(string, delims, &lastpos); 1063 1063 if (token == NULL) { 1064 1064 // should not happen ! … … 1066 1066 } 1067 1067 if (!strcmp(token, "inactive")) { 1068 log_msg(1, "RAID device '%s' inactive.\n", 1069 raidlist->el[raidlist->entries].raid_device); 1068 log_msg(1, "RAID device '%s' inactive.\n", raidlist->el[raidlist->entries].raid_device); 1070 1069 mr_free(string); 1071 1070 mr_free(token); … … 1075 1074 1076 1075 // get RAID level 1077 token = mr_strtok 1076 token = mr_strtok(string, delims, &lastpos); 1078 1077 if (token == NULL) { 1079 1078 // should not happen ! -
branches/3.0/mondo/src/common/libmondo-tools.c
r3150 r3154 409 409 mr_free(tmp); 410 410 } 411 make_hole_for_dir(bkpinfo->scratchdir);412 411 if (bkpinfo->backup_media_type == iso) 413 412 make_hole_for_dir(bkpinfo->isodir); … … 744 743 char *p = NULL; 745 744 746 if ( (bkpinfo->tmpdir != NULL) && (strstr(bkpinfo->tmpdir,"mondo.tmp.") != NULL)) {745 if (bkpinfo->tmpdir != NULL) { 747 746 /* purging a potential old tmpdir */ 748 log_it("Purging old tmpdir %s", bkpinfo->tmpdir);749 747 if (chdir("/tmp")) { 750 748 // FIXME 751 749 } 752 mr_asprintf(&tmp,"rm -Rf %s",bkpinfo->tmpdir); 750 if (strstr(bkpinfo->tmpdir,"mondo.tmp.") != NULL) { 751 log_it("Purging old tmpdir %s", bkpinfo->tmpdir); 752 mr_asprintf(&tmp,"rm -Rf %s",bkpinfo->tmpdir); 753 } else { 754 log_it("Purging old tmpdir %s/mondo.tmp.*", bkpinfo->tmpdir); 755 mr_asprintf(&tmp,"rm -Rf %s/mondo.tmp.*",bkpinfo->tmpdir); 756 } 753 757 paranoid_system(tmp); 754 paranoid_free(tmp); 755 } 756 757 /* Always take in account env first */ 758 if (getenv("TMPDIR")) { 758 mr_free(tmp); 759 } 760 761 /* Always take in account arg first, then env, then default */ 762 if (path != NULL) { 763 mr_asprintf(&tmp, "%s/mondo.tmp.XXXXXX", path); 764 } else if (getenv("TMPDIR")) { 759 765 mr_asprintf(&tmp, "%s/mondo.tmp.XXXXXX", getenv("TMPDIR")); 760 } else if (getenv("TMP")) { 761 mr_asprintf(&tmp, "%s/mondo.tmp.XXXXXX", getenv("TMP")); 762 } else if (path != NULL) { 763 mr_asprintf(&tmp, "%s/mondo.tmp.XXXXXX", path); 766 } else if (getenv("MRTMP")) { 767 mr_asprintf(&tmp, "%s/mondo.tmp.XXXXXX", getenv("MRTMP")); 764 768 } else { 765 769 mr_asprintf(&tmp, "/tmp/mondo.tmp.XXXXXX"); … … 772 776 strcpy(bkpinfo->tmpdir,p); 773 777 paranoid_free(tmp); 778 779 mr_asprintf(&tmp, "mkdir -p %s/tmpfs", bkpinfo->tmpdir); 780 paranoid_system(tmp); 781 mr_free(tmp); 782 } 783 784 void setup_scratchdir(char *path) { 785 786 char *tmp = NULL; 787 char *p = NULL; 788 789 if (bkpinfo->scratchdir != NULL) { 790 /* purging a potential old scratchdir */ 791 if (chdir("/tmp")) { 792 // FIXME 793 } 794 if (strstr(bkpinfo->scratchdir,"mondo.scratch.") != NULL) { 795 log_it("Purging old scratchdir %s", bkpinfo->scratchdir); 796 mr_asprintf(&tmp,"rm -Rf %s",bkpinfo->scratchdir); 797 } else { 798 log_it("Purging old scratchdir %s/mondo.scratch.*", bkpinfo->scratchdir); 799 mr_asprintf(&tmp,"rm -Rf %s/mondo.scratch.*",bkpinfo->scratchdir); 800 } 801 paranoid_system(tmp); 802 mr_free(tmp); 803 } 804 805 /* Always take in account arg first, then env, then default */ 806 if (path != NULL) { 807 mr_asprintf(&tmp, "%s/mondo.scratch.XXXXXX", path); 808 } else if (getenv("MRSCRATCH")) { 809 mr_asprintf(&tmp, "%s/mondo.scratch.XXXXXX", getenv("MRSCRATCH")); 810 } else { 811 mr_asprintf(&tmp, "/tmp/mondo.scratch.XXXXXX"); 812 } 813 p = mkdtemp(tmp); 814 if (p == NULL) { 815 log_it("Failed to create global scratch directory %s for Mondo.",tmp); 816 finish(-1); 817 } 818 strcpy(bkpinfo->scratchdir,p); 819 paranoid_free(tmp); 820 821 mr_asprintf(&tmp, "mkdir -p %s", bkpinfo->scratchdir); 822 paranoid_system(tmp); 823 mr_free(tmp); 774 824 } 775 825 … … 811 861 } 812 862 strcpy(bkpinfo->prefix, STD_PREFIX); 813 sensibly_set_tmpdir_and_scratchdir(); 863 setup_tmpdir(NULL); 864 setup_scratchdir(NULL); 814 865 815 866 bkpinfo->optimal_set_size = 0; -
branches/3.0/mondo/src/common/newt-specific.c
r3141 r3154 356 356 paranoid_system("killall mindi 2> /dev/null"); 357 357 kill_anything_like_this("/mondo/do-not"); 358 kill_anything_like_this(" tmp.mondo");358 kill_anything_like_this("mondo.tmp"); 359 359 kill_anything_like_this("ntfsclone"); 360 360 sync();
Note:
See TracChangeset
for help on using the changeset viewer.