From 09a3c05fa4c416af92800b0a2a1c85bf5fcf7d18 Mon Sep 17 00:00:00 2001 From: Christoph Date: Sun, 3 Mar 2024 11:11:18 +0100 Subject: [PATCH] boot-autostart-lx-container.sh: change default LX Container dir; some minor changes in script output. --- boot-autostart-lx-container.sh | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/boot-autostart-lx-container.sh b/boot-autostart-lx-container.sh index efc263e..3f6dde1 100755 --- a/boot-autostart-lx-container.sh +++ b/boot-autostart-lx-container.sh @@ -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