Developing lightweight computation at the DSG edge

Commit 7038fb6e authored by p4u's avatar p4u
Browse files

Added new feature to be able to reach the node using the domain name: qmpadmin or admin.qmp

parent 3ddda4f5
......@@ -61,8 +61,17 @@ configure() {
#This function is executed in each boot
startup() {
# Set HostName
. $QMP_DIR/qmp_functions.sh
qmp_set_hosts
# Start/Stop netserver
$QMP_DIR/qmp_control.sh apply_netserver
# Generate current qmp key
logread | md5sum | awk '{print $1}' > $QMP_KEY
# Hack to enable wifi when channel is not standar
wifi
}
......
......@@ -826,6 +826,24 @@ qmp_configure_olsr6_uci_unused() {
}
qmp_set_hosts() {
echo "Configuring /etc/hosts file with qmpadmin entry"
local ip=$(uci get bmx6.general.tun4Address | cut -d'/' -f1)
local hn=$(uci get system.@system[0].hostname)
if [ -z "$ip" -o -z "$hn" ]; then
echo "Cannot get IP or HostName"
return
fi
cat /etc/hosts | grep -v qmpadmin > /tmp/hosts.tmp
echo "$ip $hn admin.qmp qmpadmin" >> /tmp/hosts.tmp
cp /tmp/hosts.tmp /etc/hosts
echo "done"
}
qmp_configure_system() {
local primary_device="$(uci get qmp.node.primary_device)"
......@@ -849,6 +867,9 @@ qmp_configure_system() {
uci set uhttpd.main.listen_https="443"
uci commit uhttpd
/etc/init.d/uhttpd restart
# configuring hosts
qmp_set_hosts
}
......
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