bkctld-rename: abort operation if incs exist with the new name

This commit is contained in:
Jérémy Lecour 2021-06-30 18:12:36 +02:00 committed by Jérémy Lecour
parent 09f1789a53
commit a2c6d073a7
2 changed files with 4 additions and 0 deletions

View file

@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
* bkctld-rename: abort operation if incs exist with the new name
### Deprecated
### Removed

View file

@ -14,6 +14,7 @@ new_jail_name="${2:?}"
if [ -z "${jail_name}" ] || [ -z "${new_jail_name}" ]; then
show_help && exit 1
fi
jail_path=$(jail_path "${jail_name}")
incs_path=$(incs_path "${jail_name}")
jail_config_dir=$(jail_config_dir "${jail_name}")
@ -27,6 +28,7 @@ new_jail_config_dir=$(jail_config_dir "${new_jail_name}")
new_legacy_config_file="${CONFDIR}/${new_jail_name}"
test -d "${new_jail_path}" && error "${new_jail_name}: jail already exists" 2
test -d "${new_incs_path}" && error "${new_jail_name}: incs already exists" 2
"${LIBDIR}/bkctld-is-on" "${jail_name}" 2>/dev/null
case "$?" in