From d881f47088839775559f043669d6869703461651 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Mon, 16 Jan 2017 12:13:59 +0100 Subject: [PATCH] Add partial support for non-FHS host systems Fixes weaveworks/weave#2733 partially, where /etc/resolv.conf is not a symlink --- weave | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/weave b/weave index f0fffece..8be24ee5 100755 --- a/weave +++ b/weave @@ -1667,7 +1667,16 @@ launch_router() { --label=weavevolumes $WEAVEDB_IMAGE >/dev/null fi - RESOLV_CONF=$(chroot ${HOST_ROOT:-/} readlink -f /etc/resolv.conf) + # Figure out the location of the actual resolv.conf file because + # we want to bind mount its directory into the container. + if [ -L ${HOST_ROOT:-/}/etc/resolv.conf ]; then # symlink + # This assumes a host with readlink in FHS directories... + # Ideally, this would resolve the symlink manually, without + # using host commands. + RESOLV_CONF=$(chroot ${HOST_ROOT:-/} readlink -f /etc/resolv.conf) + else + RESOLV_CONF=/etc/resolv.conf + fi RESOLV_CONF_DIR=$(dirname "$RESOLV_CONF") RESOLV_CONF_BASE=$(basename "$RESOLV_CONF")