diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2021-09-16 22:05:01 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2021-09-16 22:05:01 +0100 |
commit | cc4618c9ba3d974948ebf340b542d8cb01db2f55 (patch) | |
tree | 125ee67bb9e0d548771cf7b61d04bb1f0dc57687 /sys-apps/etckeeper/files | |
parent | 677b7ba5c317778df2ad7e70df94b9b7eec4adbc (diff) |
gentoo resync : 16.09.2021
Diffstat (limited to 'sys-apps/etckeeper/files')
-rw-r--r-- | sys-apps/etckeeper/files/etckeeper-conf-update-hook | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/sys-apps/etckeeper/files/etckeeper-conf-update-hook b/sys-apps/etckeeper/files/etckeeper-conf-update-hook new file mode 100644 index 000000000000..d0546c8776d3 --- /dev/null +++ b/sys-apps/etckeeper/files/etckeeper-conf-update-hook @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +set -eu + +# etckeeper hook for portage's conf-update hooks (e.g. invoked by +# dispatch-conf). Requires portage > 3.0.22. + +# Do nothing if etckeeper is not initialized. +if [[ ! -f "/etc/etckeeper/etckeeper.conf" ]]; then + exit +fi + +echo "conf-update.d ${@}" + +case "${1}" in + pre-session) + echo "Commiting uncommited changes before starting a configuration update session" + etckeeper pre-install + ;; + post-session) + echo "Commiting uncommited changes before after finishing a configuration update session" + etckeeper post-install + ;; + post-update) + ACTION=${1} + FILE_PATH=${2} + FILE=$(basename "${FILE_PATH}") + + echo "Commiting changes for ${FILE}" + etckeeper vcs add "${FILE_PATH}" + etckeeper vcs commit -m "${FILE}: ${ACTION} (conf-update.d hook)" + ;; +esac |