summaryrefslogtreecommitdiffstats
path: root/packaging
diff options
context:
space:
mode:
authorLisa Stillwell <lisa@localhost.localdomain>2012-05-09 09:44:09 (GMT)
committer Lisa Stillwell <lisa@localhost.localdomain>2012-05-09 09:44:09 (GMT)
commit65a66813ed49b796a4db737a8641bda3ee83ad59 (patch)
tree2c511cf3b26fe89325819cc6c18e0ef9d72d0192 /packaging
parent3a6a5935c939d621a275e28e3e85d9e863ee0c2f (diff)
downloadQCG-Data-65a66813ed49b796a4db737a8641bda3ee83ad59.zip
QCG-Data-65a66813ed49b796a4db737a8641bda3ee83ad59.tar.gz
QCG-Data-65a66813ed49b796a4db737a8641bda3ee83ad59.tar.bz2
[#769 first delivery
Diffstat (limited to 'packaging')
-rw-r--r--packaging/COPYING1
-rw-r--r--packaging/README1
-rwxr-xr-xpackaging/build.sh92
-rw-r--r--packaging/idrop-web.list.template187
4 files changed, 281 insertions, 0 deletions
diff --git a/packaging/COPYING b/packaging/COPYING
new file mode 100644
index 0000000..6c55f07
--- /dev/null
+++ b/packaging/COPYING
@@ -0,0 +1 @@
+Licensing stuff here.
diff --git a/packaging/README b/packaging/README
new file mode 100644
index 0000000..8548376
--- /dev/null
+++ b/packaging/README
@@ -0,0 +1 @@
+Info aboutpackage here.
diff --git a/packaging/build.sh b/packaging/build.sh
new file mode 100755
index 0000000..52f77dd
--- /dev/null
+++ b/packaging/build.sh
@@ -0,0 +1,92 @@
+#!/bin/bash
+#requirements:
+# Jargon
+# Java SDK 1.6+
+# Maven 3+
+# Grails
+# EPM packager
+
+# define witch idrop-lite applet to use
+IDROP_LITE_APPLET=idrop-lite-1.0.1-SNAPSHOT-jar-with-dependencies.jar
+
+# check to make sure mvn, grails, and epm commands are in path
+command -v mvn >/dev/null 2>&1 || { echo "Maven commands must be in PATH to package iDrop Web. Aborting." >&2; exit 1; }
+
+command -v grails >/dev/null 2>&1 || { echo "Grails commands must be in PATH to package iDrop Web. Aborting." >&2; exit 1; }
+
+command -v epm >/dev/null 2>&1 || { echo "EPM commands must be in PATH to package iDrop Web. Aborting." >&2; exit 1; }
+
+# get into the correct directory
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+cd $DIR
+
+# build idrop swing first
+echo "Building iDrop Swing ..."
+cd ../idrop-swing
+#mvn assembly:assembly -Dmaven.test.skip=true
+# TODO: jar (JNLP) created is signed and expire is 6 months????
+mvn package webstart:jnlp-inline -Dmaven.test.skip=true
+RETVAL=$?
+if [ $RETVAL -eq 1 ]; then
+ echo "iDrop Swing Build Failed - Exiting"
+ echo "Packaging Failed"
+ exit 1
+fi
+
+# now build idrop-lite
+echo "Building iDrop Lite ..."
+cd ../idrop-lite
+mvn assembly:assembly -Dmaven.test.skip=true
+RETVAL=$?
+if [ $RETVAL -eq 1 ]; then
+ echo "iDrop Lite Build Failed - Exiting"
+ echo "Packaging Failed"
+ exit 1
+fi
+
+# now build grails war file
+echo "Building iDrop Web ..."
+cd ../idrop-web
+grails war idrop-web.war
+# TODO: check return value of grails build??
+
+#create EPM .list file
+# available from: http://fossies.org/unix/privat/epm-4.2-source.tar.gz
+# md5sum 3805b1377f910699c4914ef96b273943
+
+echo "Creating Package ..."
+cd ../packaging
+if [ -d idrop-web ]; then
+ rm -rf idrop-web
+fi
+mkdir idrop-web
+cd idrop-web
+cp ../../idrop-web/idrop-web.war .
+unzip idrop-web.war
+mkdir extras
+# get idrop-lite applet
+cp ../../idrop-lite/target/$IDROP_LITE_APPLET extras
+# get idrop-swing app
+cp ../../idrop-swing/target/jnlp/idrop.jnlp extras
+rm -f idrop-web.war
+cd ..
+
+mkepmlist -u idropweb -g idropweb --prefix /usr/share/idrop-web idrop-web > idrop-web.list
+sed 's/\$/$$/g' idrop-web.list > tmp.list
+cat idrop-web.list.template tmp.list > idrop-web.list
+rm tmp.list
+
+if [ -f "/etc/redhat-release" ]; then # CentOS and RHEL and Fedora
+ echo "Running EPM :: Generating RPM"
+ epm -f rpm idrop-web idrop-web.list
+elif [ -f "/etc/SuSE-release" ]; then # SuSE
+ echo "Running EPM :: Generating RPM"
+ epm -f rpm idrop-web idrop-web.list
+elif [ -f "/etc/lsb-release" ]; then # Ubuntu
+ echo "Running EPM :: Generating DEB"
+ epm -a amd64 -f deb idrop-web idrop-web.list
+elif [ -f "/usr/bin/sw_vers" ]; then # MacOSX
+ echo "TODO: generate package for MacOSX"
+fi
+
+rm idrop-web.list
diff --git a/packaging/idrop-web.list.template b/packaging/idrop-web.list.template
new file mode 100644
index 0000000..7ea9001
--- /dev/null
+++ b/packaging/idrop-web.list.template
@@ -0,0 +1,187 @@
+%product iRODS iDrop Web
+%copyright Any copyright here.
+%vendor Data Intensive Cyberinfrastructure Foundation, Renaissance Computing Institute
+%license COPYING
+%readme README
+%description Web Based Interface for Interacting with the iRODS data grid
+%version 3.1 300001
+
+%if DEB
+%elseif RPM
+%endif
+
+#%requires http 2
+#%requires java 6
+#%requires wget
+
+%format all
+
+# =-=-=-=-=-=-=-
+# variables for configuring the install
+# =-=-=-=-=-=-=-
+$OS_IDROP_ACCT=idropweb
+$OS_IDROP_DIR=idrop-web
+$IDROP_HOME_DIR=/usr/share/$OS_IDROP_DIR
+
+$OS_TOMCAT_ACCT=idroptomcat
+$TOMCAT_EXTRACT_DIR=/usr/share
+$TOMCAT_VER=7
+$TOMCAT_VER_DOT=0.27
+$TOMCAT_FILE=apache-tomcat-${TOMCAT_VER}.${TOMCAT_VER_DOT}
+$TOMCAT_ARC_FILE=${TOMCAT_FILE}.tar.gz
+$TOMCAT_HTTP_HOST=http://apache.mirrors.pair.com/tomcat/tomcat-${TOMCAT_VER}/v${TOMCAT_VER}.${TOMCAT_VER_DOT}/bin/
+$TOMCAT_TMP_LOC=/tmp/tomcat${TOMCAT_VER}.tar.gz
+$TOMCAT_HOME_DIR=${TOMCAT_EXTRACT_DIR}/idrop-tomcat-${TOMCAT_VER}.${TOMCAT_VER_DOT}
+$TOMCAT_STARTED=false
+
+# =-=-=-=-=-=-=-
+# preinstall directives
+# =-=-=-=-=-=-=-
+%preinstall << END_PREINSTALL
+
+#make sure tomcat is not already installed here
+if [ -d "${TOMCAT_HOME_DIR}" ]; then
+ echo "WARNING :: Tomcat Is Already Installed In: ${TOMCAT_HOME_DIR}"
+else
+# install tomcat
+ echo "INFO :: Getting Apache Tomcat version: ${TOMCAT_VER}.${TOMCAT_VER_DOT} ..."
+# download install archive
+ wget -O ${TOMCAT_TMP_LOC} ${TOMCAT_HTTP_HOST}${TOMCAT_ARC_FILE}
+# unpack into share
+ tar -zxf $TOMCAT_TMP_LOC -C $TOMCAT_EXTRACT_DIR
+ mv /usr/share/${TOMCAT_FILE} ${TOMCAT_HOME_DIR}
+fi
+
+# create a service account for tomcat
+# determine if the service account already exists
+USER=$$( grep $OS_TOMCAT_ACCT /etc/passwd )
+if [ -n "$$USER" ];
+then
+ echo "WARNING :: Service Account $OS_TOMCAT_ACCT Already Exists."
+else
+# create the service account
+ echo "INFO :: Creating Service Account: $OS_TOMCAT_ACCT at ${TOMCAT_HOME_DIR}"
+ /usr/sbin/useradd -c "Tomcat" -d ${TOMCAT_HOME_DIR} -s "/sbin/nologin" $OS_TOMCAT_ACCT
+fi
+ACCT=$OS_TOMCAT_ACCT
+chown -R $$ACCT:$$ACCT ${TOMCAT_HOME_DIR}
+
+# create a service account for idrop-web
+# determine if the service account already exists
+USER=$$( grep $OS_IDROP_ACCT /etc/passwd )
+if [ -n "$$USER" ];
+then
+ echo "WARNING :: Service Account $OS_IDROP_ACCT Already Exists"
+else
+# create the service account
+ echo "INFO :: Creating Service Account: $OS_IDROP_ACCT at ${IDROP_HOME_DIR}"
+ /usr/sbin/useradd -m -d ${IDROP_HOME_DIR} $OS_IDROP_ACCT
+fi
+END_PREINSTALL
+
+# =-=-=-=-=-=-=-
+# post install
+# =-=-=-=-=-=-=-
+%postinstall << END_POSTINSTALL
+
+# start tomcat
+echo "INFO :: Starting Tomcat ..."
+su -p -s /bin/sh $OS_TOMCAT_ACCT ${TOMCAT_HOME_DIR}/bin/startup.sh
+
+# wait until the tomcat conf/Catalina/localhost folder is created
+# or timeout after about 10 seconds
+TRIES=0
+while [ "$$TRIES" -lt 100 -a ! -e ${TOMCAT_HOME_DIR}/conf/Catalina/localhost ]; do
+ TRIES=$$((TRIES + 1))
+ sleep .1
+done
+
+# create config file (if it does not exist) for idrop-web in order to allow symbolic linking
+echo "INFO :: Configuring iDrop Web for Tomcat ..."
+if [ -f ${TOMCAT_HOME_DIR}/conf/Catalina/localhost/${OS_IDROP_DIR}.xml ];
+then
+ echo "WARNING :: ${TOMCAT_HOME_DIR}/conf/Catalina/localhost/${OS_IDROP_DIR}.xml Already Exists"
+else
+ echo "<?xml version='1.0' encoding='utf-8'?>
+<Context path=\"/idrop-web\" allowLinking=\"true\">
+
+ <WatchedResource>WEB-INF/web.xml</WatchedResource>
+
+</Context>" > ${TOMCAT_HOME_DIR}/conf/Catalina/localhost/${OS_IDROP_DIR}.xml
+fi
+
+# create symbolic link to idrop-web
+if [ -f ${TOMCAT_HOME_DIR}/webapps/${OS_IDROP_DIR} ];
+then
+ echo "WARNING :: ${TOMCAT_HOME_DIR}/webapps/${OS_IDROP_DIR} Already Exists"
+else
+ ln -s ${IDROP_HOME_DIR} ${TOMCAT_HOME_DIR}/webapps/${OS_IDROP_DIR}
+fi
+
+# add iptables entry for HTTP and port 8080
+echo "INFO :: Modifying Firewall For HTTP Port 8080 access ..."
+/sbin/iptables -N idropweb
+/sbin/iptables -I INPUT 1 -j idropweb
+/sbin/iptables -A idropweb -m state --state NEW -p tcp --dport 80 -j ACCEPT
+/sbin/iptables -A idropweb -m tcp -p tcp --dport 8080 -m state --state NEW -j ACCEPT
+/sbin/iptables -A idropweb -m state --state ESTABLISHED,RELATED -j ACCEPT
+/sbin/service iptables save
+
+# TODO: Any other instructions that should be printed here about configuring idrop-web?
+echo "INFO :: To Run IDrop Web In Web Browser Type: http://localhost:8080/idrop-web"
+END_POSTINSTALL
+
+# =-=-=-=-=-=-=-
+# preremove
+# =-=-=-=-=-=-=-
+%preremove << END_PREREMOVE
+# first check to make sure idrop-web is not logged in.
+USER=$$( who | grep $OS_IDROP_ACCT )
+if [ -n "$$USER" ]; then
+ echo "${OS_IDROP_ACCT} is currently logged in. Aborting."
+ exit 1
+fi
+
+# stop tomcat
+RESULT=$$(ps -ef | grep -i tomcat)
+if [ -n "$$RESULT" ];
+then
+ echo "INFO :: Stopping Tomcat ..."
+ su -p -s /bin/sh $OS_TOMCAT_ACCT ${TOMCAT_HOME_DIR}/bin/shutdown.sh
+fi
+
+# remove iptables entries related to idropweb install
+echo "INFO :: Removing Firewall Access for iDrop Web ..."
+/sbin/iptables -F idropweb
+/sbin/iptables -D INPUT -j idropweb
+/sbin/iptables -X idropweb
+/sbin/service iptables save
+END_PREREMOVE
+
+# =-=-=-=-=-=-=-
+# postremove
+%postremove << END_POSTREMOVE
+# remove idropweb service account
+echo "INFO: :: Removing iDrop Web Service Account: ${OS_IDROP_ACCT} ..."
+USER=$$( grep $OS_IDROP_ACCT /etc/passwd )
+if [ -n "$$USER" ];
+then
+ /usr/sbin/userdel $OS_IDROP_ACCT
+else
+ echo "WARNING :: Service Account: ${OS_IDROP_ACCT} Already Removed"
+fi
+
+# remove tomcat service account
+echo "INFO: :: Removing iDrop Web Tomcat Service Account: ${OS_TOMCAT_ACCT} ..."
+USER=$$( grep $OS_TOMCAT_ACCT /etc/passwd )
+if [ -n "$$USER" ];
+then
+ /usr/sbin/userdel -r $OS_TOMCAT_ACCT
+else
+ echo "WARNING :: Service Account: ${OS_TOMCAT_ACCT} Already Removed."
+fi
+END_POSTREMOVE
+
+# =-=-=-=-=-=-=-
+# =-=-=-=-=-=-=-
+# files, and more files...