From 86e79488aab3ff434c6682a9464ba2eee49158e9 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sun, 15 Mar 2020 17:01:36 +0100 Subject: LXC: utils/makefile.lxc (inital) add /.lxcenv.mk to contaiiners Get LXC environment when building make targets. Signed-off-by: Markus Heiser --- utils/makefile.lxc | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 utils/makefile.lxc (limited to 'utils/makefile.lxc') diff --git a/utils/makefile.lxc b/utils/makefile.lxc new file mode 100644 index 000000000..8b79994ee --- /dev/null +++ b/utils/makefile.lxc @@ -0,0 +1,29 @@ +# -*- coding: utf-8; mode: makefile-gmake -*- +# +# LXC environment +# =============== +# +# To activate/deactivate LXC makefile environment in a container, set/unset link +# from root '/.lxcenv.mk' to *this* file:: +# +# sudo make ./utils/makefile.lxc lxc-activate +# sudo make ./utils/makefile.lxc lxc-deactivate + +LXC_ENV_FOLDER=/lxc-$(shell hostname) + +lxc-help:: + @echo 'LXC: running in container LXC_ENV_FOLDER=$(LXC_ENV_FOLDER)' + +# If not activated, serve target 'lxc-activate' .. +ifeq (,$(wildcard /.lxcenv.mk)) +PHONY += lxc-activate +lxc-activate: + ln -s "$(abspath $(lastword $(MAKEFILE_LIST)))" "/.lxcenv.mk" +else +# .. and if activated, serve target 'lxc-deactivate'. +PHONY += lxc-deactivate +lxc-deactivate: + rm /.lxcenv.mk +endif + +.PHONY: $(PHONY) -- cgit v1.2.3 From baf1ffd1fa4923f3bd105f0d8daac4a9527bdc50 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 23 Mar 2020 18:05:46 +0100 Subject: LXC: set LXC_ENV_FOLDER=lxc/$(shell hostname)/ Signed-off-by: Markus Heiser --- utils/makefile.lxc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'utils/makefile.lxc') diff --git a/utils/makefile.lxc b/utils/makefile.lxc index 8b79994ee..fd999e40d 100644 --- a/utils/makefile.lxc +++ b/utils/makefile.lxc @@ -9,7 +9,7 @@ # sudo make ./utils/makefile.lxc lxc-activate # sudo make ./utils/makefile.lxc lxc-deactivate -LXC_ENV_FOLDER=/lxc-$(shell hostname) +LXC_ENV_FOLDER=lxc/$(shell hostname)/ lxc-help:: @echo 'LXC: running in container LXC_ENV_FOLDER=$(LXC_ENV_FOLDER)' -- cgit v1.2.3