From 89b0636cf6377c28bd5451b7e78577a4132f4f8f Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Thu, 5 May 2022 11:43:02 +0200 Subject: [PATCH] bkctld-init: create "incs/\" directory for jails --- server/CHANGELOG.md | 6 ++++++ server/lib/bkctld-init | 7 +++++-- server/test/incs.bats | 5 +++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/server/CHANGELOG.md b/server/CHANGELOG.md index 98e7b12..3998263 100644 --- a/server/CHANGELOG.md +++ b/server/CHANGELOG.md @@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +* bkctld-init: create "incs/\" directory for jails + +### Changed + ### Deprecated ### Removed diff --git a/server/lib/bkctld-init b/server/lib/bkctld-init index 79aed1a..b0862fb 100755 --- a/server/lib/bkctld-init +++ b/server/lib/bkctld-init @@ -12,11 +12,12 @@ if [ -z "${jail_name}" ]; then show_help && exit 1 fi jail_path=$(jail_path "${jail_name}") +incs_path=$(incs_path "${jail_name}") test -d "${jail_path}" && error "Skip jail \`${jail_name}' : it already exists" -# Create config and jails directory -mkdir --parents "${CONFDIR}" "${JAILDIR}" +# Create config, jails and incs directories +mkdir --parents "${CONFDIR}" "${JAILDIR}" "${INCDIR}" if is_btrfs "$(dirname "${JAILDIR}")" || is_btrfs "${JAILDIR}"; then btrfs_bin=$(command -v btrfs) @@ -28,6 +29,8 @@ else mkdir --parents "${jail_path}" fi +mkdir --parents "${incs_path}" + setup_jail_chroot "${jail_name}" setup_jail_config "${jail_name}" diff --git a/server/test/incs.bats b/server/test/incs.bats index 973242d..4bb615f 100644 --- a/server/test/incs.bats +++ b/server/test/incs.bats @@ -9,6 +9,11 @@ load test_helper run test -e "${CONFDIR}/${JAILNAME}.d/incs_policy" [ "${status}" -eq 0 ] } +@test "Inc directory after jail init" { + # An incs_policy file should exist + run test -d "${INCDIR}/${JAILNAME}" + [ "${status}" -eq 0 ] +} @test "Normal inc creation" { /usr/lib/bkctld/bkctld-inc