summaryrefslogtreecommitdiff
path: root/sign-ca.in
diff options
context:
space:
mode:
Diffstat (limited to 'sign-ca.in')
-rwxr-xr-xsign-ca.in13
1 files changed, 10 insertions, 3 deletions
diff --git a/sign-ca.in b/sign-ca.in
index 372309c..6ac277d 100755
--- a/sign-ca.in
+++ b/sign-ca.in
@@ -38,9 +38,16 @@ level_ground_for_new_ca() {
touch \
'#ETCDIR#/'"$1"'/ca/'"$1"'/db/'"$1"'.db' \
'#ETCDIR#/'"$1"'/ca/'"$1"'/db/'"$1"'.db.attr'
- echo '01' \
- |tee '#ETCDIR#/'"$1"'/ca/'"$1"'/db/'"$1"'.crt.srl' \
- >'#ETCDIR#/'"$1"'/ca/'"$1"'/db/'"$1"'.crl.srl'
+ for srl in 'crl' 'crt'; do
+ old='#ETCDIR#/'"$1"'.old/ca/'"$1"'/db/'"$1"'.old.'"${srl}"'.srl'
+ new='#ETCDIR#/'"$1"'/ca/'"$1"'/db/'"$1"'.'"${srl}"'.srl'
+ if [ ! -f "${old}" ]; then
+ cp "${old}" "${new}"
+ else
+ echo '01' \
+ >"${new}"
+ fi
+ done
}
if [ -f '#ETCDIR#/simple-pki/ca/root-ca.crt' ]; then