on master help sign in
[fix] creation of /.lxcenv in containers

In utils/lib.sh there are two functions with the same name, but different tasks. Rename one of them from lxc_init_container() into lxc_init_container_env(). Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>

commitc2caf9569c5b6e1a9d143382c2045983f7c6dd61 authorMarkus Heiser <markus.heiser@darmarit.de> dateSun 5 Apr 2020, 15:15 (7 years ago) parentc748047
2 files changed+6−5
utils/lib.sh+5−5 utils/lxc.sh+1
utils/lib.sh+5−5
@@ -1073,7 +1073,7 @@ in_container() {
10731073 # to be safe, take a look at the environment of process 1 (/sbin/init)
10741074 # grep -qa 'container=lxc' /proc/1/environ
10751075
1076− # see lxc_init_container
1076+ # see lxc_init_container_env
10771077 [[ -f /.lxcenv ]]
10781078}
10791079
@@ -1083,12 +1083,12 @@ if in_container; then
10831083 LXC_ENV_FOLDER="lxc/$(hostname)/"
10841084fi
10851085
1086−lxc_init_container() {
1086+lxc_init_container_env() {
10871087
1088− # Create a /.lxcenv file in the root folder. Call this once after container
1089− # is inital started.
1088+ # usage: lxc_init_container_env <name>
10901089
1091− # usage: lxc_create_root_dot_lxcenv <name>
1090+ # Create a /.lxcenv file in the root folder. Call this once after the
1091+ # container is inital started and before installing any boilerplate stuff.
10921092
10931093 info_msg "create /.lxcenv in container $1"
10941094 cat <<EOF | lxc exec "${1}" -- bash | prefix_stdout "[${_BBlue}${1}${_creset}] "
utils/lxc.sh+1
@@ -538,6 +538,7 @@ lxc_install_boilerplate() {
538538 if lxc start -q "${container_name}" &>/dev/null; then
539539 sleep 5 # guest needs some time to come up and get an IP
540540 fi
541+ lxc_init_container_env "${container_name}"
541542 info_msg "[${_BBlue}${container_name}${_creset}] install /.lxcenv.mk .."
542543 cat <<EOF | lxc exec "${container_name}" -- bash | prefix_stdout "[${_BBlue}${container_name}${_creset}] "
543544rm -f "/.lxcenv.mk"