Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
software/JDetector/compare-detector.sh
Go to the documentation of this file.
1#!/usr/bin/env zsh
2#
3# \author mdejong
4#
5script=${0##*/}
6
7# ------------------------------------------------------------------------------------------
8#
9# Utility script to compare two binary formatted detector files.
10#
11# ------------------------------------------------------------------------------------------
12
13if [ -z $JPP_DIR ]; then
14 echo "Variable JPP_DIR undefined."
15 exit
16fi
17
18source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/null
19
20set_variable SKIP 48 # "####" + <length> + <UUID>
21
22if do_usage $*; then
23 usage "$script <detector file> <detector file>"\
24 "\nComparison of binary formatted detector files excluding UUID."
25fi
26
27if (( $# != 2 )); then
28 fatal "Wrong number of arguments."
29fi
30
31JConvertDetectorFormat -a $1 -o ${TMPDIR:-/tmp}/d1.datx -q; CHECK_EXIT_CODE
32JConvertDetectorFormat -a $2 -o ${TMPDIR:-/tmp}/d2.datx -q; CHECK_EXIT_CODE
33
34tail -c+$SKIP ${TMPDIR:-/tmp}/d1.datx > ${TMPDIR:-/tmp}/da.datx
35tail -c+$SKIP ${TMPDIR:-/tmp}/d1.datx > ${TMPDIR:-/tmp}/db.datx
36
37diff ${TMPDIR:-/tmp}/da.datx ${TMPDIR:-/tmp}/db.datx
38
39if (( $? == 0 )); then
40 echo "Detectors $1 and $2 are equal."
41else
42 fatal "Detectors $1 and $2 differ."
43fi
44
45rm -f ${TMPDIR:-/tmp}/d{1,2,a,b}.datx
46