[Bug 221951] hostname does not update /etc/rc.conf with new hostname

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu Aug 31 09:50:13 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221951

            Bug ID: 221951
           Summary: hostname does not update /etc/rc.conf with new
                    hostname
           Product: Base System
           Version: 11.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: arm
          Assignee: freebsd-arm at FreeBSD.org
          Reporter: tarjei at online.no

When I change the hostname of a server using "hostname NewHostName", the
hostname entry in /etc/rc.conf is not updated to reflect the new name.

This is likely to be highly confusing to both newbies and users with no
previous experience with this behaviour.

The script fragment below will do the job. And it might be executed from the
hostname program, but it might not be paranoid enough since it contains no
error detection.

nl=$'\n'
rcCont=`grep -v "^hostname=" /etc/rc.conf`
rcCont="${rcCont}${nl}hostname=\"NewHostName\"${nl}"
echo "${rcCont}" > /etc/rc.conf

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-arm mailing list