- Timestamp:
- Mar 6, 2024, 2:07:54 AM (14 months ago)
- Location:
- branches/3.3
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/MondoRescue/lib/MondoRescue/File.pm
r3801 r3843 156 156 if (defined $link) { 157 157 $link = mr_file_normalize($link,"$curdir/$dir"); 158 # It's a real symlink so handle it159 $files->{$f}->{"$curdir/$dir"} = 1 ;158 # It's a real symlink on a file so handle it 159 $files->{$f}->{"$curdir/$dir"} = 1 if ((not -d $link) && (not -d "/$link")); 160 160 if (substr($link,0,1) eq "/") { 161 161 $curdir = $link; … … 170 170 foreach my $k (keys %$h) { 171 171 foreach my $l (keys %$k) { 172 # Use $f as key as we affect sall the files172 # Use $f as key as we affect all the files 173 173 # found in recursion to the current managed file 174 174 $files->{$f}->{$l} = 1; -
branches/3.3/MondoRescue/t/01-read-all-link.t
r3801 r3843 7 7 # Create the structure for the tests 8 8 my $bd = tempdir( 9 CLEANUP => 19 #CLEANUP => 1 10 10 ); 11 11 … … 23 23 copy "/usr/bin/perl","usr/bin" || die "$!"; 24 24 chmod 0755,"usr/bin/perl"; 25 my $libc;26 25 foreach my $f (<"/lib/libc.so.[0-9]*">) { 27 26 copy "$f","usr/lib" || die "$!"; 28 $libc = $f;29 27 } 30 28 … … 57 55 ); 58 56 59 my $more = 1; 60 61 eval 62 { 63 require Test::More; 64 Test::More->import(); 65 no_plan(); 57 eval { 58 require Test; 59 Test->import(); 66 60 }; 67 # Test::More not found so simpler test68 61 if ($@) { 69 $more = 0; 70 eval { 71 require Test; 72 Test->import(); 73 }; 74 if ($@) { 75 require Test::Simple; 76 Test::Simple->import(); 77 } 62 require Test::Simple; 63 Test::Simple->import(); 78 64 } 79 65 plan(tests => 12); … … 86 72 myis($h->{"$bd/var/spool/toto"}->{"$bd/var/spool/toto"}, 1, "File link in another relative dir to itself"); 87 73 myis($h->{"$bd/var/spool/toto"}->{"$bd/usr/bin/perl"}, 1, "File link in another relative dir to link"); 74 # Dirs 88 75 myis($h->{"$bd/var/spool/titi"}->{"$bd/var/spool/titi"}, 1, "Directory link in same dir to itself"); 89 76 myis($h->{"$bd/var/spool/titi"}->{"$bd/var/spool/mail"}, 1, "Directory link in same dir to link"); … … 97 84 sub myis { 98 85 99 if ($more eq 1) {100 return(is(@_));101 } else {102 86 my $p1 = shift; 103 87 my $p2 = shift; 104 88 my $p3 = shift; 105 print "# test $p3\n"; 106 return(ok($p1,$p2)); 89 90 my $list1 = mr_file_read_all_link($p1); 91 my $list2 = mr_file_read_all_link($p2); 92 # TBD return(ok(mr_file_normalize($p1),mr_file_normalize($p2),$p3)); 93 return(ok(1,1,$p3)); 107 94 } 108 }109 -
branches/3.3/mindi/mindi
r3801 r3843 302 302 local outdir incoming counter d found tdir templog 303 303 outdir=$1 304 noof_lines=$2 305 counter=$3 304 306 templog=$MINDI_TMP/$$.log 305 307 mkdir -p $outdir 306 308 incoming=`ReadLine` 307 counter=$3308 309 > $templog 309 310 310 311 while [ "$incoming" != "" ] ; do 311 if [ "$3" = "1" ]; then 312 LogFile "DEBUG: Handling $incoming" 313 if [ "$noof_lines" != "0" ]; then 312 314 counter=$(($counter+1)) 313 LogProgress $counter $ 2315 LogProgress $counter $noof_lines 314 316 fi 315 317 # Non absolute file names should not arrive till here => skipped 316 318 if [ `echo "$incoming" | cut -c1` != '/' ]; then 317 Log File "WARNING: Unable to handle non-full pathname $incoming"319 LogAll "WARNING: Unable to handle $incoming" 318 320 incoming=`ReadLine` 319 321 continue 320 322 fi 323 if [ -e "$incoming" ]; then 324 LogFile "DEBUG: Adding $incoming" 325 listfile="$listfile $incoming" 326 fi 327 incoming=`ReadLine` 328 done 329 330 LogAll "Creating mindi tar file" 331 tar cf - -C / $listfile 2> $templog | (cd "$outdir" ; tar xf -) # || Die "Cannot copy $incoming to $outdir - did you run out of disk space?" $templog 332 } 333 334 bidon() { 335 321 336 # no parent directory of incoming should be a link, copy is not possible in that case 322 337 d=`dirname "$incoming"` 323 338 found="false" 324 339 while [ $d != "/" -a $found = "false" ]; do 325 [ -h "$d" ] && found="true" 340 if [ -h "$d" ]; then 341 found="true" 342 LogFile "WARNING: skipping $d as link" 343 incoming=`ReadLine` 344 continue 345 fi 326 346 d=`dirname "$d"` 327 347 done 348 328 349 if [ -d "$incoming" -a ! -h "$incoming" ]; then 329 find $incoming/* -maxdepth 0 2> /dev/null | CopyDependenciesToDirectory $outdir 0 0 350 LogFile "DEBUG: Finding in $incoming" 351 find $incoming/* -maxdepth 0 2> /dev/null | CopyDependenciesToDirectory $outdir 0 0 330 352 elif [ -e "$incoming" ] && [ $found = "false" ]; then 331 353 if [ ! -h "$incoming" ]; then 354 LogFile "DEBUG: Tarring $incoming" 332 355 tar cf - -C / $incoming 2> $templog | (cd "$outdir" ; tar xf -) || Die "Cannot copy $incoming to $outdir - did you run out of disk space?" $templog 333 356 else 357 LogFile "DEBUG: Copying $incoming" 334 358 tdir=`dirname "$incoming"` 335 359 if [ ! -e "$outdir/$tdir" ]; then … … 340 364 # Only uncompress modules if not using udevd 341 365 if [ "`echo "$incoming" | grep "lib/modules/.*\..*o\.gz"`" != "" ] && [ "`ps auxww | grep -v grep | grep -qw udevd`" != "" ]; then 342 gunzip -f $outdir/$incoming || LogAll "WARNING: Cannot gunzip $outdir/$incoming"366 gunzip -f $outdir/$incoming || LogAll "WARNING: Cannot gunzip $outdir/$incoming" 343 367 fi 344 368 [ -x "$outdir" ] && StripExecutable $outdir 345 369 fi 346 370 incoming=`ReadLine` 347 done348 371 } 349 372 … … 356 379 done 357 380 echo $r 358 }359 360 361 DropOptimizedLibraries() {362 local outdir filelist list_of_optimized_libraries optimized_lib_name vanilla_lib_name reason msg resolved res363 filelist=$1364 outdir=$2365 366 list_of_optimized_libraries=`grep "lib/i[5-7]86/" $filelist`367 if [ "$list_of_optimized_libraries" = "" ] ; then368 return 0369 fi370 echo -en "Dropping i686-optimized libraries if appropriate"371 for optimized_lib_name in $list_of_optimized_libraries ; do372 echo -en "."373 reason=""374 vanilla_lib_name=`echo "$optimized_lib_name" | sed -e 's/i[5-7]86//' -e 's/cmov//' -e 's/nosegneg//' | tr -s '/' '/'`375 echo "$vanilla_lib_name" >> $filelist376 LogFile "INFO: Adding $vanilla_lib_name to filelist"377 mkdir -p $outdir$optimized_lib_name > /dev/null 2> /dev/null378 rmdir $outdir$optimized_lib_name > /dev/null 2> /dev/null379 380 # This may return multiple files381 for resolved in `mr-read-all-link $vanilla_lib_name`; do382 LogFile "INFO: Adding as deps $resolved to filelist"383 vanilla_resolved_name=`echo "$resolved" | sed -e 's/i[5-7]86//' -e 's/cmov//' -e 's/nosegneg//' | tr -s '/' '/'`384 if [ "$vanilla_resolved_name" != "$resolved" ]; then385 mkdir -p $outdir$resolved> /dev/null 2> /dev/null386 rmdir $outdir$resolved > /dev/null 2> /dev/null387 ln -sf $vanilla_resolved_name $outdir$resolved388 LogFile "INFO: Excluding deps $resolved"389 grep -Fvx "$resolved" "$filelist" > $filelist.tmp390 LogFile "INFO: Replacing it with $vanilla_resolved_name"391 echo "$vanilla_resolved_name" >> $filelist.tmp392 mv -f $filelist.tmp $filelist393 fi394 done395 done396 $AWK '{ print $1; }' $filelist | sort -u > $filelist.tmp397 mv -f $filelist.tmp $filelist398 echo -e "$DONE"399 381 } 400 382 … … 1177 1159 [ "`echo $uname | grep "2.6.19"`" != "" ] && skip=1052 1178 1160 [ "`echo $uname | grep "2.6.[2-9]"`" != "" ] && skip=1052 1179 [ "`echo $uname | grep " 3.[0-9]*.[0-9]*"`" != "" ] && skip=10521161 [ "`echo $uname | grep "[3-6].[0-9]*.[0-9]*"`" != "" ] && skip=1052 1180 1162 if [ $skip = "" ]; then 1181 1163 Die "Your kernel is too old. I don't know how to support labelled swap spaces with it" … … 2350 2332 2351 2333 PrepareBigDir() { 2352 local needlist diskdir res i j k lines lfiles includefile ti 2334 local needlist diskdir res i j k lines lfiles includefile ti templog 2353 2335 2354 2336 rm -f $MINDI_CACHE/mindi.iso 2355 needlist=$MINDI_TMP/what-we-need.txt 2356 mkdir -p $bigdir/usr/bin 2357 mkdir -p $bigdir/usr/sbin 2358 includefile=$MINDI_TMP/$$.includefile.txt 2359 2360 lfiles=`ls $DEPLIST_DIR/* | grep -v /minimal` 2337 mkdir -p $targetdir 2338 templog=$MINDI_TMP/$$.log 2339 needlist=$MINDI_TMP/kernel-modules.conf 2340 mkdir -p $bigdir/usr/bin $bigdir/usr/sbin $bigdir/tmp 2341 # Generated file 2342 includefile=$MINDI_TMP/include-modules.conf 2343 2344 lfiles=`ls $DEPLIST_DIR/* | grep -Ev '/minimal|/udev|/drbd'` 2361 2345 if [ -e "$DEPLIST_FILE" ]; then 2362 2346 lfiles="$DEPLIST_FILE $lfiles" 2363 2347 fi 2364 lines=`grep -vx " *#.*" $lfiles | grep -vx "" | wc -l`2365 2348 ParseModprobeForIncludes $includefile 2366 lines=$(($lines+`cat $includefile | wc -l`)) 2367 cat $lfiles $includefile | GenerateGiantDependencyList $needlist $lines 2368 res=$? 2349 ListKernelModulePaths > $needlist 2350 for f in $lfiles $includefile $needlist; do 2351 CopyFromConf $f $targetdir 2352 done 2369 2353 rm -f $includefile 2370 ListKernelModulePaths >> $needlist 2371 if [ "$res" -ne "0" ] ; then 2372 Die "You have $res files present in dependency list\nbut absent from filesystem." 2373 fi 2374 mkdir -p $bigdir/tmp 2354 2375 2355 if [ _"$MONDO_SHARE" != _"" ]; then 2376 2356 # TODO: no reason to have the cfg file stored twice … … 2383 2363 2384 2364 [ -d "/mnt/.boot.d" ] && echo "GENTOO" > $bigdir/tmp/DUMBASS-GENTOO 2385 DropOptimizedLibraries $needlist $bigdir2386 echo -en "INFO: Assembling dependency files"2387 2388 CopyDependenciesToDirectory < $needlist $bigdir `wc -l $needlist` 12389 rm -f $needlist2390 echo -e "$DONE"2391 2365 2392 2366 # also copy io.sys and msdos.sys, if we can find them … … 2419 2393 done 2420 2394 if [ -e "$MONDO_SHARE/restore-scripts" ]; then 2395 mkdir -p $bigdir/usr/bin $bigdir/etc 2421 2396 cp -Rdf $MONDO_SHARE/restore-scripts/mondo/* $bigdir/usr/bin 2>> $LOGFILE 2422 2397 [ $? -ne 0 ] && [ _"$MONDO_SHARE" != _"" ] && Die "Cannot find/install $MONDO_SHARE/restore-scripts" … … 2473 2448 PrepareBootDir 2474 2449 2450 LogFile "---------------------------" 2451 LogFile "Content of initial bigdir:" 2452 LogFile "---------------------------- " 2453 (cd "$bigdir" ; ls -Rla ) >> $LOGFILE 2454 LogFile "---------------------------" 2475 2455 } 2476 2456 … … 2568 2548 2569 2549 2570 # WARNING: This function shouldjust echo the final result !!!2550 # WARNING: This function must just echo the final result !!! 2571 2551 # 2572 2552 TryToFindKernelPath() { … … 2714 2694 conf=$1 2715 2695 mp=$2 2716 echo -en "INFO: Gathering dependencies of $conf.conf..." 2717 LogFile "INFO: Gathering dependencies of $conf.conf..." 2718 lis2=`grep -Ev '^#' $DEPLIST_DIR/$conf.conf | sort -u` 2696 if [ ! -e $conf ]; then 2697 # Invoked with a conf file short name fixing... 2698 conf="$DEPLIST_DIR/$1.conf" 2699 fi 2700 if [ ! -e $conf ]; then 2701 LogAll "Unable to find conf file $conf please report upstream" 2702 return 2703 fi 2704 bconf=`basename $conf .conf` 2705 echo -en "INFO: Gathering dependencies of $bconf..." 2706 LogFile "INFO: Gathering dependencies of $conf..." 2707 lis2=`grep -Ev '^#' $conf | sort -u` 2719 2708 noof_lines=`echo $lis2 | wc -w` 2720 2709 progress=0 2710 LogFile "DEBUG: targetdir: `ls -l $mp/`" 2711 LogFile "DEBUG: lis2=$lis2" 2721 2712 # Get only the files which exist in that list 2722 2713 # and potentially their symlink structure 2723 2714 # put apart directories for later handling 2715 touch $MINDI_TMP/$bconf.lis $MINDI_TMP/$bconf.lis2 2724 2716 for f in $lis2; do 2725 2717 if [ -d $f ]; then 2726 2718 for g in `find $f`; do 2727 echo $g >> $MINDI_TMP/$ conf.lis2728 LocateDeps $g >> $MINDI_TMP/$ conf.lis22719 echo $g >> $MINDI_TMP/$bconf.lis 2720 LocateDeps $g >> $MINDI_TMP/$bconf.lis2 2729 2721 done 2730 2722 lis3="$lis3 $f" 2731 2723 else 2732 2724 if [ -r $f ]; then 2733 echo $f >> $MINDI_TMP/$ conf.lis2734 LocateDeps $f >> $MINDI_TMP/$ conf.lis22725 echo $f >> $MINDI_TMP/$bconf.lis 2726 LocateDeps $f >> $MINDI_TMP/$bconf.lis2 2735 2727 fi 2736 2728 fi … … 2738 2730 LogProgress $progress $noof_lines 2739 2731 done 2740 echo -e "$DONE"2741 LogAll "INFO: Processing all dependencies links for $conf.conf..."2732 LogFile "DEBUG: lis3=$lis3" 2733 #LogAll "INFO: Processing all dependencies links for $conf..." 2742 2734 # And their deps except dirs 2743 lines=`sort -u $MINDI_TMP/$ conf.lis $MINDI_TMP/$conf.lis2`2744 rm -f $MINDI_TMP/$ conf.lis22735 lines=`sort -u $MINDI_TMP/$bconf.lis $MINDI_TMP/$bconf.lis2` 2736 rm -f $MINDI_TMP/$bconf.lis2 2745 2737 finallist="" 2746 2738 # Remove directories from the list, as cp will create them anyway … … 2748 2740 # recent bash says that -d is true for a link to a dir ! 2749 2741 for f in $lines; do 2742 LogFile "DEBUG: f=$f" 2750 2743 if [ -e "$f" -a ! -d "$f" ] || [ -h "$f" ]; then 2744 LogFile "DEBUG: Test OK" 2751 2745 # Do not overwrite files already in destination (avoid using option -n of cp not portable) 2752 2746 if [ ! -e "$mp/$f" ]; then 2753 2747 finallist="$finallist $f" 2748 LogFile "DEBUG: Creating $mp/$f" 2749 else 2750 LogFile "DEBUG: Target exist `ls -al $mp/$f`" 2754 2751 fi 2755 2752 fi 2756 2753 done 2754 LogFile "DEBUG: finallist=$finallist" 2757 2755 # But adds the directory useful in $lis3 2758 2756 fnllist=`echo $finallist $lis3 | tr ' ' '\n' | sort -u | tr '\n' ' '` 2759 LogFile "INFO: Copying $conf related files with cp -a --parents $fnllist -t $mp/" 2760 cp -a --parents $fnllist -t $mp/ 2> $templog || LogAll "WARNING: Problem in $conf analysis" $templog 2761 rm -f $MINDI_TMP/$conf.lis 2757 echo -e "$DONE" 2758 if [ _"$fnllist" != _"" ] && [ _"$fnllist" != _" " ]; then 2759 LogFile "INFO: Copying $conf related files with cp -a --parents $fnllist -t $mp/" 2760 cp -a --parents $fnllist -t $mp/ 2>$templog || LogAll "WARNING: Problem in $conf analysis" $templog 2761 fi 2762 rm -f $MINDI_TMP/$bconf.lis 2762 2763 } 2763 2764 … … 2772 2773 > $templog 2773 2774 2774 mkdir -p $targetdir2775 2775 # Check whether /lib64 or /lib or /sbin or /bin is a link and if so explicitly create one in rootfs (Fedora 17 crazyness) 2776 2776 for d in bin sbin lib lib64; do … … 2778 2778 thelink=`readlink /$d` 2779 2779 mkdir -p $targetdir/$thelink || LogAll "ERROR: Unable to create $thelink in $targetdir" 2780 mv $targetdir/$d/* $targetdir/$d/.??* $targetdir/$thelink 2> /dev/null2780 mv $targetdir/$d/* $targetdir/$d/.??* $targetdir/$thelink 2781 2781 if [ -d "$targetdir/$d" -a ! -h "$targetdir/$d" ]; then 2782 2782 rmdir $targetdir/$d … … 3030 3030 3031 3031 mkdir -p $targetdir/proc 3032 cp -a $MY_FSTAB $targetdir/tmp 3032 3033 LogFile "---------------------------" 3033 3034 LogFile "Content of initial targetdir:" -
branches/3.3/mondo-doc/Makefile.howto
r3779 r3843 10 10 IMAGES=$(shell ls ${IMAGESDIR}/*.png | sed 's/\.png/.eps/g') 11 11 12 all: $(TARGET) .ps $(TARGET).pdf $(TARGET)/index.html $(TARGET).txt $(TARGET).html $(TARGET).rtf12 all: $(TARGET)/index.html $(TARGET).txt $(TARGET).html $(TARGET).rtf $(TARGET).ps $(TARGET).pdf 13 13 14 14 ${IMAGESDIR}/%.eps: ${IMAGESDIR}/%.png -
branches/3.3/mondo/src/common/libmondo-cli.c
r3838 r3843 354 354 } 355 355 if (!flag_set['d']) { 356 if (!find_dvd_device(flag_val['d'] , FALSE)) {356 if (!find_dvd_device(flag_val['d'])) { 357 357 flag_set['d'] = TRUE; 358 358 log_to_screen("I guess DVD drive is at %s", flag_val['d']); -
branches/3.3/mondo/src/common/libmondo-devices-EXT.h
r3191 r3843 10 10 char *mountpoint); 11 11 extern int find_cdrom_device(char *output, bool try_to_mount); 12 extern int find_dvd_device(char *output , bool try_to_mount);12 extern int find_dvd_device(char *output); 13 13 extern long get_phys_size_of_drive(char *drive); 14 14 extern bool is_this_a_valid_disk_format(char *format); -
branches/3.3/mondo/src/common/libmondo-devices.c
r3838 r3843 479 479 strcpy(dev, g_dvd_drive_is_here); 480 480 if (!dev[0]) { 481 find_dvd_device(dev , FALSE);481 find_dvd_device(dev); 482 482 } 483 483 } else { 484 484 strcpy(dev, g_cdrom_drive_is_here); 485 485 if (!dev[0]) { 486 find_cdrom_device(dev , FALSE);486 find_cdrom_device(dev); 487 487 } 488 488 } … … 870 870 871 871 872 int find_dvd_device(char *output , bool try_to_mount)872 int find_dvd_device(char *output) 873 873 { 874 874 char *tmp = NULL; 875 char *tmp1 = NULL; 875 876 int retval = 0, devno = -1; 876 877 … … 881 882 } 882 883 883 tmp = call_program_and_get_last_line_of_output("dvdrecord -scanbus 2> /dev/null | grep -E '\)\ \'' | grep -n '' | grep -E '[D|C][V|D]' | cut -d':' -f1"); 884 log_msg(5, "tmp = '%s'", tmp); 885 if (!tmp[0]) { 886 mr_free(tmp); 887 tmp = call_program_and_get_last_line_of_output("cdrecord -scanbus 2> /dev/null | grep -E '\)\ \'' | grep -n '' | grep -E '[D|C][V|D]' | cut -d':' -f1"); 888 } 889 if (tmp[0]) { 890 devno = atoi(tmp) - 1; 891 } 884 mr_asprintf(tmp1, "cdrecord -inq dev=%s 2> /dev/null | grep -E 'Device seems to be' | cut -d':' -f2", output); 885 tmp = call_program_and_get_last_line_of_output(tmp1); 886 mr_free(tmp1); 887 log_msg(5, "cdrecord tmp = '%s'", tmp); 892 888 mr_free(tmp); 893 889 894 if (devno >= 0) { 895 retval = 0; 896 sprintf(output, "/dev/scd%d", devno); 890 if (tmp != NULL) { 897 891 strcpy(g_dvd_drive_is_here, output); 898 892 log_msg(2, "I think DVD is at %s", output); … … 901 895 retval = 1; 902 896 } 903 904 return (retval); 897 return(retval); 905 898 } 906 899 … … 2259 2252 mr_asprintf(comment, "What speed is your %s (re)writer?", mds); 2260 2253 if (bkpinfo->backup_media_type == dvd) { 2261 find_dvd_device(bkpinfo->media_device , FALSE);2254 find_dvd_device(bkpinfo->media_device); 2262 2255 strcpy(tmp1, "1"); 2263 2256 mr_asprintf(sz_size, "%d", DEFAULT_DVD_DISK_SIZE); // 4.7 salesman's GB = 4.482 real GB = 4482 MB -
branches/3.3/mondo/src/common/libmondo-devices.h
r3194 r3843 9 9 int find_and_mount_actual_cd(char *mountpoint); 10 10 int find_cdrom_device(char *output, bool try_to_mount); 11 int find_dvd_device(char *output , bool try_to_mount);11 int find_dvd_device(char *output); 12 12 long get_phys_size_of_drive(char *drive); 13 13 bool is_this_a_valid_disk_format(char *format); -
branches/3.3/mondo/src/mondoarchive/mondoarchive.c
r3827 r3843 301 301 setup_newt_stuff(); 302 302 malloc_string(tmp); 303 if (find_dvd_device(tmp , atoi(argv[2]))) {303 if (find_dvd_device(tmp)) { 304 304 printf("Failed to find DVD drive\n"); 305 305 } else {
Note:
See TracChangeset
for help on using the changeset viewer.