diff options
-rwxr-xr-x | sign-ca.in | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -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 |