# Payara Version
PAYARA_VERSION=4.1.153
-# Payara URLs
+# Payara directory
+PAYARA_HOME=/opt/payara/payara-$PAYARA_VERSION
+
+
+# Payara Edition URLs
case "$PAYARA_VERSION" in
4.1.151)
FULL=http://bit.ly/1CGCtI9
echo "unknown version number"
esac
-# Payara directory
-PAYARA_HOME=/opt/payara/payara-$PAYARA_VERSION
-#
+# Payara edition (Full, Web, Micro, etc., from above list)
+PAYARA_ED=$MINIMAL
+
#
#
##########################################
-echo "Provisioning Payara-$PAYARA_VERSION to $PAYARA_HOME"
-
# Download and unzip to /opt/payara
-echo "running update..."
-sudo apt-get -qqy update # Update the repos
-
-echo "installing openjdk and unzip"
-sudo apt-get -qqy install openjdk-7-jdk # Install JDK 7
-sudo apt-get -qqy install unzip # Install unzip
+installPayara() {
+ echo "Provisioning Payara-$PAYARA_VERSION $PAYARA_ED to $PAYARA_HOME"
+
+ echo "running update..."
+ sudo apt-get -qqy update # Update the repos
+
+ echo "installing openjdk and unzip"
+ sudo apt-get -qqy install openjdk-7-jdk # Install JDK 7
+ sudo apt-get -qqy install unzip # Install unzip
+
+ echo "Downloading Payara $PAYARA_VERSION"
+ wget -q $PAYARA_ED -O temp.zip > /dev/null # Download Payara
+ sudo mkdir -p $PAYARA_HOME # Make dirs for Payara
+ unzip -qq temp.zip -d $PAYARA_HOME # unzip Payara to dir
+ sudo chown -R vagrant:vagrant $PAYARA_HOME # Make sure vagrant owns dir
+}
-echo "Downloading Payara $PAYARA_VERSION"
-wget -q $WEB -O temp.zip > /dev/null # Download Payara
-sudo mkdir -p $PAYARA_HOME/startup # Make dirs for Payara
-unzip -qq temp.zip -d $PAYARA_HOME # unzip Payara to dir
-
-#########################################
-#
-# Delete or comment out from here down
-# for Micro/Embedded versions
-#
-#########################################
# Copy startup script, and create service
-echo "installing startup scripts"
-sudo cp /vagrant/payara_service-$PAYARA_VERSION $PAYARA_HOME/startup/
-sudo chmod +x $PAYARA_HOME/startup/payara_service-$PAYARA_VERSION
-ln -s $PAYARA_HOME/startup/payara_service-$PAYARA_VERSION /etc/init.d/payara
-
-echo "Adding payara system startup..."
-sudo update-rc.d payara defaults > /dev/null
-
-sudo chown -R vagrant:vagrant $PAYARA_HOME # Make sure vagrant owns dir
+installService() {
+ echo "installing startup scripts"
+ mkdir -p $PAYARA_HOME/startup # Make dirs for Payara
+ cp /vagrant/payara_service-$PAYARA_VERSION $PAYARA_HOME/startup/
+ chmod +x $PAYARA_HOME/startup/payara_service-$PAYARA_VERSION
+ ln -s $PAYARA_HOME/startup/payara_service-$PAYARA_VERSION /etc/init.d/payara
+
+ echo "Adding payara system startup..."
+ sudo update-rc.d payara defaults > /dev/null
+
+ #sudo chown -R vagrant:vagrant $PAYARA_HOME # Make sure vagrant owns dir
+
+ echo "starting Payara..."
+
+ # Explicitly start payaradomain by default
+ case "$PAYARA_VERSION" in
+ 4.1.151)
+ su - vagrant -c 'service payara start domain1'
+ ;;
+ 4.1.152)
+ su - vagrant -c 'service payara start payaradomain'
+ ;;
+ 4.1.153)
+ su - vagrant -c 'service payara start payaradomain'
+ ;;
+ /*)
+ echo "Unknown Payara version, attempting to start domain1..."
+ su - vagrant -c 'service payara start domain1'
+ esac
+}
-echo "starting Payara..."
+installPayara
-# Explicitly start payaradomain by default
-case "$PAYARA_VERSION" in
- 4.1.151)
- su - vagrant -c 'service payara start domain1'
- ;;
- 4.1.152)
- su - vagrant -c 'service payara start payaradomain'
- ;;
- 4.1.153)
- su - vagrant -c 'service payara start payaradomain'
- ;;
- /*)
- echo "Unknown Payara version, attempting to start domain1..."
- su - vagrant -c 'service payara start domain1'
-esac
+if [ $PAYARA_ED = $WEB ] ||
+ [ $PAYARA_ED = $FULL ] ||
+ [ $PAYARA_ED = $MULTI_LANGUAGE_FULL ] ||
+ [ $PAYARA_ED = $MULTI_LANGUAGE_WEB ]; then
+ installService
+fi