FrowardVPNNEW


SUBMITTED BY: FrowardVPN

DATE: June 23, 2022, 6:08 p.m.

UPDATED: June 29, 2023, 1:28 a.m.

FORMAT: Text only

SIZE: 4.7 kB

HITS: 1803

  1. #!/bin/bash
  2. # Get prerequisite packages:
  3. PREREQUISITE_PACKAGES="build-essential g++ libudev-dev libdbus-1-dev libusb-1.0-0-dev zlib1g-dev libpng-dev libjpeg-dev libtiff-dev libasound2-dev libspeex-dev libopenal-dev libv4l-dev libdc1394-22 libtheora-dev libbluetooth-dev libxi-dev libxrandr-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev"
  4. echo "Please enter your password to install Vrui's prerequisite packages"
  5. sudo apt-get install $PREREQUISITE_PACKAGES
  6. INSTALL_RESULT=$?
  7. if [ $INSTALL_RESULT -ne 0 ]; then
  8. echo "Problem while downloading prerequisite packages; please fix the issue and try again"
  9. exit $INSTALL_RESULT
  10. fi
  11. # Create src directory:
  12. echo "Creating source code directory $HOME/src"
  13. cd $HOME
  14. mkdir src
  15. cd src
  16. CD_RESULT=$?
  17. if [ $CD_RESULT -ne 0 ]; then
  18. echo "Could not create source code directory $HOME/src. Please fix the issue and try again"
  19. exit $CD_RESULT
  20. fi
  21. # Determine current Vrui version:
  22. VRUI_CURRENT_RELEASE=$(wget -q -O - http://idav.ucdavis.edu/~okreylos/ResDev/Vrui/CurrentVruiRelease.txt)
  23. GETVERSION_RESULT=$?
  24. if [ $GETVERSION_RESULT -ne 0 ]; then
  25. echo "Could not determine current Vrui release number; please check your network connection and try again"
  26. exit $GETVERSION_RESULT
  27. fi
  28. read VRUI_VERSION VRUI_RELEASE <<< "$VRUI_CURRENT_RELEASE"
  29. # Download and unpack Vrui tarball:
  30. echo "Downloading Vrui-$VRUI_VERSION-$VRUI_RELEASE into $HOME/src"
  31. wget -O - http://idav.ucdavis.edu/~okreylos/ResDev/Vrui/Vrui-$VRUI_VERSION-$VRUI_RELEASE.tar.gz | tar xfz -
  32. cd Vrui-$VRUI_VERSION-$VRUI_RELEASE
  33. DOWNLOAD_RESULT=$?
  34. if [ $DOWNLOAD_RESULT -ne 0 ]; then
  35. echo "Problem while downloading or unpacking Vrui; please check your network connection and try again"
  36. exit $DOWNLOAD_RESULT
  37. fi
  38. # Set up Vrui's installation directory:
  39. VRUI_INSTALLDIR=/usr/local
  40. if [ $# -ge 1 ]; then
  41. VRUI_INSTALLDIR=$1
  42. fi
  43. # Check if make install requires sudo, i.e., install directory is not under user's home:
  44. INSTALL_NEEDS_SUDO=1
  45. [[ $VRUI_INSTALLDIR = $HOME* ]] && INSTALL_NEEDS_SUDO=0
  46. # Check if make directory path needs Vrui-<version> shim:
  47. VRUI_MAKEDIR=$VRUI_INSTALLDIR/share/Vrui-$VRUI_VERSION/make
  48. [[ $VRUI_INSTALLDIR = *Vrui-$VRUI_VERSION* ]] && VRUI_MAKEDIR=$VRUI_INSTALLDIR/share/make
  49. # Determine the number of CPUs on the host computer:
  50. NUM_CPUS=`cat /proc/cpuinfo | grep processor | wc -l`
  51. # Build Vrui:
  52. echo "Building Vrui on $NUM_CPUS CPUs"
  53. make -j$NUM_CPUS INSTALLDIR=$VRUI_INSTALLDIR
  54. BUILD_RESULT=$?
  55. if [ $BUILD_RESULT -ne 0 ]; then
  56. echo "Build unsuccessful; please fix any reported errors and try again"
  57. exit $BUILD_RESULT
  58. fi
  59. # Install Vrui
  60. echo "Build successful; installing Vrui in $VRUI_INSTALLDIR"
  61. if [ $INSTALL_NEEDS_SUDO -ne 0 ]; then
  62. echo "Please enter your password to install Vrui in $VRUI_INSTALLDIR"
  63. sudo make INSTALLDIR=$VRUI_INSTALLDIR install
  64. else
  65. make INSTALLDIR=$VRUI_INSTALLDIR install
  66. fi
  67. INSTALL_RESULT=$?
  68. if [ $INSTALL_RESULT -ne 0 ]; then
  69. echo "Could not install Vrui in $VRUI_INSTALLDIR. Please fix the issue and try again"
  70. exit $INSTALL_RESULT
  71. fi
  72. # Install device permission rules
  73. echo "Installation in $VRUI_INSTALLDIR successful; installing device permission rules in /etc/udev/rules.d"
  74. echo "If prompted, please enter your password again to install device permission rules"
  75. sudo make INSTALLDIR=$VRUI_INSTALLDIR installudevrules
  76. UDEVRULES_RESULT=$?
  77. if [ $UDEVRULES_RESULT -ne 0 ]; then
  78. echo "Could not install device permission rules in /etc/udev/rules.d. Please fix the issue and try again"
  79. exit $UDEVRULES_RESULT
  80. fi
  81. # Build Vrui example applications
  82. cd ExamplePrograms
  83. echo "Building Vrui example programs on $NUM_CPUS CPUs"
  84. make -j$NUM_CPUS VRUI_MAKEDIR=$VRUI_MAKEDIR INSTALLDIR=$VRUI_INSTALLDIR
  85. BUILD_RESULT=$?
  86. if [ $BUILD_RESULT -ne 0 ]; then
  87. echo "Build unsuccessful; please fix any reported errors and try again"
  88. exit $BUILD_RESULT
  89. fi
  90. # Install Vrui example applications
  91. echo "Build successful; installing Vrui example programs in $VRUI_INSTALLDIR"
  92. if [ $INSTALL_NEEDS_SUDO -ne 0 ]; then
  93. echo "If prompted, please enter your password again to install Vrui's example applications in $VRUI_INSTALLDIR"
  94. sudo make VRUI_MAKEDIR=$VRUI_MAKEDIR INSTALLDIR=$VRUI_INSTALLDIR install
  95. else
  96. make VRUI_MAKEDIR=$VRUI_MAKEDIR INSTALLDIR=$VRUI_INSTALLDIR install
  97. fi
  98. INSTALL_RESULT=$?
  99. if [ $INSTALL_RESULT -ne 0 ]; then
  100. echo "Could not install Vrui example programs in $VRUI_INSTALLDIR. Please fix the issue and try again"
  101. exit $INSTALL_RESULT
  102. fi
  103. # Run ShowEarthModel
  104. echo "Running ShowEarthModel application. Press Esc or close the window to exit."
  105. cd $HOME
  106. $VRUI_INSTALLDIR/bin/ShowEarthModel

comments powered by Disqus