summaryrefslogtreecommitdiff
path: root/usr.sbin/httpd/conf/ssl.crt/Makefile
blob: 333eff4d53d7db0baabcae8d104f37952e615e12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
##
##  Makefile to keep the hash symlinks in SSLCACertificatePath up to date
##  Copyright (c) 1998-2001 Ralf S. Engelschall, All Rights Reserved. 
##

SSL_PROGRAM=

update: clean
	-@ssl_program="$(SSL_PROGRAM)"; \
	if [ ".$$ssl_program" = . ]; then \
	    for dir in . `echo $$PATH | sed -e 's/:/ /g'`; do \
	        for program in openssl ssleay; do \
	            if [ -f "$$dir/$$program" ]; then \
	                if [ -x "$$dir/$$program" ]; then \
	                    ssl_program="$$dir/$$program"; \
						break; \
	                fi; \
	            fi; \
	        done; \
	        if [ ".$$ssl_program" != . ]; then \
				break; \
	        fi; \
	    done; \
	fi; \
	if [ ".$$ssl_program" = . ]; then \
	    echo "Error: neither 'openssl' nor 'ssleay' program found" 1>&2; \
	    exit 1; \
	fi; \
	for file in *.crt; do \
	    if [ ".`grep SKIPME $$file`" != . ]; then \
	        echo dummy |\
	        awk '{ printf("%-15s ... Skipped\n", file); }' \
	        "file=$$file"; \
	    else \
	        n=0; \
	        while [ 1 ]; do \
	            hash="`$$ssl_program x509 -noout -hash <$$file`"; \
	            if [ -r "$$hash.$$n" ]; then \
	                n=`expr $$n + 1`; \
	            else \
	                echo dummy |\
	                awk '{ printf("%-15s ... %s\n", file, hash); }' \
	                "file=$$file" "hash=$$hash.$$n"; \
	                ln -s $$file $$hash.$$n; \
	                break; \
	            fi; \
	        done; \
	    fi; \
	done

clean:
	-@rm -f [0-9a-fA-F]*.[0-9]*