diff options
author | Markus Heiser <markus.heiser@darmarit.de> | 2020-04-04 12:40:14 +0200 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarit.de> | 2020-04-04 12:40:14 +0200 |
commit | 3c19f2f1cef31fd512975c70a25442d078992a42 (patch) | |
tree | 4382d420e515c9f81aad9b4fc9d3c5cea8526627 /utils/lxc.sh | |
parent | 84daf9999c9b52bf0b938725755a871aa359c62c (diff) | |
download | searxng-3c19f2f1cef31fd512975c70a25442d078992a42.tar.gz searxng-3c19f2f1cef31fd512975c70a25442d078992a42.zip |
utils/lxc.sh install: support installation on selected containers
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'utils/lxc.sh')
-rwxr-xr-x | utils/lxc.sh | 35 |
1 files changed, 19 insertions, 16 deletions
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|<name>] $_cmd show [images|suite|info|config [<name>]] $_cmd cmd [--|<name>] '...' - $_cmd install [suite|base] + $_cmd install [suite|base [<name>]] build :containers: build, launch all containers and 'install base' packages @@ -105,32 +105,26 @@ cmd -- run command '...' in all containers of the LXC suite :<name>: run command '...' in container <name> 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 <name>) containers EOF - usage_images - echo usage_containers - echo [ -n "${1+x}" ] && err_msg "$1" } usage_containers() { cat <<EOF -LXC suite containers: +LXC suite: ${LXC_SUITE_NAME} +$(echo " ${LXC_SUITE_INSTALL_INFO}" | $FMT) +suite images: +$(echo " ${LOCAL_IMAGES[*]}" | $FMT) +suite containers: $(echo " ${CONTAINERS[*]}" | $FMT) EOF [ -n "${1+x}" ] && err_msg "$1" } -usage_images() { - cat <<EOF -LXC suite images: -$(echo " ${LOCAL_IMAGES[*]}" | $FMT) -EOF -} - lxd_info() { cat <<EOF @@ -216,6 +210,7 @@ main() { config) case $3 in ${LXC_HOST_PREFIX}-*) + ! lxc_exists "$3" && usage_containers "unknown container: $3" && exit 42 lxc config show "$3" | prefix_stdout "[${_BBlue}${3}${_creset}] " ;; *) @@ -230,6 +225,7 @@ main() { info) case $3 in ${LXC_HOST_PREFIX}-*) + ! lxc_exists "$3" && usage_containers "unknown container: $3" && exit 42 lxc info "$3" | prefix_stdout "[${_BBlue}${3}${_creset}] " ;; *) @@ -259,14 +255,21 @@ main() { shift lxc_exec_cmd "${name}" "$@" ;; - *) usage "uknown or missing container <name> $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 |