summaryrefslogtreecommitdiffstats
path: root/split-ca-bundle.sh
blob: 80217ec39fe30a64cba56a25aef99dff068159b6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh

prev=
while read line; do
	case "$line" in
	=*=)
		fname="$(printf "%s" "$prev" | tr '/ (),' '__==_').crt"
		while read cline; do
			printf "%s\n" "$cline"
			if [ "$cline" = "-----END CERTIFICATE-----" ]; then
				break;
			fi
		done > "$fname"
		;;
	esac
	prev="$line"
done