#!/bin/sh
#
# Run evoacme script on every configured cert
#
# Author: Victor Laborie <vlaborie@evolix.fr>
# Licence: AGPLv3
#

[ -f /etc/default/evoacme ] && . /etc/default/evoacme
CRT_DIR="${CRT_DIR:-'/etc/letsencrypt'}"

export QUIET=1

find "${CRT_DIR}" \
    -maxdepth 1 \
    -mindepth 1 \
    -type d \
    ! -path "${CRT_DIR}/accounts" \
    ! -path "${CRT_DIR}/archive" \
    ! -path "${CRT_DIR}/csr" \
    ! -path "${CRT_DIR}/hooks" \
    ! -path "${CRT_DIR}/keys" \
    ! -path "${CRT_DIR}/live" \
    ! -path "${CRT_DIR}/renewal" \
    -printf "%f\n" \
        | xargs --max-args=1 --no-run-if-empty evoacme
