Skip to content

Commit

Permalink
Merge pull request #317 from mekanix/feature/dns
Browse files Browse the repository at this point in the history
Set jail's resolv.conf
  • Loading branch information
mekanix authored Apr 14, 2023
2 parents 5020111 + ac2bcc9 commit a1bb595
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions scripts/mkjail.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,7 @@ bsdinstall distextract
sed -i "" -e "s/^Components .*/Components world/" "${BSDINSTALL_CHROOT}/etc/freebsd-update.conf"
mkdir -p "${BSDINSTALL_CHROOT}/usr/local/etc/pkg/repos"
echo -e "FreeBSD: {\n url: \"pkg+http://${PKG_MIRROR}/\${ABI}/${PKG_REPO}\",\n}">"${BSDINSTALL_CHROOT}/usr/local/etc/pkg/repos/FreeBSD.conf"
echo "search $(hostname)" >"${BSDINSTALL_CHROOT}/etc/resolv.conf"
if [ "${USE_IPV4}" = "yes" ]; then
echo "nameserver ${INTERFACE_IP}" >>"${BSDINSTALL_CHROOT}/etc/resolv.conf"
fi
if [ "${USE_IPV6}" = "yes" ]; then
echo "nameserver ${IPV6_PREFIX}${INTERFACE_IP6}" >>"${BSDINSTALL_CHROOT}/etc/resolv.conf"
fi
cp /etc/resolv.conf "${BSDINSTALL_CHROOT}/etc/resolv.conf"
if [ "${UPDATE}" != "no" -a "${OS_VERSION_NAME}" = "RELEASE" ]; then
chroot "${BSDINSTALL_CHROOT}" freebsd-update fetch install
fi
Expand Down Expand Up @@ -171,6 +165,13 @@ if [ "${NAME}" = "network" ]; then
-e "s;BASE_WORKDIR;${BASE_WORKDIR};g" \
-e "s;INTERFACE;${INTERFACE};g" \
"${SCRIPT_DIR}/../templates/network-jail.conf" >"/etc/jail.conf.d/${NAME}.conf"
echo "search $(hostname)" >"${BSDINSTALL_CHROOT}/etc/resolv.conf"
if [ "${USE_IPV4}" = "yes" ]; then
echo "nameserver ${INTERFACE_IP}" >>"${BSDINSTALL_CHROOT}/etc/resolv.conf"
fi
if [ "${USE_IPV6}" = "yes" ]; then
echo "nameserver ${IPV6_PREFIX}${INTERFACE_IP6}" >>"${BSDINSTALL_CHROOT}/etc/resolv.conf"
fi
else
MOUNTS=$(get_mounts)
DEPENDS=$(get_dependencies)
Expand Down

0 comments on commit a1bb595

Please sign in to comment.