summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEndi Sukma Dewata <edewata@redhat.com>2013-02-20 17:06:11 -0500
committerEndi Sukma Dewata <edewata@redhat.com>2013-02-20 17:06:11 -0500
commitdfdb289645231eebd2022f9f55c01aa5e19e8567 (patch)
tree6cb39b83f0f9560c2abb77d16fca15f85218afc7
parent291d1962b67db4cb3fd984a547ed4827ec65e327 (diff)
downloadpki-dfdb289645231eebd2022f9f55c01aa5e19e8567.zip
pki-dfdb289645231eebd2022f9f55c01aa5e19e8567.tar.gz
pki-dfdb289645231eebd2022f9f55c01aa5e19e8567.tar.xz
Added cref script.
-rwxr-xr-xbase/javacard/bin/cref.sh36
-rw-r--r--base/javacard/build.xml14
2 files changed, 49 insertions, 1 deletions
diff --git a/base/javacard/bin/cref.sh b/base/javacard/bin/cref.sh
new file mode 100755
index 0000000..d44cf46
--- /dev/null
+++ b/base/javacard/bin/cref.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+command=$1
+
+SCRIPT_DIR=`dirname $0`
+SCRIPT_DIR=`cd $SCRIPT_DIR; pwd`
+
+CREF_DIR=$SCRIPT_DIR/../jcdk/bin
+CREF_DIR=`cd $CREF_DIR; pwd`
+
+DATA_DIR=/var/run/pki/javacard
+LOG_DIR=/var/log/pki/javacard
+
+mkdir -p $DATA_DIR
+mkdir -p $LOG_DIR
+
+DATA_FILE=$DATA_DIR/cref.data
+PID_FILE=$DATA_DIR/cref.pid
+LOG_FILE=$LOG_DIR/cref.log
+
+if [ "$command" == "start" ]; then
+
+ touch $DATA_FILE
+
+ $CREF_DIR/cref -i $DATA_FILE -o $DATA_FILE 2>&1 >> $LOG_FILE &
+
+ echo $! > $PID_FILE
+
+elif [ "$command" == "stop" ]; then
+
+ kill -9 `cat $PID_FILE`
+ rm -f $PID_FILE
+
+else
+ echo "Usage: cref.sh <start|stop>"
+fi
diff --git a/base/javacard/build.xml b/base/javacard/build.xml
index cdf3580..ab57307 100644
--- a/base/javacard/build.xml
+++ b/base/javacard/build.xml
@@ -132,7 +132,19 @@
</junit>
</target>
- <target name="clean-build" depends="clean,build"/>
+ <target name="start-cref">
+ <exec executable="bin/cref.sh">
+ <arg value="start"/>
+ </exec>
+ </target>
+
+ <target name="stop-cref">
+ <exec executable="bin/cref.sh">
+ <arg value="stop"/>
+ </exec>
+ </target>
+
+ <target name="clean-build" depends="clean,build"/>
<target name="main" depends="clean,test"/>