I need to edit both the hostname file AND the hosts file when I am renaming the RPi I am running my project on. The end user will use my Xojo project to use the touchscreen to create a new name. When I wrote the code, I did not know that I needed to change the hosts file also. Can anyone help me with the code to change the hosts file? I am struggling since the Hosts file looks like this
::1 localhost ip6-localhost ip6-loopback
and I need to change the last line only.
My current code is this:
Dim PiName As String
Dim myshell As New Shell
PiName="sudo hostnamectl set-hostname """" + NewMachineName.Text +""""
If TargetARM Then
myshell.mode = 0
myshell.Execute "sudo reboot"
Thanks in advance!