The current default hostname in this block is "raspberrypi.local" which suggests that the new name should retain the ".local" extension. Although it appears to work, I don't recommend this since the dot (.) is not actually a valid hostname character, even though raspberrypi.local is often how you will access your Pi using the magic of avahi.
This block runs:
raspi-config nonint do_hostname "$1"
which then writes the specified name into /etc/hosts and /etc/hostsname. An unmodified Pi does not have ".local" in these files, but running this command with the default name adds it to them. The reason this works at all is that /etc/init.d/hostname.sh sanitizes these files during the next boot startup, removing the ".local" extensions.
The current default hostname in this block is "raspberrypi.local" which suggests that the new name should retain the ".local" extension. Although it appears to work, I don't recommend this since the dot (.) is not actually a valid hostname character, even though raspberrypi.local is often how you will access your Pi using the magic of avahi.
This block runs:
which then writes the specified name into /etc/hosts and /etc/hostsname. An unmodified Pi does not have ".local" in these files, but running this command with the default name adds it to them. The reason this works at all is that
/etc/init.d/hostname.sh
sanitizes these files during the next boot startup, removing the ".local" extensions.