Changeset 2880 in MondoRescue
- Timestamp:
- Oct 5, 2011, 11:54:20 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mindi/mindi
r2876 r2880 53 53 # If set to "no", the kernel is not a Xen kernel 54 54 # If "yes", mindi will modify isolinux.cfg for the Xen kernel. 55 xenkernelpath="" 56 xenkernelname="" 55 57 56 58 MY_FSTAB=/etc/fstab … … 138 140 } 139 141 140 LogIt() { 141 if [ -e /dev/stderr ] ; then 142 echo -e "$1" >> /dev/stderr 143 elif [ -e /usr/bin/logger ] ; then 144 /usr/bin/logger -s $1 145 fi 142 LogOnly() { 146 143 echo -e "$1" >> $LOGFILE 147 144 if [ _"$2" != _"" ]; then … … 149 146 fi 150 147 rm -f "$2" 148 } 149 150 # Function to log on screen only 151 LogScreen() { 152 if [ -e /dev/stderr ] ; then 153 echo -e "$1" >> /dev/stderr 154 elif [ -e /usr/bin/logger ] ; then 155 /usr/bin/logger -s $1 156 fi 157 } 158 159 # Function to log in log file only 160 LogFile() { 161 162 echo -e "$1" >> $LOGFILE 163 if [ _"$2" != _"" ]; then 164 grep -Ev "tar: Removing \`/\'" "$2" >> $LOGFILE 165 fi 166 rm -f "$2" 167 } 168 169 # Function to log in both screen and logfile 170 LogAll() { 171 LogScreen "$1" 172 LogFile "$1" "$2" 173 } 174 175 # Preserved for compatibility 176 LogIt() { 177 LogAll "$1" "$2" 151 178 } 152 179 … … 460 487 [ ! -e "$MBOOTC32" ] && MBOOTC32=`find / -name mboot.c32 | grep -x "/.*/mboot.c32"` 461 488 [ ! -e "$MBOOTC32" ] && Die "Please install mboot.c32 first. If your syslinux RPM doesn't include mboot.c32, you may download an isolinux RPM from Mondo's website - go to http://www.mondorescue.com and click on 'Download'" 462 echo "Found mboot.c32 at $MBOOTC32" >> $LOGFILE 463 LogIt " Found mboot.c32 at $MBOOTC32" 489 LogFile "Found mboot.c32 at $MBOOTC32" 464 490 } 465 491 … … 2261 2287 2262 2288 2289 # WARNING: This function should just echo the final result !!! 2290 # 2263 2291 TryToFindKernelPath() { 2264 local fname incoming res fkern_ver we_want_version possible_kernels noof_kernels kernelpath kdate duff_kernels2292 local fname fkern_ver we_want_version possible_kernels noof_kernels possible_xenkernels noof_xenkernels kp kdate duff_kernels output root 2265 2293 2266 2294 we_want_version=$KERVERRUN 2267 2295 possible_kernels="" 2268 2296 duff_kernels="" 2297 output="" 2269 2298 2270 2299 if [ "$ARCH" = "ia64" ] ; then … … 2277 2306 # It's a Xen kernel 2278 2307 KERNEL_IS_XEN="yes" 2279 Log It"It's a Xen kernel..."2308 LogFile "It's a Xen kernel..." 2280 2309 fi 2281 2310 … … 2293 2322 # Used by ia64 2294 2323 if [ "`gzip -cd $fname | strings 2> /dev/null | grep -F "$kdate"`" = "" ] ; then 2295 Log It"Have you recompiled your kernel \"$fname\" w/o rebooting? Naughty but I'll allow it..."2324 LogFile "Have you recompiled your kernel \"$fname\" w/o rebooting? Naughty but I'll allow it..." 2296 2325 duff_kernels="$fname $duff_kernels" 2297 2326 else … … 2301 2330 else 2302 2331 if [ "`strings $fname 2> /dev/null | grep -F "$kdate"`" = "" ] ; then 2303 Log It"Have you recompiled your kernel \"$fname\" w/o rebooting?\n Naughty but I'll allow it..."2332 LogFile "Have you recompiled your kernel \"$fname\" w/o rebooting?\n Naughty but I'll allow it..." 2304 2333 duff_kernels="$fname $duff_kernels" 2305 2334 else … … 2313 2342 fi 2314 2343 if [ ! "$possible_kernels" ] ; then 2315 Log It"No kernel matches exactly. Are there any duff kernels?"2344 LogFile "No kernel matches exactly. Are there any duff kernels?" 2316 2345 possible_kernels="$duff_kernels" 2317 2346 if [ ! "$possible_kernels" ] ; then 2318 Log It"Sorry, no duff kernels either"2347 LogFile "Sorry, no duff kernels either" 2319 2348 else 2320 Log It"I bet you're running Debian or Gentoo, aren't you?"2321 Log It"Your kernel doesn't have a sane builddate. Oh well..."2349 LogFile "I bet you're running Debian or Gentoo, aren't you?" 2350 LogFile "Your kernel doesn't have a sane builddate. Oh well..." 2322 2351 fi 2323 2352 fi … … 2330 2359 noof_kernels=`CountItemsIn "$possible_kernels"` 2331 2360 if [ "$noof_kernels" -eq "0" ] ; then 2332 Log It"Could not find your kernel."2361 LogFile "Could not find your kernel." 2333 2362 if [ -e "/boot/vmlinuz" ] ; then 2334 Log It"Using /boot/vmlinuz as a last resort."2363 LogFile "Using /boot/vmlinuz as a last resort." 2335 2364 output=/boot/vmlinuz 2336 2365 else … … 2338 2367 fi 2339 2368 elif [ "$noof_kernels" -eq "1" ] ; then 2340 k ernelpath=`echo "$possible_kernels" | sed s/' '//`2341 echo "Your kernel is $kernelpath (v$KERVERRUN)" >> $LOGFILE2342 output="$k ernelpath"2369 kp=`echo "$possible_kernels" | sed s/' '//` 2370 LogFile "Your kernel is $kp (v$KERVERRUN)" 2371 output="$kp" 2343 2372 else 2344 2373 for i in $possible_kernels ; do 2345 if echo $i | grep "$KERVERRUN"; then2346 Log It"OK, I used my initiative and found that "2347 Log It"$i is probably your kernel. "2374 if [ "`echo $i | grep "$KERVERRUN"`" ]; then 2375 LogFile "OK, I used my initiative and found that " 2376 LogFile "$i is probably your kernel. " 2348 2377 output="$i" 2349 2378 break … … 2351 2380 done 2352 2381 if [ ! -n "$output" ]; then 2353 if echo " $possible_kernels " | grep -F "/boot/vmlinuz " &> /dev/null; then2382 if [ "`echo " $possible_kernels " | grep -F "/boot/vmlinuz " &> /dev/null`" ]; then 2354 2383 output=/boot/vmlinuz 2355 echo "Schlomo, this one's for you." >> $LOGFILE2384 LogFile "Schlomo, this one's for you." 2356 2385 else 2357 Log It"Two or more possible kernels found. You may specify any one of them and the "2358 Log It"boot disks will still work, probably. If one does not work, try another."2359 Log It"$possible_kernels"2360 echo""2386 LogFile "Two or more possible kernels found. You may specify any one of them and the " 2387 LogFile "boot disks will still work, probably. If one does not work, try another." 2388 LogFile "$possible_kernels" 2389 output="" 2361 2390 fi 2362 2391 fi … … 2367 2396 elif [ "$noof_xenkernels" -eq "1" ]; then 2368 2397 xenkernelpath=`echo "$possible_xenkernels" | sed s/' '//` 2369 echo "Your Xen kernel is $xenkernelpath (v$KERVERRUN)" >> $LOGFILE2398 LogFile "Your Xen kernel is $xenkernelpath (v$KERVERRUN)" 2370 2399 else 2371 2400 for i in $possible_xenkernels ; do 2372 if echo $i | grep "$KERVERRUN"; then2373 Log It"OK, I used my initiative and found that "2374 Log It"$i is probably your Xen kernel. "2401 if [ "`echo $i | grep "$KERVERRUN"`" ]; then 2402 LogFile "OK, I used my initiative and found that " 2403 LogFile "$i is probably your Xen kernel. " 2375 2404 xenkernelpath="$i" 2376 2405 break … … 2381 2410 if [ ! -n "$new_possible_xenkernels" ]; then 2382 2411 xenkernelpath=`echo $new_possible_xenkernels | tr -s ' ' '\n' | head -1` 2383 Log It"Using $xenkernelpath"2412 LogFile "Using $xenkernelpath" 2384 2413 else 2385 Log It"Two or more possible Xen kernels found. You may specify any one of them and the "2386 Log It"boot disks will still work, probably. If one does not work, try another."2387 Log It"$possible_xenkernels"2388 echo""2414 LogFile "Two or more possible Xen kernels found. You may specify any one of them and the " 2415 LogFile "boot disks will still work, probably. If one does not work, try another." 2416 LogFile "$possible_xenkernels" 2417 output="" 2389 2418 xenkernelpath=`echo $possible_xenkernels | tr -s ' ' '\n' | head -1` 2390 Log It"Using $xenkernelpath"2419 LogFile "Using $xenkernelpath" 2391 2420 fi 2392 2421 fi … … 2397 2426 fi 2398 2427 fi 2428 LogAll "TryToFindKernelPath found $output" 2399 2429 echo "$output" 2400 2430 } … … 2895 2925 if [ "$#" -ne "0" ] ; then 2896 2926 if [ "$1" = "--findkernel" ] ; then 2897 res =`TryToFindKernelPath`2927 resk=`TryToFindKernelPath` 2898 2928 # Avoids logfile content for mondo 2899 2929 export MONDO_SHARE="" 2900 if [ "$res " = "" ] ; then2930 if [ "$resk" = "" ] ; then 2901 2931 if [ $KERNEL_IS_XEN = "yes" ]; then 2902 2932 echo "$xenkernelpath" 2903 Log It"xenkernelpath = $xenkernelpath"2933 LogOnly "xenkernelpath = $xenkernelpath" 2904 2934 MindiExit 0 2905 2935 else … … 2907 2937 fi 2908 2938 else 2909 echo "$res" 2939 echo "$resk" 2940 LogOnly "kernelpath = $resk" 2910 2941 MindiExit 0 2911 2942 fi
Note:
See TracChangeset
for help on using the changeset viewer.