Skip to content

Commit

Permalink
ninja and ninja37 packaged to dist, simple upgrade script
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed May 29, 2018
1 parent 72a61fd commit 4ccaa52
Show file tree
Hide file tree
Showing 4 changed files with 168 additions and 2 deletions.
29 changes: 27 additions & 2 deletions dist/pom.xml
Expand Up @@ -58,8 +58,8 @@
<groupId>com.evolveum.midpoint.tools</groupId>
<artifactId>ninja</artifactId>
<version>3.8-SNAPSHOT</version>
</dependency>
<dependency><!-- Not used, but required for surefire plugin not to complain -->
</dependency>
<dependency><!-- Not used, but required for surefire plugin not to complain -->
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
Expand Down Expand Up @@ -103,6 +103,31 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<id>copy-model</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.evolveum.midpoint.tools</groupId>
<artifactId>ninja</artifactId>
<version>3.7.2-SNAPSHOT</version> <!-- TODO switch to 3.7.2 -->
<type>jar</type>
</artifactItem>
</artifactItems>
<outputDirectory>target/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
Expand Down
9 changes: 9 additions & 0 deletions dist/src/main/assembly/dist.xml
Expand Up @@ -85,6 +85,15 @@
<directory>${project.basedir}/src/main/bin</directory>
<outputDirectory>/bin</outputDirectory>
</fileSet>
<fileSet>
<directory>target/lib</directory>
<outputDirectory>/lib</outputDirectory>
<directoryMode>755</directoryMode>
<fileMode>644</fileMode>
<includes>
<include>ninja-*</include>
</includes>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
Expand Down
71 changes: 71 additions & 0 deletions dist/src/main/bin/ninja37.sh
@@ -0,0 +1,71 @@
#!/bin/bash
#
# Licensed 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.
#
# Parts of this file Copyright (c) 2017 Evolveum
#

SCRIPT_PATH=$(cd $(dirname "$0") && pwd -P)/

# resolve links - $0 may be a softlink
PRG="$0"

while [ -h "$PRG" ]; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`/"$link"
fi
done

# Get standard environment variable
PRGDIR=`dirname "$PRG"`

cd "$PRGDIR/.." >/dev/null

cd "$SCRIPT_PATH/.."

if [ ! -d var ] ; then
echo "ERROR: midpoint.home directory desn't exist"
exit 1
else
MIDPOINT_HOME=$(cd "$SCRIPT_PATH../var"; pwd)
fi

[ -z "$MIDPOINT_HOME" ] && MIDPOINT_HOME=`cd "$SCRIPT_PATH../var" >/dev/null; pwd`

cd "$SCRIPT_PATH../lib"

if [ ! -f ninja-3.7.2.jar ] ; then
echo "ERROR: ninja-3.7.2.jar is not in /lib directory"
exit 1
fi

# Set UMASK unless it has been overridden
if [ -z "$UMASK" ]; then
UMASK="0027"
fi
umask $UMASK

if [ -z "$JAVA_HOME" ] ; then
_RUNJAVA=java
else
_RUNJAVA="$JAVA_HOME"/bin/java
fi


exec "$_RUNJAVA" -jar $SCRIPT_PATH../lib/ninja-3.7.2.jar -m $MIDPOINT_HOME $@


61 changes: 61 additions & 0 deletions dist/src/main/bin/upgrade.sh
@@ -0,0 +1,61 @@
#!/usr/bin/env bash
#
# Licensed 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.
#
# Parts of this file Copyright (c) 2018 Evolveum
#

if [ $# -eq 0 ]; then
echo "No arguments supplied"
exit 1
fi

SCRIPT_PATH=$(cd $(dirname "$0") && pwd -P)/

# resolve links - $0 may be a softlink
PRG="$0"

PRGDIR=`dirname "$PRG"`

MIDPOINT_EXISTING_FOLDER="$1"

if [ ! -d "$MIDPOINT_EXISTING_FOLDER" ]; then
echo "'$MIDPOINT_EXISTING_FOLDER' is not a folder"
exit 1
fi

# MOVE TO *37
#drwxr-xr-x 13 bin
#drwxr-xr-x 4 lib

mv $MIDPOINT_EXISTING_FOLDER/bin $MIDPOINT_EXISTING_FOLDER/bin.backup
mv $MIDPOINT_EXISTING_FOLDER/lib $MIDPOINT_EXISTING_FOLDER/lib.backup

# DELETE
#drwxr-xr-x 6 doc
rm -rf $MIDPOINT_EXISTING_FOLDER/doc

# DON'T TOUCH
#drwxr-xr-x 17 var

# REPLACE
#-rw-r--r-- 1 INSTALL
#-rw-r--r-- 1 LICENSE
#-rw-r--r-- 1 NEWS
#-rw-r--r-- 1 NOTICE
#-rw-r--r-- 1 README
#-rw-r--r-- 1 RELEASE-NOTES

# COPY everything from 3.8

cp -r "$PRGDIR/.."/* $MIDPOINT_EXISTING_FOLDER/

0 comments on commit 4ccaa52

Please sign in to comment.