Changeset 3231 in MondoRescue
- Timestamp:
- Dec 30, 2013, 10:46:45 AM (11 years ago)
- Location:
- branches/3.2
- Files:
-
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/MondoRescue/bin/mr-process-ldd
r3230 r3231 57 57 58 58 my $verbose = undef; 59 $verbose = 1 if ( $ARGV[0] eq "-v");59 $verbose = 1 if ((defined $ARGV[0]) && ($ARGV[0] eq "-v")); 60 60 61 61 foreach my $f (sort keys %$file) { -
branches/3.2/MondoRescue/bin/mr-read-all-link
r3230 r3231 58 58 59 59 my $verbose = undef; 60 $verbose = 1 if ( $ARGV[0] eq "-v");60 $verbose = 1 if ((defined $ARGV[0]) && ($ARGV[0] eq "-v")); 61 61 62 62 #print Dumper($file); -
branches/3.2/mindi/mindi
r3214 r3231 254 254 fi 255 255 256 #cp -a -n --parents -t $mappath $bigdir 2>> $MINDI_TMP/$$.log || LogAll "WARNING: AKMF -- Could not copy $mappath to $bigdir" $MINDI_TMP/$$.log 256 257 tar cf - -C / $mappath 2>> $MINDI_TMP/$$.log | (cd "$bigdir" ; tar xf -) || LogAll "WARNING: AKMF -- Could not copy $mappath to $bigdir" $MINDI_TMP/$$.log 257 258 if [ "`echo $mappath | grep -F ".gz"`" ] ; then … … 349 350 350 351 # This may return multiple files 351 for resolved in ` ReadAllLink $vanilla_lib_name`; do352 for resolved in `mr-read-all-link $vanilla_lib_name`; do 352 353 LogFile "INFO: Adding as deps $resolved to filelist" 353 354 vanilla_resolved_name=`echo "$resolved" | sed -e 's/i[5-7]86//' -e 's/cmov//' -e 's/nosegneg//' | tr -s '/' '/'` … … 373 374 local r res mapfile mappath included_item included_list keyfile mp locale 374 375 LogAll "INFO: Analyzing your keyboard's configuration." 375 KEYDIR=/ lib/kbd376 KEYDIR=/usr/lib/kbd 376 377 [ ! -e "$KEYDIR" ] && KEYDIR=/usr/share/kbd # Slackware 377 378 [ ! -e "$KEYDIR" ] && KEYDIR=/usr/lib/kbd 378 [ ! -e "$KEYDIR" ] && KEYDIR=/lib/kbd379 379 [ ! -e "$KEYDIR" ] && KEYDIR=/usr/share 380 380 [ ! -e "$KEYDIR" ] && KEYDIR=/etc/condole 381 381 [ ! -e "$KEYDIR" ] && KEYDIR=/etc/condole-setup 382 [ ! -e "$KEYDIR" ] && KEYDIR=/lib/kbd 382 383 if [ ! -e "$KEYDIR" ] ; then 383 384 LogAll "WARNING: Keyboard mapping directory not found. I shall use default map at boot-time." … … 513 514 local modpaths pwd line 514 515 pwd=`pwd` 515 if [ "$YOUR_KERNEL_SUCKS" ] ; then 516 cd "$MINDI_TMP" 517 else 518 cd / 519 fi 516 cd / 520 517 if [ ! -e "$1" ] ; then 521 518 LogAll "WARNING: cannot search specific path '$1'" … … 555 552 # LogFile "INFO: '$incoming' generates filelist '$filelist'" 556 553 for fname in $filelist ; do 557 [ "$fname" != "" ] && echo "$fname" >> $tempfile554 [ "$fname" != "" ] && echo "$fname" >> $tempfile 558 555 done 559 556 progress=$(($progress+1)) … … 781 778 782 779 783 HackPathsToFailsafe() {784 local incoming newpath stub i pwd785 incoming=`ReadLine`786 pwd=`pwd`787 cd "$MINDI_TMP"788 while [ "$incoming" != "" ] ; do789 stub=`basename $incoming`790 newpath=`FindSpecificModuleInPath lib/modules/$FAILSAFE_KVER $stub`791 for i in $newpath ; do792 echo "$i"793 done794 read incoming795 done796 cd "$pwd"797 }798 799 800 780 ListAllPartitions() { 801 781 local res currline partition all_partitions ap_orig remaining i j … … 833 813 ### Sq-Modification ... Use kernelname for module search path if specified 834 814 ### 835 if [ "${kernelname}" != "" -a "${kernelname}" != "FAILSAFE"]815 if [ "${kernelname}" != "" ] 836 816 then 837 817 kern=${kernelname} … … 868 848 local incoming fname deps 869 849 incoming="$*" 850 deps="" 851 870 852 for fname in $incoming ; do 871 853 if [ ! -e "$fname" ] ; then … … 874 856 LogFile " This warning only affects you if you are using LVM." 875 857 if echo "$MODULES" | grep lvm &> /dev/null ; then 876 858 LogFile " I think you are, so please take heed!" 877 859 else 878 860 LogFile " I don't think you are, so don't worry about it." 879 861 fi 880 862 fi 881 elif [ -h "$fname" ] && [ -x "$fname" ] ; then882 newf=`readlink -f $fname`883 LogFile "INFO: $fname is softlink to $newf which deps will be analyzed"884 ldd $newf 2> /dev/null | ProcessLDD885 863 else 886 ldd $fname 2> /dev/null | ProcessLDD 887 fi 888 done 864 deps="$deps $fname" 865 fi 866 done 867 mr-read-all-link `mr-process-ldd $deps | sort -u` | sort -u 889 868 } 890 869 … … 932 911 933 912 LocateFile() { 934 local i path fname_to_find location output resolved tmp stub cache_id loclist913 local i j path fname_to_find location output resolved tmp stub cache_id loclist 935 914 fname_to_find="$1" 936 915 # It's an absolute path 937 if echo "$fname_to_find" | grep -x "/.*" ; then 938 output="$fname_to_find" 916 j=`echo "$fname_to_find" | cut -c1` 917 if [ _"$j" = _"/" ]; then 918 dn=`dirname $fname_to_find` 919 # We suppose that the link is already included, just add the new file 920 if [ -h "$dn" ]; then 921 newdn=`readlink -f $dn` 922 bn=`basename $fname_to_find` 923 output="$newdn/$bn" 924 else 925 output="$fname_to_find" 926 fi 939 927 if [ -h "$output" ] ; then 940 output="` ReadAllLink $output` $output"928 output="`mr-read-all-link $output` $output" 941 929 fi 942 930 echo "$output" … … 951 939 output="$path/$fname_to_find $output" 952 940 if [ -h "$path/$fname_to_find" ] ; then 953 output="` ReadAllLink $path/$fname_to_find` $output"941 output="`mr-read-all-link $path/$fname_to_find` $output" 954 942 fi 955 943 done … … 1285 1273 if [ "$MINDI_EXCLUDE_DEVS" ] ; then 1286 1274 l="" 1287 list_of_devices="` ReadAllLink $current_partition`"1275 list_of_devices="`mr-read-all-link $current_partition`" 1288 1276 for d in $list_of_devices; do 1289 1277 l="$l `$MINDI_LIB/analyze-my-lvm --givemapperofdm $d`" … … 2086 2074 if [ -h "/$d" ]; then 2087 2075 thelink=`readlink /$d` 2088 mkdir -p $ thelink || LogIt "ERROR: Unable to create $thelink in $mountpoint."2089 mv $ d/*$thelink 2> /dev/null2090 if [ -d "$ d" -a ! -h "$d" ]; then2091 rmdir $ d2092 fi 2093 if [ ! -h $ d ]; then2094 rm -f $ d 2> /dev/null2095 ln -s $thelink $d|| LogIt "ERROR: /$d is a symbolic link, but I couldn't create it in $mountpoint."2076 mkdir -p $mountpoint/$thelink || LogIt "ERROR: Unable to create $thelink in $mountpoint." 2077 mv $mountpoint/$d/* $mountpoint/$d/.??* $mountpoint/$thelink 2> /dev/null 2078 if [ -d "$mountpoint/$d" -a ! -h "$mountpoint/$d" ]; then 2079 rmdir $mountpoint/$d 2080 fi 2081 if [ ! -h $mountpoint/$d ]; then 2082 rm -f $mountpoint/$d 2> /dev/null 2083 (cd $mountpoint ; ln -s $thelink $d) || LogIt "ERROR: /$d is a symbolic link, but I couldn't create it in $mountpoint." 2096 2084 fi 2097 2085 fi … … 2108 2096 res=$? 2109 2097 rm -f $includefile 2110 if [ "$YOUR_KERNEL_SUCKS" ]; then 2111 pwd=`pwd` 2112 cd "$MINDI_TMP" 2113 for i in `ListKernelModulePaths | HackPathsToFailsafe` ; do 2114 tar cf - ./$i 2>> $MINDI_TMP/$$.log | (cd "$bigdir" ; tar xf -) || Die "PDDI can't copy $i->$bigdir" $MINDI_TMP/$$.log 2115 done 2116 for i in $EXTRA_MODS ; do 2117 j=`find lib/modules/$FAILSAFE_KVER -name $i.*o.gz 2> /dev/null` 2118 [ ! "$j" ] && LogFile "WARNING: cannot find failsafe module $i.o.gz" 2119 for k in $j ; do 2120 tar cf - $k 2>> $MINDI_TMP/$$.log | (cd "$bigdir" ; tar xf -) || LogIt "ERROR: module $k extraction issue" $MINDI_TMP/$$.log 2121 LogFile "INFO: Added failsafe module $k to ramdisk" 2122 done 2123 done 2124 cd "$pwd" 2125 else 2126 ListKernelModulePaths >> $needlist 2127 fi 2098 ListKernelModulePaths >> $needlist 2128 2099 if [ "$res" -ne "0" ] ; then 2129 2100 Die "You have $res files present in dependency list\nbut absent from filesystem." … … 2176 2147 fi 2177 2148 if [ -d "/lib/dev-state" ]; then 2178 tar cf - -C / ./lib/dev-state 2>> $MINDI_TMP/$$.log | tar xf -|| LogAll "ERROR: Unable to handle /lib/dev-state" $MINDI_TMP/$$.log2149 cp -a /lib/dev-state ./lib/ 2>> $MINDI_TMP/$$.log || LogAll "ERROR: Unable to handle /lib/dev-state" $MINDI_TMP/$$.log 2179 2150 fi 2180 2151 cd "$old_pwd" … … 2527 2498 fi 2528 2499 done 2529 tar -zxf symlinks.tgz || Die "Cannot untar symlinks.tgz" 2500 (cd etc ; ln -sf bashrc profile ; ln -sf bashrc shrc ; ln -sf ../proc/mounts mtab ; ln -sf ../usr/sbin/init linuxrc) 2501 ln -sf usr/sbin/init linuxrc 2530 2502 2531 2503 cd dev || Die "Can't cd to dev" … … 2555 2527 2556 2528 # Handle the case where busybox and mount are dynamically linked 2557 file $MINDI_LIB/rootfs/ bin/busybox 2>&1 | grep -q "dynamically"2529 file $MINDI_LIB/rootfs/usr/bin/busybox 2>&1 | grep -q "dynamically" 2558 2530 if [ $? -eq 0 ]; then 2559 2531 # We want to use the real mount and all the supported variants (nfs, cifs, ...) … … 2570 2542 done 2571 2543 for f in `cat $MINDI_TMP/minimal.lis` `sort -u $MINDI_TMP/minimal2.lis`; do 2572 ReadAllLink $f >> $MINDI_TMP/minimal.lis2544 mr-read-all-link $f >> $MINDI_TMP/minimal.lis 2573 2545 done 2574 2546 # Initial / are trucated by tar … … 2678 2650 tar cf - -C / /dev/fd0*[1,2][4,7,8]* 2>> $MINDI_TMP/$$.log | tar xf - || LogIt "ERROR: Problem in fd dev analysis" $MINDI_TMP/$$.log 2679 2651 2680 cd "$old_pwd"2681 2652 echo -en "..." 2682 if [ "$YOUR_KERNEL_SUCKS" ] ; then2683 cd "$MINDI_TMP"2684 needed_modules_path=lib/modules/$ FAILSAFE_KVER2653 cd / 2654 if [ "${kernelname}" != "" ]; then 2655 needed_modules_path=lib/modules/${kernelname} 2685 2656 else 2686 cd / 2687 if [ "${kernelname}" != "" ] 2688 then 2689 needed_modules_path=lib/modules/${kernelname} 2690 else 2691 needed_modules_path=lib/modules/$KERVERRUN 2692 fi 2657 needed_modules_path=lib/modules/$KERVERRUN 2693 2658 fi 2694 2659 … … 2715 2680 for i in `echo $needed_modules | tr ' ' '\n' | sort -u`; do 2716 2681 [ -e "$i" ] && s=`du -sk $i | cut -f1` || s="" 2717 [ "$YOUR_KERNEL_SUCKS" ] && i=$MINDI_TMP/$i2718 2682 LogFile "INFO: Adding $i ($s KB) to the rootfs" 2719 2683 tar cf - -C / $i 2>> $MINDI_TMP/$$.log | (cd "$mountpoint" ; tar xf -) || LogIt "ERROR: Unable to copy $i to $mountpoint" $MINDI_TMP/$$.log … … 2776 2740 LogFile "INFO: Deleting devfsd daemon from ramdisk" 2777 2741 [ ! -e "/sbin/devfsd" ] && LogFile " ...because /sbin/devfsd not found" 2778 [ "$kernelpath" = "$MINDI_LIB/vmlinuz" ] && LogFile " ...because kernel is failsafe"2779 2742 rm -f $mountpoint/sbin/devfsd 2780 2743 fi … … 2807 2770 LogFile "INFO: Creating an $gvFileSystem initrd image..." 2808 2771 # kernel expects linuxrc in ext2 filesystem 2809 ( cd "$mountpoint" && ln -sf sbin/init linuxrc )2772 ( cd "$mountpoint" && ln -sf usr/sbin/init linuxrc ) 2810 2773 # unmount loop filesystem and create image file using the standard approach 2811 2774 umount $mountpoint || Die "Cannot unmount $tempfile" … … 2929 2892 LogFile "INFO: However, you may wish to ask your vendor to provide a permanent fix..." 2930 2893 LogFile "INFO: Or you might like to call 'su -' instead of 'su', for example." 2931 fi2932 2933 # If we have a distribution-specific script for finding a FAILSAFE kernel, use it.2934 if [ -f "$MINDI_LIB/FindDistroFailsafe" ] && [ ! "$1" = "--makemountlist" ] && [ "$kernelpath" = "FAILSAFE" ]; then2935 source $MINDI_LIB/FindDistroFailsafe2936 # Log kernel image2937 LogIt "INFO: FAILSAFE kernel image to be used is: $FAILSAFE_KBIN ($FAILSAFE_KVER)"2938 else2939 [ -f "$MINDI_LIB/vmlinuz" ] && FAILSAFE_KVER=`strings $MINDI_LIB/vmlinuz 2> /dev/null | grep -E "2\.[46]" | cut -d' ' -f1`2940 2894 fi 2941 2895 … … 3179 3133 # Avoids logfile content for mondo 3180 3134 export MONDO_SHARE="" 3181 ReadAllLink $23135 mr-read-all-link $2 3182 3136 MindiExit $? 3183 3137 elif [ "$1" = "--makemessage" ] ; then … … 3226 3180 fi 3227 3181 kernelname=`echo $kernelpath | cut -d'-' -f2- | sed 's/.[bg]z[2]*$//'` 3228 if [ ! -d "/lib/modules/$kernelname" ] && [ "$kernelpath" != "FAILSAFE" ] 3229 then 3182 if [ ! -d "/lib/modules/$kernelname" ]; then 3230 3183 LogAll "WARNING: Module path for ${kernelpath} not found..." 3231 3184 LogAll " using running kernel\'s modules." … … 3295 3248 LogFile "INFO: You are using Mindi-Linux v$MINDI_VERSION to make boot+data disks" 3296 3249 fi 3297 if [ -f $MINDI_LIB/rootfs/ bin/busybox ]; then3298 LogIt "Mindi-`$MINDI_LIB/rootfs/ bin/busybox 2>&1 | head -1`"3250 if [ -f $MINDI_LIB/rootfs/usr/bin/busybox ]; then 3251 LogIt "Mindi-`$MINDI_LIB/rootfs/usr/bin/busybox 2>&1 | head -1`" 3299 3252 else 3300 3253 LogIt "ERROR: Unable to find mindi-busybox, please install it" … … 3342 3295 fi 3343 3296 if [ "$USE_OWN_KERNEL" = "yes" ]; then 3344 YOUR_KERNEL_SUCKS=""3345 3297 kernelpath=`TryToFindKernelPath` 3346 3298 if [ "$kernelpath" = "" ] ; then … … 3348 3300 read kernelpath 3349 3301 fi 3350 else 3351 YOUR_KERNEL_SUCKS="That's why you're using mine, dude. :-)" 3352 fi 3353 fi 3354 if [ "$YOUR_KERNEL_SUCKS" != "" ] || [ "$kernelpath" = "" ] || [ "$kernelpath" = "SUCKS" ] || [ "$kernelpath" = "FAILSAFE" ] ; then 3355 # If we have a distribution-specific script for finding a FAILSAFE kernel, use it. 3356 if [ -f "$MINDI_LIB/FindDistroFailsafe" ] && [ ! "$1" = "--makemountlist" ]; then 3357 source $MINDI_LIB/FindDistroFailsafe 3358 # Log kernel image 3359 LogIt "INFO: FAILSAFE kernel image to be used is: $FAILSAFE_KBIN ($FAILSAFE_KVER)" 3360 kernelpath="$FAILSAFE_KBIN" 3361 LogIt "INFO: I shall include a failsafe kernel, not your kernel, in the boot disks." 3362 LogIt " The failsafe kernel is $kernelpath." 3363 LogIt " However, you are still running your kernel. If Mindi fails to create your" 3364 LogIt " disks then it may still be a result of a problem with your kernel." 3365 pwd=`pwd` 3366 cd "$MINDI_TMP" 3367 mkdir -p lib/modules 3368 cp -a "/lib/modules/$FAILSAFE_KVER" "lib/modules/$FAILSAFE_KVER" || Die "Cannot copy kernel modules." 3369 cd "$pwd" 3370 else 3371 kernelpath=$MINDI_LIB/vmlinuz 3372 LogIt "INFO: I shall include Mindi's failsafe kernel, not your kernel, in the boot disks." 3373 LogIt " However, you are still running your kernel. If Mindi fails to create your" 3374 LogIt " disks then it may still be a result of a problem with your kernel." 3375 pwd=`pwd` 3376 cd "$MINDI_TMP" 3377 bzip2 -dc $MINDI_LIB/lib.tar.bz2 | tar -x || Die "Cannot unzip lib.tar.bz2" 3378 cd "$pwd" 3379 fi 3380 YOUR_KERNEL_SUCKS="Your kernel sucks" 3381 fi 3302 fi 3303 fi 3304 3382 3305 echo -e "Mindi's temp dir = $MINDI_TMP \nMindi's output dir=$MINDI_CACHE" >> $LOGFILE 3383 3306 [ "$(($RANDOM%64))" -eq "0" ] && LogIt "INFO: Dude, I've looked inside your computer and it's really dusty..." 3384 3385 [ "$YOUR_KERNEL_SUCKS" ] && [ ! "$FAILSAFE_KVER" ] && Die "Please install mindi-kernel package. You need it.\nGo to http://www.mondorescue.org and download it, then install it."3386 3307 3387 3308 PrepareDataDiskImages -
branches/3.2/mindi/mindi-get-perl-modules
r3224 r3231 78 78 # 79 79 foreach my $d (@INC) { 80 $d = mr_ read_all_link($d) if (-l $d);80 $d = mr_file_read_all_link($d) if (-l $d); 81 81 push @includes,$d if (-d $d); 82 82 }
Note:
See TracChangeset
for help on using the changeset viewer.