List Info

Thread: sysinst with dhcp: host-name option




sysinst with dhcp: host-name option
country flaguser name
Germany
2007-03-22 09:54:44
Hi,

I've always wondered why sysinst wasn't capable to detect
the
installee's host name although it is present in dhcp - today
I
discovered the problem:

sysinst is doing

	get_dhcp_value(dhcp_host, sizeof(dhcp_host),
"hostname");

while dhclient is writing the option as
"host-name".

I'm doing a test build with the fix below, and will commit
after testing,
unless there are serious objections.

Regards
	-is

--- net.c       5 Dec 2006 10:21:09 -0000       1.114
+++ net.c       22 Mar 2007 14:53:48 -0000
 -649,7
+649,7 
                        /* pull hostname out of leases file
*/
                        dhcp_host[0] = 0;
                        get_dhcp_value(dhcp_host,
sizeof(dhcp_host),
-                           "hostname");
+                           "host-name");
                        if (dhcp_host[0] != '') {
                                net_dhcpconf |=
DHCPCONF_HOST;
                                strlcpy(net_host, dhcp_host,
sizeof net_host);


Re: sysinst with dhcp: host-name option
country flaguser name
United Kingdom
2007-03-22 15:44:19
On Thu, Mar 22, 2007 at 03:54:44PM +0100, Ignatios Souvatzis
wrote:
> Hi,
> 
> I've always wondered why sysinst wasn't capable to
detect the
> installee's host name although it is present in dhcp -
today I
> discovered the problem:
> 
> sysinst is doing
> 
> 	get_dhcp_value(dhcp_host, sizeof(dhcp_host),
"hostname");
> 
> while dhclient is writing the option as
"host-name".

Well spotted ....

Someone with the odd round-tuit to spare could look at
making sysinst
ask the user for network setup at the end of a non-network
install.
Most of it is just plumbing existing functions into
different places.

	David

-- 
David Laight: davidl8s.co.uk

Re: sysinst with dhcp: host-name option
user name
2007-03-29 01:55:02
On Tue, 27 Mar 2007 18:20:37 +0100 David Laight wrote:

 DL> On Tue, Mar 27, 2007 at 09:52:43AM +0200, Alan
Barrett wrote:
 >> Actually, I'd like the opportunity to edit the
settings before saving,
 >> so I'd make both the above questions go to a
network config editor
 >> (initialised differently in the two cases, but
otherwise offering the
 >> same capabilities).

 DL> Which rather seems as though a normal menu, rather
than a yes/no
 DL> question is needed.

 DL> Possibly based on the one that shows the final
configuration that the
 DL> user confirms during network setup.

Then what about this patch. If network is not configured
yet, sysinst will ask
if user want to setup the network parameters and save them.
But if network has
been configured previously, sysinst will display current
configuration and ask
if user want to discard network setup, save current setup or
change
configuration before saving.

Also, I have note that during network configuration sysinst
asks:

 The following network interfaces are active: xennet0
 Does one of them connect to the required server?

And the next question:

 I have found the following network interfaces: xennet0
 
 Which device shall I use? [xennet0]: 

Dose it have a sense to ask almost the same thing twice?

-- 
Mikolaj Golub


diff -urp src/distrib/utils/sysinst.ORIG/menus.mi
src/distrib/utils/sysinst/menus.mi
--- src/distrib/utils/sysinst.ORIG/menus.mi	2007-03-27
12:44:12.000000000 +0300
+++ src/distrib/utils/sysinst/menus.mi	2007-03-28
19:17:53.000000000 +0300
 -392,3
+392,10  menu extract, title MSG_Select_set_extra
 	option MSG_Progress_bar, exit, action { *(int *)arg = 0;
};
 	option MSG_Silent,       exit, action { *(int *)arg = 1;
};
 	option MSG_Verbose,      exit, action { *(int *)arg = 2;
};
+
+menu mntnetconfig, title MSG_mntnetconfig_save, y = -10;
+	display action { menu->cursel = *(int *)arg; };
+	option MSG_Yes,    exit, action { *(int *)arg = 0; };
+	option MSG_No,     exit, action { *(int *)arg = 1; };
+	option MSG_Change, exit, action { *(int *)arg = 2; };
+
diff -urp src/distrib/utils/sysinst.ORIG/msg.mi.de
src/distrib/utils/sysinst/msg.mi.de
--- src/distrib/utils/sysinst.ORIG/msg.mi.de	2007-03-27
12:44:12.000000000 +0300
+++ src/distrib/utils/sysinst/msg.mi.de	2007-03-28
16:15:32.000000000 +0300
 -757,10
+757,15  abbrechen.
 }
 .endif
 
-message mntnetconfig
+message mntnetconfig_save
 {Möchten Sie die aktuellen Netzwerkeinstellungen für den
allgemeinen
 Gebrauch in /etc speichern?}
 
+message mntnetconfig_setup
+{XXXDo you want to setup the network parameters and save
the values? }
+
+message Change 
+
 message cur_distsets
 {Die folgenden Distributionspakete werden verwendet:
 
diff -urp src/distrib/utils/sysinst.ORIG/msg.mi.en
src/distrib/utils/sysinst/msg.mi.en
--- src/distrib/utils/sysinst.ORIG/msg.mi.en	2007-03-27
12:44:12.000000000 +0300
+++ src/distrib/utils/sysinst/msg.mi.en	2007-03-28
16:14:42.000000000 +0300
 -703,10
+703,15  If the set's has no more disks, select "
 Select "Abort fetch" to return to the install
media selection menu.
 }
 
-message mntnetconfig
+message mntnetconfig_save
 {Is the network information you entered accurate for this
machine
 in regular operation and do you want it installed in /etc?
}
 
+message mntnetconfig_setup
+{Do you want to setup the network parameters and save the
values? }
+
+message Change 
+
 message cur_distsets
 {The following is the list of distribution sets that will
be used.
 
diff -urp src/distrib/utils/sysinst.ORIG/msg.mi.es
src/distrib/utils/sysinst/msg.mi.es
--- src/distrib/utils/sysinst.ORIG/msg.mi.es	2007-03-27
12:44:12.000000000 +0300
+++ src/distrib/utils/sysinst/msg.mi.es	2007-03-28
16:16:10.000000000 +0300
 -724,10
+724,15  para instalarlo. Seleccione "Abortar lec
 de selección de medios de instalación.
 }
 
-message mntnetconfig
+message mntnetconfig_save
 {La información de red que ha introducido, ¿es la adecuada
para el
 funcionamiento normal de esta máquina y desea instalarla en
/etc? }
 
+message mntnetconfig_setup
+{XXXDo you want to setup the network parameters and save
the values? }
+
+message Change 
+
 message cur_distsets
 {Ésta es la lista de conjuntos de distribución que se
usará.
 
diff -urp src/distrib/utils/sysinst.ORIG/msg.mi.fr
src/distrib/utils/sysinst/msg.mi.fr
--- src/distrib/utils/sysinst.ORIG/msg.mi.fr	2007-03-27
12:44:12.000000000 +0300
+++ src/distrib/utils/sysinst/msg.mi.fr	2007-03-28
16:16:31.000000000 +0300
 -769,12
+769,17  Sélectionnez "Annuler la récupération" p
 de sélection du média d'installation.
 }
 
-message mntnetconfig
+message mntnetconfig_save
 {
 Souhaitez-vous conserver les réglages réseaux après le
redémarrage
 du système que nous venons d'installer ?
 }
 
+message mntnetconfig_setup
+{XXXDo you want to setup the network parameters and save
the values? }
+
+message Change 
+
 message cur_distsets
 {
 Veuillez trouver ci-dessous la liste des composants
disponibles :
diff -urp src/distrib/utils/sysinst.ORIG/msg.mi.pl
src/distrib/utils/sysinst/msg.mi.pl
--- src/distrib/utils/sysinst.ORIG/msg.mi.pl	2007-03-27
12:44:12.000000000 +0300
+++ src/distrib/utils/sysinst/msg.mi.pl	2007-03-28
16:17:28.000000000 +0300
 -697,10
+697,15  aby rozpoczac proces jego instalacji. Wy
 zeby wybrac inne zrodlo oprogramowania.
 }
 
-message mntnetconfig
+message mntnetconfig_save
 {Czy informacje o sieci, ktore podales sa prawidlowe dla
tej maszyny
 w reguralnej pracy i czy chcesz aby je zapisac w /etc? }
 
+message mntnetconfig_setup
+{Czy chcesz skonfigurowac siec i zapisac podane ustawienia?
}
+
+message Change 
+
 message cur_distsets
 {Ponizej jest lista pakietow dystrybucyjnych, ktore zostana
uzyte.
 
diff -urp src/distrib/utils/sysinst.ORIG/net.c
src/distrib/utils/sysinst/net.c
--- src/distrib/utils/sysinst.ORIG/net.c	2007-03-27
12:47:25.000000000 +0300
+++ src/distrib/utils/sysinst/net.c	2007-03-29
10:22:24.000000000 +0300
 -1014,12
+1014,46  mnt_net_config(void)
 {
 	char ifconfig_fn[STRSIZE];
 	FILE *ifconf = NULL;
+	int config = 0;
+
+	if (network_up) {
+	        if (net_dev[0] == 's' && net_dev[1] == 'l'
&&
+			isdigit((unsigned char)net_dev[2])) /* slip */
+        	        msg_display(MSG_netok_slip, net_domain,
net_host, net_dev,
+                	        *net_ip == '' ?
"<none>" : net_ip,
+                        	*net_srv_ip == '' ?
"<none>" : net_srv_ip,
+	                        *net_mask == '' ?
"<none>" : net_mask,
+        	                *net_namesvr == '' ?
"<none>" : net_namesvr,
+                	        *net_defroute == '' ?
"<none>" : net_defroute,
+                        	*net_media == '' ?
"<default>" : net_media);
+	        else
+        	        msg_display(MSG_netok, net_domain,
net_host, net_dev,
+                	        *net_ip == '' ?
"<none>" : net_ip,
+                        	*net_mask == '' ?
"<none>" : net_mask,
+	                        *net_namesvr == '' ?
"<none>" : net_namesvr,
+        	                *net_defroute == '' ?
"<none>" : net_defroute,
+                	        *net_media == '' ?
"<default>" : net_media);
+#ifdef INET6
+		msg_display_add(MSG_netokv6,
+			!is_v6kernel() ? "<not supported>" :
+			(net_ip6conf & IP6CONF_AUTOHOST ? "yes" :
"no"),
+			*net_namesvr6 == '' ? "<none>" :
net_namesvr6);
+#endif
+        	process_menu(MENU_mntnetconfig, &config);
+		if (config == 1) 
+			network_up = 0;
+		else if (config == 2) {
+			network_up = 0;
+			config_network();
+		}
+	} else {
+		process_menu(MENU_yesno,
deconst(MSG_mntnetconfig_setup));
+		if (yesno)
+			config_network();
+	}
 
 	if (!network_up)
 		return;
-	process_menu(MENU_yesno, deconst(MSG_mntnetconfig));
-	if (!yesno)
-		return;
 
 	/* Write hostname to /etc/rc.conf */
 	if ((net_dhcpconf & DHCPCONF_HOST) == 0)

Re: sysinst with dhcp: host-name option
country flaguser name
South Africa
2007-03-29 04:02:25
On Thu, 29 Mar 2007, Mikolaj Golub wrote:
> +menu mntnetconfig, title MSG_mntnetconfig_save, y =
-10;
> +	display action { menu->cursel = *(int *)arg; };
> +	option MSG_Yes,    exit, action { *(int *)arg = 0;
};
> +	option MSG_No,     exit, action { *(int *)arg = 1;
};
> +	option MSG_Change, exit, action { *(int *)arg = 2;
};

Multi-way questions in which some of the choices are Yes or
No can be
confusing.  I'd make this one say "Save without
changes"/"Edit before
saving"/"Do not save" instead of
"Yes"/"No"/"Change".  Or just
leave out
this question, go straight to the edit screen, but have a
"cancel, do
not save" option on the edit screen.

--apb (Alan Barrett)

Re: sysinst with dhcp: host-name option
country flaguser name
Germany
2007-03-29 06:32:41
On Thu, Mar 29, 2007 at 09:55:02AM +0300, Mikolaj Golub
wrote:
> Dose it have a sense to ask almost the same thing
twice?

It is only the same if you have only a single interface. We
might consider
optimizing this case.

Martin

Re: sysinst with dhcp: host-name option
user name
2007-03-30 03:12:57
On Thu, 29 Mar 2007 11:02:25 +0200 Alan Barrett wrote:

 AB> On Thu, 29 Mar 2007, Mikolaj Golub wrote:
 >> +menu mntnetconfig, title MSG_mntnetconfig_save, y
= -10;
 >> +        display action { menu->cursel = *(int
*)arg; };
 >> +        option MSG_Yes,    exit, action { *(int
*)arg = 0; };
 >> +        option MSG_No,     exit, action { *(int
*)arg = 1; };
 >> +        option MSG_Change, exit, action { *(int
*)arg = 2; };

 AB> Multi-way questions in which some of the choices are
Yes or No can be
 AB> confusing.  I'd make this one say "Save without
changes"/"Edit before
 AB> saving"/"Do not save" instead of
"Yes"/"No"/"Change".  Or just
leave out
 AB> this question, go straight to the edit screen, but
have a "cancel, do
 AB> not save" option on the edit screen.

Unfortunately, there is no edit screen in sysint for
network
configuration. Network setup is done in questions-answers
manner. I agree that
edit screen is better configuration interface then series of
questions, but
this question for another patch .

Here:

http:/
/inec.kharkov.com/~golub/netbsd/sysinst/ 

are the last version of my patch and screenshots how it
looks now (I have
taken into account Alan's note about multi-way questions).
Also
netbsd-INSTALL_XEN3_DOMU kernel image is provided.

-- 
Mikolaj Golub

[1-6]

about | contact  Other archives ( Real Estate discussion Medical topics )