]> git.ipfire.org Git - thirdparty/dehydrated.git/commitdiff
added option to automatically run cleanup routine (implements #389)
authorLukas Schauer <lukas@schauer.so>
Mon, 10 Jul 2017 18:20:04 +0000 (20:20 +0200)
committerLukas Schauer <lukas@schauer.so>
Mon, 10 Jul 2017 18:21:30 +0000 (20:21 +0200)
dehydrated
docs/examples/config

index b32bdc8b0b68c8d4cd8ac87df7186b5c141cfb14..d7581cfb74dcd0328b30f136aef0fa66d405fcbc 100755 (executable)
@@ -131,6 +131,7 @@ load_config() {
   OCSP_MUST_STAPLE="no"
   IP_VERSION=
   CHAINCACHE=
+  AUTO_CLEANUP="no"
 
   if [[ -z "${CONFIG:-}" ]]; then
     echo "#" >&2
@@ -1009,6 +1010,10 @@ command_sign_domains() {
   # remove temporary domains.txt file if used
   [[ -n "${PARAM_DOMAIN:-}" ]] && rm -f "${DOMAINS_TXT}"
 
+  if [[ "${AUTO_CLEANUP}" == "yes" ]]; then
+    echo "+ Running automatic cleanup"
+    command_cleanup noinit
+  fi
   [[ -n "${HOOK}" ]] && "${HOOK}" "exit_hook"
   exit 0
 }
@@ -1095,7 +1100,9 @@ command_revoke() {
 # Usage: --cleanup (-gc)
 # Description: Move unused certificate files to archive directory
 command_cleanup() {
-  load_config
+  if [ ! "${1:-}" = "noinit" ]; then
+    load_config
+  fi
 
   # Create global archive directory if not existent
   if [[ ! -e "${BASEDIR}/archive" ]]; then
index 69cd7245abf533170201331488519047f24205cb..e596c24ef4654ac8b0abc63a27fc12effad365bf 100644 (file)
@@ -95,3 +95,6 @@
 
 # Issuer chain cache directory (default: $BASEDIR/chains)
 #CHAINCACHE="${BASEDIR}/chains"
+
+# Automatic cleanup (default: no)
+#AUTO_CLEANUP="no"