changeset 224:6713d97b4180

Copy the host's resolv.conf into a jail when configuring it. But do not overwrite an existing resolv.conf.
author Franz Glasner <f.glasner@feldmann-mg.com>
date Wed, 31 Aug 2022 13:01:35 +0200
parents dce9ba905c32
children ffd24013d346
files sbin/fjail
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/sbin/fjail	Wed Aug 31 12:55:51 2022 +0200
+++ b/sbin/fjail	Wed Aug 31 13:01:35 2022 +0200
@@ -362,6 +362,14 @@
         echo "WARNING: \"${_mp}/etc/localtime\" exists already -- not changed"
     fi
 
+    # resolv.conf
+    if [ ! -f "${_mp}/etc/resolv.conf" ]; then
+        echo "Copying the host's resolv.conf into the jail"
+        cp -p /etc/resolv.conf "${_mp}/etc/resolv.conf"
+    else
+        echo "WARNING: \"${_mp}/etc/resolv.conf\" exists already -- not changed"
+    fi
+
     #
     # hostid and hostuuid should be set (at least for consistency ressons)
     # in vnet jails (see /etc/rc.d/hostid and /etc/rc.d/hostid_save).