Changeset 2445 in MondoRescue for branches/2.2.10/mindi/mindi
- Timestamp:
- Oct 2, 2009, 4:30:07 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mindi/mindi
r2444 r2445 34 34 TMPDIR=/tmp 35 35 36 EXTRA_SPACE= 49152# increase if you run out of ramdisk space36 EXTRA_SPACE=60000 # increase if you run out of ramdisk space 37 37 BOOT_SIZE=16384 # size of the boot disk 38 38 … … 92 92 . $MINDI_CONFIG 93 93 fi 94 DEPLIST_FILE="$MINDI_CONF/deplist.txt" 94 DEPLIST_FILE="$MINDI_CONF/deplist.conf" 95 DEPLIST_FILE_MIN="$MINDI_CONF/deplist-minimal.conf" 95 96 DEPLIST_DIR="$MINDI_CONF/deplist.d" 96 97 … … 153 154 return 154 155 fi 155 else156 echo -en "`basename $mappath | tr '.' '#' | sed s/#kmap#gz// | sed s/#inc#gz//` " | tr '#' '.'157 156 fi 158 157 … … 181 180 local outdir incoming fname counter d found 182 181 outdir=$1 182 noof_lines=$2 183 183 mkdir -p $outdir 184 184 incoming=`ReadLine` 185 counter=0185 progress=0 186 186 while [ "$incoming" != "" ] ; do 187 187 # Non absolute file names should not arrive till here => skipped … … 199 199 done 200 200 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 202 202 elif [ -e "$incoming" ] && [ $found = "false" ]; then 203 203 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 … … 208 208 fi 209 209 [ -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 215 212 fi 216 213 incoming=`ReadLine` … … 315 312 FindAndAddUserKeyboardMappingFile() { 316 313 local r res mapfile mappath included_item included_list keyfile mp locale 317 Log All"Analyzing your keyboard's configuration."314 LogFile "Analyzing your keyboard's configuration." 318 315 KEYDIR=/lib/kbd 319 316 [ ! -e "$KEYDIR" ] && KEYDIR=/usr/share/kbd # Slackware … … 326 323 return 0 327 324 fi 325 LogFile "Adding the following keyboard mapping tables: " 328 326 if [ -e "/etc/sysconfig/keyboard" ] ; then 329 327 LogFile "Red Hat-style config detected." … … 337 335 elif [ -e "/etc/console/boottime.kmap.gz" ] ; then 338 336 LogFile "Debian-style config detected." 339 echo -en "Adding the following keyboard mapping tables: "340 337 mkdir -p $bigdir/tmp 341 338 echo "/etc/console/boottime.kmap.gz" > $bigdir/tmp/KEYMAP-LIVES-HERE … … 347 344 elif [ -e "/etc/console-setup/boottime.kmap.gz" ] ; then 348 345 LogFile "Ubuntu-style config detected." 349 echo -en "Adding the following keyboard mapping tables: "350 346 mkdir -p $bigdir/tmp 351 347 echo "/etc/console-setup/boottime.kmap.gz" > $bigdir/tmp/KEYMAP-LIVES-HERE … … 359 355 keyfile=/etc/conf.d/keymaps 360 356 else 361 echo -en"Searching for rc.config ..."357 LogAll "Searching for rc.config ..." 362 358 keyfile=`find /etc -name rc.config | head -n1` 363 359 if [ "$keyfile" = "" ] || [ ! -e "$keyfile" ] ; then … … 385 381 [ ! "$mp" ] && mp=`grep "i[3-8]86" $MINDI_TMP/keymaps.find | grep "$locale[^r][^/]" | grep -vx " *#.*"` 386 382 # If we have multiple keymaps then log it !! 387 echo "$mp" | grep -q " " 383 echo "$mp" | grep -q " " >> $LOGFILE 388 384 if [ $? -eq 0 ]; then 389 385 LogAll "WARNING: Multiple keymaps found: $mp" … … 402 398 return 403 399 fi 404 echo -en "Adding the following keyboard mapping tables: "405 400 mkdir -p $bigdir/tmp 406 401 echo "$mappath" > $bigdir/tmp/KEYMAP-LIVES-HERE … … 731 726 ListKernelModulePaths() { 732 727 local module_list module fname oss r kern 728 outfile=$1 729 echo -en "Analyzing modules requirements" 733 730 oss="/root/oss/modules" 734 731 module_list="$MODULES" … … 751 748 ### Sq-Mod End 752 749 ### 750 noof_lines=0 751 for module in $module_list $EXTRA_MODS ; do 752 noof_lines=$(($noof_lines+1)) 753 done 754 progress=0 753 755 for module in $module_list $EXTRA_MODS ; do 754 756 r=`find /lib/modules/$kern -type f | grep "/${module}\..*o" | tail -n1` 755 757 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 761 765 } 762 766 … … 932 936 absolute_partition old_partition_fmt current_lvolume uname skip 933 937 938 LogFile "------------------------------------" 934 939 LogFile "Your raw fstab file looks like this:" 935 940 LogFile "------------------------------------" 936 941 cat $MY_FSTAB >> $LOGFILE 942 LogAll "-----------------------------------" 937 943 LogAll "Your mountlist will look like this:" 938 944 LogAll "-----------------------------------" … … 952 958 953 959 if [ $LVM != "false" ]; then 954 echo -en "Analyzing LVM...\n"960 LogFile "Analyzing LVM..." 955 961 $MINDI_LIB/analyze-my-lvm > $MINDI_TMP/lvm.res 956 962 if [ $? -ne 0 ]; then … … 965 971 done 966 972 [ "$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 968 975 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" 969 976 for c_p in $all_partitions ; do … … 1255 1262 partition_format="`echo "$partition_format" | cut -d',' -f1`"; # in case user has ext3,ext2 or something dumb like that 1256 1263 [ "$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"` 1258 1265 if [ "$current_partition" = "" ] ; then 1259 1266 LogFile "Unknown partition (outstring = $unofficial_outstring)" … … 1262 1269 partition_mountpt=raid 1263 1270 partition_format=raid 1264 printf " \t%-15s %-15s %-15s %7s %-15s\n" $current_partition $partition_mountpt $partition_format $psz "$label" | tee -a $LOGFILE1271 printf "%-15s %-15s %-15s %7s %15s\n" $current_partition $partition_mountpt $partition_format $psz "$label" | tee -a $LOGFILE 1265 1272 printf "%s %s %s %s %s %s\n" $current_partition $partition_mountpt $partition_format $partition_size "$label" >> $mountlist 1266 1273 else … … 1278 1285 partition_format="vfat" 1279 1286 fi 1280 printf " \t%-15s %-15s %-15s %7s %-15s\n" $current_partition $partition_mountpt $partition_format $psz "$label" | tee -a $LOGFILE1287 printf "%-15s %-15s %-15s %7s %-15s\n" $current_partition $partition_mountpt $partition_format $psz "$label" | tee -a $LOGFILE 1281 1288 printf "%s %s %s %s %s\n" $current_partition $partition_mountpt $partition_format $partition_size "$label" >> $mountlist 1282 1289 fi 1283 1290 done 1291 LogAll "-----------------------------------" 1284 1292 } 1285 1293 … … 1682 1690 umount $mountpoint || Die "Cannot unmount mountpoint ($mountpoint)" 1683 1691 rmdir $mountpoint || LogAll "Cannot rmdir (PBDI)" 1684 # losetup /dev/loop0 -d1685 1692 [ "$imagefile" != "" ] && rm -f $imagefile 1686 1693 return 0 … … 1841 1848 includefile=$MINDI_TMP/$$.includefile.txt 1842 1849 1850 lfiles=`ls $DEPLIST_DIR/* | grep -v /minimal` 1843 1851 if [ -e "$DEPLIST_FILE" ]; then 1844 lfiles="$DEPLIST_FILE $DEPLIST_DIR/*" 1845 else 1846 lfiles="$DEPLIST_DIR/*" 1852 lfiles="$DEPLIST_FILE $lfiles" 1847 1853 fi 1848 1854 lines=`grep -vx " *#.*" $lfiles | grep -vx "" | wc -l` … … 1855 1861 pwd=`pwd` 1856 1862 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 1858 1866 tar cf - ./$i 2>> $MINDI_TMP/$$.log | (cd $bigdir ; tar xf -) || Die "PDDI can't copy $i->$bigdir" $MINDI_TMP/$$.log 1859 1867 done 1868 rm -f lkm.lis 1860 1869 for i in $EXTRA_MODS ; do 1861 1870 j=`find lib/modules/$FAILSAFE_KVER -name $i.*o.gz 2> /dev/null` … … 1868 1877 cd $pwd 1869 1878 else 1870 ListKernelModulePaths >> $needlist 1879 # This function appends to the file passed in param 1880 ListKernelModulePaths $needlist 1871 1881 fi 1872 1882 if [ "$res" -ne "0" ] ; then … … 1882 1892 DropOptimizedLibraries $needlist $bigdir 1883 1893 echo -en "Assembling dependency files" 1884 CopyDependenciesToDirectory < $needlist $bigdir 1894 1895 CopyDependenciesToDirectory < $needlist $bigdir `wc -l $needlist` 1885 1896 1886 1897 # also copy io.sys and msdos.sys, if we can find them … … 2196 2207 res=0 2197 2208 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)" 2199 2210 echo -en "..." 2200 2211 LogFile "Creating ext2 filesystem on $tempfile" … … 2214 2225 2215 2226 cp -Rdf $tgz_dir_fname/* . 2>&1 >> $LOGFILE 2216 tar -zxf symlinks.tgz || Die "Cannot untar symlinks.tgz"2217 2227 2218 2228 cd dev || Die "Can't cd to dev" … … 2230 2240 [ -e "/dev/.devfsd" ] && echo "/dev/.devfsd found" > tmp/USE-DEVFS 2231 2241 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 2247 2252 2248 2253 # Copy of files mandatory for ssh to automate mount if sshfs is used 2249 2254 mkdir $mountpoint/.ssh 2250 2255 cp -rp ~root/.ssh/*.pub ~root/.ssh/config ~root/.ssh/known* $mountpoint/.ssh 2> /dev/null 2251 echo > $mountpoint/tmp/myssh << EOF2256 cat > $mountpoint/bin/myssh << EOF 2252 2257 ssh -o StrictHostKeyChecking=no $* 2253 2258 EOF 2254 chmod 755 $mountpoint/ tmp/myssh2259 chmod 755 $mountpoint/bin/myssh 2255 2260 2256 2261 # Copy of files mandatory for ld.so … … 2807 2812 LogAll "Mindi Linux mini-distro generator v$MINDI_VERSION" 2808 2813 LogAll "Latest Mindi is available from http://www.mondorescue.org" 2809 LogAll "BusyBox sources are available from http://www.busybox.net"2810 2814 LogAll "------------------------------------------------------------------------------" 2811 2815 else 2812 2816 LogFile "You are using Mindi-Linux v$MINDI_VERSION to make boot+data disks" 2813 2817 fi 2814 if [ -f $MINDI_LIB/rootfs/bin/busybox ]; then2815 LogAll "Mindi-`$MINDI_LIB/rootfs/bin/busybox 2>&1 | head -1`"2816 else2817 LogAll "Unable to find mindi-busybox, please install it"2818 MindiExit -12819 fi2820 2821 2818 # for Mandrake 9.2, which comes with two aes.o.gz modules :-/ 2822 2819 insmod /lib/modules/$KERVERRUN/*/*/misc/aes.*o.gz >> $LOGFILE 2>> $LOGFILE
Note:
See TracChangeset
for help on using the changeset viewer.