Changeset 2445 in MondoRescue for branches/2.2.10/mindi/mindi


Ignore:
Timestamp:
Oct 2, 2009, 4:30:07 AM (15 years ago)
Author:
Bruno Cornec
Message:

r3513@localhost: bruno | 2009-10-02 00:09:16 +0200

  • Not using busybox for mindi anymore (start - step needed for tests)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.10/mindi/mindi

    r2444 r2445  
    3434TMPDIR=/tmp
    3535
    36 EXTRA_SPACE=49152       # increase if you run out of ramdisk space
     36EXTRA_SPACE=60000       # increase if you run out of ramdisk space
    3737BOOT_SIZE=16384         # size of the boot disk
    3838
     
    9292    . $MINDI_CONFIG
    9393fi
    94 DEPLIST_FILE="$MINDI_CONF/deplist.txt"
     94DEPLIST_FILE="$MINDI_CONF/deplist.conf"
     95DEPLIST_FILE_MIN="$MINDI_CONF/deplist-minimal.conf"
    9596DEPLIST_DIR="$MINDI_CONF/deplist.d"
    9697
     
    153154            return
    154155        fi
    155     else
    156         echo -en "`basename $mappath | tr '.' '#' | sed s/#kmap#gz// | sed s/#inc#gz//` " | tr '#' '.'
    157156    fi
    158157
     
    181180    local outdir incoming fname counter d found
    182181    outdir=$1
     182    noof_lines=$2
    183183    mkdir -p $outdir
    184184    incoming=`ReadLine`
    185     counter=0
     185    progress=0
    186186    while [ "$incoming" != "" ] ; do
    187187        # Non absolute file names should not arrive till here => skipped
     
    199199        done
    200200        if [ -d "$incoming" ] && [ ! -h "$incoming" ]; then
    201             find $incoming/* -maxdepth 0 2> /dev/null | CopyDependenciesToDirectory $outdir
     201            find $incoming/* -maxdepth 0 2> /dev/null | CopyDependenciesToDirectory $outdir 0
    202202        elif [ -e "$incoming" ] && [ $found = "false" ]; then
    203203            tar cf - -C / $incoming 2>> $MINDI_TMP/$$.log | (cd $outdir ; tar xf -) || Die "Cannot copy $incoming to $outdir - did you run out of disk space?" $MINDI_TMP/$$.log
     
    208208            fi
    209209            [ -x "$outdir" ] && StripExecutable $outdir "-$filename-"
    210             counter=$(($counter+1))
    211             if [ "$counter" -ge "5" ] ; then
    212                 counter=0
    213                 echo -en "."
    214             fi
     210            progress=$(($progress+1))
     211            LogProgress $progress $noof_lines
    215212        fi
    216213        incoming=`ReadLine`
     
    315312FindAndAddUserKeyboardMappingFile() {
    316313    local r res mapfile mappath included_item included_list keyfile mp locale
    317     LogAll "Analyzing your keyboard's configuration."
     314    LogFile "Analyzing your keyboard's configuration."
    318315    KEYDIR=/lib/kbd
    319316    [ ! -e "$KEYDIR" ] && KEYDIR=/usr/share/kbd     # Slackware
     
    326323        return 0
    327324    fi
     325    LogFile "Adding the following keyboard mapping tables: "
    328326    if [ -e "/etc/sysconfig/keyboard" ] ; then
    329327        LogFile "Red Hat-style config detected."
     
    337335    elif [ -e "/etc/console/boottime.kmap.gz" ] ; then
    338336        LogFile "Debian-style config detected."
    339         echo -en "Adding the following keyboard mapping tables: "
    340337        mkdir -p $bigdir/tmp
    341338        echo "/etc/console/boottime.kmap.gz" > $bigdir/tmp/KEYMAP-LIVES-HERE
     
    347344    elif [ -e "/etc/console-setup/boottime.kmap.gz" ] ; then
    348345        LogFile "Ubuntu-style config detected."
    349         echo -en "Adding the following keyboard mapping tables: "
    350346        mkdir -p $bigdir/tmp
    351347        echo "/etc/console-setup/boottime.kmap.gz" > $bigdir/tmp/KEYMAP-LIVES-HERE
     
    359355        keyfile=/etc/conf.d/keymaps
    360356    else
    361         echo -en "Searching for rc.config ..."
     357        LogAll "Searching for rc.config ..."
    362358        keyfile=`find /etc -name rc.config | head -n1`
    363359        if [ "$keyfile" = "" ] || [ ! -e "$keyfile" ] ; then
     
    385381    [ ! "$mp" ] && mp=`grep "i[3-8]86" $MINDI_TMP/keymaps.find | grep "$locale[^r][^/]" | grep -vx " *#.*"`
    386382    # If we have multiple keymaps then log it !!
    387     echo "$mp" | grep -q " "
     383    echo "$mp" | grep -q " " >> $LOGFILE
    388384    if [ $? -eq 0 ]; then
    389385        LogAll "WARNING: Multiple keymaps found: $mp"
     
    402398        return
    403399    fi
    404     echo -en "Adding the following keyboard mapping tables: "
    405400    mkdir -p $bigdir/tmp
    406401    echo "$mappath" > $bigdir/tmp/KEYMAP-LIVES-HERE
     
    731726ListKernelModulePaths() {
    732727    local module_list module fname oss r kern
     728    outfile=$1
     729    echo -en "Analyzing modules requirements"
    733730    oss="/root/oss/modules"
    734731    module_list="$MODULES"
     
    751748### Sq-Mod End
    752749###
     750    noof_lines=0
     751    for module in $module_list $EXTRA_MODS ; do
     752        noof_lines=$(($noof_lines+1))
     753    done
     754    progress=0
    753755    for module in $module_list $EXTRA_MODS ; do
    754756        r=`find /lib/modules/$kern -type f | grep "/${module}\..*o" | tail -n1`
    755757        LogFile "module $module --> $r"
    756         [ "$r" ] && echo "$r"
    757         [ -f "$oss" ] && find $oss | grep -F $module
    758     done
    759     find /lib/modules/$kern/modules.* -type f 2> /dev/null
    760     [ -f "$oss" ] && find $oss.* 2> /dev/null
     758        [ "$r" ] && echo "$r" >> $outfile
     759        [ -f "$oss" ] && find $oss | grep -F $module >> $outfile
     760        progress=$(($progress+1))
     761        LogProgress $progress $noof_lines
     762    done
     763    find /lib/modules/$kern/modules.* -type f 2> /dev/null >> $outfile
     764    [ -f "$oss" ] && find $oss.* 2> /dev/null >> $outfile
    761765}
    762766
     
    932936absolute_partition old_partition_fmt current_lvolume uname skip
    933937
     938    LogFile "------------------------------------"
    934939    LogFile "Your raw fstab file looks like this:"
    935940    LogFile "------------------------------------"
    936941    cat $MY_FSTAB >> $LOGFILE
     942    LogAll "-----------------------------------"
    937943    LogAll "Your mountlist will look like this:"
    938944    LogAll "-----------------------------------"
     
    952958   
    953959    if [ $LVM != "false" ]; then
    954         echo -en "Analyzing LVM...\n"
     960        LogFile "Analyzing LVM..."
    955961        $MINDI_LIB/analyze-my-lvm > $MINDI_TMP/lvm.res
    956962        if [ $? -ne 0 ]; then
     
    965971    done
    966972    [ "$IMAGE_DEVS" != "" ] && all_partitions="`echo "$all_partitions $IMAGE_DEVS" | tr ' ' '\n' | sort -u | tr '\n ' ' '`"
    967     printf "        %-15s %-15s %-15s %-15s %-15s\n" DEVICE MOUNTPOINT FORMAT "SIZE (MB)" LABEL/UUID | tee -a $LOGFILE
     973    printf "%-15s %-15s %-15s %-15s %15s\n" DEVICE MOUNTPOINT FORMAT "SIZE MB" LABEL/UUID | tee -a $LOGFILE
     974    printf "%-15s %-15s %-15s %-15s %15s\n" ------ ---------- ------  -------  ---------- | tee -a $LOGFILE
    968975    useless_dev="/dev/floppy /dev/fd0h1440 /dev/fd0H1440 /dev/cdrom /dev/cdrom/cdrom /dev/cdrom/cdrom1 /dev/cdrom/cdrom2 /dev/cdrom0 /dev/cdrom1 /dev/cdrom2 /dev/cdrom3 /dev/cdrw /dev/scd /dev/ram :/ /dev/sr0 /dev/sr1 /dev/cdrom1"
    969976    for c_p in $all_partitions ; do
     
    12551262        partition_format="`echo "$partition_format" | cut -d',' -f1`"; # in case user has ext3,ext2 or something dumb like that
    12561263        [ "$partition_format" = "auto" ] && partition_format="`mount | grep -w $current_partition | $AWK '{print$5;}'`"; # in case user uses 'auto' (dumb!)
    1257         unofficial_outstring=`printf "\t%-15s %-15s %-15s %7s %-15s\n" $current_partition $partition_mountpt $partition_format $psz "$label"`
     1264        unofficial_outstring=`printf "%-15s %-15s %-15s %7s %-15s\n" $current_partition $partition_mountpt $partition_format $psz "$label"`
    12581265        if [ "$current_partition" = "" ] ; then
    12591266            LogFile "Unknown partition (outstring = $unofficial_outstring)"
     
    12621269                partition_mountpt=raid
    12631270                partition_format=raid
    1264                 printf "\t%-15s %-15s %-15s %7s %-15s\n" $current_partition $partition_mountpt $partition_format $psz "$label" | tee -a $LOGFILE
     1271                printf "%-15s %-15s %-15s %7s %15s\n" $current_partition $partition_mountpt $partition_format $psz "$label" | tee -a $LOGFILE
    12651272                printf "%s %s %s %s %s %s\n" $current_partition $partition_mountpt $partition_format $partition_size "$label" >> $mountlist
    12661273            else
     
    12781285                partition_format="vfat"
    12791286            fi
    1280             printf "\t%-15s %-15s %-15s %7s %-15s\n" $current_partition $partition_mountpt $partition_format $psz "$label" | tee -a $LOGFILE
     1287            printf "%-15s %-15s %-15s %7s %-15s\n" $current_partition $partition_mountpt $partition_format $psz "$label" | tee -a $LOGFILE
    12811288            printf "%s %s %s %s %s\n" $current_partition $partition_mountpt $partition_format $partition_size "$label" >> $mountlist
    12821289        fi
    12831290    done
     1291    LogAll "-----------------------------------"
    12841292}
    12851293
     
    16821690        umount $mountpoint || Die "Cannot unmount mountpoint ($mountpoint)"
    16831691        rmdir $mountpoint || LogAll "Cannot rmdir (PBDI)"
    1684     #   losetup /dev/loop0 -d
    16851692        [ "$imagefile" != "" ] && rm -f $imagefile
    16861693        return 0
     
    18411848    includefile=$MINDI_TMP/$$.includefile.txt
    18421849
     1850    lfiles=`ls $DEPLIST_DIR/* | grep -v /minimal`
    18431851    if [ -e "$DEPLIST_FILE" ]; then
    1844         lfiles="$DEPLIST_FILE $DEPLIST_DIR/*"
    1845     else
    1846         lfiles="$DEPLIST_DIR/*"
     1852        lfiles="$DEPLIST_FILE $lfiles"
    18471853    fi
    18481854    lines=`grep -vx " *#.*" $lfiles | grep -vx "" | wc -l`
     
    18551861        pwd=`pwd`
    18561862        cd $MINDI_TMP
    1857         for i in `ListKernelModulePaths | HackPathsToFailsafe` ; do
     1863        rm -f lkm.lis
     1864        ListKernelModulePaths lkm.lis
     1865        for i in `cat lkm.lis | HackPathsToFailsafe` ; do
    18581866            tar cf - ./$i 2>> $MINDI_TMP/$$.log | (cd $bigdir ; tar xf -) || Die "PDDI can't copy $i->$bigdir" $MINDI_TMP/$$.log
    18591867        done
     1868        rm -f lkm.lis
    18601869        for i in $EXTRA_MODS ; do
    18611870            j=`find lib/modules/$FAILSAFE_KVER -name $i.*o.gz 2> /dev/null`
     
    18681877        cd $pwd
    18691878    else
    1870         ListKernelModulePaths >> $needlist
     1879        # This function appends to the file passed in param
     1880        ListKernelModulePaths $needlist
    18711881    fi
    18721882    if [ "$res" -ne "0" ] ; then
     
    18821892    DropOptimizedLibraries $needlist $bigdir
    18831893    echo -en "Assembling dependency files"
    1884     CopyDependenciesToDirectory < $needlist $bigdir
     1894
     1895    CopyDependenciesToDirectory < $needlist $bigdir `wc -l $needlist`
    18851896
    18861897    # also copy io.sys and msdos.sys, if we can find them
     
    21962207    res=0
    21972208    echo -en "..."
    2198     dd if=/dev/zero of=$tempfile bs=1k count=$ramdisk_size &> /dev/null || Die "Not enough room for temporary ramdisk (TurnTgzIntoRdz)"
     2209    dd if=/dev/zero of=$tempfile bs=1k count=$ramdisk_size &> /dev/null || Die "Not enough room for temporary ramdisk ($tempfile)"
    21992210    echo -en "..."
    22002211    LogFile "Creating ext2 filesystem on $tempfile"
     
    22142225
    22152226    cp -Rdf $tgz_dir_fname/* . 2>&1 >> $LOGFILE
    2216     tar -zxf symlinks.tgz || Die "Cannot untar symlinks.tgz"
    22172227
    22182228    cd dev || Die "Can't cd to dev"
     
    22302240    [ -e "/dev/.devfsd" ] && echo "/dev/.devfsd found" > tmp/USE-DEVFS
    22312241
    2232     # Handle the case where busybox and mount are dynamically linked
    2233     file $MINDI_LIB/rootfs/bin/busybox 2>&1 | grep -q "dynamically"
    2234     if [ $? -eq 0 ]; then
    2235         # We want to use the real mount and all the supported variants (nfs, cifs, ...)
    2236         rm -f bin/mount $MINDI_TMP/busy.lis
    2237         mountlis=`grep -E "mount|fuse|ssh" $DEPLIST_FILE $DEPLIST_DIR/* | grep -v " *#.*" | cut -d: -f2 | sort -u`
    2238         LocateDeps $MINDI_LIB/rootfs/bin/busybox $mountlis >> $MINDI_TMP/busy.lis
    2239         # Special for libs
    2240         for f in `grep -E "libnss" $DEPLIST_FILE $DEPLIST_DIR/* | grep -v " *#.*" | cut -d: -f2`; do
    2241             echo "`ReadAllLink $f`" >> $MINDI_TMP/busy.lis
    2242         done
    2243         # Initial / are trucated by tar
    2244         tar cf - $mountlis `sort -u $MINDI_TMP/busy.lis` 2>> $MINDI_TMP/$$.log | tar xf - || LogAll "Problem in mount analysis" $MINDI_TMP/$$.log
    2245         rm -f $MINDI_TMP/busy.lis
    2246     fi
     2242    # We need a minimal conf in the initial ramdisk
     2243    mountlis=`grep -v "^#.*" $DEPLIST_FILE_MIN $DEPLIST_DIR/minimal*.conf | cut -d: -f2 | sort -u`
     2244    LocateDeps $mountlis >> $MINDI_TMP/busy.lis
     2245    # Special for libs
     2246    for f in `grep -E "/lib" $DEPLIST_FILE_MIN $DEPLIST_DIR/minimal*.conf | grep -v "^#.*" | cut -d: -f2`; do
     2247        echo "`ReadAllLink $f`" >> $MINDI_TMP/busy.lis
     2248    done
     2249    # Initial / are trucated by tar
     2250    tar cf - $mountlis `sort -u $MINDI_TMP/busy.lis` 2>> $MINDI_TMP/$$.log | tar xf - || LogAll "Problem in mount analysis" $MINDI_TMP/$$.log
     2251    rm -f $MINDI_TMP/busy.lis
    22472252
    22482253    # Copy of files mandatory for ssh to automate mount if sshfs is used
    22492254    mkdir $mountpoint/.ssh
    22502255    cp -rp ~root/.ssh/*.pub ~root/.ssh/config ~root/.ssh/known* $mountpoint/.ssh 2> /dev/null
    2251     echo > $mountpoint/tmp/myssh << EOF
     2256    cat > $mountpoint/bin/myssh << EOF
    22522257ssh -o StrictHostKeyChecking=no $*
    22532258EOF
    2254     chmod 755 $mountpoint/tmp/myssh
     2259    chmod 755 $mountpoint/bin/myssh
    22552260
    22562261    # Copy of files mandatory for ld.so
     
    28072812    LogAll "Mindi Linux mini-distro generator v$MINDI_VERSION"
    28082813    LogAll "Latest Mindi is available from http://www.mondorescue.org"
    2809     LogAll "BusyBox sources are available from http://www.busybox.net"
    28102814    LogAll "------------------------------------------------------------------------------"
    28112815else
    28122816    LogFile "You are using Mindi-Linux v$MINDI_VERSION to make boot+data disks"
    28132817fi
    2814 if [ -f $MINDI_LIB/rootfs/bin/busybox ]; then
    2815     LogAll "Mindi-`$MINDI_LIB/rootfs/bin/busybox 2>&1 | head -1`"
    2816 else
    2817     LogAll "Unable to find mindi-busybox, please install it"
    2818     MindiExit -1
    2819 fi
    2820 
    28212818# for Mandrake 9.2, which comes with two aes.o.gz modules :-/
    28222819insmod /lib/modules/$KERVERRUN/*/*/misc/aes.*o.gz >> $LOGFILE 2>> $LOGFILE
Note: See TracChangeset for help on using the changeset viewer.