boot-autostart-lx-container.sh: change default LX Container dir; some minor changes in script output.

This commit is contained in:
Christoph 2024-03-03 11:11:18 +01:00
parent e422efbd30
commit 09a3c05fa4

View File

@ -341,7 +341,7 @@ fi
# - Give your default values here
# -
DEFAULT_LOGGING=false
DEFAUL_LXC_ROOT_DIR=/data/lxc
DEFAUL_LXC_ROOT_DIR="$(realpath "/var/lib/lxc")"
if [[ -f "$conf_file" ]]; then
@ -357,6 +357,8 @@ fi
[[ -n "$LOGGING" ]] || LOGGING="${DEFAULT_LOGGING}"
info "LX Container folder: \033[1m${LXC_ROOT_DIR}\033[m"
# ----------
# - Some pre-script tasks ..
@ -390,14 +392,20 @@ _failed=false
for _container in ${lx_container_all_arr[@]} ; do
if [[ ! -d "${LXC_ROOT_DIR}/${_container}" ]] ; then
_failed=true
error_msg_arr+=("")
IFS='§' error_msg_arr+=("No Container named \033[1m${_container}\033[m found!")
if $terminal ; then
IFS='§' error_msg_arr+=("No Container \033[1m${LXC_ROOT_DIR}/${_container}\033[m found!")
else
IFS='§' error_msg_arr+=("No Container '${LXC_ROOT_DIR}/${_container}' found!")
fi
continue
fi
if [[ ! -f "${LXC_ROOT_DIR}/${_container}/config" ]]; then
_failed=true
error_msg_arr+=("")
IFS='§' error_msg_arr+="No Cocnfiguration for Container named \033[1m${_container}\033[m found!"
if $terminal ; then
IFS='§' error_msg_arr+="No Cocnfiguration \033[1m${LXC_ROOT_DIR}/${_container}/config\033[m found!"
else
IFS='§' error_msg_arr+="No Cocnfiguration '${LXC_ROOT_DIR}/${_container}/config' found!"
fi
continue
fi
if $(grep -E -q "^\s*lxc.start.auto\s*=\s*1" "${LXC_ROOT_DIR}/${_container}/config" 2> $log_file) ; then
@ -418,11 +426,17 @@ done
if $_failed ; then
echo_failed
if ! $terminal ; then
echo ""
echo " [ Info ] LX Container folder: '${LXC_ROOT_DIR}'"
echo ""
echo ""
fi
for _msg in ${error_msg_arr[@]} ; do
error $_msg
done
for _container in ${lx_container_autostart_arr[@]} ; do
info "Added Contaimer \033[1m${_container}\033[m."
info "Added Container \033[1m${_container}\033[m."
done
else
echo_done