3 # Install Script for HiTas and Yagle tools distribution
5 # Copyright (c)1999-2005, Avertec
8 ##########################################################################
10 ##########################################################################
13 if [ `echo "x\c"` = "x" ] ; then
20 ##########################################################################
23 echo "Exit installation..."
28 ##########################################################################
31 if readinlist
"Abort installation y/n? [n]:" "$YESNOLIST" n
; then
32 if readinlist
"Are you sure? y/n [n]:" "$YESNOLIST" n
; then
38 ##########################################################################
55 ##########################################################################
61 for arg
in $arginlist ; do
63 for available
in $listofarg ; do
64 if [ "$arg" = "$available" ] ; then
76 ##########################################################################
83 osinfile
=`echo "$file" | grep Solaris_2.8 | grep -v Solaris_2.8_64`
84 if [ "$osinfile" ] ; then
86 for os
in $OSTOINSTALL ; do
87 if [ "$os" = "S2.8" ] ; then
93 osinfile
=`echo "$file" | grep Solaris_2.8_64`
94 if [ "$osinfile" ] ; then
96 for os
in $OSTOINSTALL ; do
97 if [ "$os" = "S2.8_64" ] ; then
103 osinfile
=`echo "$file" | grep Solaris_10 | grep -v Solaris_10_64`
104 if [ "$osinfile" ] ; then
106 for os
in $OSTOINSTALL ; do
107 if [ "$os" = "S10" ] ; then
113 osinfile
=`echo "$file" | grep Solaris_10_64`
114 if [ "$osinfile" ] ; then
116 for os
in $OSTOINSTALL ; do
117 if [ "$os" = "S10_64" ] ; then
123 osinfile
=`echo "$file" | grep RHEL_3.0`
124 if [ "$osinfile" ] ; then
126 for os
in $OSTOINSTALL ; do
127 if [ "$os" = "RHEL3.0" ] ; then
133 osinfile
=`echo "$file" | grep RHEL_3.0_64`
134 if [ "$osinfile" ] ; then
136 for os
in $OSTOINSTALL ; do
137 if [ "$os" = "RHEL3.0_64" ] ; then
143 if [ $in_os -eq 1 -o $is_os -eq 0 ] ; then
149 ##########################################################################
159 if [ ! "$answer" ] ; then
160 answer
="$defaultvalue"
162 if is_yes_no
"$answer" ; then
170 ##########################################################################
179 if read_answer
"$question" "$defaultvalue" ; then
184 if is_in_list
"$answer" "$listofarg" ; then
187 echo "ERROR: Invalid response... try again"
192 if [ "$returnvalue" = "true" ] ; then
199 ##########################################################################
204 if [ -f "/bin/more" ] ; then
206 elif [ -f "/usr/bin/more" ] ; then
207 cattool
="/usr/bin/more"
208 elif [ -f "/usr/ucb/more" ] ; then
209 cattool
="/usr/ucb/more"
214 echo "You must accept the following license agreement before installation"
216 echo "Press return to continue"
219 $cattool "$licensefile"
222 ##########################################################################
224 ##########################################################################
228 if [ ! -d "$dir" ] ; then
229 echo "Directory $INSTALLDIR does not exist..."
231 if readinlist
"Do you want to create it now y/n? [y]:" "$YESNOLIST" y
; then
232 if mkdir
-p "$INSTALLDIR" > /dev
/null
2>&1 ; then
233 echo "Creating installation directory..."
237 echo "Can not create directory $INSTALLDIR..."
247 echo "Directory $INSTALLDIR already exists..."
249 if readinlist
"Do you want to overwrite it now y/n? [n]:" "$YESNOLIST" n
; then
250 echo "All data will be destroyed..."
252 if readinlist
"Are you sure y/n? [n]:" "$YESNOLIST" n
; then
253 if rm -rf $INSTALLDIR/* > /dev
/null
2>&1 ; then
254 echo "Creating installation directory..."
258 echo "Can not overwrite directory $INSTALLDIR..."
273 ##########################################################################
275 ##########################################################################
281 read_answer
"Enter the source directory [${INSTALLTOOLSDIR}]: " "$INSTALLTOOLSDIR"
282 INSTALLTOOLSDIR
="$answer"
283 if [ -f "$INSTALLTOOLSDIR/license_terms/license.txt" ] ; then
284 printlicense
"$INSTALLTOOLSDIR/license_terms/license.txt"
286 echo "To accept the terms and conditions of this agreement enter accept"
288 echo "To decline the terms and conditions of this agreement enter decline"
290 if readinlist
"Do you accept the terms and conditions? [accept]:" "accept decline" accept
; then
294 echo "You must accept the terms and conditions license agreement to continue..."
300 echo "Bad source directory..."
307 read_answer
"Enter the destination directory [${INSTALLDIR}]: " "$INSTALLDIR"
309 if create_dir
"$INSTALLDIR" ; then
314 echo "Enter the OS to install"
315 echo " S2.8 : Solaris 2.8"
316 echo " S2.8_64 : Solaris 2.8 64bits"
317 echo " S10 : Solaris 10"
318 echo " S10_64 : Solaris 10 64bits"
319 echo " RHEL3.0 : Red Hat Enterprise Linux 3.0"
320 echo " RHEL3.0_64 : Red Hat Enterprise Linux 3.0 64bits"
321 readinlist
"OS [${OSTOINSTALL}]: " "$OSTOINSTALL all" "all"
323 if [ "$OSTOINSTALL" = "all" ] ; then
324 OSTOINSTALL
="S2.8 S2.8_64 S10 S10_64 RHEL3.0 RHEL3.0_64"
327 ##########################################################################
332 echo "Copying common distribution files..."
334 for line
in `awk '/^common/ {printf "%s ",$0}' $sourcedirfile/etc/avttools.dtb`; do
335 file=`echo "$line"|sed 's/.*://g'`
336 if not_in_os
"$file" ; then
339 scefullname
="$sourcedirfile/$file"
340 dstfullname
="$INSTALLDIR/$file"
341 if [ -d "$scefullname" ] ; then
342 if [ ! -d "$dstfullname" ] ; then
343 if mkdir
-p "$dstfullname" > /dev
/null
2>&1 ; then
346 echo "Can not write in the destination directory..."
351 elif [ -f "$scefullname" ] ; then
352 if cp -f "$scefullname" "$dstfullname" > /dev
/null
2>&1 ; then
355 echo "Can not write in the destination directory..."
360 basename=`basename "$file"`
361 if [ "$basename" = "*r" ] ; then
362 dirname=`dirname "$file"`
363 if cp -rf $sourcedirfile/$dirname/* $INSTALLDIR/$dirname/.
> /dev
/null
2>&1 ; then
366 elif [ "$basename" = "*" ] ; then
367 dirname=`dirname "$file"`
368 if cp -f $sourcedirfile/$dirname/* $INSTALLDIR/$dirname/.
> /dev
/null
2>&1 ; then
377 echo "Copying HITAS distribution files..."
379 for line
in `awk '/^hitas/ {printf "%s ",$0}' $sourcedirfile/etc/avttools.dtb`; do
380 file=`echo "$line"|sed 's/.*://g'`
381 if not_in_os
"$file" ; then
384 scefullname
="$sourcedirfile/$file"
385 dstfullname
="$INSTALLDIR/$file"
386 if [ -d "$scefullname" ] ; then
387 if [ ! -d "$dstfullname" ] ; then
388 if mkdir
-p "$dstfullname" > /dev
/null
2>&1 ; then
391 echo "Can not write in the destination directory..."
396 elif [ -f "$scefullname" ] ; then
397 if cp -f "$scefullname" "$dstfullname" > /dev
/null
2>&1 ; then
400 echo "Can not write in the destination directory..."
405 basename=`basename "$file"`
406 if [ "$basename" = "*r" ] ; then
407 dirname=`dirname "$file"`
408 if cp -rf $sourcedirfile/$dirname/* $INSTALLDIR/$dirname/.
> /dev
/null
2>&1 ; then
411 elif [ "$basename" = "*" ] ; then
412 dirname=`dirname "$file"`
413 if cp -f $sourcedirfile/$dirname/* $INSTALLDIR/$dirname/.
> /dev
/null
2>&1 ; then
422 echo "Copying YAGLE distribution files..."
424 for line
in `awk '/^yagle/ {printf "%s ",$0}' $sourcedirfile/etc/avttools.dtb`; do
425 file=`echo "$line"|sed 's/.*://g'`
426 if not_in_os
"$file" ; then
429 scefullname
="$sourcedirfile/$file"
430 dstfullname
="$INSTALLDIR/$file"
431 if [ -d "$scefullname" ] ; then
432 if [ ! -d "$dstfullname" ] ; then
433 if mkdir
-p "$dstfullname" > /dev
/null
2>&1 ; then
436 echo "Can not write in the destination directory..."
441 elif [ -f "$scefullname" ] ; then
442 if cp -f "$scefullname" "$dstfullname" > /dev
/null
2>&1 ; then
445 echo "Can not write in the destination directory..."
450 basename=`basename "$file"`
451 if [ "$basename" = "*r" ] ; then
452 dirname=`dirname "$file"`
453 if cp -rf $sourcedirfile/$dirname/* $INSTALLDIR/$dirname/.
> /dev
/null
2>&1 ; then
456 elif [ "$basename" = "*" ] ; then
457 dirname=`dirname "$file"`
458 if cp -f $sourcedirfile/$dirname/* $INSTALLDIR/$dirname/.
> /dev
/null
2>&1 ; then
468 ##########################################################################
470 ##########################################################################
473 if [ -f "$INSTALLDIR/etc/avttools.dtb" ] ; then
474 if rm -f $INSTALLDIR/etc
/avttools.dtb
> /dev
/null
2>&1 ; then
475 echo "Remove the old distribution database..."
478 echo "Can not remove the old database..."
483 if [ ! -d "$INSTALLDIR/etc" ] ; then
484 if mkdir
-p "$INSTALLDIR/etc" > /dev
/null
2>&1 ; then
485 echo "Creating the new distribution database..."
488 echo "Can not write in the destination directory..."
495 copy_file
$INSTALLTOOLSDIR
497 ##########################################################################
498 ##########################################################################
501 destfile
="$INSTALLDIR/etc/avt_env.csh"
503 read_answer
"Enter the license server name [${server}]: " "$server"
507 if [ -d "$INSTALLTOOLSDIR/tools/Linux_demo" ] ; then
508 echo "setenv AVTOS Linux_demo" >> "$destfile"
510 echo "switch (\`uname\`)" >> "$destfile"
511 echo " case Linux*:" >> "$destfile"
512 echo " switch (\$1)" >> "$destfile"
513 echo " case 64:" >> "$destfile"
514 echo " setenv AVTOS RHEL_3.0_64" >> "$destfile"
515 echo " breaksw" >> "$destfile"
516 echo " default" >> "$destfile"
517 echo " setenv AVTOS RHEL_3.0" >> "$destfile"
518 echo " breaksw" >> "$destfile"
519 echo " endsw" >> "$destfile"
520 echo " breaksw" >> "$destfile"
521 echo " case SunOS*:" >> "$destfile"
522 echo " switch (\`uname -r\`)" >> "$destfile"
523 echo " case 5.8*:" >> "$destfile"
524 echo " case 5.9*:" >> "$destfile"
525 echo " switch (\$1)" >> "$destfile"
526 echo " case 64:" >> "$destfile"
527 echo " setenv AVTOS Solaris_2.8_64" >> "$destfile"
528 echo " breaksw" >> "$destfile"
529 echo " default" >> "$destfile"
530 echo " setenv AVTOS Solaris_2.8" >> "$destfile"
531 echo " breaksw" >> "$destfile"
532 echo " endsw" >> "$destfile"
533 echo " breaksw" >> "$destfile"
534 echo " case 5.10*:" >> "$destfile"
535 echo " switch (\$1)" >> "$destfile"
536 echo " case 64:" >> "$destfile"
537 echo " setenv AVTOS Solaris_10_64" >> "$destfile"
538 echo " breaksw" >> "$destfile"
539 echo " default" >> "$destfile"
540 echo " setenv AVTOS Solaris_10" >> "$destfile"
541 echo " breaksw" >> "$destfile"
542 echo " endsw" >> "$destfile"
543 echo " breaksw" >> "$destfile"
544 echo " default :" >> "$destfile"
545 echo " setenv AVTOS Solaris_2.8" >> "$destfile"
546 echo " breaksw" >> "$destfile"
547 echo " endsw" >> "$destfile"
548 echo " breaksw" >> "$destfile"
549 echo " default :" >> "$destfile"
550 echo " setenv AVTOS Solaris_2.8" >> "$destfile"
551 echo " breaksw" >> "$destfile"
552 echo "endsw" >> "$destfile"
555 echo "setenv AVT_FLEX_LICENSE yes" >> "$destfile"
556 echo "setenv AVT_LICENSE_FILE $INSTALLDIR/etc/avtlicense.lic" >> "$destfile"
558 echo "setenv AVT_TOOLS_DIR $AVT_TOOLS_DIR" >> "$destfile"
559 echo "if \$?PATH then" >> "$destfile"
560 echo " setenv PATH \$AVT_TOOLS_DIR/tools/\$AVTOS/bin:\$AVT_TOOLS_DIR/tcl:\${PATH}" >> "$destfile"
561 echo "else" >> "$destfile"
562 echo " setenv PATH \$AVT_TOOLS_DIR/tools/\$AVTOS/bin:\$AVT_TOOLS_DIR/tcl" >> "$destfile"
563 echo "endif" >> "$destfile"
564 echo "if \$?LD_LIBRARY_PATH then" >> "$destfile"
565 echo " setenv LD_LIBRARY_PATH \$AVT_TOOLS_DIR/tools/\$AVTOS/api_lib:\${LD_LIBRARY_PATH}" >> "$destfile"
566 echo "else" >> "$destfile"
567 echo " setenv LD_LIBRARY_PATH \$AVT_TOOLS_DIR/tools/\$AVTOS/api_lib" >> "$destfile"
568 echo "endif" >> "$destfile"
569 echo "if \$?MANPATH then" >> "$destfile"
570 echo " setenv MANPATH \$AVT_TOOLS_DIR/man:\${MANPATH}" >> "$destfile"
571 echo "else" >> "$destfile"
572 echo " setenv MANPATH \$AVT_TOOLS_DIR/man" >> "$destfile"
573 echo "endif" >> "$destfile"
574 echo "setenv AVT_LICENSE_SERVER $server" >> "$destfile"
577 destfilesh
="$INSTALLDIR/etc/avt_env.sh"
579 if [ -d "$INSTALLTOOLSDIR/tools/Linux_demo" ] ; then
580 echo "AVTOS=Linux_demo" >> "$destfilesh"
581 echo "export $AVTOS" >> "$destfilesh"
583 echo "case \`uname\` in" >> "$destfilesh"
584 echo " Linux*)" >> "$destfilesh"
585 echo " case \${1:-32} in" >> "$destfilesh"
586 echo " 64)" >> "$destfilesh"
587 echo " AVTOS=RHEL_3.0_64" >> "$destfilesh"
588 echo " export AVTOS;;" >> "$destfilesh"
589 echo " *)" >> "$destfilesh"
590 echo " AVTOS=RHEL_3.0" >> "$destfilesh"
591 echo " export AVTOS;;" >> "$destfilesh"
592 echo " esac;;" >> "$destfilesh"
593 echo " SunOS*)" >> "$destfilesh"
594 echo " case \`uname -r\` in" >> "$destfilesh"
595 echo " 5.8*)" >> "$destfilesh"
596 echo " case \${1:-32} in" >> "$destfilesh"
597 echo " 64)" >> "$destfilesh"
598 echo " AVTOS=Solaris_2.8_64" >> "$destfilesh"
599 echo " export AVTOS;;" >> "$destfilesh"
600 echo " *)" >> "$destfilesh"
601 echo " AVTOS=Solaris_2.8" >> "$destfilesh"
602 echo " export AVTOS;;" >> "$destfilesh"
603 echo " esac;;" >> "$destfilesh"
604 echo " 5.9*)" >> "$destfilesh"
605 echo " case \${1:-32} in" >> "$destfilesh"
606 echo " 64)" >> "$destfilesh"
607 echo " AVTOS=Solaris_2.8_64" >> "$destfilesh"
608 echo " export AVTOS;;" >> "$destfilesh"
609 echo " *)" >> "$destfilesh"
610 echo " AVTOS=Solaris_2.8" >> "$destfilesh"
611 echo " export AVTOS;;" >> "$destfilesh"
612 echo " esac;;" >> "$destfilesh"
613 echo " 5.10*)" >> "$destfilesh"
614 echo " case \${1:-32} in" >> "$destfilesh"
615 echo " 64)" >> "$destfilesh"
616 echo " AVTOS=Solaris_10_64" >> "$destfilesh"
617 echo " export AVTOS;;" >> "$destfilesh"
618 echo " *)" >> "$destfilesh"
619 echo " AVTOS=Solaris_10" >> "$destfilesh"
620 echo " export AVTOS;;" >> "$destfilesh"
621 echo " esac;;" >> "$destfilesh"
622 echo " *)" >> "$destfilesh"
623 echo " AVTOS=Solaris_2.8" >> "$destfilesh"
624 echo " export AVTOS;;" >> "$destfilesh"
625 echo " esac;;" >> "$destfilesh"
626 echo " *)" >> "$destfilesh"
627 echo " AVTOS=Solaris_2.8" >> "$destfilesh"
628 echo " export AVTOS;;" >> "$destfilesh"
629 echo "esac" >> "$destfilesh"
632 echo "AVT_FLEX_LICENSE=yes" >> "$destfilesh"
633 echo "export AVT_FLEX_LICENSE" >> "$destfilesh"
634 echo "AVT_LICENSE_FILE=$INSTALLDIR/etc/avtlicense.lic" >> "$destfilesh"
635 echo "export AVT_LICENSE_FILE" >> "$destfilesh"
636 echo "AVT_TOOLS_DIR=$AVT_TOOLS_DIR" >> "$destfilesh"
637 echo "export AVT_TOOLS_DIR" >> "$destfilesh"
638 echo "if [ \${PATH:-notset} = notset ]" >> "$destfilesh"
639 echo "then" >> "$destfilesh"
640 echo " PATH=\$AVT_TOOLS_DIR/tools/\$AVTOS/bin:\$AVT_TOOLS_DIR/tcl" >> "$destfilesh"
641 echo " export PATH" >> "$destfilesh"
642 echo "else" >> "$destfilesh"
643 echo " PATH=\$AVT_TOOLS_DIR/tools/\$AVTOS/bin:\$AVT_TOOLS_DIR/tcl:\${PATH}" >> "$destfilesh"
644 echo " export PATH" >> "$destfilesh"
645 echo "fi" >> "$destfilesh"
646 echo "if [ \${LD_LIBRARY_PATH:-notset} = notset ]" >> "$destfilesh"
647 echo "then" >> "$destfilesh"
648 echo " LD_LIBRARY_PATH=\$AVT_TOOLS_DIR/tools/\$AVTOS/api_lib" >> "$destfilesh"
649 echo " export LD_LIBRARY_PATH" >> "$destfilesh"
650 echo "else" >> "$destfilesh"
651 echo " LD_LIBRARY_PATH=\$AVT_TOOLS_DIR/tools/\$AVTOS/api_lib:\${LD_LIBRARY_PATH}" >> "$destfilesh"
652 echo " export LD_LIBRARY_PATH" >> "$destfilesh"
653 echo "fi" >> "$destfilesh"
654 echo "if [ \${MANPATH:-notset} = notset ]" >> "$destfilesh"
655 echo "then" >> "$destfilesh"
656 echo " MANPATH=\$AVT_TOOLS_DIR/man" >> "$destfilesh"
657 echo " export MANPATH" >> "$destfilesh"
658 echo "else" >> "$destfilesh"
659 echo " MANPATH=\$AVT_TOOLS_DIR/man:\${MANPATH}" >> "$destfilesh"
660 echo " export MANPATH" >> "$destfilesh"
661 echo "fi" >> "$destfilesh"
662 echo "AVT_LICENSE_SERVER=$server" >> "$destfilesh"
663 echo "export AVT_LICENSE_SERVER" >> "$destfilesh"
668 ##########################################################################
670 INSTALLTOOLS
=`basename $0`
671 INSTALLTOOLSDIR
=`dirname $0`
673 if [ "$AVT_TOOLS_DIR" ] ; then
674 INSTALLDIR
="$AVT_TOOLS_DIR"
676 INSTALLDIR
="$CURRENTDIR/AvtTools"
679 OSTOINSTALL
="S2.8 S2.8_64 S10 S10_64 RHEL3.0 RHEL3.0_64"
681 YESNOLIST
="y Y yes YES n N no NO"
684 if [ "$1" = "-help" ] ||
[ "$1" = "-h" ] ||
[ "$1" = "--help" ] ; then
685 echo "usage: Install [source directory] [destination directory]"
706 echo "Installation successful"