Re: preseed installation, hostname and PTR

2012-10-13 Thread Philipp Kern
On Tue, Oct 09, 2012 at 02:03:59AM +0200, Floris Bos / Maxnet wrote:
 On 10/08/2012 11:13 PM, Philipp Kern wrote:
 On Mon, Oct 08, 2012 at 09:20:47PM +0200, Floris Bos / Maxnet wrote:
 Deja vu: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=606636
 To me it is still a bug, although others mentioned it is documented
 behavior.
 It is. However that patch would need to be redone against Matt's changes
 to netcfg.
 Attached a new one, so that excuse can no longer be used.

Thanks. Applied as db19e15 in the netcfg git repository. I also updated the
manual (r68201). I find it a bit inconsistent given the reliance on the get_
values for plain static configuration, but given that get_hostname is explained
differently in the manual already, it probably makes sense to introduce the new
variable as you did.

Kind regards
Philipp Kern


signature.asc
Description: Digital signature


Re: preseed installation, hostname and PTR

2012-10-08 Thread Floris Bos / Maxnet

On 10/08/2012 05:51 PM, George Shuklin wrote:
Found very strange behavior: If VM installed with preseed and new VM 
hostname is passed via kernel command line, installer ignores that 
option and use data from DNS (PTR record for IP).


This is bug or feature? I found it in sqeeze/wheezy and ubuntu (12.04) 
installers. 


Deja vu: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=606636

To me it is still a bug, although others mentioned it is documented 
behavior.


--

Yours sincerely,

Floris Bos


--
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/5073278f.3000...@je-eigen-domein.nl



Re: preseed installation, hostname and PTR

2012-10-08 Thread Philipp Kern
On Mon, Oct 08, 2012 at 09:20:47PM +0200, Floris Bos / Maxnet wrote:
 Deja vu: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=606636
 To me it is still a bug, although others mentioned it is documented
 behavior.

It is. However that patch would need to be redone against Matt's changes
to netcfg.

Kind regards
Philipp kern


signature.asc
Description: Digital signature


Re: preseed installation, hostname and PTR

2012-10-08 Thread Floris Bos / Maxnet

On 10/08/2012 11:13 PM, Philipp Kern wrote:

On Mon, Oct 08, 2012 at 09:20:47PM +0200, Floris Bos / Maxnet wrote:

Deja vu: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=606636
To me it is still a bug, although others mentioned it is documented
behavior.

It is. However that patch would need to be redone against Matt's changes
to netcfg.


Attached a new one, so that excuse can no longer be used.


Yours sincerely,

Floris Bos

diff -ur netcfg-1.98.orig/debian/netcfg-common.templates netcfg-1.98/debian/netcfg-common.templates
--- netcfg-1.98.orig/debian/netcfg-common.templates	2012-10-03 01:23:27.0 +0200
+++ netcfg-1.98/debian/netcfg-common.templates	2012-10-09 01:34:16.287439267 +0200
@@ -152,6 +152,12 @@
  administrator. If you are setting up your own home network, you can make
  something up here.
 
+Template: netcfg/hostname
+Type: string
+Description: Hostname that can be preseeded.
+ .
+ If specified this disables the automatic detection of the hostname by netcfg.
+
 Template: netcfg/invalid_hostname
 Type: error
 # :sl2:
Only in netcfg-1.98/debian: netcfg.debhelper.log
Only in netcfg-1.98/debian: netcfg-static.debhelper.log
diff -ur netcfg-1.98.orig/dhcp.c netcfg-1.98/dhcp.c
--- netcfg-1.98.orig/dhcp.c	2012-09-25 02:07:24.0 +0200
+++ netcfg-1.98/dhcp.c	2012-10-09 01:57:22.055463420 +0200
@@ -559,12 +559,19 @@
 {
 char buf[MAXHOSTNAMELEN + 1] = { 0 };
 /*
- * Default to the hostname returned via DHCP, if any,
+ * If the netcfg/hostname preseed value is set use that
+ * otherwise default to the hostname returned via DHCP, if any,
  * otherwise to the requested DHCP hostname
  * otherwise to the hostname found in DNS for the IP address
  * of the interface
  */
-if (gethostname(buf, sizeof(buf)) == 0
+debconf_get(client, netcfg/hostname);
+if (!empty_str(client-value))
+{
+strncpy(buf, client-value, MAXHOSTNAMELEN);
+preseed_hostname_from_fqdn(client, buf);
+} 
+else if (gethostname(buf, sizeof(buf)) == 0
  !empty_str(buf)
  strcmp(buf, (none))
 ) {
diff -ur netcfg-1.98.orig/static.c netcfg-1.98/static.c
--- netcfg-1.98.orig/static.c	2012-10-04 23:14:35.0 +0200
+++ netcfg-1.98/static.c	2012-10-09 01:58:14.375464370 +0200
@@ -608,8 +608,15 @@
 break;
 case GET_HOSTNAME:
 {
-char buf[MAXHOSTNAMELEN + 1];
-if (get_hostname_from_dns(iface, buf, sizeof(buf)))
+char buf[MAXHOSTNAMELEN + 1] = { 0 };
+
+debconf_get(client, netcfg/hostname);
+if (!empty_str(client-value))
+{
+strncpy(buf, client-value, MAXHOSTNAMELEN);
+preseed_hostname_from_fqdn(client, buf);
+} 
+else if (get_hostname_from_dns(iface, buf, sizeof(buf)))
 preseed_hostname_from_fqdn(client, buf);
 }
 state = (netcfg_get_hostname(client, netcfg/get_hostname, hostname, 1)) ?