ast_tls_cert: don't recreate generated files
[asterisk/asterisk.git] / 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
        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
 else
        if [ -z ${CAKEY} ]
        then