Permalink
Browse files

Some bash scripts for setting up the test environment

  • Loading branch information...
1 parent c4c08a2 commit 0f3687882c01878aed3235b11692c682b2008b3e @vjuranek vjuranek committed Oct 31, 2011
Showing with 49 additions and 0 deletions.
  1. +49 −0 setup.sh
View
@@ -0,0 +1,49 @@
+#!/bin/bash -e
+
+LIB_DIR="./lib" # if changed, JENKINS_LIB_DIR variable in test/selenium/lib/base.rb needs to be changed as well!
+JENKINS_WAR="$LIB_DIR/jenkins.war"
+
+function prepare_lib_dir {
+ # LIB_DIR doesn't exist
+ if [ ! -d $LIB_DIR ]; then
+ echo "Creating lib dir ($LIB_DIR)"
+ mkdir $LIB_DIR
+ fi
+}
+
+function clean_lib_dir {
+ # LIB_DIR is not empty
+ if [ !`ls -A $LIB_DIR` ]; then
+ echo "Lib dir ($LIB_DIR) is not empty, cleaning"
+ rm -rf $LIB_DIR
+ fi
+
+}
+
+function grab_latest_rc {
+ curl "http://mirrors.jenkins-ci.org/war-rc/latest/jenkins.war" > $JENKINS_WAR
+}
+
+function grab_latest_lts {
+ curl "http://mirrors.jenkins-ci.org/war-stable/latest/jenkins.war" > $JENKINS_WAR
+}
+
+function extract_slave {
+ prepare_lib_dir
+ tmp_dir=`mktemp -d`
+ unzip $JENKINS_WAR -d $tmp_dir
+ if [ -r $tmp_dir/WEB-INF/slave.jar ]; then
+ cp $tmp_dir/WEB-INF/slave.jar $LIB_DIR
+ else
+ echo "slave.jar ($tmp_dir/WEB-INF/slave.jar) wasn't found, exit!"
+ rm -rf $tmp_dir
+ exit 1
+ fi
+ rm -rf $tmp_dir
+}
+
+
+extract_slave
+
+
+

0 comments on commit 0f36878

Please sign in to comment.