mirror of
https://github.com/CopterExpress/clever-show.git
synced 2026-05-30 16:59:32 +00:00
Client: Fix /etc/hosts file with hostname.local, this is needed for ROS
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user