Changeset 1924 in MondoRescue for branches/stable/mindi/mindi
- Timestamp:
- Apr 18, 2008, 1:41:41 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mindi/mindi
r1904 r1924 108 108 109 109 BOOT_MEDIA_MESSAGE="$mindi_boot_msg" 110 110 111 FDISK=$MINDI_SBIN/parted2fdisk 111 112 … … 171 172 172 173 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" 174 176 if [ "`echo $mappath | grep -F ".gz"`" ] ; then 175 177 included_list=`gzip -dc $mappath | grep -Fi include | sed s/'"'// | sed s/'"'// | cut -d' ' -f2` … … 206 208 [ "`head $scratchfile -n1 | grep -F "bin/sh"`" != "" ] && StripComments $scratchfile "-$filename-" 207 209 [ "`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 209 213 mv $scratchfile $scratchfile.gz 210 214 gunzip -f $scratchfile || LogIt "Cannot gunzip $scratchfile.gz" … … 278 282 BIGNO=$(($BIGNO+1)) 279 283 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 282 289 gunzip -f $outdir/$incoming || LogIt "Cannot gunzip $outdir/$incoming" 283 290 fi … … 1022 1029 1023 1030 1024 MakeModuleLoadingScript() {1025 local module fname params modpath kver outerloop i modpaths kver searchpath list_to_echo j1026 tmpmodprobe_flag=$11027 outfile=$21028 > $outfile || Die "Cannot create empty $outfile"1029 echo -en "#\041/bin/sh\n\n" >> $outfile1030 echo "echo -en \"Loading your modules...\"" >> $outfile1031 if [ "$YOUR_KERNEL_SUCKS" ] ; then1032 kver=$FAILSAFE_KVER1033 cd $MINDI_TMP1034 searchpath=lib/modules/$kver1035 else1036 ###1037 ### Sq-Modification ... Use kernelname for module search path if specified1038 ###1039 #kver=`uname -r`1040 if [ "${kernelname}" != "" ]1041 then1042 kver=${kernelname}1043 else1044 kver=`uname -r`1045 fi1046 ###1047 ### Sq-Modification end1048 ###1049 searchpath=/lib/modules/$kver1050 fi1051 1052 echo -en "for outerloop in 1 2 3 4 5 ; do\necho -en \".\"\n" >> $outfile1053 list_to_echo="$MODULES"1054 # Remove unwanted modules from list1055 for i in $DENY_MODS; do1056 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 done1059 1060 # Make temporary modprobe.conf file if we are told so1061 if [ "$tmpmodprobe_flag" = "Y" ] ; then1062 infile="$MINDI_TMP/modprobe.conf.mindi"1063 find /etc/modprobe.d -maxdepth 1 -name "*" -xtype f -print0 | xargs -0 cat > $infile1064 else1065 infile="/etc/modules.conf"1066 fi1067 1068 for module in $list_to_echo $EXTRA_MODS ; do1069 params=`sed -n "s/^options \\+$module \\+//p" $infile`1070 modpaths=`FindSpecificModuleInPath $searchpath $module`1071 for i in $modpaths ; do1072 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 '#' '.' >> $outfile1079 echo -en "$i added to module list.\n" >> $LOGFILE1080 done1081 done1082 echo -en "done\n" >> $outfile1083 echo "echo \"Done.\"" >> $outfile1084 chmod +x $outfile1085 cd /1086 # Remove temporary modprobe.conf file if we have created one1087 if [ "$tmpmodprobe_flag" = "Y" ] ; then1088 rm -f $infile1089 fi1090 }1091 1092 1093 1031 MakeMountlist() { 1094 1032 local scratchdir mountlist all_partitions current_partition \ … … 2022 1960 cd $MINDI_TMP 2023 1961 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" 2025 1964 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 -) 2027 1967 else 2028 1968 ChopUpAndCopyFile $i $bigdir $CHOPSIZE $BIGNO … … 2035 1975 for k in $j ; do 2036 1976 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 -) 2038 1979 else 2039 1980 ChopUpAndCopyFile $k $bigdir $CHOPSIZE $BIGNO … … 2095 2036 [ "$?" -ne "0" ] && [ _"$MONDO_SHARE" != _"" ] && Die "Cannot find/install $MONDO_SHARE/restore-scripts" 2096 2037 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 - 2098 2040 cd $old_pwd 2099 2041 echo -e "$DONE" … … 2401 2343 cp -Rdf $tgz_dir_fname/* . 2>&1 >> $LOGFILE 2402 2344 tar -zxf symlinks.tgz || Die "Cannot untar symlinks.tgz" 2345 2403 2346 cd dev || Die "Can't cd to dev" 2404 2347 tar -zxf dev-entries.tgz || Die "Cannot untar dev-entries.tgz" … … 2409 2352 s=`which $w 2> /dev/null` 2410 2353 if [ -e "$s" ] ; then 2411 cp --parents -af $s . 2>> $LOGFILE2412 fi2413 done2414 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 2416 2359 [ -e "/dev/.devfsd" ] && echo "/dev/.devfsd found" > tmp/USE-DEVFS 2417 2360 2418 2361 # Handle the case where busybox and mount are dynamically linked 2419 # Should be done first so that if /lib64 is a link, it's2420 # created first like that, instead of as a real dir later on2421 2362 file $MINDI_LIB/rootfs/bin/busybox 2>&1 | grep -q "dynamically" 2422 2363 if [ $? -eq 0 ]; then 2364 # We want to use the real mount 2365 rm -f bin/mount 2423 2366 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 - 2425 2369 rm -f $MINDI_TMP/busy.lis 2426 2370 fi 2427 2371 2372 mkdir -p $mountpoint/tmp 2428 2373 # Management of udev (which includes modprobe in rules) 2429 2374 ps auxww | grep -v grep | grep -qw udevd 2430 2375 if [ $? -eq 0 ]; then 2431 echo "udev device manager found" > tmp/USE-UDEV2376 echo "udev device manager found" > $mountpoint/tmp/USE-UDEV 2432 2377 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 - 2434 2380 # This avoids NIC remapping if on another machine at restore time on Debian at least 2435 2381 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 - 2437 2384 if [ -x /sbin/udevd ]; then 2438 2385 lis2=`grep -Ev '^#' $MINDI_CONF/udev.files` … … 2460 2407 fi 2461 2408 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 - 2463 2411 rm -f $MINDI_TMP/udev.lis 2464 2412 else 2465 2413 echo "udevd daemon not in standard place (/sbin)" 2>&1 | tee -a $LOGFILE 2466 2414 echo "mindi will use static devices which may cause problems" 2>&1 | tee -a $LOGFILE 2467 rm -f tmp/USE-UDEV2415 rm -f $mountpoint/tmp/USE-UDEV 2468 2416 fi 2469 2417 fi … … 2478 2426 lis=`grep -Ev '^#' $MINDI_CACHE/tools.files` 2479 2427 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 - 2481 2430 fi 2482 2431 if [ -f $MINDI_CACHE/mindi-rsthw ]; then … … 2497 2446 fi 2498 2447 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 - 2500 2450 2501 2451 cd $old_pwd 2502 echo -en "..."2503 MakeModuleLoadingScript $TMPMODPROBE_FLAG $mountpoint/sbin/insert-all-my-modules2504 2452 echo -en "..." 2505 2453 old_pwd=`pwd` … … 2536 2484 needed_modules="$needed_modules `FindSpecificModuleInPath $needed_modules_path $i`" 2537 2485 done 2486 2538 2487 for i in $needed_modules ; do 2539 2488 [ -e "$i" ] && s=`du -sk $i | cut -f1` || s="" 2540 2489 [ "$YOUR_KERNEL_SUCKS" ] && i=$MINDI_TMP/$i 2541 2490 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 2544 2494 if [ ! -f $mountpoint/tmp/USE-UDEV ]; then 2545 2495 if [ "`echo "$i" | grep -F ".gz"`" ]; then 2496 echo "Uncompressing $i" >> $LOGFILE 2546 2497 gunzip -f $mountpoint/$i 2547 #i=`echo $i | sed 's/.gz//'`2548 2498 fi 2549 2499 fi … … 2551 2501 2552 2502 # 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 2562 2506 if [ ! -e "/sbin/devfsd" ] || [ "$kernelpath" = "$MINDI_LIB/vmlinuz" ] ; then 2563 2507 echo "Deleting devfsd daemon from ramdisk" >> $LOGFILE … … 2570 2514 dd if=/dev/zero of=$mountpoint/zero &> /dev/null 2571 2515 rm -f $mountpoint/zero 2572 mkdir -p $mountpoint/tmp2573 2516 if [ _"$MONDO_SHARE" != _"" ]; then 2574 2517 cp -f $MONDO_CACHE/mondo-restore.cfg $mountpoint/tmp &> /dev/null || Die "Cannot copy mondo-restore.cfg to ramdisk" … … 2666 2609 echo "-----------------------------" >> $LOGFILE 2667 2610 2668 if [ -e "/etc/conf.modules" ] && [ ! -e "/etc/modules.conf" ] ; then2669 LogIt "WARNING - Ancient distro detected." 12670 ln -sf /etc/conf.modules /etc/modules.conf2671 fi2672 2611 [ -e "/sbin/mkdosfs" ] && [ ! -e "/sbin/mkfs.vfat" ] && ln -sf /sbin/mkdosfs /sbin/mkfs.vfat 2673 2612 … … 2704 2643 2705 2644 [ "`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 we2707 # may have the modprobe configuration spread out across multiple files in2708 # directory /etc/modprobe.d. If this is the case we concatenate these files into2709 # a temporary file for further processing. Otherwise we continue in the standard2710 # way. Note further that in case /etc/modprobe.d exists, we use it and ignore2711 # /etc/modprobe.conf which is exactly what module-init-tools does. The temporary2712 # modprobe.conf file is created in MakeModuleLoadingScript. AL041128.2713 if [ -d "/etc/modprobe.d" ] && [ "`uname -r | cut -c1-3`" = "2.6" ] ; then2714 TMPMODPROBE_FLAG="Y"2715 else2716 TMPMODPROBE_FLAG="N"2717 [ -e "/etc/modprobe.conf" ] && [ ! -e "/etc/modules.conf" ] && ln -sf /etc/modprobe.conf /etc/modules.conf2718 [ ! -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 fi2720 2645 2721 2646 # Update the PATH variable if incomplete … … 3037 2962 mkdir -p $MINDI_TMP/small-all/tmp 3038 2963 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" 3040 2965 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" 3042 2967 sync 2968 sleep 2 3043 2969 LogIt "Done. Exiting." 3044 2970 MindiExit 0
Note:
See TracChangeset
for help on using the changeset viewer.