Commit 19d5dd74 authored by Adam Wujek's avatar Adam Wujek 💬

[Feature: 1388] Allow to specify hostname in the dot-config URL

Allow to specify hostname in the dot-config URL and in PPSI URL.
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent be083eea
......@@ -40,8 +40,8 @@ config DOTCONF_URL
depends on DOTCONF_SOURCE_REMOTE
help
tftp://, ftp:// or http:// URLs are allowed. Names are allowed if
you configured a DNS server. The special strings IPADDR and MACADDR
are substituted before retrieving the file.
you configured a DNS server. The special strings HOSTNAME, IPADDR and
MACADDR are substituted before retrieving the file.
Example: "tftp://morgana/wrs-config-IPADDR"
config BR2_CONFIGFILE
......@@ -593,7 +593,7 @@ config PTP_CONF_URL
depends on PTP_REMOTE_CONF
string "Download URL (http, ftp, tftp) for custom ppsi.conf"
help
Like CONFIG_DOTCONF_URL, this option allows passing IPADDR
Like CONFIG_DOTCONF_URL, this option allows passing HOSTNAME, IPADDR
and MACADDR in the filename, and if a DNS server is configured,
you can use host names.
For example: tftp://morgana/wrs-IPADDR-ppsi.conf
......
......@@ -403,8 +403,10 @@ file, it will replace the copy in the local storage if it is different.
The URL (stored in @t{CONFIG_DOTCONF_URL} or retrieved via DHCP) is of the form
``@i{protocol}@t{://}@i{host}@t{/}@i{pathname}''. The special upper-case
strings @t{IPADDR} and @t{MACADDR} are substituted with the current
addresses of the management port of the switch.
strings @t{HOSTNAME}, @t{IPADDR} and @t{MACADDR} are substituted with the
current hostname, IP addresses or MAC address of the management port of the
switch. By this the same configuration string can be used to set up a batch
of switches with different configurations.
The three parts of the URL are as follows:
......@@ -424,8 +426,8 @@ The three parts of the URL are as follows:
@item path
The pathname can include directory components and @t{IPADDR}
or @t{MACADDR} (or both).
The pathname can include directory components and any of @t{HOSTNAME},
@t{IPADDR}, @t{MACADDR}.
@end table
......@@ -722,7 +724,8 @@ value is changed by the web interface, proper action is taken.
Finally, you can choose @t{PTP_REMOTE_CONF} and be able to
specify an URL (@t{http://}, @t{ftp://} or @t{tftp://}) whence
the switch will download the @t{ppsi.conf} at boot time.
The filename in the URL can include @t{IPADDR} and/or @t{MACADDR},
The filename in the URL can include @t{HOSTNAME}, @t{IPADDR}
and/or @t{MACADDR},
so the same configuration string can be used to set up a batch
of switches with different configurations.
......
......@@ -86,8 +86,9 @@ if [ "$CONFIG_DOTCONF_SOURCE_REMOTE" = "y" ] || [ "$CONFIG_DOTCONF_SOURCE_TRY_DH
/etc/init.d/network
ipaddr=$(ifconfig eth0 | grep inet | cut -d: -f 2 | cut '-d ' -f 1)
fi
host_name=`hostname`
URL=$(echo $CONFIG_DOTCONF_URL | \
sed -e s/MACADDR/$macaddr/ -e s/IPADDR/$ipaddr/)
sed -e s/MACADDR/$macaddr/ -e s/IPADDR/$ipaddr/ -e s/HOSTNAME/$host_name/)
# split the parts, as we need to handle tftp by hand
proto=$(echo $URL | cut -d: -f 1)
host=$(echo $URL | cut -d/ -f 3)
......
......@@ -116,8 +116,9 @@ elif [ "$CONFIG_PTP_REMOTE_CONF" = "y" ]; then
/etc/init.d/network
ipaddr=$(ifconfig eth0 | grep inet | cut -d: -f 2 | cut '-d ' -f 1)
fi
host_name=`hostname`
URL=$(echo $CONFIG_PTP_CONF_URL | \
sed -e s/MACADDR/$macaddr/ -e s/IPADDR/$ipaddr/)
sed -e s/MACADDR/$macaddr/ -e s/IPADDR/$ipaddr/ -e s/HOSTNAME/$host_name/)
# split the parts, as we need to handle tftp by hand
proto=$(echo $URL | cut -d: -f 1)
host=$(echo $URL | cut -d/ -f 3)
......
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