diff options
author | David Kunz <david.kunz@open-infrastructure.net> | 2017-01-05 15:01:34 +0000 |
---|---|---|
committer | David Kunz <david.kunz@open-infrastructure.net> | 2017-01-05 15:01:34 +0000 |
commit | d4751693a25644d7b0a091db9fdf41b2fc9a848e (patch) | |
tree | 369f0877812d251e875f6d85b91a76bd11506038 /lib/container/config-update | |
parent | Add check if exist config-new in config-update. (diff) | |
download | compute-tools-tmp-david.tar.xz compute-tools-tmp-david.zip |
Change config-update.tmp-david
Diffstat (limited to 'lib/container/config-update')
-rwxr-xr-x | lib/container/config-update | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/lib/container/config-update b/lib/container/config-update index 772da23..52aa892 100755 --- a/lib/container/config-update +++ b/lib/container/config-update @@ -19,36 +19,35 @@ #set -e CONFIG="/etc/container-tools/config" +MACHINES="/var/lib/machines" echo -n "Creating new config files " +# FIXME: only touch config files of this system + for FILE in "${CONFIG}"/*.conf do CONTAINER="$(basename ${FILE} .conf)" - NET="$(dig @8.8.8.8 +short ${CONTAINER} | awk -F. '{ print $3 }')" - IP="$(dig @8.8.8.8 +short ${CONTAINER} | awk -F. '{ print $4 }')" - BRIDGE="$(awk -F: '/^cnt.network-bridge=/ { print $2 }' ${FILE})" - CNT_AUTO="$(awk -F= '/^cnt.auto=/ { print $2 }' ${FILE})" CNT_AUTO="${CNT_AUTO:-FIXME}" - CNT_NETWORK_BRIDGE="veth-${NET}-${IP}:${BRIDGE}" CNT_OVERLAY="$(awk -F= '/^cnt.overlay=/ { print $2 }' ${FILE})" BIND="$(awk -F= '/^bind=/ { print $2 }' ${FILE})" BIND="${BIND:-/srv/data/${CONTAINER}:/srv/${CONTAINER};}" BOOT="$(awk -F= '/^boot=/ { print $2 }' ${FILE})" + BOOT="${BOOT:-no}" + CAPABILITY="$(awk -F= '/^capability=/ { print $2 }' ${FILE})" - DIRECTORY="/var/lib/machines/${CONTAINER}" + DIRECTORY="${MACHINES}/${CONTAINER}" DROP_CAPABILITY="$(awk -F= '/^drop-capability=/ { print $2 }' ${FILE})" LINK_JOURNAL="$(awk -F= '/^link-journal=/ { print $2 }' ${FILE})" LINK_JOURNAL="${LINK_JOURNAL:-no}" MACHINE="${CONTAINER}" - NETWORK_VETH_EXTRA="veth-${NET}-${IP}:eth0" PRIVATE_USERS="$(awk -F= '/^private-users=/ { print $2 }' ${FILE})" PRIVATE_USERS="${PRIVATE_USERS:-no}" @@ -56,6 +55,25 @@ do REGISTER="$(awk -F= '/^register=/ { print $2 }' ${FILE})" REGISTER="${REGISTER:-yes}" + while read LINE + do + if echo ${LINE} | grep -qs '^cnt.network-bridge=' + then + VETH="$(echo ${LINE} | awk -F: '{ print $1 }')" + BRIDGE="$(echo ${LINE} | awk -F: '{ print $2 }')" + + IP="$(ip address show ${VETH} | awk '/inet / { print $2 }' | sed -e 's|/.*||')" + CNT_NETWORK_BRIDGE="veth-$(echo ${IP} | awk -F. '{ print $3 }')-$(echo ${IP} | awk -F. '{ print $4 }'):${BRIDGE}" + elif echo ${LINE} | grep -qs '^network-veth-extra=' + then + VETH="$(echo ${LINE} | awk -F: '{ print $1 }')" + ETH="$(echo ${LINE} | awk -F: '{ print $2 }')" + + IP="$(ip address show ${VETH} | awk '/inet / { print $2 }' | sed -e 's|/.*||')" + NETWORK_VETH_EXTRA="veth-$(echo ${IP} | awk -F. '{ print $3 }')-$(echo ${IP} | awk -F. '{ print $4 }'):${ETH}" + fi + done < "${FILE}" + cat > ${FILE}-new << EOF # container-tools: ${CONTAINER} |