Browse Source

First stab at removing install.sh files

msmith-techempower 10 years ago
parent
commit
1ea1090603

+ 0 - 3
frameworks/Java/gemini/install.sh

@@ -1,3 +0,0 @@
-#!/bin/bash
-
-fw_depends java7 resin maven

+ 1 - 2
frameworks/Java/gemini/start.sh

@@ -1,7 +1,6 @@
 #!/bin/bash
 
-# load java environment variables
-source $IROOT/java7.installed
+fw_depends java7 resin maven
 
 sed -i 's|db.ConnectString = .*/|db.ConnectString = '"$DBHOST"':3306/|g' Docroot/WEB-INF/GeminiHello.conf
 sed -i 's|root-directory=".*/FrameworkBenchmarks/frameworks/Java/gemini|root-directory="'"$TROOT"'|g' Docroot/WEB-INF/resin.xml

+ 9 - 7
toolset/benchmark/framework_test.py

@@ -167,6 +167,7 @@ class FrameworkTest:
 
     # Setup environment variables    
     logDir = os.path.join(self.fwroot, self.benchmarker.latest_results_directory, 'logs', self.name.lower())
+    bash_functions_path= os.path.join(self.fwroot 'toolset/setup/linux/bash_functions.sh')
     setup_util.replace_environ(config='$FWROOT/config/benchmark_profile', 
               command='''\
               export TROOT=%s       && \
@@ -176,7 +177,7 @@ class FrameworkTest:
               export MAX_THREADS=%s    \
               ''' % (
                 self.directory, 
-                self.install_root, 
+                self.iroot, 
                 self.database_host, 
                 logDir,
                 self.benchmarker.threads))
@@ -211,7 +212,7 @@ class FrameworkTest:
     # See http://www.pixelbeat.org/programming/stdio_buffering/
     # See https://blogs.gnome.org/markmc/2013/06/04/async-io-and-python/
     # See http://eyalarubas.com/python-subproc-nonblock.html
-    command = 'sudo -u %s -E -H stdbuf -o0 -e0 bash -ex %s.sh' % (self.benchmarker.runner_user, self.setup_file)
+    command = 'cat %s %s.sh > /tmp/command.sh && sudo -u %s -E -H stdbuf -o0 -e0 bash -ex /tmp/command.sh' % (bash_functions_path, os.path.join(self.troot, self.setup_file), self.benchmarker.runner_user)
     
     debug_command = '''\
       export FWROOT=%s      && \\
@@ -249,7 +250,8 @@ class FrameworkTest:
     # Start the setup.sh command
     p = subprocess.Popen(command, cwd=self.directory, 
           shell=True, stdout=subprocess.PIPE, 
-          stderr=subprocess.STDOUT)
+          stderr=subprocess.STDOUT,
+          executable='/bin/bash')
     nbsr = setup_util.NonBlockingStreamReader(p.stdout, 
       "%s: %s.sh and framework processes have terminated" % (self.name, self.setup_file))
 
@@ -473,6 +475,10 @@ class FrameworkTest:
         results = self.__parse_test(test_type)
         self.benchmarker.report_benchmark_results(framework=self, test=test_type, results=results['results'])
 
+  ##########################################################################################
+  # Private Methods
+  ##########################################################################################
+
   ############################################################
   # __parse_test(test_type)
   ############################################################
@@ -579,10 +585,6 @@ class FrameworkTest:
   # End benchmark
   ############################################################
 
-  ##########################################################################################
-  # Private Methods
-  ##########################################################################################
-
   ############################################################
   # __generate_concurrency_script(url, port)
   # Generates the string containing the bash script that will

+ 14 - 6
toolset/setup/linux/bash_functions.sh

@@ -20,6 +20,8 @@ fw_get () {
   # Ensure the background job is killed if we are
   kill $!; trap 'kill $!' SIGTERM
 }
+# Makes it available in subshells
+export -f fw_get
 
 fw_untar() {
   echo "Running 'tar xf $@'...please wait"
@@ -29,6 +31,7 @@ fw_untar() {
   # use -f to avoid printing errors if they gave additional arguments
   rm -f "$@"
 }
+export -f fw_untar
 
 fw_unzip() {
   echo "Running 'unzip $@'...please wait"
@@ -37,6 +40,7 @@ fw_unzip() {
   # use -f to avoid printing errors if they gave additional arguments
   rm -f "$@"
 }
+export -f fw_unzip
 
 # Download *.deb file and install into IROOT without using sudo
 # Does not download dependant packages
@@ -49,6 +53,7 @@ fw_apt_to_iroot() {
   echo "Extracting $1 to $DIR"
   dpkg-deb -x $1*.deb "$IROOT/$DIR" && rm $1*.deb
 }
+export -f 
 
 # Was there an error for the current dependency?
 FW_dep_error=0
@@ -73,6 +78,7 @@ fw_traperror () {
   #echo "  Bash source stack : ${bashstack[@]}"
   #echo "  Bash line stack   : ${linestack[@]}"
 }
+export -f fw_traperror
 
 # Requires dependencies to come in order e.g. Nimrod before
 # Jester, etc. Users should be know this 
@@ -91,7 +97,7 @@ fw_depends() {
     retcode=0
 
     # Ensure we are inside the installer root for this framework
-    cd $IROOT
+    pushd $IROOT
     wd=$(pwd)
     relative_wd=\$FWROOT${wd#$FWROOT}
 
@@ -119,10 +125,15 @@ fw_depends() {
       . $FWROOT/toolset/setup/linux/frameworks/${depend}.sh
     else
       echo WARN: No installer found for $depend
+      # Return whence you came.
+      popd
       continue
     fi
     set +x
 
+    # Return whence you came.
+    popd
+
     # For a sourced script to pass, all internal commands must return
     # non-zero. If you want to intentionally cause a failed install
     # message, just return a non-zero status from the sourced script
@@ -140,11 +151,9 @@ fw_depends() {
   set +E
   trap - ERR
 
-  # Politely return to IROOT for later install.sh code
-  cd $IROOT  
-
   return $FW_any_errors
 }
+export -f fw_depends
 
 # Echo's 0 if file or directory exists
 # To be used with or || blocks, avoids triggering our ERR 
@@ -156,5 +165,4 @@ fw_exists() {
     echo 1
   fi 
 }
-
-
+export -f fw_exists

+ 1 - 4
toolset/setup/linux/installer.py

@@ -26,10 +26,7 @@ class Installer:
     for k,v in script_vars.iteritems():
       l.append("export %s=%s" % (k,v))
     script_vars_str = "\n".join(l) + "\n\n"
-
-    if imode == 'all' or imode == 'server':
-      self.__install_server_software()
-
+    
     if imode == 'all' or imode == 'database':
       print("\nINSTALL: Installing database software\n")   
       self.__run_command("cd .. && " + self.benchmarker.database_sftp_string(batch_file="../config/database_sftp_batch"), True)

+ 3 - 1
toolset/setup/linux/languages/java7.sh

@@ -16,4 +16,6 @@ sudo apt-get install -y openjdk-7-jdk
 
 # Setup environment variables
 echo "export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-`dpkg --print-architecture`" > $IROOT/java7.installed
-echo "export PATH=$JAVA_HOME/bin:$PATH" >> $IROOT/java7.installed
+chmod +x $IROOT/java7.installed
+
+. $IROOT/java7.installed

+ 9 - 3
toolset/setup/linux/webservers/resin.sh

@@ -2,8 +2,11 @@
 
 RVER=4.0.41
 
-RETCODE=$(fw_exists ${IROOT}/resin-$RVER.installed)
-[ ! "$RETCODE" == 0 ] || { return 0; }
+RETCODE=$(fw_exists ${IROOT}/resin-${RVER}.installed)
+[ ! "$RETCODE" == 0 ] || { \
+  # Load environment variables
+  . $IROOT/resin-$RVER.installed 
+  return 0; }
 
 fw_depends java7
 sudo cp -r $JAVA_HOME/include $JAVA_HOME/jre/bin/
@@ -21,4 +24,7 @@ cat $FWROOT/config/resin.properties > conf/resin.properties
 mv conf/resin.xml conf/resin.xml.orig
 cat $FWROOT/config/resin.xml > conf/resin.xml
 
-touch ${IROOT}/resin-$RVER.installed
+echo "export RESIN_HOME=${IROOT}/resin-${RVER}" > ${IROOT}/resin-$RVER.installed
+chmod +x ${IROOT}/resin-$RVER.installed
+
+. ${IROOT}/resin-$RVER.installed