hooks: Make RestoreCustomHooks RPC atomic
Currently the RestoreCustomHooks
RPC is not atomic. This means that
the repository hooks on disk can be left in an altered state when the
RPC fails or quorum for the transaction is not achieved.
To remediate this issue the hooks are no longer immediately extracted to the repository and instead stored in a temporary directory. From here the current repository hooks, if any, can be swapped with the newly extracted hooks. Since the original hooks are still preserved, they can be restored if there is an issue during the RPC.
Edited by Justin Tobler