summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xlib/container/config-update32
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}