Changeset 3231


Ignore:
Timestamp:
Dec 30, 2013, 10:46:45 AM (5 years ago)
Author:
bruno
Message:
  • Try to put everything for mindi under /usr now with the way the latest distros work.
  • symlinks.tgz is gone as a consequence
  • FAILSAFE kernel is now gone in mindi
  • mindi now uses the new mr-read-all-link and mr-process-ldd perl scripts.
  • All this makes this version 3.0.0
Location:
branches/3.2
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/MondoRescue/bin/mr-process-ldd

    r3230 r3231  
    5757
    5858my $verbose = undef;
    59 $verbose = 1 if ($ARGV[0] eq "-v");
     59$verbose = 1 if ((defined $ARGV[0]) && ($ARGV[0] eq "-v"));
    6060
    6161foreach my $f (sort keys %$file) {
  • branches/3.2/MondoRescue/bin/mr-read-all-link

    r3230 r3231  
    5858
    5959my $verbose = undef;
    60 $verbose = 1 if ($ARGV[0] eq "-v");
     60$verbose = 1 if ((defined $ARGV[0]) && ($ARGV[0] eq "-v"));
    6161
    6262#print Dumper($file);
  • branches/3.2/mindi/mindi

    r3214 r3231  
    254254    fi
    255255
     256    #cp -a -n --parents -t $mappath $bigdir 2>> $MINDI_TMP/$$.log || LogAll "WARNING: AKMF -- Could not copy $mappath to $bigdir" $MINDI_TMP/$$.log
    256257    tar cf - -C / $mappath 2>> $MINDI_TMP/$$.log | (cd "$bigdir" ; tar xf -) || LogAll "WARNING: AKMF -- Could not copy $mappath to $bigdir" $MINDI_TMP/$$.log
    257258    if [ "`echo $mappath | grep -F ".gz"`" ] ; then
     
    349350
    350351        # This may return multiple files
    351         for resolved in `ReadAllLink $vanilla_lib_name`; do
     352        for resolved in `mr-read-all-link $vanilla_lib_name`; do
    352353            LogFile "INFO: Adding as deps $resolved to filelist"
    353354            vanilla_resolved_name=`echo "$resolved" | sed -e 's/i[5-7]86//' -e 's/cmov//' -e 's/nosegneg//' | tr -s '/' '/'`
     
    373374    local r res mapfile mappath included_item included_list keyfile mp locale
    374375    LogAll "INFO: Analyzing your keyboard's configuration."
    375     KEYDIR=/lib/kbd
     376    KEYDIR=/usr/lib/kbd
    376377    [ ! -e "$KEYDIR" ] && KEYDIR=/usr/share/kbd     # Slackware
    377378    [ ! -e "$KEYDIR" ] && KEYDIR=/usr/lib/kbd
    378     [ ! -e "$KEYDIR" ] && KEYDIR=/lib/kbd
    379379    [ ! -e "$KEYDIR" ] && KEYDIR=/usr/share
    380380    [ ! -e "$KEYDIR" ] && KEYDIR=/etc/condole
    381381    [ ! -e "$KEYDIR" ] && KEYDIR=/etc/condole-setup
     382    [ ! -e "$KEYDIR" ] && KEYDIR=/lib/kbd
    382383    if [ ! -e "$KEYDIR" ] ; then
    383384        LogAll "WARNING: Keyboard mapping directory not found. I shall use default map at boot-time."
     
    513514    local modpaths pwd line
    514515    pwd=`pwd`
    515     if [ "$YOUR_KERNEL_SUCKS" ] ; then
    516         cd "$MINDI_TMP"
    517     else
    518         cd /
    519     fi
     516    cd /
    520517    if [ ! -e "$1" ] ; then
    521518        LogAll "WARNING: cannot search specific path '$1'"
     
    555552#       LogFile "INFO: '$incoming' generates filelist '$filelist'"
    556553        for fname in $filelist ; do
    557             [ "$fname" != "" ] && echo "$fname" >> $tempfile
     554                [ "$fname" != "" ] && echo "$fname" >> $tempfile
    558555        done
    559556        progress=$(($progress+1))
     
    781778
    782779
    783 HackPathsToFailsafe() {
    784     local incoming newpath stub i pwd
    785     incoming=`ReadLine`
    786     pwd=`pwd`
    787     cd "$MINDI_TMP"
    788     while [ "$incoming" != "" ] ; do
    789         stub=`basename $incoming`
    790         newpath=`FindSpecificModuleInPath lib/modules/$FAILSAFE_KVER $stub`
    791         for i in $newpath ; do
    792             echo "$i"
    793         done
    794         read incoming
    795     done
    796     cd "$pwd"
    797 }
    798 
    799 
    800780ListAllPartitions() {
    801781    local res currline partition all_partitions ap_orig remaining i j
     
    833813### Sq-Modification ... Use kernelname for module search path if specified
    834814###
    835     if [ "${kernelname}" != "" -a "${kernelname}" != "FAILSAFE" ]
     815    if [ "${kernelname}" != "" ]
    836816    then
    837817        kern=${kernelname}
     
    868848    local incoming fname deps
    869849    incoming="$*"
     850    deps=""
     851
    870852    for fname in $incoming ; do
    871853        if [ ! -e "$fname" ] ; then
     
    874856                LogFile "          This warning only affects you if you are using LVM."
    875857                if echo "$MODULES" | grep lvm &> /dev/null ; then
    876                     LogFile "          I think you are, so please take heed!"
     858                    LogFile "          I think you are, so please take heed!"
    877859                else
    878                     LogFile "          I don't think you are, so don't worry about it."
     860                    LogFile "          I don't think you are, so don't worry about it."
    879861                fi
    880862            fi
    881         elif [ -h "$fname" ] && [ -x "$fname" ] ; then
    882             newf=`readlink -f $fname`
    883             LogFile "INFO: $fname is softlink to $newf which deps will be analyzed"
    884             ldd $newf 2> /dev/null | ProcessLDD
    885863        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
    889868}
    890869
     
    932911
    933912LocateFile() {
    934     local i path fname_to_find location output resolved tmp stub cache_id loclist
     913    local i j path fname_to_find location output resolved tmp stub cache_id loclist
    935914    fname_to_find="$1"
    936915    # 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
    939927        if [ -h "$output" ] ; then
    940             output="`ReadAllLink $output` $output"
     928            output="`mr-read-all-link $output` $output"
    941929        fi
    942930        echo "$output"
     
    951939        output="$path/$fname_to_find $output"
    952940        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"
    954942        fi
    955943    done
     
    12851273        if [ "$MINDI_EXCLUDE_DEVS" ] ; then
    12861274            l=""
    1287             list_of_devices="`ReadAllLink $current_partition`"
     1275            list_of_devices="`mr-read-all-link $current_partition`"
    12881276            for d in $list_of_devices; do
    12891277                l="$l `$MINDI_LIB/analyze-my-lvm --givemapperofdm $d`"
     
    20862074        if [ -h "/$d" ]; then
    20872075            thelink=`readlink /$d`
    2088             mkdir -p $thelink || LogIt "ERROR: Unable to create $thelink in $mountpoint."
    2089             mv $d/* $thelink 2> /dev/null
    2090             if [ -d "$d" -a ! -h "$d" ]; then
    2091                 rmdir $d
    2092             fi
    2093             if [ ! -h $d ]; then
    2094                 rm -f $d 2> /dev/null
    2095                 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."
    20962084            fi
    20972085        fi
     
    21082096    res=$?
    21092097    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
    21282099    if [ "$res" -ne "0" ] ; then
    21292100        Die "You have $res files present in dependency list\nbut absent from filesystem."
     
    21762147    fi
    21772148    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/$$.log
     2149        cp -a /lib/dev-state ./lib/ 2>> $MINDI_TMP/$$.log || LogAll "ERROR: Unable to handle /lib/dev-state" $MINDI_TMP/$$.log
    21792150    fi
    21802151    cd "$old_pwd"
     
    25272498        fi
    25282499    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
    25302502
    25312503    cd dev || Die "Can't cd to dev"
     
    25552527
    25562528    # 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"
    25582530    if [ $? -eq 0 ]; then
    25592531        # We want to use the real mount and all the supported variants (nfs, cifs, ...)
     
    25702542    done
    25712543    for f in `cat $MINDI_TMP/minimal.lis` `sort -u $MINDI_TMP/minimal2.lis`; do
    2572         ReadAllLink $f >> $MINDI_TMP/minimal.lis
     2544        mr-read-all-link $f >> $MINDI_TMP/minimal.lis
    25732545    done
    25742546    # Initial / are trucated by tar
     
    26782650    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
    26792651
    2680     cd "$old_pwd"
    26812652    echo -en "..."
    2682     if [ "$YOUR_KERNEL_SUCKS" ] ; then
    2683         cd "$MINDI_TMP"
    2684         needed_modules_path=lib/modules/$FAILSAFE_KVER
     2653    cd /
     2654    if [ "${kernelname}" != "" ]; then
     2655        needed_modules_path=lib/modules/${kernelname}
    26852656    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
    26932658    fi
    26942659
     
    27152680    for i in `echo $needed_modules  | tr ' ' '\n' | sort -u`; do
    27162681        [ -e "$i" ] && s=`du -sk $i | cut -f1` || s=""
    2717         [ "$YOUR_KERNEL_SUCKS" ] && i=$MINDI_TMP/$i
    27182682        LogFile "INFO: Adding $i ($s KB) to the rootfs"
    27192683        tar cf - -C / $i 2>> $MINDI_TMP/$$.log | (cd "$mountpoint" ; tar xf -) || LogIt "ERROR: Unable to copy $i to $mountpoint" $MINDI_TMP/$$.log
     
    27762740        LogFile "INFO: Deleting devfsd daemon from ramdisk"
    27772741        [ ! -e "/sbin/devfsd" ] && LogFile "      ...because /sbin/devfsd not found"
    2778         [ "$kernelpath" = "$MINDI_LIB/vmlinuz" ] && LogFile "      ...because kernel is failsafe"
    27792742        rm -f $mountpoint/sbin/devfsd
    27802743    fi
     
    28072770        LogFile "INFO: Creating an $gvFileSystem initrd image..."
    28082771        # kernel expects linuxrc in ext2 filesystem
    2809         ( cd "$mountpoint" && ln -sf sbin/init linuxrc )
     2772        ( cd "$mountpoint" && ln -sf usr/sbin/init linuxrc )
    28102773        # unmount loop filesystem and create image file using the standard approach
    28112774        umount $mountpoint || Die "Cannot unmount $tempfile"
     
    29292892    LogFile "INFO: However, you may wish to ask your vendor to provide a permanent fix..."
    29302893    LogFile "INFO:  Or you might like to call 'su -' instead of 'su', for example."
    2931 fi
    2932 
    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" ]; then
    2935     source $MINDI_LIB/FindDistroFailsafe
    2936     # Log kernel image
    2937     LogIt "INFO: FAILSAFE kernel image to be used is: $FAILSAFE_KBIN ($FAILSAFE_KVER)"
    2938 else
    2939     [ -f "$MINDI_LIB/vmlinuz" ] && FAILSAFE_KVER=`strings $MINDI_LIB/vmlinuz 2> /dev/null | grep -E "2\.[46]" | cut -d' ' -f1`
    29402894fi
    29412895
     
    31793133        # Avoids logfile content for mondo
    31803134        export MONDO_SHARE=""
    3181         ReadAllLink $2
     3135        mr-read-all-link $2
    31823136        MindiExit $?
    31833137    elif [ "$1" = "--makemessage" ] ; then
     
    32263180        fi
    32273181        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
    32303183           LogAll "WARNING: Module path for ${kernelpath} not found..."
    32313184           LogAll "         using running kernel\'s modules."
     
    32953248    LogFile "INFO: You are using Mindi-Linux v$MINDI_VERSION to make boot+data disks"
    32963249fi
    3297 if [ -f $MINDI_LIB/rootfs/bin/busybox ]; then
    3298     LogIt "Mindi-`$MINDI_LIB/rootfs/bin/busybox 2>&1 | head -1`"
     3250if [ -f $MINDI_LIB/rootfs/usr/bin/busybox ]; then
     3251    LogIt "Mindi-`$MINDI_LIB/rootfs/usr/bin/busybox 2>&1 | head -1`"
    32993252else
    33003253    LogIt "ERROR: Unable to find mindi-busybox, please install it"
     
    33423295    fi
    33433296    if [ "$USE_OWN_KERNEL" = "yes" ]; then
    3344         YOUR_KERNEL_SUCKS=""
    33453297        kernelpath=`TryToFindKernelPath`
    33463298        if [ "$kernelpath" = "" ] ; then
     
    33483300            read kernelpath
    33493301        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
     3303fi
     3304
    33823305echo -e "Mindi's temp dir = $MINDI_TMP \nMindi's output dir=$MINDI_CACHE" >> $LOGFILE
    33833306[ "$(($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."
    33863307
    33873308PrepareDataDiskImages
  • branches/3.2/mindi/mindi-get-perl-modules

    r3224 r3231  
    7878#
    7979foreach my $d (@INC) {
    80     $d = mr_read_all_link($d) if (-l $d);
     80    $d = mr_file_read_all_link($d) if (-l $d);
    8181    push @includes,$d if (-d $d);
    8282}
Note: See TracChangeset for help on using the changeset viewer.