setup.sh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/sh
  2. oldecho=`echo -n test | grep '\-n'`
  3. if [ "x$oldecho" = "x" ]; then
  4. #This echo supports '-n' (no newline)
  5. echon="echo -n"
  6. else
  7. echon=echo
  8. fi
  9. if test -z "$DISPLAY" ; then
  10. echo "No X server."
  11. else
  12. if test "x$1" != "x--run-myself" ; then
  13. exec xterm -e $0 --run-myself
  14. fi
  15. fi
  16. echo "GCC4TI Installation Wizard"
  17. I_AM_ROOT="`id | grep root`"
  18. # Get GCC4TI prefix directory
  19. if test -z "$I_AM_ROOT" ; then
  20. PREFIX_GCC4TI=$HOME/gcc4ti
  21. else
  22. PREFIX_GCC4TI="/usr/local/share/gcc4ti"
  23. fi
  24. ${echon} "Destination directory ($PREFIX_GCC4TI) - will become \$TIGCC: "
  25. read PREFIX_GCC4TInew
  26. PREFIX_GCC4TInew=`eval echo "$PREFIX_GCC4TInew"`
  27. if [ ! -z "$PREFIX_GCC4TInew" ]
  28. then PREFIX_GCC4TI="$PREFIX_GCC4TInew"
  29. fi
  30. export PREFIX_GCC4TI
  31. # copy the file except setup.sh
  32. mkdir -p "$PREFIX_GCC4TI"
  33. cp -r . "$PREFIX_GCC4TI"
  34. rm -f "$PREFIX_GCC4TI"/setup.sh
  35. # Now offer to install environment variables
  36. ${echon} "Add environment settings (\$TIGCC, \$PATH) to bashrc [Y/n]? "
  37. read AddEnvSettings
  38. echo
  39. if [ -z "$AddEnvSettings" -o "$AddEnvSettings" = y -o "$AddEnvSettings" = Y ]
  40. then
  41. TIGCC="$PREFIX_GCC4TI"
  42. export TIGCC
  43. "$PREFIX_GCC4TI/bin/envreg"
  44. echo "Done. You must restart bash for the new environment settings to take effect."
  45. exit 0;
  46. fi
  47. echo "Done. Make sure you set \$TIGCC to \"$PREFIX_GCC4TI\" and add \$TIGCC/bin to your \$PATH before using GCC4TI."
  48. exit 0