Commit 0ff588a4 authored by Alessandro Rubini's avatar Alessandro Rubini

config: allow specifying a DNS server and default domain

If static IP addressing is used (e.g. using wrboot), it makes sense
to provide a static DNS nameserver.  This option may be useful to
people building a single image to install several switches.

If the configuration string is empty (default) nothing changes (and
/etc/resolv.conf is a symlink to /tmp/resolv.conf, so a dhcp client
can work withint a read-only filesystem).
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent d12ed5ac
......@@ -44,6 +44,21 @@ config NTP_SERVER
IPV4 address (e.g.: "192.168.16.1"); an empty string
disables NTP-based priming.
config DNS_SERVER
string "static IP address of local DNS server (empty for none)"
help
Using names instead of IP addresses is sometimes handy. This
option allow to specify a static server name, that is stored
in /etc/resolv.conf, within the WRS image being built. If
the string is empty, /etc/resolv.conf is managed according
to buildroot defaults.
config DNS_DOMAIN
string "Default domain for DNS resolution"
help
If CONFIG_DNS_SERVER is being used, this option may be
useful as well.
config KEEP_ROOTFS
bool "Keep generated filesystem and related script"
help
......
......@@ -45,6 +45,14 @@ if [ ! -z "$CONFIG_NTP_SERVER" ]; then
echo "ntpserver $CONFIG_NTP_SERVER" > $TMPFS/wr/etc/wr_date.conf
fi
if [ ! -z "$CONFIG_DNS_SERVER" ]; then
rm $TMPFS/etc/resolv.conf
echo "nameserver $CONFIG_DNS_SERVER" > $TMPFS/etc/resolv.conf
if [ ! -z "$CONFIG_DNS_DOMAIN" ]; then
echo "domain $CONFIG_DNS_DOMAIN" >> $TMPFS/etc/resolv.conf
fi
fi
mkdir -p $TMPFS/root/.ssh
#cat $HOME/.ssh/id_?sa.pub >> $TMPFS/root/.ssh/authorized_keys
if [ -f $WRS_BASE_DIR/authorized_keys ]; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment