#!/bin/sh {% if (acme_owner is string) and (acme_group is string) and (acme_owner | length > 0) and (acme_group | length > 0) and (acme_use_symlinks | d(true) == true) -%} chown -R {{ acme_owner ~ ':' ~ acme_group }} {{ (acme_directory ~ '/archive/' ~ acme_cert_name ~ '/') | quote }} {% endif -%} {{ acme_before_copy_hook | d('') }} {% if (acme_cert is string) and (acme_cert | length > 0) and (acme_use_symlinks | d(true) == false) -%} cp -fpT {{ (lego_cert_dir ~ '/live/' ~ acme_cert_name ~ '/fullchain.pem') | quote }} {{ acme_cert | quote }} {% if (acme_owner is not string) and (acme_group is string) -%} chgrp -f {{ acme_group }} {{ acme_cert | quote }} {% elif acme_owner is defined -%} chown -f {{ acme_owner ~ ((':' ~ acme_group) if acme_group is string else '') }} {{ acme_cert | quote }} {% endif -%} {% endif -%} {% if (acme_key is string) and (acme_key | length > 0) and (acme_use_symlinks | d(true) == false) -%} cp -fpT {{ (acme_directory ~ '/live/' ~ acme_cert_name ~ '/privkey.pem') | quote }} {{ acme_key | quote }} {% if (acme_owner is not string) and (acme_group is string) -%} chgrp -f {{ acme_group }} {{ acme_key | quote }} {% elif acme_owner is defined -%} chown -f {{ acme_owner ~ ((':' ~ acme_group) if acme_group is string else '') }} {{ acme_key | quote }} {% endif -%} {% endif -%} {% if (acme_cert_single is string) and (acme_cert_single | length > 0) and (acme_use_symlinks | d(true) == false) -%} cp -fpT {{ (acme_directory ~ '/live/' ~ acme_cert_name ~ '/cert.pem') | quote }} {{ acme_cert_single | quote }} {% if (acme_owner is not string) and (acme_group is string) -%} chgrp -f {{ acme_group }} {{ acme_cert_single | quote }} {% elif acme_owner is defined -%} chown -f {{ acme_owner ~ ((':' ~ acme_group) if acme_group is string else '') }} {{ acme_cert_single | quote }} {% endif -%} {% endif -%} {% if (acme_chain is string) and (acme_chain | length > 0) and (acme_use_symlinks | d(true) == false) -%} cp -fpT {{ (acme_directory ~ '/live/' ~ acme_cert_name ~ '/chain.pem') | quote }} {{ acme_chain | quote }} {% if (acme_owner is not string) and (acme_group is string) -%} chgrp -f {{ acme_group }} {{ acme_chain | quote }} {% elif acme_owner is defined -%} chown -f {{ acme_owner ~ ((':' ~ acme_group) if acme_group is string else '') }} {{ acme_chain | quote }} {% endif -%} {% endif -%} {{ (acme_post_hook ~ ' &>/dev/null &') if acme_post_hook is defined else '' }}