From: Marcin Krol Date: Sat, 28 Oct 2017 12:42:25 +0000 (+0000) Subject: - added support for custom functions X-Git-Url: https://git.tld-linux.org/?a=commitdiff_plain;h=7651f36ffc080f1cb16224e339e5ee6818855e97;p=packages%2Fdehydrated.git - added support for custom functions --- diff --git a/dehydrated.spec b/dehydrated.spec index a6ac9df..62f11b3 100644 --- a/dehydrated.spec +++ b/dehydrated.spec @@ -21,7 +21,8 @@ Source12: 06-hook.sh Source13: 07-contact.sh Source14: hook.sh Source15: hook.functions -Source16: hook.global +Source16: hook.custom_functions +Source17: hook.global Patch0: tld.patch URL: https://github.com/lukas2511/dehydrated BuildRequires: rpmbuild(macros) >= 1.713 @@ -74,7 +75,8 @@ cp -p %{SOURCE7} %{SOURCE8} %{SOURCE9} %{SOURCE10} \ $RPM_BUILD_ROOT/etc/%{name}/conf.d/ install -p %{SOURCE14} $RPM_BUILD_ROOT/etc/%{name}/hooks/hook.sh cp -p %{SOURCE15} $RPM_BUILD_ROOT/etc/%{name}/hooks/functions -cp -p %{SOURCE16} $RPM_BUILD_ROOT/etc/%{name}/hooks.d/global +cp -p %{SOURCE16} $RPM_BUILD_ROOT/etc/%{name}/hooks/custom_functions +cp -p %{SOURCE17} $RPM_BUILD_ROOT/etc/%{name}/hooks.d/global %clean rm -rf $RPM_BUILD_ROOT @@ -110,6 +112,7 @@ rm -rf $RPM_BUILD_ROOT %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/%{name}/conf.d/*.sh %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/%{name}/domains.txt %attr(755,root,root) /etc/%{name}/hooks +%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/%{name}/hooks/custom_functions %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/%{name}/hooks/functions %attr(750,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/%{name}/hooks/hook.sh %attr(755,root,root) /etc/%{name}/hooks.d diff --git a/hook.functions b/hook.functions index 15183d8..71b769a 100644 --- a/hook.functions +++ b/hook.functions @@ -1,6 +1,6 @@ #!/bin/bash -# This file contains base functions for dehydrated hook scripts. +# This file contains base functions for dehydrated system hook scripts. # Please do not edit this file! It will be overwritten by package updates! # If you need to implement your own functions, take a look at # custom_functions file. diff --git a/hook.sh b/hook.sh index 283ed79..d46a064 100755 --- a/hook.sh +++ b/hook.sh @@ -4,34 +4,44 @@ # certificate is successfully deployed HOOKS_D="/etc/dehydrated/hooks.d" -# Load fucntions +# Load system fucntions . "/etc/dehydrated/hooks/functions" +# Load custom fucntions +. "/etc/dehydrated/hooks/custom_functions" HANDLER="${1}" shift case "${HANDLER}" in deploy_cert) deploy_cert "$@" + custom_deploy_cert "$@" ;; clean_challenge) clean_challenge "$@" + custom_clean_challenge "$@" ;; deploy_challenge) deploy_challenge "$@" + custom_deploy_challenge "$@" ;; invalid_challenge) invalid_challenge "$@" + custom_invalid_challenge "$@" ;; request_failure) request_failure "$@" + custom_request_failure "$@" ;; unchanged_cert) unchanged_cert "$@" + custom_unchanged_cert "$@" ;; startup_hook) startup_hook "$@" + custom_startup_hook "$@" ;; exit_hook) exit_hook "$@" + custom_exit_hook "$@" ;; esac