bkctld-upgrade-config: install check_policy template if missing

This commit is contained in:
Jérémy Lecour 2021-02-22 09:37:15 +01:00 committed by Jérémy Lecour
parent 21f4544016
commit 82dbb29511
2 changed files with 11 additions and 0 deletions

View File

@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
* bkctld-init: install check_policy template
* bkctld-upgrade-config: install check_policy template if missing
* test: bkctld check-incs shouldn't fail without incs_policy file
### Changed

View File

@ -45,3 +45,13 @@ elif [ -f "${legacy_incs_policy_file}" ]; then
info "${jail_name}: config has been upgraded"
fi
check_policy_file=$(jail_check_policy_file "${jail_name}")
if [ ! -f "${check_policy_file}" ]; then
check_policy_tpl="${TPLDIR}/check_policy.tpl"
test -f "${LOCALTPLDIR}/check_policy.tpl" && check_policy_tpl="${LOCALTPLDIR}/check_policy.tpl"
mkdir --parents "$(dirname "${check_policy_file}")"
install -m 0640 "${check_policy_tpl}" "${check_policy_file}"
info "${jail_name}: check_policy template ha been installed"
fi