Merge from vendor branch NCURSES:
[dragonfly.git] / contrib / sendmail-8.13.4 / contrib / link_hash.sh
1 #!/bin/sh
2 ##
3 ## Copyright (c) 2000 Sendmail, Inc. and its suppliers.
4 ##       All rights reserved.
5 ##
6 ## $Id: link_hash.sh,v 1.2 2000/04/25 00:12:28 ca Exp $
7 ##
8 #
9 # ln a certificate to its hash
10 #
11 SSL=openssl
12 if test $# -ge 1
13 then
14   for i in $@
15   do
16   C=$i.pem
17   test -f $C || C=$i
18   if test -f $C
19   then
20     H=`$SSL x509 -noout -hash < $C`.0
21     if test -h $H -o -f $H
22     then
23       echo link $H to $C exists
24     else
25       ln -s $C $H
26     fi
27   else
28     echo "$0: cannot open $C"
29     exit 2
30   fi
31   done
32 else
33   echo "$0: missing name"
34   exit 1
35 fi
36 exit 0