OK, i've fixed the template for this one as suggested. Let me know of
further changes.

As for what it does, all i can really do is point you at this:
Support for netrc
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=518473


On 10 May 2014 18:45, Christian PERRIER <bubu...@debian.org> wrote:

> (dropping CC, please do so as well, as I'm subscribed to the list)
>
> Quoting bofh80 (afm...@gmail.com):
> > Ok, here's the other patch too updated with a slightly better template
> > thing. Now i noticed the _Description part is different, so i changed it,
> > then noticed the other string entries don't have _Description parts.
> >
> > I'm now reading http://www.fifi.org/doc/debconf-doc/tutorial.html  and
> > https://www.debian.org/doc/packaging-manuals/debconf_specification.html  .
> > Any other pages i should be looking at? Since i still can't find info on
> > sl2 or _Decription vs Description ....
>
> #sl2 markers give the "sublevel" where the strings will go. Sublevels
> are specific to d-i and described in
> http://d-i.alioth.debian.org/doc/i18n/ch01s04.html#sublevels
>
> Here, these templates belong to sublevel 3 as they won't probably be
> shown in default installs (they should be priority medium or low).
>
>
> > +Template: apt-setup/local/netrc
> > +Type: string
> > +_Description: Have a http apt repository that requires authentication?
> > + Example: machine packages.server.org login myuser password mypass
> > + Does not pull apt/localx/repostory as machine due to possible parse
> mangle
> > + Formats as man netrc suggests
>
> Here, I have to admit that I have absolutely no clue about *what*
> should really be in the template (because I don't really understand
> what's the purpose of the patch) but the wording definitely needs a
> lot of improvement.
>
> First, anyway, "string" templates can't use a question as synopsis.
>
> You seem to expect users to enter something there, so you should
> *prompt* them for this:
>
> _Description: netrc-style entry:
>  Please enter here....blah blah blah (explain what is expected there
>  and avoid jargon).
>  .
>  For instance:
>   machine packages.server.org login myuser password mypass
>
> (note the double space meant to guarantee that the last line is
> hard(formatted.
>
>
>
From bba65cb45f63ee9605fef490348d0a7933500c12 Mon Sep 17 00:00:00 2001
From: "Anthony F. McInerney" <afm...@gmail.com>
Date: Tue, 6 May 2014 18:50:32 +0100
Subject: [PATCH] Adding netrc to generate auth.conf

Signed-off-by: Anthony F. McInerney <afm...@gmail.com>
---
 debian/apt-setup-udeb.templates | 10 ++++++++++
 generators/60local              |  7 +++++++
 2 files changed, 17 insertions(+)

diff --git a/debian/apt-setup-udeb.templates b/debian/apt-setup-udeb.templates
index 7b7afcf..d6096aa 100644
--- a/debian/apt-setup-udeb.templates
+++ b/debian/apt-setup-udeb.templates
@@ -112,3 +112,13 @@ Description: for internal use; can be preseeded
  without using 'dpkg --force-architecture', in addition to the native
  architecture. If empty, only allow installing packages from the native
  architecture.
+
+Template: apt-setup/local/netrc
+Type: string
+# :sl3:
+_Description: netrc-style entry:
+ Please enter here your apt host that requires authentication. Please use
+ the format described by man netrc.
+ .
+ For instance:
+  machine packages.server.org login myuser password mypass
diff --git a/generators/60local b/generators/60local
index fcd4f1c..ade16f2 100755
--- a/generators/60local
+++ b/generators/60local
@@ -51,6 +51,13 @@ while db_get "apt-setup/local$i/repository" && [ "$RET" ]; do
 			fi
 		done
 	fi
+	netrc=
+	if db_get "apt-setup/local$i/netrc"; then
+		netrc="$RET"
+	fi
+	if [ -n "$netrc" ]; then
+		echo "$netrc">> $ROOT/etc/apt/auth.conf
+	fi
 	i="$(($i + 1))"
 done
 
-- 
2.0.0.rc0

Reply via email to