Skip to content

Commit

Permalink
modified linux scripts for ninja.jar added ninja.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
KristianSuchanovsky committed Feb 16, 2018
1 parent 6e49c9c commit 01755f9
Show file tree
Hide file tree
Showing 4 changed files with 192 additions and 258 deletions.
97 changes: 8 additions & 89 deletions dist/src/main/bin/export.sh
Expand Up @@ -17,94 +17,13 @@ done

# Get standard environment variable
PRGDIR=`dirname "$PRG"`
EXECUTABLE=ninja.sh

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.jar ] ; then
echo "ERROR: ninja.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

DATE=`date '+%Y-%m-%d-%H:%M:%S'`

OPTIONS=""
EXP_OPTIONS=""

while getopts "c:hm:p:P:sU:u:vVf:o:O:rt:z" option; do
case "${option}" in
c) c="-c $OPTARG "
OPTIONS+="${c}"
;;
h) h="-h "
OPTIONS+="${h}"
;;
m) echo "midpoint.home set by default"
;;
p) p="-p $OPTARG "
OPTIONS+="${p}"
;;
P) P="-P $OPTARG "
OPTIONS+="${P}"
;;
s) s="-s "
OPTIONS+="${s}"
;;
U) U="-U $OPTARG "
OPTIONS+="${U}"
;;
u) u="-u $OPTARG "
OPTIONS+="${u}"
;;
v) v="-v "
OPTIONS+="${v}"
;;
V) V="-V "
OPTIONS+="${V}"
;;
f) f="-f $OPTARG "
EXP_OPTIONS+="${f}"
;;
o) o="-o $OPTARG "
EXP_OPTIONS+="${o}"
;;
O) echo "Output file already set by default"
;;
r) r="-r "
EXP_OPTIONS+="${r}"
;;
t) t="-t $OPTARG "
EXP_OPTIONS+="${t}"
;;
z) z="-z "
EXP_OPTIONS+="${z}"
;;
esac
done

exec "$_RUNJAVA" -jar $SCRIPT_PATH../lib/ninja.jar $OPTIONS -m $MIDPOINT_HOME export $EXP_OPTIONS -O "export.$DATE.xml"
if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then
echo "Cannot find $PRGDIR/$EXECUTABLE"
echo "The file is absent or does not have execute permission"
echo "This file is needed to run this program"
exit 1
fi

exec "$PRGDIR"/"$EXECUTABLE" export "$@"
100 changes: 8 additions & 92 deletions dist/src/main/bin/import.sh
Expand Up @@ -17,98 +17,14 @@ done

# Get standard environment variable
PRGDIR=`dirname "$PRG"`
EXECUTABLE=ninja.sh

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.jar ] ; then
echo "ERROR: ninja.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


OPTIONS=""
IMP_OPTIONS=""
if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then
echo "Cannot find $PRGDIR/$EXECUTABLE"
echo "The file is absent or does not have execute permission"
echo "This file is needed to run this program"
exit 1
fi

while getopts "c:hm:p:P:sU:u:vVef:i:o:Ort:z" option; do
case "${option}" in
c) c="-c $OPTARG "
OPTIONS+="${c}"
;;
h) h="-h "
OPTIONS+="${h}"
;;
m) echo "midpoint.home set by default"
;;
p) p="-p $OPTARG "
OPTIONS+="${p}"
;;
P) P="-P $OPTARG "
OPTIONS+="${P}"
;;
s) s="-s "
OPTIONS+="${s}"
;;
U) U="-U $OPTARG "
OPTIONS+="${U}"
;;
u) u="-u $OPTARG "
OPTIONS+="${u}"
;;
v) v="-v "
OPTIONS+="${v}"
;;
V) V="-V "
OPTIONS+="${V}"
;;
e) e="-e "
IMP_OPTIONS+="${e}"
;;
f) f="-f $OPTARG "
IMP_OPTIONS+="${f}"
;;
i) i="-i $OPTARG "
IMP_OPTIONS+="${i}"
;;
o) o="-o $OPTARG "
IMP_OPTIONS+="${o}"
;;
O) echo "Overwrite option already set by default"
;;
r) r="-r "
IMP_OPTIONS+="${r}"
;;
t) t="-t $OPTARG "
IMP_OPTIONS+="${t}"
;;
z) z="-z "
IMP_OPTIONS+="${z}"
;;
esac
done
exec "$PRGDIR"/"$EXECUTABLE" import "$@"

exec "$_RUNJAVA" -jar $SCRIPT_PATH../lib/ninja.jar $OPTIONS -m $MIDPOINT_HOME import $IMP_OPTIONS -O
85 changes: 8 additions & 77 deletions dist/src/main/bin/keys.sh
Expand Up @@ -17,83 +17,14 @@ done

# Get standard environment variable
PRGDIR=`dirname "$PRG"`
EXECUTABLE=ninja.sh

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.jar ] ; then
echo "ERROR: ninja.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


OPTIONS=""
KEY_OPTIONS=""

while getopts "c:hm:p:P:sU:u:vVk:K" option; do
case "${option}" in
c) c="-c $OPTARG "
OPTIONS+="${c}"
;;
h) h="-h "
OPTIONS+="${h}"
;;
m) echo "midpoint.home set by default"
;;
p) p="-p $OPTARG "
OPTIONS+="${p}"
;;
P) P="-P $OPTARG "
OPTIONS+="${P}"
;;
s) s="-s "
OPTIONS+="${s}"
;;
U) U="-U $OPTARG "
OPTIONS+="${U}"
;;
u) u="-u $OPTARG "
OPTIONS+="${u}"
;;
v) v="-v "
OPTIONS+="${v}"
echo "${v}"
;;
V) V="-V "
OPTIONS+="${V}"
;;
k) k="-k $OPTARG "
KEY_OPTIONS+="${k}"
;;
K) K="-K "
KEY_OPTIONS+="${K}"
;;
if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then
echo "Cannot find $PRGDIR/$EXECUTABLE"
echo "The file is absent or does not have execute permission"
echo "This file is needed to run this program"
exit 1
fi

esac
done
exec "$PRGDIR"/"$EXECUTABLE" keys "$@"

exec "$_RUNJAVA" -jar $SCRIPT_PATH../lib/ninja.jar $OPTIONS -m $MIDPOINT_HOME keys $KEY_OPTIONS

0 comments on commit 01755f9

Please sign in to comment.