Commit 996202e7 by Felix Abecassis

lxc-oci: import the environment variables

parent ce59e4ca
...@@ -105,6 +105,21 @@ getep() { ...@@ -105,6 +105,21 @@ getep() {
return return
} }
# get environment from oci image.
getenv() {
if [ "$#" -eq 0 ]; then
return
fi
configpath="$1"
cat "${configpath}" > /tmp/config
env=`cat "${configpath}" | jq -c '.config.Env[]'`
echo "${env}"
return
}
usage() { usage() {
cat <<EOF cat <<EOF
LXC container template for OCI images LXC container template for OCI images
...@@ -213,6 +228,11 @@ entrypoint=$(getep ${OCI_CONF_FILE}) ...@@ -213,6 +228,11 @@ entrypoint=$(getep ${OCI_CONF_FILE})
echo "lxc.execute.cmd = '${entrypoint}'" >> "${LXC_CONF_FILE}" echo "lxc.execute.cmd = '${entrypoint}'" >> "${LXC_CONF_FILE}"
echo "lxc.mount.auto = proc:mixed sys:mixed cgroup:mixed" >> "${LXC_CONF_FILE}" echo "lxc.mount.auto = proc:mixed sys:mixed cgroup:mixed" >> "${LXC_CONF_FILE}"
environment=$(getenv ${OCI_CONF_FILE})
while read -r line; do
echo "lxc.environment = ${line}" >> "${LXC_CONF_FILE}"
done <<< "${environment}"
echo "lxc.uts.name = ${LXC_NAME}" >> "${LXC_CONF_FILE}" echo "lxc.uts.name = ${LXC_NAME}" >> "${LXC_CONF_FILE}"
# set the hostname # set the hostname
cat <<EOF > ${LXC_ROOTFS}/etc/hostname cat <<EOF > ${LXC_ROOTFS}/etc/hostname
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment