ast_tls_cert: don't recreate generated files
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>
Tue, 2 Jul 2013 08:23:16 +0000 (08:23 +0000)
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>
Tue, 2 Jul 2013 08:23:16 +0000 (08:23 +0000)
Don't regenrate cat.cfg, ca.crt and ca.key if they were already created
on a previous run.

(closes issue ASTERISK-21932)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393383 65c4cc65-6c06-0410-ace0-fbb531ad65f3

contrib/scripts/ast_tls_cert

index 3c5363a..fe7d6ab 100755 (executable)
@@ -204,8 +204,12 @@ then
        CAKEY=${OUTPUT_DIR}/ca.key
        CACERT=${OUTPUT_DIR}/ca.crt
        CACFG=${OUTPUT_DIR}/ca.cfg
-       create_config ca "${CACFG}" "${DEFAULT_CA_CN}" "${DEFAULT_CA_ORG}"
-       create_ca
+       if [ ! -r "$CAKEY" ] &&  [ ! -r "$CACFG" ]; then
+               create_config ca "${CACFG}" "${DEFAULT_CA_CN}" "${DEFAULT_CA_ORG}"
+       fi
+       if  [ ! -r "$CACERT" ]; then
+               create_ca
+       fi
 else
        if [ -z ${CAKEY} ]
        then