Skip to content

Commit

Permalink
Client: Fix /etc/hosts file with hostname.local, this is needed for ROS
Browse files Browse the repository at this point in the history
  • Loading branch information
goldarte committed Nov 15, 2019
1 parent 466954c commit fcba38f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Drone/client_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ systemctl restart dhcpcd
cat << EOF | tee /etc/hostname
$3
EOF
sed -i "/127.0.1.1/c 127.0.1.1 $3" /etc/hosts
sed -i "/127.0.1.1/c 127.0.1.1 $3 $3.local" /etc/hosts

# set hostname for ROS
sed -i "/ROS_HOSTNAME/c ROS_HOSTNAME=\'$3\'" /home/pi/.bashrc
Expand Down
2 changes: 1 addition & 1 deletion Drone/copter_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def configure_hosts(hostname):

_ip, current_hostname = raw_content[index_start:index_stop].split()
if current_hostname != hostname:
content = raw_content[:index_start] + "{} {}".format(_ip, hostname) + raw_content[index_stop:]
content = raw_content[:index_start] + "{} {} {}".format(_ip, hostname, hostname+'.local') + raw_content[index_stop:]
try:
with open(path, 'w') as f:
f.write(content)
Expand Down

0 comments on commit fcba38f

Please sign in to comment.