You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lens.apache.org by am...@apache.org on 2015/01/11 07:11:15 UTC
incubator-lens git commit: LENS-181 : Adds post install script to
expand war (Himanshu Gahlaut via amareshwari)
Repository: incubator-lens
Updated Branches:
refs/heads/master 9d8695df6 -> 8c722a523
LENS-181 : Adds post install script to expand war (Himanshu Gahlaut via amareshwari)
Project: http://git-wip-us.apache.org/repos/asf/incubator-lens/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-lens/commit/8c722a52
Tree: http://git-wip-us.apache.org/repos/asf/incubator-lens/tree/8c722a52
Diff: http://git-wip-us.apache.org/repos/asf/incubator-lens/diff/8c722a52
Branch: refs/heads/master
Commit: 8c722a5230acba478c11727f63ebd8123d3b8406
Parents: 9d8695d
Author: Amareshwari Sriramdasu <am...@inmobi.com>
Authored: Sun Jan 11 11:40:59 2015 +0530
Committer: Amareshwari Sriramdasu <am...@inmobi.com>
Committed: Sun Jan 11 11:40:59 2015 +0530
----------------------------------------------------------------------
lens-dist/pom.xml | 9 +++--
lens-dist/src/deb/control/postinst | 67 +++++++++++++++++++++++++++++++++
pom.xml | 19 ++++++++++
tools/scripts/lens-config.sh | 7 +---
4 files changed, 92 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/8c722a52/lens-dist/pom.xml
----------------------------------------------------------------------
diff --git a/lens-dist/pom.xml b/lens-dist/pom.xml
index f3c5463..0c49bf0 100644
--- a/lens-dist/pom.xml
+++ b/lens-dist/pom.xml
@@ -99,7 +99,8 @@
<goal>jdeb</goal>
</goals>
<configuration>
- <installDir>/usr/local/lens</installDir>
+ <installDir>${mvn.lens.install.dir}</installDir>
+ <controlDir>${mvn.deb.build.dir}/control</controlDir>
<deb>${project.build.directory}/lens-server_${project.version}.deb</deb>
<dataSet>
<data>
@@ -107,7 +108,7 @@
<type>directory</type>
<mapper>
<type>perm</type>
- <prefix>/usr/local/lens</prefix>
+ <prefix>${mvn.lens.install.dir}</prefix>
</mapper>
</data>
<data>
@@ -115,7 +116,7 @@
<type>directory</type>
<mapper>
<type>perm</type>
- <prefix>/usr/local/lens/bin</prefix>
+ <prefix>${mvn.lens.bin.dir}</prefix>
<filemode>755</filemode>
</mapper>
</data>
@@ -124,7 +125,7 @@
<type>directory</type>
<mapper>
<type>perm</type>
- <prefix>/usr/local/lens/webapp</prefix>
+ <prefix>${mvn.lens.webapp.dir}</prefix>
</mapper>
</data>
</dataSet>
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/8c722a52/lens-dist/src/deb/control/postinst
----------------------------------------------------------------------
diff --git a/lens-dist/src/deb/control/postinst b/lens-dist/src/deb/control/postinst
new file mode 100644
index 0000000..0cd9d57
--- /dev/null
+++ b/lens-dist/src/deb/control/postinst
@@ -0,0 +1,67 @@
+#!/bin/sh
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# Postinst script for lens
+
+manage_war_expansion () {
+
+ # Lens Server war is expanded into lens server directory.
+
+ WEB_APP_DIR=${mvn.lens.webapp.dir}
+ LENS_SERVER_DIR=${mvn.lens.server.dir}
+
+ # 1. Remove lens server directory and its contents
+ rm -rf $LENS_SERVER_DIR
+
+ # 2. Recreate lens server directory
+ mkdir -p $LENS_SERVER_DIR
+
+ # 3. Expand the newly installed war in lens server directory
+ cd $LENS_SERVER_DIR
+ if [ $? -ne 0 ]; then
+ echo "Could not change directory to->"$LENS_SERVER_DIR
+ return 1
+ fi
+
+ jar -xf $WEB_APP_DIR/lens-server.war
+
+ if [ $? -ne 0 ]; then
+ echo "War expansion failed"
+ return 1
+ fi
+
+ cd -
+ if [ $? -ne 0 ]; then
+ echo "Could not move back from the changed directory"
+ return 1
+ fi
+
+ return 0
+
+}
+
+manage_war_expansion
+
+if [ $? -ne 0 ]; then
+ echo "Debian installation unsuccessful"
+ exit 1
+fi
+
+exit 0
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/8c722a52/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 30ba1a3..e7b1f1c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -97,6 +97,16 @@
<war.plugin.version>2.1.1</war.plugin.version>
<license.plugin.version>2.6</license.plugin.version>
<buildnumber.plugin.version>1.0</buildnumber.plugin.version>
+
+ <!-- debian -->
+ <mvn.deb.build.dir>${project.build.directory}/debian</mvn.deb.build.dir>
+
+ <!-- installation -->
+ <mvn.lens.install.dir>/usr/local/lens</mvn.lens.install.dir>
+ <mvn.lens.bin.dir>${mvn.lens.install.dir}/bin</mvn.lens.bin.dir>
+ <mvn.lens.webapp.dir>${mvn.lens.install.dir}/webapp</mvn.lens.webapp.dir>
+ <mvn.lens.server.dir>${mvn.lens.webapp.dir}/lens-server</mvn.lens.server.dir>
+
</properties>
<groupId>org.apache.lens</groupId>
@@ -230,6 +240,15 @@
</reporting>
<build>
+
+ <resources>
+ <resource>
+ <directory>${basedir}/src/deb/control</directory>
+ <targetPath>${mvn.deb.build.dir}/control</targetPath>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+
<pluginManagement>
<plugins>
<plugin>
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/8c722a52/tools/scripts/lens-config.sh
----------------------------------------------------------------------
diff --git a/tools/scripts/lens-config.sh b/tools/scripts/lens-config.sh
index 8bd9013..9f5d6e7 100644
--- a/tools/scripts/lens-config.sh
+++ b/tools/scripts/lens-config.sh
@@ -94,12 +94,7 @@ case $type in
LENS_EXPANDED_WEBAPP_DIR=${LENS_EXPANDED_WEBAPP_DIR:-${BASEDIR}/webapp}
export LENS_EXPANDED_WEBAPP_DIR
# set the server classpath
- if [ ! -d ${LENS_EXPANDED_WEBAPP_DIR}/lens-server/WEB-INF ]; then
- mkdir -p ${LENS_EXPANDED_WEBAPP_DIR}/lens-server
- cd ${LENS_EXPANDED_WEBAPP_DIR}/lens-server
- $JAR_BIN -xf ${BASEDIR}/webapp/lens-server.war
- cd -
- fi
+
LENSCPPATH="${LENSCPPATH}:${LENS_EXPANDED_WEBAPP_DIR}/lens-server/WEB-INF/classes"
LENSCPPATH=${LENSCPPATH}:`ls ${LENS_EXPANDED_WEBAPP_DIR}/lens-server/WEB-INF/lib/* 2>/dev/null | tr "\n" ':' 2>/dev/null`
LENSCPPATH=${LENSCPPATH}:`ls ${BASEDIR}/lib/* 2>/dev/null | tr "\n" ':' 2>/dev/null`