@@ -104,7 +104,8 @@ cmd
104104 -- run command '...' in all containers of the LXC suite
105105 :<name>: run command '...' in container <name>
106106install
107− :suite: install LXC suite, includes morty & filtron
107+ :suite: install LXC suite; ${lxc_suite_install_info}
108+ :buildhost: prepare LXC; buildhost
108109
109110EOF
110111 usage_images
@@ -224,12 +225,7 @@ main() {
224225 sudo_or_exit
225226 shift
226227 case $1 in
227− --)
228− shift
229− for name in "${CONTAINERS[@]}"; do
230− lxc_exec_cmd "${name}" "$@"
231− done
232− ;;
228+ --) shift; lxc_exec "$@" ;;
233229 ${LXC_HOST_PREFIX}-*)
234230 ! lxc_exists "$1" && usage_containers "unknown container: $1" && exit 42
235231 local name=$1
@@ -242,13 +238,15 @@ main() {
242238 install)
243239 sudo_or_exit
244240 case $2 in
245− suite) install_suite ;;
241+ suite) lxc_exec "${LXC_REPO_ROOT}/utils/lxc.sh" __install suite;;
242+ buildhost) lxc_exec "${LXC_REPO_ROOT}/utils/lxc.sh" __install buildhost;;
246243 *) usage "$_usage"; exit 42 ;;
247244 esac
248245 ;;
249246 __install)
250247 case $2 in
251248 suite) lxc_suite_install ;;
249+ buildhost) lxc_suite_prepare_buildhost ;;
252250 esac
253251 ;;
254252 doc)
@@ -263,7 +261,6 @@ main() {
263261
264262build_instances() {
265263 rst_title "Build LXC instances"
266− echo
267264 lxc_copy_images_localy
268265 echo
269266 rst_title "build containers" section
@@ -360,18 +357,6 @@ show_suite(){
360357 done
361358}
362359
363−install_suite() {
364− for i in "${CONTAINERS[@]}"; do
365− if ! lxc_exists "$i"; then
366− warn_msg "container ${_BBlue}$i${_creset} does not yet exists"
367− else
368− info_msg "[${_BBlue}${i}${_creset}] ${_BGreen}${LXC_REPO_ROOT}/utils/lxc.sh install suite${_creset}"
369− lxc exec -t "${i}" -- "${LXC_REPO_ROOT}/utils/lxc.sh" __install suite \
370− | prefix_stdout "[${_BBlue}${i}${_creset}] "
371− fi
372− done
373−}
374−
375360lxc_cmd() {
376361 for i in "${CONTAINERS[@]}"; do
377362 if ! lxc_exists "$i"; then
@@ -389,14 +374,23 @@ lxc_exec_cmd() {
389374 shift
390375 exit_val=
391376 info_msg "[${_BBlue}${name}${_creset}] ${_BGreen}${*}${_creset}"
392− lxc exec --cwd "${LXC_REPO_ROOT}" "${name}" -- bash -c "$*"
377+ lxc exec -t --cwd "${LXC_REPO_ROOT}" "${name}" -- bash -c "$*"
393378 exit_val=$?
394379 if [[ $exit_val -ne 0 ]]; then
395380 warn_msg "[${_BBlue}${name}${_creset}] exit code (${_BRed}${exit_val}${_creset}) from ${_BGreen}${*}${_creset}"
396381 else
397382 info_msg "[${_BBlue}${name}${_creset}] exit code (${exit_val}) from ${_BGreen}${*}${_creset}"
398383 fi
399− echo
384+}
385+
386+lxc_exec() {
387+ for i in "${CONTAINERS[@]}"; do
388+ if ! lxc_exists "$i"; then
389+ warn_msg "container ${_BBlue}$i${_creset} does not yet exists"
390+ else
391+ lxc_exec_cmd "${i}" "$@" | prefix_stdout "[${_BBlue}${i}${_creset}] "
392+ fi
393+ done
400394}
401395
402396lxc_init_containers() {
@@ -449,7 +443,17 @@ lxc_boilerplate_containers() {
449443 boilerplate_script="${image_name}_boilerplate"
450444 boilerplate_script="${!boilerplate_script}"
451445
452− info_msg "[${_BBlue}${container_name}${_creset}] install boilerplate"
446+ info_msg "[${_BBlue}${container_name}${_creset}] install /.lxcenv.mk .."
447+ if lxc start -q "${container_name}" &>/dev/null; then
448+ sleep 5 # guest needs some time to come up and get an IP
449+ fi
450+ cat <<EOF | lxc exec "${container_name}" -- bash | prefix_stdout "[${_BBlue}${container_name}${_creset}] "
451+rm -f "/.lxcenv.mk"
452+ln -s "${LXC_REPO_ROOT}/utils/makefile.lxc" "/.lxcenv.mk"
453+ls -l "/.lxcenv.mk"
454+EOF
455+
456+ info_msg "[${_BBlue}${container_name}${_creset}] install boilerplate .."
453457 if lxc start -q "${container_name}" &>/dev/null; then
454458 sleep 5 # guest needs some time to come up and get an IP
455459 fi