Skip to content

Commit a1bb595

Browse files
authored
Merge pull request #317 from mekanix/feature/dns
Set jail's resolv.conf
2 parents 5020111 + ac2bcc9 commit a1bb595

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

scripts/mkjail.sh

+8-7
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,7 @@ bsdinstall distextract
135135
sed -i "" -e "s/^Components .*/Components world/" "${BSDINSTALL_CHROOT}/etc/freebsd-update.conf"
136136
mkdir -p "${BSDINSTALL_CHROOT}/usr/local/etc/pkg/repos"
137137
echo -e "FreeBSD: {\n url: \"pkg+http://${PKG_MIRROR}/\${ABI}/${PKG_REPO}\",\n}">"${BSDINSTALL_CHROOT}/usr/local/etc/pkg/repos/FreeBSD.conf"
138-
echo "search $(hostname)" >"${BSDINSTALL_CHROOT}/etc/resolv.conf"
139-
if [ "${USE_IPV4}" = "yes" ]; then
140-
echo "nameserver ${INTERFACE_IP}" >>"${BSDINSTALL_CHROOT}/etc/resolv.conf"
141-
fi
142-
if [ "${USE_IPV6}" = "yes" ]; then
143-
echo "nameserver ${IPV6_PREFIX}${INTERFACE_IP6}" >>"${BSDINSTALL_CHROOT}/etc/resolv.conf"
144-
fi
138+
cp /etc/resolv.conf "${BSDINSTALL_CHROOT}/etc/resolv.conf"
145139
if [ "${UPDATE}" != "no" -a "${OS_VERSION_NAME}" = "RELEASE" ]; then
146140
chroot "${BSDINSTALL_CHROOT}" freebsd-update fetch install
147141
fi
@@ -171,6 +165,13 @@ if [ "${NAME}" = "network" ]; then
171165
-e "s;BASE_WORKDIR;${BASE_WORKDIR};g" \
172166
-e "s;INTERFACE;${INTERFACE};g" \
173167
"${SCRIPT_DIR}/../templates/network-jail.conf" >"/etc/jail.conf.d/${NAME}.conf"
168+
echo "search $(hostname)" >"${BSDINSTALL_CHROOT}/etc/resolv.conf"
169+
if [ "${USE_IPV4}" = "yes" ]; then
170+
echo "nameserver ${INTERFACE_IP}" >>"${BSDINSTALL_CHROOT}/etc/resolv.conf"
171+
fi
172+
if [ "${USE_IPV6}" = "yes" ]; then
173+
echo "nameserver ${IPV6_PREFIX}${INTERFACE_IP6}" >>"${BSDINSTALL_CHROOT}/etc/resolv.conf"
174+
fi
174175
else
175176
MOUNTS=$(get_mounts)
176177
DEPENDS=$(get_dependencies)

0 commit comments

Comments
 (0)