source: MondoRescue/branches/3.3/contrib/mkcd/setup

Last change on this file was 3889, checked in by Bruno Cornec, 8 weeks ago

Remove EFI references for ia64

  • Property svn:executable set to *
File size: 21.4 KB
Line 
1#!/bin/sh
2
3
4##########################################################################
5# SETUP for Mondo/Mindi installation CD, by Hugo Rabson
6#
7#
8# 07/14
9# - added SLES support
10# - added NNA support
11#
12# 06/29/2004
13# - if finals and snapshots are present, use snapshots
14#
15# 06/20/2004
16# - patch by Geofuz@netscape.com
17#
18# 06/08/2004
19# - upgraded to Mondo 2.0, Mindi 1.0
20# - fixed bug related to softlinks (xxx.86-64 --> xxxx.amd64)
21#
22# 05/23/2004
23# - added SuSE 9.1 (64-bit) slang/newt workaround
24#
25# 04/25/2004
26# - fixed bug which stopped RPM-based distros whose dirs are softlinks
27# from having their dependencies resolved properly
28#
29# 04/15/2004
30# - fixed RHT9-specific Mondo/Mindi installation bug
31#
32# 04/02/2004
33# - added RHE2.1 support
34#
35# 03/29/2004
36# - added Fedora 2 and SuSE 8.1 support (thanks, Mike Roark, for slang RPM)
37#
38# 03/25/2004
39# - changed $command from 'rpm -Uvh ...' to just '...'; now, it's called
40# as 'rpm -Uvh $command' not '$command' --- required for SuSE 9
41# compatibility
42#
43# 03/23/2004
44# - added Knoppix 3.3 preliminary support
45#
46# 02/22/2004
47# - added Mitel 6.0 support (a.k.a. SME 6.0)
48#
49# 01/15/2004
50# - added RHE 3.0 to the mix
51#
52# 01/02/2004
53# - FindMissingRPMs() was installing finals, not snapshots, under
54# certain circumstances - FIXED
55#
56# 11/18/2003
57# - make sure to remove all _old_ mindi, mondo stuff from HDD
58#
59# 10/20/2003
60# - added Fedore Core support
61#
62# 10/19/2003
63# - added code to distinguish zisofs from zisofs-tools when looking
64# for missing RPMs
65#
66# 10/16/2003
67# - friendlier messages re: umount /mnt/cdrom
68#
69# 10/06/2003
70# - better handling of dirs w/ final & snapshot in them at same time
71#
72# 09/22/2003
73# - added SuSE and Trustix to the mix
74# - uninstall cdrecord if version is < 1.10
75#
76# 09/08/2003
77# - added partimagehack to the mix
78#
79# 07/31/2003
80# - fixed input param bug
81#
82# 05/20/2003
83# - added code to deal with mindi-kernel rpm
84#
85# 05/03/2003
86# - copy self to /tmp/$RANDOM.$RANDOM.txt and run from there
87# - unmount (if not supermount) and eject CD at end of install
88#
89# 04/25/2003
90# - pause before exiting, even Die()'ing
91#
92# 01/10/2003
93# - misc bugs fixed
94#
95# 12/10/2002
96# - misc bugs fixed
97#
98# 12/07/2002
99# - changed ALX to ARK (ArkLinux)
100#
101# 11/31/2002
102# - report success/failure at end
103#
104# 11/29/2002
105# - tweaked it to automount; also to look for mondo/mindi RPMs in
106# the distro's directory before trying the vanilla RPMs
107#
108# 08/12/2002
109# - minor tweaks
110#
111# 03/29/2002
112# - started keeping a changelog in here
113##########################################################################
114
115
116InBkgd() {
117 cd /
118 sleep 1
119 umount $1
120 eject $2
121}
122
123# ------------------------- main -------------------------
124
125
126LOGFILE=/tmp/mondo-setup.log
127STABLE_BRANCH=2.0
128DEVEL_BRANCH=2.1
129
130
131
132
133Die() {
134 LogIt "$1"
135 LogIt ""
136 echo -en "Press ENTER to abort." 2> /dev/stderr
137 read line
138 cd /
139 exit 1
140}
141
142
143
144GetDistroBanner() {
145 local fname res
146
147 if uname -a | grep Knoppix > /dev/null ; then
148 echo "Knoppix LiveCD"
149 return
150 fi
151
152 res=`cat /etc/issue.net 2>/dev/null | grep -i turbolinux | head -n1`
153 if [ "$res" != "" ] ; then
154 echo "$res"
155 return
156 fi
157
158 for fname in `find /etc -maxdepth 1 | grep -E 'release|issue'` ; do
159 res=`cat $fname 2>/dev/null | grep -i "linux" | head -n1 | tr -s '\t' ' '`
160 [ "$res" = "" ] && res=`cat $fname |head -n1 | tr -s '\t' ' '`
161 if [ "$res" != "" ] ; then
162 echo "$res"
163 return
164 fi
165 done
166#echo "fname = $fname" > /dev/stderr
167
168 echo "UNKNOWN"
169}
170
171#GetDistroBanner
172#exit 0
173
174
175GetDistroName() {
176 local banner name
177 banner="`GetDistroBanner`"
178 name="X" ;# unknown
179#echo "banner = $banner" >> /dev/stderr
180 StrStr "`cat /etc/issue.net 2> /dev/null | head -n1`" "SuSE Linux Openexchange" && name=SLX; # SuSE Openexchange
181 StrStr "`cat /etc/issue.net 2> /dev/null | head -n1`" "SuSE SLES" && name=SLE; # SLES
182 StrStr "$banner" "OpenNA" && name="NNA" ;# OpenNA
183 StrStr "$banner" "Fedora" && name="FDR" ;# Fedora
184 StrStr "$banner" "Red Hat" && name="RHT" ;# Red Hat
185 StrStr "$banner" "Red Hat Linux Advanced" && name="RHE" ;# Red Hat E
186 StrStr "$banner" "Red Hat Linux Enterprise" &&name="RHE" ;# Red Hat E
187 StrStr "$banner" "Red Hat Advanced" && name="RHE"
188 StrStr "$banner" "Red Hat Enterprise" && name="RHE"
189 StrStr "$banner" "White Box Enterprise" && name="RHE";# Red Hat Enterpr.
190 StrStr "$banner" "Red Hat Enterprise" && name="RHE"
191 StrStr "$banner" "Mandrake" && name="MDK" ;# Mandrake
192 StrStr "$banner" "e-Smith" && name="SME" ;# e-Smith / SME
193 StrStr "$banner" "SME Server" && name="SME" ;# e-Smith / SME
194 StrStr "$banner" "Mitel" && name="SME" ;# Mitel a.k.a. SME
195 StrStr "$banner" "SuSE" && name="SUS" ;# SuSE
196 StrStr "$banner" "Trustix" && name="TSL" ;# Trustix
197 uname -a | grep Knoppix > /dev/null && name="KPX" ;# Knoppix
198 if StrStr "$banner" "Turbolinux" ; then
199 StrStr "$banner" "Server" && name="TLS" ;# TurboLinux Server
200 StrStr "$banner" "Server" || name="TLW" ;# TurboLinux WorkSt'n
201 fi
202 if StrStr "$banner" "Caldera" ; then
203 StrStr "$banner" "Server" && name="CALe";# Caldera e-Server
204 StrStr "$banner" "Server" || name="CALo";# Caldera OpenLinux
205 fi
206 if [ "$name" != "RHE" ] ; then
207 for i in "ArkLinux ARK" "Gentoo GEN" "RedHat RHT" "Mandrake MDK" ; do
208 d=`echo "$i" | cut -d' ' -f1`
209 e=`echo "$i" | cut -d' ' -f2`
210 if strings /etc/ld.so.cache | grep -i "$d" &> /dev/null ; then
211 echo $e
212 return
213 fi
214 done
215 fi
216 echo "$name"
217}
218
219
220
221FindMissingRPMs() {
222 local i pkg missing_packages j todo k blah q
223 missing_packages=""
224 todo=`find $1/*.rpm | grep -v mondo | grep -v mindi`
225 if [ "`GetDistroName`" = "NNA" ] ; then
226 echo "Sorry - no mindi-kernel or partimagehack for OpenNNA" > /dev/stderr
227 else
228 for i in mindi-kernel partimagehack ; do
229# "mindi-$MINDI_BRANCH" "mondo-$MY_BRANCH" ; do
230 [ "`echo "$i" | grep mindi`" ] && qq=head || qq=tail
231 j=`find $1/ -type f -maxdepth 1 | grep "$i" | $qq -n1`
232 [ ! "$j" ] && j=`find RPMS/ -type f -maxdepth 1 | grep -F "$i" | $qq -n1`
233 if [ ! "$j" ] ; then
234 echo "Looking for $i" >> /dev/stderr
235 echo "Looking in $1" >> /dev/stderr
236 echo "pwd = `pwd`" >> /dev/stderr
237 echo "I ran 'find $1 -type f -maxdepth 1 | grep $i" >> /dev/stderr
238 Die "Unable to find $i in $1 or RPMS/"
239 fi
240 todo="$todo $j"
241 done
242 fi
243
244# echo "todo = '$todo'" >> /dev/stderr
245
246 for i in $todo ; do
247# echo "i = $i" > /dev/stderr
248 [ -d "$i" ] && continue
249 StrStr "$i" ".rpm" || continue
250 i=`basename $i`
251 j=`echo "$i" | tr '.' '#' | sed s/#rpm// | sed s/#i[3-8]86// | tr -s '#' '.'`
252 k=`echo "$j" | cut -d'-' -f1`
253 for blah in devel doc http kernel libs newt theme tools ; do
254 if echo "$j" | grep "\-$blah" &> /dev/null ; then
255 k=`echo "$j" | cut -d'-' -f1,2`
256 if echo "$j" | grep -E '^[A-Z,a-Z]*-[A-Z,a-Z]*-[A-Z,a-z]*-.*$' &> /dev/null ; then
257 k=`echo "$j" | cut -d'-' -f1,2,3`
258 fi
259 fi
260 done
261 rpm -q $k &> /dev/null && continue
262## remove xmondo thingy
263 echo "$i" | grep xmondo &> /dev/null && continue
264 missing_packages="$missing_packages $i"
265 done
266 echo "$missing_packages"
267}
268
269
270
271GetDistroVersion() {
272 local banner i res j
273 banner="`GetDistroBanner`"
274 res=""
275 j="`cat /etc/issue.net 2> /dev/null | head -n1`"
276 if StrStr "$j" "Openexchange" || StrStr "$j" "SLES" ; then
277 banner="$j"
278 fi
279# echo "banner = $banner" >> /dev/stderr
280 for i in $banner ; do
281 j=`echo $i | grep -E '^[v|V][0-9]+*.*$'`
282 [ ! "$j" ] && j=`echo $i | grep -E '^[0-9]+*.*$'`
283 echo "$j" | grep -E '^[0-9]*)$' > /dev/null && continue
284 [ "$j" ] && res=`echo $j | sed s/v// | sed s/V//`
285 done
286 [ "$res" = "2.1AS" ] && res="2.1"
287 if echo "$banner" | grep SLES &> /dev/null ; then
288 res="`echo "$banner" | sed s/SLES/#/ | cut -d'#' -f2 | cut -d' ' -f2`"
289# echo "banner = $banner"
290# echo "res = $res"
291 fi
292 [ "$res" ] && echo "$res"
293}
294
295
296GetDistroArchitecture() {
297 local arch
298 for arch in x86_64 x86-64 amd64 opteron ; do
299 if grep -i "$arch" /etc/issue.net &> /dev/null ; then
300# [ "$arch" = "x86_64" ] && arch=amd64; # hack - FIXME
301 echo $arch
302 return 0
303 fi
304 done
305
306 echo ia32
307 return 0
308}
309
310
311
312
313
314InstallFromRpms() {
315 local distro_TLA distro_ver distro_title replacement ch res q distro_arch rpms_path
316 distro_TLA=$1
317 distro_ver=$2
318 distro_arch=$3
319# Look in directory 'RPMS/$distro_TLA' for a file called 'name' which contains
320# the user-friendly name of this distribution.
321 distro_title=`cat RPMS/$distro_TLA/name`
322 echo "InstallFromRPMS($distro_TLA,$distro_ver,$distro_arch) --- title = $distro_title" >> $LOGFILE
323# $CDPATH/
324 rpms_path=RPMS/$distro_TLA/$distro_ver
325 [ "$distro_arch" != "ia32" ] && rpms_path=$rpms_path.$distro_arch
326
327# Find a (compatible) version closest or identical to this user's version.
328 if [ ! -d "$rpms_path" ] ; then
329 replacement=`find RPMS/$distro_TLA -type d | tail -n1`
330 replacement=`basename $replacement`
331 echo -en "Version $distro_ver is not supported. Would $replacement do? "
332 read ch
333 StrStr "YyYESyesYes" "$ch" && distro_ver=$replacement || Die "Please install Mondo manually.\nType 'cd $CDPATH/RPMS/$distro_TLA and \ninstall the RPMs of your choice."
334 fi
335# Install RPMs from this directory.
336 LogIt "Locating and installing packages suitable for $distro_title v $distro_ver"
337 for q in XMondo mondo mindi mindi-kernel partimagehack bootsplash-theme-SuSE ; do
338 echo -en "."
339 rpm -q $q &> /dev/null && rpm --erase $q --nodeps 2>> $LOGFILE >> $LOGFILE
340 done
341# make list of and install missing packages
342 if rpm -q cdrecord 2> /dev/null | grep "cdrecord-1\.[5-8]" ; then
343 echo -en "Uninstalling outdated cdrecord package..."
344 rpm --erase --nodeps cdrecord
345 echo "Done."
346 fi
347 echo -en "."
348
349 rm -Rf /usr/local/share/mondo /usr/share/mondo /usr/local/share/mindi /usr/share/mindi
350
351# remove packages which could be broken, then upgrade them
352 if find $rpms_path/*slang*rpm > /dev/null 2> /dev/null ; then
353 rpm --erase --nodeps slang 2> /dev/null
354 rpm --erase --nodeps slang-devel 2> /dev/null
355 rpm -i --nodeps $rpms_path/*slang*rpm
356 fi
357 if find $rpms_path/*newt*rpm > /dev/null 2> /dev/null ; then
358 rpm --erase --nodeps newt 2> /dev/null
359 rpm --erase --nodeps newt-devel 2> /dev/null
360 rpm --erase --nodeps lib64newt0.50 2> /dev/null
361 rpm --erase --nodeps lib64newt0.51 2> /dev/null
362 fi
363
364 for i in mondoarchive mondorestore mindi ; do
365 for j in 1 2 3 ; do
366 which $i &> /dev/null && rm -f `which $i`
367 done
368 done
369
370# install missing pkgs
371
372# echo "rpms_path = $rpms_path" >> /dev/stderr
373 [ "$rpms_path" = "RPMS/SUS/9.1.x86-64" ] && ln -sf libnewt.so.0.51 /usr/lib64/libnewt.so.0.50
374 if [ "$rpms_path" = "RPMS/SUS/9.1" ] ; then
375 ln -sf libnewt.so.0.51 /usr/lib/libnewt.so.0.50
376 if ! ls /usr/lib/libslang-utf8* &> /dev/null ; then
377 ln -sf libslang.so.1 /usr/lib/libslang-utf8.so.1
378 fi
379 fi
380# [ "$rpms_path" = "RPMS/SLE/8" ] && ln -sf libslang-utf8.so.1 /usr/lib/libslang.so.1
381 if ls $rpms_path/mondo* &> /dev/null ; then
382 InstallMissingPackages $rpms_path $rpms_path
383 else
384 InstallMissingPackages $rpms_path RPMS
385 fi
386 res=$?
387# PostInstallSanityChecks
388# res=$(($res+$?))
389 return $res
390}
391
392
393UntarAndMakeMindi() {
394 local tarball res builddir pkg q branch tarball outdir bindir
395
396 pkg=mindi
397 branch=$1
398 builddir=/tmp/setup.$$
399 mkdir -p $builddir
400 cd $builddir
401
402 tarball=`find $CDPATH/TGZS/$pkg-$branch*tgz | tail -n1`
403 [ -e "$tarball" ] || return 1
404 tar -zxf $tarball || return 1
405 if uname -a | grep Knoppix > /dev/null ; then
406 stub=`echo "$tarball" | gawk -F '/' '{print $NF;}' | cut -d'.' -f1,2`
407# echo "stub = $stub"
408 outdir=/ramdisk/tmp/$pkg
409 mkdir -p $outdir || return 1
410 tar -zxf $tarball -C $outdir
411 cd $outdir
412 cd $outdir/$stub
413# cp -f /mnt/mondostuff/mondocvs/mindi-devel/install.sh . 2> /dev/null
414# cp -f /mnt/mondostuff/mondocvs/mindi-devel/mindi . 2> /dev/null
415 ./install.sh || return 1
416 else
417 Die "Not written yet"
418 fi
419
420 cd /tmp
421 [ "$builddir" ] && [ -d "$builddir" ] && rm -Rf $builddir
422 return 0
423}
424
425
426
427UntarAndMakeMondo() {
428 local tarball res builddir pkg q branch tarball q outdir bindir
429
430 pkg=mondo
431 branch=$1
432 builddir=/tmp/setup.$$
433 mkdir -p $builddir
434 cd $builddir
435
436 tarball=`find $CDPATH/TGZS/$pkg-$branch*tgz | tail -n1`
437 [ -e "$tarball" ] || return 1
438 tar -zxf $tarball || return 1
439 if uname -a | grep Knoppix > /dev/null ; then
440 stub=`echo "$tarball" | gawk -F '/' '{print $NF;}' | cut -d'.' -f1,2`
441# echo "stub = $stub"
442 outdir=/ramdisk/usr/local/share/$pkg
443 bindir=/ramdisk/usr/bin
444 mkdir -p $bindir
445 mkdir -p $outdir || return 1
446 rm -Rf $outdir/*
447 tar -zxf $tarball -C $outdir $stub/$pkg/{restore-scripts,do-not-compress-these}
448 mv $outdir/$stub/$pkg/* $outdir
449 rm -Rf $outdir/$stub
450 for q in mondoarchive mondorestore ; do
451 cp -f $CDPATH/stuff/$q.static $outdir/$q || Die "Can't copy static $q"
452 ln -sf $outdir/$q $bindir/$q
453 done
454 else
455 tar -zxf $tarball || return 1
456 dir=`find $pkg-$branch* -type d`
457 echo hi > test.txt
458 cd $builddir/$dir || return 1
459 ./configure || return 1
460 make VERSION=$MY_BRANCH -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_REENTRANT || return 1
461 make install || return 1
462 fi
463 cd /tmp
464 [ "$builddir" ] && [ -d "$builddir" ] && rm -Rf $builddir
465 return 0
466}
467
468
469
470
471InstallPIH() {
472 local pkg branch builddir tarball
473 pkg=partimagehack
474 branch=$1
475 builddir=/tmp/setup.$$
476 outdir=/ramdisk/usr/bin
477 mkdir -p $builddir
478 cd $builddir
479
480 tarball=`find $CDPATH/TGZS/$pkg-$branch*bz2 | tail -n1`
481 [ -e "$tarball" ] || return 1
482
483 if uname -a | grep Knoppix > /dev/null ; then
484 stub=`echo "$tarball" | gawk -F '/' '{print $NF;}' | cut -d'.' -f1,2,3`
485# echo "stub = $stub"
486 tar -jxf $tarball -C $outdir $stub/partimagehack || return 1
487 mv -f $outdir/$stub/partimagehack $outdir
488 else
489 Die "InstallPIH doesn't work for non-Knoppix systems yet"
490 fi
491 cd /tmp
492 return 0
493}
494
495
496
497
498#CDPATH=/mnt/mondostuff/MondoCD
499#InstallPIH 0.6
500#UntarAndMakeMondo 1.7
501#UntarAndMakeMindi 0.9
502#exit 0
503
504
505InstallFromTgzs() {
506 local res old_pwd
507
508 old_pwd=`pwd`
509 res=0
510 if uname -a | grep Knoppix > /dev/null && [ "$MY_BRANCH" = "1.6" ] ; then
511 Die "Only mondo-devel supports Knoppix."
512 fi
513
514 UntarAndMakeMondo $MY_BRANCH || Die "Failed to build mondo $MY_BRANCH"
515 UntarAndMakeMindi $MINDI_BRANCH || Die "Failed to build mindi $MINDI_BRANCH"
516 InstallPIH 0.6 || Die "Failed to install partimagehack from tarball"
517 cd $old_pwd
518 return $res
519}
520
521
522
523
524InstallMissingPackages() {
525 local res pkg missing_packages command packages_path mindimondo_path possible_packages c2
526 packages_path=$1
527 mindimondo_path=$2
528# echo "mindimondo_path = $2" >> /dev/stderr
529 missing_packages=`FindMissingRPMs $1`
530 echo "missing_packages =$missing_packages" >> $LOGFILE
531 sync
532
533# echo -en "Press ENTER to continue." ; read line
534
535 command=""
536 for pkg in $missing_packages ; do
537 echo -en "."
538 if [ -e "$packages_path/$pkg" ] ; then
539 command="$command $packages_path/$pkg"
540 elif [ -e "RPMS/$pkg" ] ; then
541 command="$command RPMS/$pkg"
542 else
543 Die "Cannot find local path of $pkg - it's neither at RPMS nor at $packages_path"
544 fi
545 done
546
547# echo "\$2 = '$2'" >> /dev/stderr
548
549 c2="`find $mindimondo_path/mindi-$MINDI_BRANCH*rpm 2> $LOGFILE | tail -n1` `find $mindimondo_path/mondo-$MY_BRANCH*rpm 2>> $LOGFILE | tail -n1`"
550
551# echo "c2 = '$c2'" >> /dev/stderr
552
553 command="`echo "$command" | tr ' ' '\n' | sort -u | tr '\n' ' '`"
554 if echo "$c2" | grep mondo &> /dev/null && echo "$command" | grep mondo &> /dev/null ; then
555# echo "command was $command"
556 command="`echo "$command" | tr ' ' '\n' | grep -v mondo | tr '\n' ' '`"
557# echo "command is now $command"
558 fi
559 command="`echo "$command $c2" | tr ' ' '\n' | sort -u | tr '\n' ' '`"
560 echo "Calling 'rpm -Uvh $command'" >> $LOGFILE
561 echo -en "\r"
562 rpm -Uvh $command
563 res=$?
564 [ "$res" -ne "0" ] && Die "Some packages failed to be installed."
565 return $res
566}
567
568
569
570LogIt() {
571 echo -e "$1" >> /dev/stderr
572 echo -e "$1" >> $LOGFILE
573}
574
575
576
577PostInstallSanityChecks()
578{
579 local res
580 res=0
581 if which /usr/local/mondo/mondo-archive &> /dev/null ; then
582 echo "mondo-archive available to be executed" >> $LOGFILE
583 else
584 LogIt "mondo-archive --help failed"
585 res=$(($res+1))
586 fi
587 if [ "`/usr/local/mondo/mondo-tarme --wu-tang`" = "dollar dollar bill, y'all" ]; then
588 echo "mondo-tarme executable intact" >> $LOGFILE
589 else
590 LogIt "mondo-tarme executable not available"
591 res=$(($res+1))
592 fi
593 if [ "`/usr/local/mondo/mondo-restore --cream`" = "dollar dollar bill, y'all" ] ; then
594 echo "mondo-restore executable intact" >> $LOGFILE
595 else
596 LogIt "mondo-restore executable not available"
597 res=$(($res+1))
598 fi
599 return $res
600}
601
602
603
604StrStr() {
605 [ "`echo "$1" | grep -Fi "$2"`" ] && return 0 || return 1
606}
607
608
609
610WelcomeMessage() {
611 LogIt ""
612 LogIt "Welcome to the Mondo Rescue installer! This script"
613 LogIt "will install Mondo and any missing dependencies."
614 LogIt "--------------------------------------------------"
615 echo "banner=`GetDistroBanner`" >> $LOGFILE
616 echo "name =`GetDistroName`" >> $LOGFILE
617 echo "ver =`GetDistroVersion`" >> $LOGFILE
618 echo "arch =`GetDistroArchitecture`" >> $LOGFILE
619}
620
621
622InstallXmondoFromRpms() {
623 rpm -i RPMS/XMondo-1*rpm
624 return $?
625}
626
627
628
629InstallXmondoFromTgz() {
630 echo "InstallXmondoFromTgz() --- not written yet"
631 return 1
632}
633
634
635
636
637# ------------------------------- main -------------------------------
638
639
640
641cd `dirname $0`
642CDPATH=`pwd`
643if [ "$#" -ge "1" ] ; then
644 if [ "`pwd`" != "/tmp" ] ; then
645 rm -f /tmp/mondo-cd-setup.*
646 new_fname="/tmp/mondo-cd-setup.$RANDOM.$RANDOM.$$.sh"
647 cat $0 > $new_fname
648 chmod +x $new_fname
649 cd /
650 exec sh $new_fname $0
651 fi
652 cd `dirname $1`
653fi
654
655> $LOGFILE
656echo "pwd=`pwd`" >> $LOGFILE
657[ -e "/usr/local/mondo.devel" ] && [ -e "/usr/local/mindi" ] && Die "Noooo! Hugo, type 'mv /usr/local/mindi /usr/local/mindi.orig' first, please."
658MY_BRANCH=$STABLE_BRANCH
659MINDI_BRANCH=1.0
660WelcomeMessage
661
662#echo "distr=`GetDistroName`"
663#echo "version=`GetDistroVersion`"
664#echo "arch=`GetDistroArchitecture`"
665#exit 1
666
667echo -en "Do you want to install the (S)table or the (D)evelopment branch of Mondo? "
668read ch
669if [ "`echo "development" | grep -Fi "$ch"`" ] ; then
670 MY_BRANCH=$DEVEL_BRANCH
671 MINDI_BRANCH=1.1
672# XMONDO=yes
673fi
674[ "$MY_BRANCH" = "$STABLE_BRANCH" ] && LogIt "Installing stable branch." || LogIt "Installing development branch."
675# LogIt "I see you are running `GetDistroBanner`"
676distro=`GetDistroName`
677version=`GetDistroVersion`
678architecture=`GetDistroArchitecture`
679LogIt "distro=$distro version=$version arch=$architecture"
680
681[ "$distro" = "ARK" ] && version=1.0
682# patch by Geofuz@netscape.com
683if [ "$distro" = "FDR" ] ; then
684 if [ "$version" = "2" ] || [ "$version" = "1.90" ] ; then
685 version=2.0
686 else
687 version=1.0
688 fi
689fi
690# end patch
691[ "$distro" = "KPX" ] && version=3.3; # Knoppix
692[ ! "$version" ] && Die "Distro=$distro but I cannot ascertain version of distro"
693if [ ! -d "RPMS/$distro" ] && rpm --version &> /dev/null && [ "$distro" != "KPX" ] ; then
694 LogIt "You are using an unknown version but you have RPM available, which means"
695 LogIt "I could try installing the Red Hat 7.2-compatible stuff. It will probably work."
696 echo -en "Shall I do that (y/n)? "
697 read ch
698 if [ "`echo "YESyesYes" | grep -F "$ch"`" ] ; then
699 distro=RHT
700 version=7.2
701 fi
702fi
703res=0
704if [ -d "RPMS/$distro" ] ; then
705 InstallFromRpms "$distro" "$version" "$architecture"
706 res=$(($res+$?))
707 if [ "$XMONDO" ] ; then
708 InstallXmondoFromRpms
709 res=$(($res+$?))
710 fi
711elif [ -d "TGZS/$distro" ] ; then
712 InstallFromTgzs "$distro" "$version" "$architecture"
713 res=$(($res+$?))
714 if [ "$XMONDO" ] ; then
715 InstallXmondoFromTgzs
716 res=$(($res+$?))
717 fi
718else
719 LogIt "`GetDistroBanner` is not supported by this script."
720 LogIt "RPMs are stored in /RPMS and the tarballs are in /TGZS, both on the CD."
721 Die "Please install Mondo manually."
722fi
723if [ "$res" -eq "0" ] ; then
724 LogIt "Running 'ldconfig' to refresh library cache..."
725 ldconfig
726 LogIt "End of install. Mondo was installed OK."
727else
728 LogIt "End of install. Errors occurred."
729fi
730
731cd /
732if [ "$#" -ge "1" ] ; then
733 mountpt=`dirname $1`
734 dev=`mount | tr -s '\t' ' ' | grep "$mountpt " | awk '{print $1;}'`
735 if [ ! "$dev" ] || [ "$dev" = "none" ] ; then
736 dev=`mount | tr -s '\t' ' ' | grep "$mountpt " | tr -s ',' '\n' | sed s/dev=// | grep /dev`
737 mountpt=""; # supermount - don't unmount it :)
738 fi
739 [ "$mountpt" ] && umount $mountpt
740 [ "$dev" ] && eject $dev
741 echo "mountpt=$mountpt; dev=$dev" >> $LOGFILE
742else
743 LogIt "Please type:-"
744 LogIt " cd /"
745 LogIt " umount $CDPATH"
746 LogIt "Then remove the Mondo installation CD."
747fi
748
749LogIt "Refer to Mondo's manual for instructions"
750LogIt "on the care and feeding of Mondo Rescue."
751LogIt ""
752#if fdisk -l | grep -w 7 &> /dev/null || fdisk -l | grep -wi ntfs &> /dev/null ; then
753# LogIt "To backup your NTFS partition, you must first install"
754# LogIt "partimagehack. This is in the CD's /TGZS directory as"
755# LogIt "partimagehack-0.6.2.tar.bz2, FYI."
756# which partimagehack &> /dev/null & LogIt "...Oh my, I think you already have. Good show!"
757#fi
758#LogIt ""
759LogIt "Log in as root and type 'mondoarchive' to backup your machine"
760LogIt ""
761echo -en "Press ENTER to finish."
762read line
763exit $res
Note: See TracBrowser for help on using the repository browser.