Subject: bin/4781: sysinst neither sets nor saves hostname
To: None <gnats-bugs@gnats.netbsd.org>
From: Nathan J. Williams <nathanw@mit.edu>
List: netbsd-bugs
Date: 01/05/1998 15:15:36
>Number: 4781
>Category: bin
>Synopsis: sysinst neither sets nor saves hostname
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jan 5 12:20:01 1998
>Last-Modified:
>Originator: Nathan J. Williams
>Organization:
Massachvestts Institvte of Technology
>Release: Jan 5 12:15:41 1998
>Environment:
System: NetBSD road-runner.mit.edu 1.3 NetBSD 1.3 (ROAD-RUNNER) #91: Mon Jan 5 13:47:52 EST 1998 nathanw@road-runner.mit.edu:/u1/usr/src/sys/arch/i386/compile/ROAD-RUNNER i386
>Description:
While sysinst prompts for a host name and installs it in /etc/hosts,
it does not call sethostname(), nor does it write out the name to /etc/myname
if the user responds "y" to the question of whether the information should be
installed in /etc.
>How-To-Repeat:
Do a 1.3 install, reply "y" to that question, reboot, and watch
the system come up as Amnesiac.
>Fix:
Apply the following patch to distrib/utils/sysinst/net.c:
*** net.c.orig Mon Jan 5 14:45:12 1998
--- net.c Mon Jan 5 15:01:42 1998
***************
*** 234,239 ****
--- 234,244 ----
run_prog("/sbin/ifconfig %s inet %s netmask %s", net_dev,
net_ip, net_mask);
+ /* Set host name */
+ if (strcmp(net_host, "") != 0) {
+ sethostname(net_host, strlen(net_host));
+ }
+
/* Set a default route if one was given */
if (strcmp(net_defroute, "") != 0) {
run_prog ("/sbin/route -f > /dev/null 2> /dev/null");
***************
*** 375,380 ****
--- 380,392 ----
if (network_up) {
msg_prompt (MSG_mntnetconfig, ans, ans, 5);
if (*ans == 'y') {
+
+ /* Write hostname to /etc/myname */
+ f = target_fopen("/etc/myname", "w");
+ if (f != 0) {
+ fprintf(f, "%s\n", net_host);
+ fclose(f);
+ }
/* If not running in target, copy resolv.conf there. */
if (strcmp(net_namesvr, "") != 0)
>Audit-Trail:
>Unformatted: