1#!/bin/sh
2#
3# Check the library fingerprint and generate an executable fingerprint, or
4# return an error
5
6lib=$1
7exe=$2
8
9# deal with the case where we're run from within the build and OpenSSL is
10# not yet installed.  Also, make sure LD_LIBRARY_PATH is properly set in
11# case shared libraries are built.
12if [ "X$TOP" != "X" ]
13then
14    if test "$OSTYPE" = msdosdjgpp; then
15	PATH="$TOP/apps;$TOP;$PATH"
16    else
17    	PATH="$TOP/apps:$TOP:$PATH"
18    fi
19    LD_LIBRARY_PATH=$TOP; export LD_LIBRARY_PATH
20else
21    LD_LIBRARY_PATH=.; export LD_LIBRARY_PATH
22fi
23
24echo "Checking library fingerprint for $lib"
25openssl sha1 -hmac etaonrishdlcupfm $lib | sed "s/(.*\//(/" | diff -w $lib.sha1 - || { echo "$libs fingerprint mismatch"; exit 1; }
26
27[ -x $exe.exe ] && exe=$exe.exe
28
29echo "Making fingerprint for $exe"
30openssl sha1 -hmac etaonrishdlcupfm -binary $exe > $exe.sha1 || rm $exe.sha1
31