File: functions.sh

package info (click to toggle)
libapache-mod-ssl 2.8.22-1sarge1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,208 kB
  • ctags: 1,649
  • sloc: ansic: 13,070; sh: 3,304; lex: 190; makefile: 99; yacc: 97; perl: 11
file content (40 lines) | stat: -rw-r--r-- 916 bytes parent folder | download
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
#! /bin/sh

modssl_clean_hashes()
{
	find -type l -maxdepth 1 -name '[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f].[0-9]*' -exec rm -f {} \;
	find -type l -maxdepth 1 -name '[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f].r[0-9]*' -exec rm -f {} \;
}

modssl_update_hashes()
{
	for file in `find . -type f -name \*.crt`; do
		if [ -n "`grep SKIPME $file`" ]; then
			echo "$file ... Skipped"
		else
			hash="`openssl x509 -noout -hash < $file`"
			n=0
			while [ -r "$hash.$n" ]; do
				n=$(( $n + 1 ))
			done

			echo "$file ... $hash.$n"
			ln -s $file $hash.$n
		fi
	done

	for file in `find . -type f -name \*.crl`; do
		if [ -n "`grep SKIPME $file`" ]; then
			echo "$file ... Skipped"
		else
			hash="`openssl crl -noout -hash < $file`"
			n=0
			while [ -r "$hash.r$n" ]; do
				n=$(( $n + 1 ))
			done

			echo "$file ... $hash.r$n"
			ln -s $file $hash.r$n
		fi
	done
}