Skip to content

Commit

Permalink
feat: allow altering dns entries
Browse files Browse the repository at this point in the history
Allow to alter used DNS servers in 'base' module during build

Signed-off-by: Stephan Wendel <[email protected]>
  • Loading branch information
KwadFan authored and guysoft committed Aug 5, 2024
1 parent c85213f commit faf0c88
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/modules/base/config
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ fi

[ -n "$BASE_OVERRIDE_HOSTNAME" ] || BASE_OVERRIDE_HOSTNAME=${DIST_NAME,,}

# Alter DNS servers used during build (space seperated)
# e.g. BASE_USE_ALT_DNS="1.1.1.1 8.8.8.8"
[ -n "$BASE_USE_ALT_DNS" ] || BASE_USE_ALT_DNS=

# a git mirror to use for git clones instead of original remotes
[ -n "$BASE_BUILD_REPO_MIRROR" ] || BASE_BUILD_REPO_MIRROR=

Expand Down
14 changes: 11 additions & 3 deletions src/modules/base/start_chroot_script
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,17 @@ if [ "${BASE_DISTRO}" == "ubuntu" ]; then
unpack /filesystem/ubuntu / root

mv /etc/resolv.conf /etc/resolv.conf.orig || true
echo "nameserver 8.8.8.8" > /etc/resolv.conf
echo "nameserver 8.8.4.4" >> /etc/resolv.conf
echo "nameserver 1.1.1.1" >> /etc/resolv.conf
if [ -z "${BASE_USE_ALT_DNS}" ]; then
echo "nameserver 8.8.8.8" > /etc/resolv.conf
echo "nameserver 8.8.4.4" >> /etc/resolv.conf
echo "nameserver 1.1.1.1" >> /etc/resolv.conf
else
touch /etc/resolv.conf
for dns in ${BASE_USE_ALT_DNS}; do
echo "nameserver ${dns}" >> /etc/resolv.conf
done
fi


apt-get update --allow-releaseinfo-change
apt-get install -y net-tools wireless-tools dhcpcd5
Expand Down

0 comments on commit faf0c88

Please sign in to comment.