[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

setting preseed/url in network-preseed



On Mon, Oct 24, 2005 at 10:46:36AM +0200, Geert Stappers wrote:
> On Sun, Sep 25, 2005 at 10:39:09AM +0200, Geert Stappers wrote:
> > On Sun, Sep 25, 2005 at 12:14:25AM +0200, Geert Stappers wrote:
> > > 
> > > Hello,
> > > 
> > > In svn of d-i has under /people/stappers/packages/netcfg/
> > > a netcfg that does a DHCP request that can be identified
> > > a request from netcfg.
> 
> now also in trunk

And meanwhile in the netcfg udebs in the Debian-Installer.

> > > At DHCP server side you have in /etc/dhcp3/dhcpd.conf lines like these:
> > > 
> > >     if substring (option vendor-class-identifier, 0, 14) = "NetcfgDHClient" {
> > >       filename "proto://host.tld/newFileName"; }
> > >     else { filename "i386/pxelinux.0"; }
> 
> So check in the "vendor class identifier" for the string 'NetcfgDHClient'
>  
> > At the d-i install client you find the filename in
> > the dhcp leases files
> 
> example given:
> 
>   grep filename /var/lib/dhcp/dhclient.leases
> 
> 
> 

The filename can be set in the preseed/url key with this patch

--- packages/preseed/debian/network-preseed.postinst	(revision 34697)
+++ packages/preseed/debian/network-preseed.postinst	(working copy)
@@ -27,5 +27,17 @@
 	fi
 }
 
+LEASE="notfound"
+test -x /sbin/dhclient   && LEASE=/var/lib/dhcp/dhclient.leases 
+test -x /sbin/dhclient3  && LEASE=/var/lib/dhcp3/dhclient.leases 
+if [ -r ${LEASE} ]
+then
+  FN=$( sed -n -e '/filename/s/.*"\(.*\)"./\1/p' ${LEASE} )
+fi
+if [ -z ${FN##*://*} ]
+then
+  db_set preseed/url ${FN}
+fi
+
 preseed preseed/url
 preseed_command preseed/early_command


That has the advantage that preseed/url=URL doesn't have to be provided
at the bootprompt.

The patch is is also committed into trunk.

My question:

   Any objections to upload it, so it gets into beta2?


Cheers
Geert Stappers

Attachment: signature.asc
Description: Digital signature


Reply to: