mirror of https://github.com/searxng/searxng.git
LXC: add /.lxcenv
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
86e79488aa
commit
d2cfe9ce5b
23
utils/lib.sh
23
utils/lib.sh
|
@ -1065,18 +1065,31 @@ EOF
|
||||||
in_container() {
|
in_container() {
|
||||||
# Test if shell runs in a container.
|
# Test if shell runs in a container.
|
||||||
#
|
#
|
||||||
# hint: Reads init process environment, therefore root access is required!
|
|
||||||
#
|
|
||||||
# usage: in_container && echo "process running inside a LXC container"
|
# usage: in_container && echo "process running inside a LXC container"
|
||||||
# in_container || echo "process is not running inside a LXC container"
|
# in_container || echo "process is not running inside a LXC container"
|
||||||
#
|
#
|
||||||
|
# sudo_or_exit
|
||||||
sudo_or_exit
|
# hint: Reads init process environment, therefore root access is required!
|
||||||
# to be safe, take a look at the environment of process 1 (/sbin/init)
|
# to be safe, take a look at the environment of process 1 (/sbin/init)
|
||||||
grep -qa 'container=lxc' /proc/1/environ
|
# grep -qa 'container=lxc' /proc/1/environ
|
||||||
|
|
||||||
|
# see lxc_init_container
|
||||||
|
[[ -f /.lxcenv ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lxc_init_container() {
|
||||||
|
|
||||||
|
# Create a /.lxcenv file in the root folder. Call this once after container
|
||||||
|
# is inital started.
|
||||||
|
|
||||||
|
# usage: lxc_create_root_dot_lxcenv <name>
|
||||||
|
|
||||||
|
info_msg "create /.lxcenv in container $1"
|
||||||
|
cat <<EOF | lxc exec "${1}" -- bash | prefix_stdout "[${_BBlue}${1}${_creset}] "
|
||||||
|
touch "/.lxcenv"
|
||||||
|
ls -l "/.lxcenv"
|
||||||
|
EOF
|
||||||
|
}
|
||||||
lxc_exists(){
|
lxc_exists(){
|
||||||
|
|
||||||
# usage: lxc_exists <name> || echo "container <name> does not exists"
|
# usage: lxc_exists <name> || echo "container <name> does not exists"
|
||||||
|
|
|
@ -51,6 +51,7 @@ lxc_suite_prepare_buildhost() {
|
||||||
(
|
(
|
||||||
lxc_set_suite_env
|
lxc_set_suite_env
|
||||||
export FORCE_TIMEOUT=0
|
export FORCE_TIMEOUT=0
|
||||||
|
# "${LXC_REPO_ROOT}/utils/searx.sh* install packages
|
||||||
"${LXC_REPO_ROOT}/utils/searx.sh" install buildhost
|
"${LXC_REPO_ROOT}/utils/searx.sh" install buildhost
|
||||||
rst_title "buildhost installation finished ($(hostname))" part
|
rst_title "buildhost installation finished ($(hostname))" part
|
||||||
echo
|
echo
|
||||||
|
|
|
@ -82,7 +82,7 @@ usage::
|
||||||
$_cmd [start|stop] [containers|<name>]
|
$_cmd [start|stop] [containers|<name>]
|
||||||
$_cmd show [info|config|suite|images]
|
$_cmd show [info|config|suite|images]
|
||||||
$_cmd cmd [--|<name>] '...'
|
$_cmd cmd [--|<name>] '...'
|
||||||
$_cmd install [suite]
|
$_cmd install [suite|buildhost]
|
||||||
|
|
||||||
build
|
build
|
||||||
:containers: build & launch all LXC containers of the suite
|
:containers: build & launch all LXC containers of the suite
|
||||||
|
@ -443,10 +443,12 @@ lxc_boilerplate_containers() {
|
||||||
boilerplate_script="${image_name}_boilerplate"
|
boilerplate_script="${image_name}_boilerplate"
|
||||||
boilerplate_script="${!boilerplate_script}"
|
boilerplate_script="${!boilerplate_script}"
|
||||||
|
|
||||||
info_msg "[${_BBlue}${container_name}${_creset}] install /.lxcenv.mk .."
|
info_msg "[${_BBlue}${container_name}${_creset}] init .."
|
||||||
if lxc start -q "${container_name}" &>/dev/null; then
|
if lxc start -q "${container_name}" &>/dev/null; then
|
||||||
sleep 5 # guest needs some time to come up and get an IP
|
sleep 5 # guest needs some time to come up and get an IP
|
||||||
fi
|
fi
|
||||||
|
lxc_init_container "${container_name}"
|
||||||
|
info_msg "[${_BBlue}${container_name}${_creset}] install /.lxcenv.mk .."
|
||||||
cat <<EOF | lxc exec "${container_name}" -- bash | prefix_stdout "[${_BBlue}${container_name}${_creset}] "
|
cat <<EOF | lxc exec "${container_name}" -- bash | prefix_stdout "[${_BBlue}${container_name}${_creset}] "
|
||||||
rm -f "/.lxcenv.mk"
|
rm -f "/.lxcenv.mk"
|
||||||
ln -s "${LXC_REPO_ROOT}/utils/makefile.lxc" "/.lxcenv.mk"
|
ln -s "${LXC_REPO_ROOT}/utils/makefile.lxc" "/.lxcenv.mk"
|
||||||
|
|
Loading…
Reference in New Issue