diff --git a/utils/lxc-searx.env b/utils/lxc-searx.env index 2a3fdf37b..fc5b33f06 100644 --- a/utils/lxc-searx.env +++ b/utils/lxc-searx.env @@ -10,10 +10,12 @@ # config # ---------------------------------------------------------------------------- +# shellcheck disable=SC2034 +LXC_SUITE_NAME="searx" lxc_set_suite_env() { # name of https://images.linuxcontainers.org export LINUXCONTAINERS_ORG_NAME="${LINUXCONTAINERS_ORG_NAME:-images}" - export LXC_HOST_PREFIX="${LXC_HOST_PREFIX:-searx}" + export LXC_HOST_PREFIX="${LXC_SUITE_NAME:-searx}" export LXC_SUITE=( # to disable containers, comment out lines .. diff --git a/utils/lxc.sh b/utils/lxc.sh index 813b50843..92dfff2d1 100755 --- a/utils/lxc.sh +++ b/utils/lxc.sh @@ -82,7 +82,7 @@ usage:: $_cmd [start|stop] [containers|] $_cmd show [images|suite|info|config []] $_cmd cmd [--|] '...' - $_cmd install [suite|base] + $_cmd install [suite|base []] build :containers: build, launch all containers and 'install base' packages @@ -105,32 +105,26 @@ cmd -- run command '...' in all containers of the LXC suite :: run command '...' in container install - :suite: install LXC suite; ${LXC_SUITE_INSTALL_INFO} :base: prepare LXC; install basic packages + :suite: install LXC ${LXC_SUITE_NAME} suite into all (or ) containers EOF - usage_images - echo usage_containers - echo [ -n "${1+x}" ] && err_msg "$1" } usage_containers() { cat < $1"; exit 42;; - esac + *) usage_containers "unknown container: $1" && exit 42 + esac ;; install) sudo_or_exit case $2 in suite|base) - lxc_exec "${LXC_REPO_ROOT}/utils/lxc.sh" __install "$2" + case $3 in + ${LXC_HOST_PREFIX}-*) + ! lxc_exists "$3" && usage_containers "unknown container: $3" && exit 42 + lxc_exec_cmd "$3" "${LXC_REPO_ROOT}/utils/lxc.sh" __install "$2" + ;; + '') lxc_exec "${LXC_REPO_ROOT}/utils/lxc.sh" __install "$2" ;; + *) usage_containers "unknown container: $3" && exit 42 + esac ;; *) usage "$_usage"; exit 42 ;; esac