Changeset 1924 in MondoRescue for branches/stable/mindi/mindi


Ignore:
Timestamp:
Apr 18, 2008, 1:41:41 AM (16 years ago)
Author:
Bruno Cornec
Message:

svn merge -r 1902:1923 $SVN_M/branches/2.2.6

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mindi/mindi

    r1904 r1924  
    108108
    109109BOOT_MEDIA_MESSAGE="$mindi_boot_msg"
     110
    110111FDISK=$MINDI_SBIN/parted2fdisk
    111112
     
    171172
    172173    mkdir -p $bigdir/etc
    173     cp --parents -pRdf $mappath $bigdir 2>> $LOGFILE || LogIt "AKMF -- Could not copy $mappath to $bigdir"
     174    #cp --parents -pRdf $mappath $bigdir 2>> $LOGFILE || LogIt "AKMF -- Could not copy $mappath to $bigdir"
     175    tar cf - $mappath 2>> /dev/null | (cd $bigdir ; tar xf -) || LogIt "AKMF -- Could not copy $mappath to $bigdir"
    174176    if [ "`echo $mappath | grep -F ".gz"`" ] ; then
    175177        included_list=`gzip -dc $mappath | grep -Fi include | sed s/'"'// | sed s/'"'// | cut -d' ' -f2`
     
    206208    [ "`head $scratchfile -n1 | grep -F "bin/sh"`" != "" ] && StripComments $scratchfile "-$filename-"
    207209    [ "`echo "$filename" | grep -F "etc/termcap"`" != "" ] && StripComments $scratchfile "-$filename-"
    208     if [ "`echo "$filename" | grep -F "lib/modules/" | grep "\.*o\.gz"`" != "" ] ; then
     210
     211    # Uncompress modules only if not using udevd
     212    if [ "`echo "$filename" | grep -F "lib/modules/" | grep "\.*o\.gz"`" != "" ] && [ "`ps auxww | grep -v grep | grep -qw udevd`" != "" ]; then
    209213        mv $scratchfile $scratchfile.gz
    210214        gunzip -f $scratchfile || LogIt "Cannot gunzip $scratchfile.gz"
     
    278282                BIGNO=$(($BIGNO+1))
    279283            else
    280                 cp --parents -Rdf $incoming $outdir 2> /dev/null || Die "Cannot copy $incoming to $outdir - did you run out of disk space?"
    281                 if [ "`echo "$incoming" | grep "lib/modules/.*\..*o\.gz"`" != "" ] ; then
     284                #cp --parents -Rdf $incoming $outdir 2> /dev/null || Die "Cannot copy $incoming to $outdir - did you run out of disk space?"
     285                tar cf - $incoming 2> /dev/null | (cd $outdir ; tar xf -) || Die "Cannot copy $incoming to $outdir - did you run out of disk space?"
     286   
     287                # Only uncompress modules if not using udevd
     288                if [ "`echo "$incoming" | grep "lib/modules/.*\..*o\.gz"`" != "" ] && [ "`ps auxww | grep -v grep | grep -qw udevd`" != "" ]; then
    282289                    gunzip -f $outdir/$incoming || LogIt "Cannot gunzip $outdir/$incoming"
    283290                fi
     
    10221029
    10231030
    1024 MakeModuleLoadingScript() {
    1025     local module fname params modpath kver outerloop i modpaths kver searchpath list_to_echo j
    1026     tmpmodprobe_flag=$1
    1027     outfile=$2
    1028     > $outfile || Die "Cannot create empty $outfile"
    1029     echo -en "#\041/bin/sh\n\n" >> $outfile
    1030     echo "echo -en \"Loading your modules...\"" >> $outfile
    1031     if [ "$YOUR_KERNEL_SUCKS" ] ; then
    1032         kver=$FAILSAFE_KVER
    1033         cd $MINDI_TMP
    1034         searchpath=lib/modules/$kver
    1035     else
    1036 ###
    1037 ### Sq-Modification ... Use kernelname for module search path if specified
    1038 ###
    1039         #kver=`uname -r`
    1040         if [ "${kernelname}" != "" ]
    1041         then
    1042             kver=${kernelname}
    1043         else
    1044             kver=`uname -r`
    1045         fi
    1046 ###
    1047 ### Sq-Modification end
    1048 ###
    1049         searchpath=/lib/modules/$kver
    1050     fi
    1051    
    1052     echo -en "for outerloop in 1 2 3 4 5 ; do\necho -en \".\"\n" >> $outfile
    1053     list_to_echo="$MODULES"
    1054     # Remove unwanted modules from list
    1055     for i in $DENY_MODS; do
    1056         list_to_echo=`echo ${list_to_echo} | tr ' ' '\n' | grep -Ev "^${i}$" | tr '\n' ' '`
    1057         EXTRA_MODS=`echo ${EXTRA_MODS} | tr ' ' '\n' | grep -Ev "^${i}$" | tr '\n' ' '`
    1058     done
    1059 
    1060     # Make temporary modprobe.conf file if we are told so
    1061     if [ "$tmpmodprobe_flag" = "Y" ] ; then
    1062         infile="$MINDI_TMP/modprobe.conf.mindi"
    1063         find /etc/modprobe.d -maxdepth 1 -name "*" -xtype f -print0 | xargs -0 cat > $infile
    1064     else
    1065         infile="/etc/modules.conf"
    1066     fi
    1067 
    1068     for module in $list_to_echo $EXTRA_MODS ; do
    1069         params=`sed -n "s/^options \\+$module \\+//p" $infile`
    1070         modpaths=`FindSpecificModuleInPath $searchpath $module`
    1071         for i in $modpaths ; do
    1072             echo "MyInsmod $i $params > /dev/null 2> /dev/null" \
    1073                 | tr '.' '#' \
    1074                 | sed s/#o#gz/#o/ \
    1075                 | sed s/#o#gz/#o/ \
    1076                 | sed s/#ko#gz/#ko/ \
    1077                 | sed s/#ko#gz/#ko/ \
    1078                 | tr '#' '.' >> $outfile
    1079             echo -en "$i added to module list.\n" >> $LOGFILE
    1080         done
    1081     done
    1082     echo -en "done\n" >> $outfile
    1083     echo "echo \"Done.\"" >> $outfile
    1084     chmod +x $outfile
    1085     cd /
    1086     # Remove temporary modprobe.conf file if we have created one
    1087     if [ "$tmpmodprobe_flag" = "Y" ] ; then
    1088         rm -f $infile
    1089     fi
    1090 }
    1091 
    1092 
    10931031MakeMountlist() {
    10941032    local scratchdir mountlist all_partitions current_partition \
     
    20221960        cd $MINDI_TMP
    20231961        for i in `ListKernelModulePaths | HackPathsToFailsafe` ; do
    2024             cp --parents -pRdf ./$i $bigdir 2>> $LOGFILE || Die "PDDI can't cp $i->$bigdir"
     1962            #cp --parents -pRdf ./$i $bigdir 2>> $LOGFILE || Die "PDDI can't cp $i->$bigdir"
     1963            tar cf - ./$i 2>> $LOGFILE | (cd $bigdir ; tar xf -) || Die "PDDI can't copy $i->$bigdir"
    20251964            if [ "`du -sk $i | cut -f1`" -lt "$(($CHOPSIZE*2))" ] ; then
    2026                 cp --parents -pRdf $i $bigdir 2>> $LOGFILE
     1965                #cp --parents -pRdf $i $bigdir 2>> $LOGFILE
     1966                tar cf - $i 2>> $LOGFILE | (cd $bigdir ; tar xf -)
    20271967            else
    20281968                ChopUpAndCopyFile $i $bigdir $CHOPSIZE $BIGNO
     
    20351975            for k in $j ; do
    20361976                if [ "`du -sk $k | cut -f1`" -lt "$CHOPSIZE" ] ; then
    2037                     cp --parents -pRdf $k $bigdir 2>> $LOGFILE
     1977                    #cp --parents -pRdf $k $bigdir 2>> $LOGFILE
     1978                    tar cf - $k 2>> $LOGFILE | (cd $bigdir ; tar xf -)
    20381979                else
    20391980                    ChopUpAndCopyFile $k $bigdir $CHOPSIZE $BIGNO
     
    20952036        [ "$?" -ne "0" ] && [ _"$MONDO_SHARE" != _"" ] && Die "Cannot find/install $MONDO_SHARE/restore-scripts"
    20962037    fi
    2097     [ -d "/lib/dev-state" ] && cp --parents -pRdf /lib/dev-state . 2>> $LOGFILE
     2038    #[ -d "/lib/dev-state" ] && cp --parents -pRdf /lib/dev-state . 2>> $LOGFILE
     2039    [ -d "/lib/dev-state" ] && tar cf - /lib/dev-state 2>> $LOGFILE | tar xf -
    20982040    cd $old_pwd
    20992041    echo -e "$DONE"
     
    24012343    cp -Rdf $tgz_dir_fname/* . 2>&1 >> $LOGFILE
    24022344    tar -zxf symlinks.tgz || Die "Cannot untar symlinks.tgz"
     2345
    24032346    cd dev || Die "Can't cd to dev"
    24042347    tar -zxf dev-entries.tgz || Die "Cannot untar dev-entries.tgz"
     
    24092352        s=`which $w 2> /dev/null`
    24102353        if [ -e "$s" ] ; then
    2411             cp --parents -af $s . 2>> $LOGFILE
    2412         fi
    2413     done
    2414 
    2415     mkdir -p tmp
     2354            #cp --parents -af $s . 2>> $LOGFILE
     2355            tar cf - $s 2> /dev/null | tar xf -
     2356        fi
     2357    done
     2358
    24162359    [ -e "/dev/.devfsd" ] && echo "/dev/.devfsd found" > tmp/USE-DEVFS
    24172360
    24182361    # Handle the case where busybox and mount are dynamically linked
    2419     # Should be done first so that if /lib64 is a link, it's
    2420     # created first like that, instead of as a real dir later on
    24212362    file $MINDI_LIB/rootfs/bin/busybox 2>&1 | grep -q "dynamically"
    24222363    if [ $? -eq 0 ]; then
     2364        # We want to use the real mount
     2365        rm -f bin/mount
    24232366        LocateDeps $MINDI_LIB/rootfs/bin/busybox /bin/mount > $MINDI_TMP/busy.lis
    2424         cp --parents -Rdf `sort -u $MINDI_TMP/busy.lis` .
     2367        #cp --parents -Rdf `sort -u $MINDI_TMP/busy.lis` .
     2368        tar cf - /bin/mount `sort -u $MINDI_TMP/busy.lis` 2> /dev/null | tar xf -
    24252369        rm -f $MINDI_TMP/busy.lis
    24262370    fi
    24272371
     2372    mkdir -p $mountpoint/tmp
    24282373    # Management of udev (which includes modprobe in rules)
    24292374    ps auxww | grep -v grep | grep -qw udevd
    24302375    if [ $? -eq 0 ]; then
    2431         echo "udev device manager found" > tmp/USE-UDEV
     2376        echo "udev device manager found" > $mountpoint/tmp/USE-UDEV
    24322377        LogIt "udev device manager found"
    2433         cp --parents -Rdf /etc/udev . 2> /dev/null
     2378        #cp --parents -Rdf /etc/udev . 2> /dev/null
     2379        tar cf - /etc/udev 2> /dev/null | tar xf -
    24342380        # This avoids NIC remapping if on another machine at restore time on Debian at least
    24352381        rm -f ./etc/udev/rules.d/z25_persistent-net.rules
    2436         cp --parents -Rdf /lib/udev /lib64/udev . 2> /dev/null
     2382        #cp --parents -Rdf /lib/udev /lib64/udev . 2> /dev/null
     2383        tar cf - /lib*/udev 2> /dev/null | tar xf -
    24372384        if [ -x /sbin/udevd ]; then
    24382385            lis2=`grep -Ev '^#' $MINDI_CONF/udev.files`
     
    24602407                fi
    24612408            done
    2462             cp --parents -Rdf $lis `sort -u $MINDI_TMP/udev.lis` .
     2409            #cp --parents -Rdf $lis `sort -u $MINDI_TMP/udev.lis` .
     2410            tar cf - $lis `sort -u $MINDI_TMP/udev.lis` 2> /dev/null | tar xf -
    24632411            rm -f $MINDI_TMP/udev.lis
    24642412        else
    24652413            echo "udevd daemon not in standard place (/sbin)" 2>&1 | tee -a $LOGFILE
    24662414            echo "mindi will use static devices which may cause problems" 2>&1 | tee -a $LOGFILE
    2467             rm -f tmp/USE-UDEV
     2415            rm -f $mountpoint/tmp/USE-UDEV
    24682416        fi
    24692417    fi
     
    24782426            lis=`grep -Ev '^#' $MINDI_CACHE/tools.files`
    24792427            LocateDeps $lis > $MINDI_TMP/tools.lis
    2480             cp --parents -Rdf $lis `sort -u $MINDI_TMP/tools.lis` .
     2428            #cp --parents -Rdf $lis `sort -u $MINDI_TMP/tools.lis` .
     2429            tar cf - $lis `sort -u $MINDI_TMP/tools.lis` 2> /dev/null | tar xf -
    24812430        fi
    24822431        if [ -f $MINDI_CACHE/mindi-rsthw ]; then
     
    24972446    fi
    24982447
    2499     cp --parents -Rdf /dev/fd0*[1,2][4,7,8]* . 2> /dev/null
     2448    #cp --parents -Rdf /dev/fd0*[1,2][4,7,8]* . 2> /dev/null
     2449    tar cf - /dev/fd0*[1,2][4,7,8]* 2> /dev/null | tar xf -
    25002450
    25012451    cd $old_pwd
    2502     echo -en "..."
    2503     MakeModuleLoadingScript $TMPMODPROBE_FLAG $mountpoint/sbin/insert-all-my-modules
    25042452    echo -en "..."
    25052453    old_pwd=`pwd`
     
    25362484        needed_modules="$needed_modules `FindSpecificModuleInPath $needed_modules_path $i`"
    25372485    done
     2486
    25382487    for i in $needed_modules ; do
    25392488        [ -e "$i" ] && s=`du -sk $i | cut -f1` || s=""
    25402489        [ "$YOUR_KERNEL_SUCKS" ] && i=$MINDI_TMP/$i
    25412490        echo "Adding $i ($s KB) to the rootfs" >> $LOGFILE
    2542         cp --parents -pdf $i $mountpoint 2>/dev/null || LogIt "Unable to copy $i to $mountpoint"
    2543         # Uncompress modules if not useing udev and native modprobe
     2491        #cp --parents -Rpdf $i $mountpoint 2>/dev/null || LogIt "Unable to copy $i to $mountpoint"
     2492        tar cf - $i 2>/dev/null | (cd $mountpoint ; tar xf -) || LogIt "Unable to copy $i to $mountpoint"
     2493        # Uncompress modules if not using udev and native modprobe
    25442494        if [ ! -f $mountpoint/tmp/USE-UDEV ]; then
    25452495            if [ "`echo "$i" | grep -F ".gz"`" ]; then
     2496                echo "Uncompressing $i" >> $LOGFILE
    25462497                gunzip -f $mountpoint/$i
    2547                 #i=`echo $i | sed 's/.gz//'`
    25482498            fi
    25492499        fi
     
    25512501
    25522502    # Also copy modules.dep in case of udev so that normal modprobe works
    2553     cp --parents -pdf /$needed_modules_path/modules.dep $mountpoint 2>/dev/null || LogIt "Unable to copy modules.dep to $mountpoint"
    2554 
    2555     # For all modules supported, create symlinks under the mountpoint
    2556     for i in $EXTRA_MODS $NET_MODS $SCSI_MODS; do
    2557         all_modules="$all_modules `FindSpecificModuleInPath $mountpoint $i | sed 's~^$mountpoint/~~g'`"
    2558     done
    2559     for i in $all_modules; do
    2560         (cd $mountpoint ; ln -s $i . 2>/dev/null)
    2561     done
     2503    #cp --parents -Rpdf /$needed_modules_path/modules.dep $mountpoint 2>/dev/null || LogIt "Unable to copy modules.dep to $mountpoint"
     2504    tar cf - /$needed_modules_path/modules.dep 2>/dev/null | (cd $mountpoint ; tar xf -) || LogIt "Unable to copy modules.dep to $mountpoint"
     2505
    25622506    if [ ! -e "/sbin/devfsd" ] || [ "$kernelpath" = "$MINDI_LIB/vmlinuz" ] ; then
    25632507        echo "Deleting devfsd daemon from ramdisk" >> $LOGFILE
     
    25702514    dd if=/dev/zero of=$mountpoint/zero &> /dev/null
    25712515    rm -f $mountpoint/zero
    2572     mkdir -p $mountpoint/tmp
    25732516    if [ _"$MONDO_SHARE" != _"" ]; then
    25742517        cp -f $MONDO_CACHE/mondo-restore.cfg $mountpoint/tmp &> /dev/null || Die "Cannot copy mondo-restore.cfg to ramdisk"
     
    26662609echo "-----------------------------" >> $LOGFILE
    26672610
    2668 if [ -e "/etc/conf.modules" ] && [ ! -e "/etc/modules.conf" ] ; then
    2669     LogIt "WARNING - Ancient distro detected." 1
    2670     ln -sf /etc/conf.modules /etc/modules.conf
    2671 fi
    26722611[ -e "/sbin/mkdosfs" ] && [ ! -e "/sbin/mkfs.vfat" ] && ln -sf /sbin/mkdosfs /sbin/mkfs.vfat
    26732612
     
    27042643
    27052644[ "`uname -r | grep "2.4.[0-6]" | grep -v "2.4.[0-9][0-9]"`" != "" ] &&  echo "WARNING! Your kernel may have buggy loopfs code. Consider upgrading to 2.4.7"
    2706 # If we have a 2.6 kernel, the system uses module-init-tools which means that we
    2707 # may have the modprobe configuration spread out across multiple files in
    2708 # directory /etc/modprobe.d. If this is the case we concatenate these files into
    2709 # a temporary file for further processing. Otherwise we continue in the standard
    2710 # way. Note further that in case /etc/modprobe.d exists, we use it and ignore
    2711 # /etc/modprobe.conf which is exactly what module-init-tools does. The temporary
    2712 # modprobe.conf file is created in MakeModuleLoadingScript. AL041128.
    2713 if [ -d "/etc/modprobe.d" ] && [ "`uname -r | cut -c1-3`" = "2.6" ] ; then
    2714     TMPMODPROBE_FLAG="Y"
    2715 else
    2716     TMPMODPROBE_FLAG="N"
    2717     [ -e "/etc/modprobe.conf" ] && [ ! -e "/etc/modules.conf" ] && ln -sf /etc/modprobe.conf /etc/modules.conf
    2718     [ ! -e "/etc/modules.conf" ] && Die "/etc/modules.conf not found; you may have to create a softlink from /etc/conf.modules to /etc/modules.conf; of course, all good distros use modules.conf anyway..."
    2719 fi
    27202645
    27212646# Update the PATH variable if incomplete
     
    30372962    mkdir -p $MINDI_TMP/small-all/tmp
    30382963    MakeMountlist $MINDI_TMP/small-all/tmp/mountlist.txt
    3039     cp -f $MINDI_TMP/{filelist.full.gz,biggielist.txt} $MONDO_CACHE/mondo-restore.cfg $MINDI_CACHE/small-all/tmp 2>/dev/null || Die "Cannot copy small all.tar.gz"
     2964    cp -f $MINDI_TMP/{mountlist.txt,filelist.full.gz,biggielist.txt} $MONDO_CACHE/mondo-restore.cfg $MINDI_CACHE/small-all/tmp 2>/dev/null || Die "Cannot copy small all.tar.gz"
    30402965    cd $MINDI_TMP/small-all
    3041     tar -cv tmp | gzip -9 > $MINDI_CACHE/all.tar.gz || Die "Cannot make small all.tar.gz"
     2966    tar -cv ./tmp | gzip -9 > $MINDI_TMP/all.tar.gz || Die "Cannot make small all.tar.gz"
    30422967    sync
     2968    sleep 2
    30432969    LogIt "Done. Exiting."
    30442970    MindiExit 0
Note: See TracChangeset for help on using the changeset viewer.