Check if java home present on installer post script
#!/bin/bash
+if [ -e "$JAVA_HOME"/bin/java ]; then
# Source debconf library.
. /usr/share/debconf/confmodule
@@ -10,22 +11,17 @@ unzip -qq /opt/datafari/tomcat/webapps/Datafari/Datafari.war -d /opt/datafari/to
# Get Git commit id and version
-
file="/opt/datafari/tomcat/conf/git.properties"
-if [ -f "$file" ]
- then
- while IFS='=' read -r key value
- do
- if [[ $key == git.commit.id.abbrev ]]
- then
+ if [ -f "$file" ]; then
+ while IFS='=' read -r key value; do
+ if [[ $key == git.commit.id.abbrev ]]; then
commit=$value
fi
- if [[ $key == git.closest.tag.name ]]
- then
+ if [[ $key == git.closest.tag.name ]]; then
version=$value
fi
@@ -36,7 +32,6 @@ sed -i -e "s/@VERSION@/$version/g" /opt/datafari/tomcat/webapps/Datafari/footer.
sed -i -e "s/@VERSION@/$version/g" /opt/datafari/tomcat/webapps/Datafari/admin/admin-footer.jsp
sed -i -e "s/@COMMIT@/$commit/g" /opt/datafari/tomcat/webapps/Datafari/admin/admin-footer.jsp
-
#start script
db_input high datafari/node_host || true
@@ -87,3 +82,11 @@ chmod 755 /opt/datafari/elk/kibana/bin/*
chmod 755 /opt/datafari/elk/kibana/node/bin/*
chmod 755 /opt/datafari/elk/logstash/vendor/jruby/bin/*
chmod 755 /opt/datafari/elk/scripts/*
+
+else
+ echo "Datafari cannot be installed."
+ echo "Environment variable JAVA_HOME is not properly set." 1>&2
+ echo "Please set your JAVA HOME variable and reinstall Datafari"
+ echo "Go to https://datafari.atlassian.net/wiki/spaces/DATAFARI/pages/66125825/Quick+Start+Guide for more information"
+ exit 1
+fi
