#!/bin/sh . /lib/functions.sh configure_ee_path() { local lxc_bundle oci_bundle name root config_load swmodd config_get lxc_bundle globals lxc_bundle_root "" config_get oci_bundle globals oci_bundle_root "" mkdir -p /etc/lxc if [ -n "${oci_bundle}" ]; then # if oci_bundle_root define in swmodd, then remove it name=$(echo ${oci_bundle##/*/}) root=$(echo ${oci_bundle%/$name}) echo "lxc.lxcpath = ${oci_bundle}" > /etc/lxc/lxc.conf elif [ -n "${lxc_bundle}" ]; then # if lxc_bundle_root define in swmodd, then remove it name=$(echo ${lxc_bundle##/*/}) root=$(echo ${lxc_bundle%/$name}) echo "lxc.lxcpath = ${lxc_bundle}" > /etc/lxc/lxc.conf elif [ -f /etc/lxc/lxc.conf ]; then bundle_path=$(cat /etc/lxc/lxc.conf | grep "lxc.lxcpath" | cut -d "=" -f 2 | sed 's/[[:blank:]]//g') name=$(echo ${bundle_path##/*/}) root=$(echo ${bundle_path%/$name}) else name="lxc" root="/srv" echo "lxc.lxcpath = /srv/lxc" > /etc/lxc/lxc.conf fi uci_set swmodd globals oci_bundle_root "" uci_set swmodd globals lxc_bundle_root "" # configure root in globals section if ! uci_get swmodd globals root >/dev/null; then uci_set swmodd globals root ${root} fi # configure execenv in swmodd if ! uci_get swmodd.@execenv[0].name >/dev/null; then uci_add swmodd execenv execenv_1 uci_set swmodd execenv_1 name ${name} fi } configure_ee_path