evoacme: add a renewal hook to commit changes in /etc/.git
This commit is contained in:
parent
aebd46e4d7
commit
8279092037
18
evoacme/files/hooks/commit
Normal file
18
evoacme/files/hooks/commit
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
git_bin=$(command -v git)
|
||||||
|
letsencrypt_dir=/etc/letsencrypt
|
||||||
|
export GIT_DIR="/etc/.git"
|
||||||
|
export GIT_WORK_TREE="/etc"
|
||||||
|
|
||||||
|
if test -x "${git_bin}" && test -d "${GIT_DIR}" && test -d "${GIT_WORK_TREE}"; then
|
||||||
|
changed_lines=$(${git_bin} status --porcelain -- ${letsencrypt_dir} | wc -l | tr -d ' ')
|
||||||
|
|
||||||
|
if [ "${changed_lines}" != "0" ]; then
|
||||||
|
${git_bin} add --all ${letsencrypt_dir}
|
||||||
|
message="[letsencrypt] certificates renewal (${RENEWED_DOMAINS})"
|
||||||
|
${git_bin} commit --message "${message}" --quiet
|
||||||
|
else
|
||||||
|
echo "Weird, nothing has changed but the hook has been executed for '${RENEWED_DOMAINS}'"
|
||||||
|
fi
|
||||||
|
fi
|
|
@ -17,6 +17,7 @@
|
||||||
- reload_nginx
|
- reload_nginx
|
||||||
- reload_dovecot
|
- reload_dovecot
|
||||||
- reload_postfix
|
- reload_postfix
|
||||||
|
- commit
|
||||||
|
|
||||||
- include: conf.yml
|
- include: conf.yml
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue