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

[RFC] entropy plugin rework + support for the gtk and text frontends



On Sat, Mar 29, 2008 at 01:57:08AM +0100, Max Vozeler wrote:
> > Attached is a patchset which makes various changes to the current
> > cdebconf-entropy package in order to support other frontends than newt,
> > adds support for the GTK+ frontend, and update partman-crypto
> > accordingly.
> 
> These are good improvements, thanks!
> 
> I have reviewed your patches and couldn't spot any problems from 
> the code and packaging side.

Great. :)

For an added bonus, attached is a revised patch also adding support for
the text frontend.  Joey, will this allow you to automate the testing of
crypto installations?

> Here IMHO bubulle's suggested wording sounds very good.

The patch have been updated accordingly.  Thanks bubulle!

> Overall, I think we should go ahead with these changes - they
> seem safe enough for me even during this beta stage.

I give 2-3 more days for additional reviews, and if there is no new
issues I will push the attached patch to the repository.

Cheers,
-- 
Jérémy Bobbio                        .''`. 
lunar@debian.org                    : :Ⓐ  :  # apt-get install anarchism
                                    `. `'` 
                                      `-   
commit 6952b38fbb79345bacf331b4a976f0fb07a3f6a1
Author: Jérémy Bobbio <lunar@debian.org>
Date:   Sun Mar 23 12:08:30 2008 +0100

    Rename newt entropy plugin from "entropy-text" to "entropy"
    
    There is no reason to have two sets of templates depending on which
    frontend is used to gather entropy, so let's rename the question type to
    "entropy".
---
 packages/cdebconf-entropy/configure.ac             |    5 +++--
 packages/cdebconf-entropy/debian/changelog         |    6 ++++++
 ...plugin-entropy-text.c => newt-plugin-entropy.c} |    4 ++--
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/packages/cdebconf-entropy/configure.ac b/packages/cdebconf-entropy/configure.ac
index ab450b3..dc895f4 100644
--- a/packages/cdebconf-entropy/configure.ac
+++ b/packages/cdebconf-entropy/configure.ac
@@ -1,5 +1,6 @@
-AC_INIT(newt-plugin-entropy-text.c)
-PACKAGE=entropy-text
+AC_INIT
+
+PACKAGE=entropy
 AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE")
 
 AC_PROG_MAKE_SET
diff --git a/packages/cdebconf-entropy/debian/changelog b/packages/cdebconf-entropy/debian/changelog
index bcef2fc..4e6602e 100644
--- a/packages/cdebconf-entropy/debian/changelog
+++ b/packages/cdebconf-entropy/debian/changelog
@@ -1,3 +1,9 @@
+cdebconf-entropy (0.7) UNRELEASED; urgency=low
+
+  * Rename newt entropy plugin from "entropy-text" to "entropy".
+
+ -- Jérémy Bobbio <lunar@debian.org>  Sun, 23 Mar 2008 20:28:57 +0100
+
 cdebconf-entropy (0.6) unstable; urgency=low
 
   * Switch the handler symbol to the "cdebconf_" namespace.
diff --git a/packages/cdebconf-entropy/newt-plugin-entropy-text.c b/packages/cdebconf-entropy/newt-plugin-entropy.c
similarity index 98%
rename from packages/cdebconf-entropy/newt-plugin-entropy-text.c
rename to packages/cdebconf-entropy/newt-plugin-entropy.c
index 722cae9..2cccdbf 100644
--- a/packages/cdebconf-entropy/newt-plugin-entropy-text.c
+++ b/packages/cdebconf-entropy/newt-plugin-entropy.c
@@ -74,7 +74,7 @@ help_text(struct frontend *obj)
 static const char *
 success_text(struct frontend *obj)
 {
-    return question_get_text(obj, "partman-crypto/entropy-text-success", 
+    return question_get_text(obj, "partman-crypto/entropy-success", 
       "Key data has been created successfully.");
 }
 
@@ -104,7 +104,7 @@ copy_byte(int in, int out)
 }
 
 int 
-cdebconf_newt_handler_entropy_text(struct frontend *obj, struct question *q)
+cdebconf_newt_handler_entropy(struct frontend *obj, struct question *q)
 {
     newtComponent form;
     struct newtExitStruct nstat;

commit 7f27d64c2494224e966f13cfabaef30068cf9de8
Author: Jérémy Bobbio <lunar@debian.org>
Date:   Sun Mar 23 12:23:08 2008 +0100

    Make newt entropy plugin able to use a different FIFO
    
    By specifying the FIFO template variable, a different FIFO than
    /var/run/random.fifo can now be used.  This is more practical for testing
    the plugin outside d-i.
---
 packages/cdebconf-entropy/debian/changelog      |    2 ++
 packages/cdebconf-entropy/newt-plugin-entropy.c |   23 +++++++++++++++--------
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/packages/cdebconf-entropy/debian/changelog b/packages/cdebconf-entropy/debian/changelog
index 4e6602e..3348160 100644
--- a/packages/cdebconf-entropy/debian/changelog
+++ b/packages/cdebconf-entropy/debian/changelog
@@ -1,6 +1,8 @@
 cdebconf-entropy (0.7) UNRELEASED; urgency=low
 
   * Rename newt entropy plugin from "entropy-text" to "entropy".
+  * Make newt entropy plugin able to use a different FIFO through the "FIFO"
+    variable.
 
  -- Jérémy Bobbio <lunar@debian.org>  Sun, 23 Mar 2008 20:28:57 +0100
 
diff --git a/packages/cdebconf-entropy/newt-plugin-entropy.c b/packages/cdebconf-entropy/newt-plugin-entropy.c
index 2cccdbf..ba73eb2 100644
--- a/packages/cdebconf-entropy/newt-plugin-entropy.c
+++ b/packages/cdebconf-entropy/newt-plugin-entropy.c
@@ -111,18 +111,23 @@ cdebconf_newt_handler_entropy(struct frontend *obj, struct question *q)
     const char *p;
     int ret = DC_NOTOK;
     int keysize;
+    const char *fifo = NULL;
     int nwritten = 0;
     int want_data = 1;
     int randfd = 0;
     int fifofd = 0;
- 
+
     if (mlock(&rnd_byte, sizeof(rnd_byte)) < 0) {
         error("mlock failed: %s", strerror(errno));
         goto errout;
     }
-        
-    if (mkfifo(FIFO, 0600) < 0) {
-        error("mkfifo(%s): %s", FIFO, strerror(errno));
+
+    if (NULL == (fifo = question_get_variable(q, "FIFO"))) {
+        fifo = FIFO;
+    }
+
+    if (mkfifo(fifo, 0600) < 0) {
+        error("mkfifo(%s): %s", fifo, strerror(errno));
         goto errout;
     }
 
@@ -132,9 +137,9 @@ cdebconf_newt_handler_entropy(struct frontend *obj, struct question *q)
         goto errout;
     }
 
-    fifofd = open(FIFO, O_WRONLY);
+    fifofd = open(fifo, O_WRONLY);
     if (fifofd < 0) {
-        error("open(%s): %s", FIFO, strerror(errno));
+        error("open(%s): %s", fifo, strerror(errno));
         goto errout;
     }
    
@@ -195,8 +200,10 @@ errout:
         close(randfd);
     if (fifofd)
         close(fifofd);
-    
-    unlink(FIFO);
+   
+    if (NULL != fifo) {
+        unlink(fifo);
+    }
 
     munlock(&rnd_byte, sizeof(rnd_byte));
     return ret;

commit 8414a018c3b68d37d087e2539389455d456e640b
Author: Jérémy Bobbio <lunar@debian.org>
Date:   Sun Mar 23 12:26:44 2008 +0100

    Properly link the newt entropy plugin against libtextwrap
---
 packages/cdebconf-entropy/Makefile.in      |    2 +-
 packages/cdebconf-entropy/debian/changelog |    1 +
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/packages/cdebconf-entropy/Makefile.in b/packages/cdebconf-entropy/Makefile.in
index 18e128e..6962224 100644
--- a/packages/cdebconf-entropy/Makefile.in
+++ b/packages/cdebconf-entropy/Makefile.in
@@ -25,7 +25,7 @@ install: $(PLUGIN_MODULES)
 	done
 
 newt-plugin-$(PACKAGE).so: newt-plugin-$(PACKAGE).opic
-	$(CC) $(LDFLAGS) -shared -lnewt -o $@ newt-plugin-$(PACKAGE).opic
+	$(CC) $(LDFLAGS) -shared -lnewt -ltextwrap -o $@ newt-plugin-$(PACKAGE).opic
 
 clean:
 	rm -f $(PLUGIN_MODULES)
diff --git a/packages/cdebconf-entropy/debian/changelog b/packages/cdebconf-entropy/debian/changelog
index 3348160..ef8f74b 100644
--- a/packages/cdebconf-entropy/debian/changelog
+++ b/packages/cdebconf-entropy/debian/changelog
@@ -3,6 +3,7 @@ cdebconf-entropy (0.7) UNRELEASED; urgency=low
   * Rename newt entropy plugin from "entropy-text" to "entropy".
   * Make newt entropy plugin able to use a different FIFO through the "FIFO"
     variable.
+  * Properly link the newt entropy plugin against libtextwrap.
 
  -- Jérémy Bobbio <lunar@debian.org>  Sun, 23 Mar 2008 20:28:57 +0100
 

commit eef14fdd1a6347fe61e083fa927c7fada19e0df1
Author: Jérémy Bobbio <lunar@debian.org>
Date:   Sun Mar 23 14:35:02 2008 +0000

    Do not link against the no longer used libdl
---
 packages/cdebconf-entropy/Makefile.in      |    2 +-
 packages/cdebconf-entropy/debian/changelog |    2 ++
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/packages/cdebconf-entropy/Makefile.in b/packages/cdebconf-entropy/Makefile.in
index 6962224..466c3b1 100644
--- a/packages/cdebconf-entropy/Makefile.in
+++ b/packages/cdebconf-entropy/Makefile.in
@@ -11,7 +11,7 @@ incdir=${prefix}/include/cdebconf
 PACKAGE=@PACKAGE@
 CC=@CC@
 CFLAGS=@CFLAGS@ -I.
-LDFLAGS=@LDFLAGS@ -ldl
+LDFLAGS=@LDFLAGS@
 
 FRONTENDS=@FRONTENDS@
 PLUGIN_MODULES=$(addsuffix -plugin-$(PACKAGE).so,$(FRONTENDS))
diff --git a/packages/cdebconf-entropy/debian/changelog b/packages/cdebconf-entropy/debian/changelog
index ef8f74b..76784ca 100644
--- a/packages/cdebconf-entropy/debian/changelog
+++ b/packages/cdebconf-entropy/debian/changelog
@@ -4,6 +4,8 @@ cdebconf-entropy (0.7) UNRELEASED; urgency=low
   * Make newt entropy plugin able to use a different FIFO through the "FIFO"
     variable.
   * Properly link the newt entropy plugin against libtextwrap.
+  * Correctly link newt entropy plugin against libtextwrap.
+  * Do not link against the no longer used libdl.
 
  -- Jérémy Bobbio <lunar@debian.org>  Sun, 23 Mar 2008 20:28:57 +0100
 

commit 71f0e321b9436cfffae56837c4e052ad90a7c2f0
Author: Jérémy Bobbio <lunar@debian.org>
Date:   Sun Mar 23 12:45:01 2008 +0100

    Allow success message to be read from a configurable template
    
    A new variable, SUCCESS, can be used to specify a template which text will
    be displayed when enough entropy has been gathered.
---
 packages/cdebconf-entropy/debian/changelog      |    2 ++
 packages/cdebconf-entropy/newt-plugin-entropy.c |   11 ++++++++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/packages/cdebconf-entropy/debian/changelog b/packages/cdebconf-entropy/debian/changelog
index 76784ca..7c3a880 100644
--- a/packages/cdebconf-entropy/debian/changelog
+++ b/packages/cdebconf-entropy/debian/changelog
@@ -6,6 +6,8 @@ cdebconf-entropy (0.7) UNRELEASED; urgency=low
   * Properly link the newt entropy plugin against libtextwrap.
   * Correctly link newt entropy plugin against libtextwrap.
   * Do not link against the no longer used libdl.
+  * Allow success message to be read from a configurable template through the
+    "SUCCESS" variable.
 
  -- Jérémy Bobbio <lunar@debian.org>  Sun, 23 Mar 2008 20:28:57 +0100
 
diff --git a/packages/cdebconf-entropy/newt-plugin-entropy.c b/packages/cdebconf-entropy/newt-plugin-entropy.c
index ba73eb2..d6cf346 100644
--- a/packages/cdebconf-entropy/newt-plugin-entropy.c
+++ b/packages/cdebconf-entropy/newt-plugin-entropy.c
@@ -72,9 +72,14 @@ help_text(struct frontend *obj)
 }
 
 static const char *
-success_text(struct frontend *obj)
+success_text(struct frontend *obj, struct question *q)
 {
-    return question_get_text(obj, "partman-crypto/entropy-success", 
+    const char *success;
+
+    if (NULL == (success = question_get_variable(q, "SUCCESS"))) {
+        success = "partman-crypto/entropy-success";
+    }
+    return question_get_text(obj, success, 
       "Key data has been created successfully.");
 }
 
@@ -187,7 +192,7 @@ cdebconf_newt_handler_entropy(struct frontend *obj, struct question *q)
 
             if (nwritten == keysize) {
                 /* Done - activate OK button */
-                newtTextboxSetText(textbox, success_text(obj));
+                newtTextboxSetText(textbox, success_text(obj, q));
                 newtComponentTakesFocus(bOK, 1);
                 newtFormSetCurrent(form, bOK);
                 want_data = 0;

commit ce5f71880d779de97cd2a3860b56ef2f9f8feffa
Author: Jérémy Bobbio <lunar@debian.org>
Date:   Sun Mar 23 15:03:54 2008 +0100

    Put strings relevant to the newt entropy plugin in new templates
    
    debconf/entropy/text/action and debconf/entropy/text/help, shipped in
    the cdebconf-newt-entropy package are now used by the plugin to get the
    strings that will be prompted by the user.
    
    The short description of the entropy question will now be prepended to the
    help text, thus removing the need to be specific on how to produce more
    entropy.
---
 .../debian/cdebconf-newt-entropy.templates         |   14 ++++++
 packages/cdebconf-entropy/debian/changelog         |    2 +
 packages/cdebconf-entropy/debian/po/POTFILES.in    |    1 +
 packages/cdebconf-entropy/debian/rules             |    1 +
 packages/cdebconf-entropy/newt-plugin-entropy.c    |   45 +++++++++++++-------
 5 files changed, 48 insertions(+), 15 deletions(-)

diff --git a/packages/cdebconf-entropy/debian/cdebconf-newt-entropy.templates b/packages/cdebconf-entropy/debian/cdebconf-newt-entropy.templates
new file mode 100644
index 0000000..17ef2e3
--- /dev/null
+++ b/packages/cdebconf-entropy/debian/cdebconf-newt-entropy.templates
@@ -0,0 +1,14 @@
+Template: debconf/entropy/text/action
+Type: text
+# :sl3:
+_Description: Enter random characters
+
+Template: debconf/entropy/text/help
+Type: text
+# :sl3:
+_Description: You can help speed up the process by entering random characters on the keyboard, or just wait until enough keydata has been collected. (NOTE: this can take a long time)
+
+Template: debconf/entropy/success
+Type: text
+# :sl5:
+_Description: Enough entropy has been gathered.
diff --git a/packages/cdebconf-entropy/debian/changelog b/packages/cdebconf-entropy/debian/changelog
index 7c3a880..49f5852 100644
--- a/packages/cdebconf-entropy/debian/changelog
+++ b/packages/cdebconf-entropy/debian/changelog
@@ -8,6 +8,8 @@ cdebconf-entropy (0.7) UNRELEASED; urgency=low
   * Do not link against the no longer used libdl.
   * Allow success message to be read from a configurable template through the
     "SUCCESS" variable.
+  * Strings only relevant to the newt entropy plugin are now in templates
+    shipped with cdebconf-newt-entropy.
 
  -- Jérémy Bobbio <lunar@debian.org>  Sun, 23 Mar 2008 20:28:57 +0100
 
diff --git a/packages/cdebconf-entropy/debian/po/POTFILES.in b/packages/cdebconf-entropy/debian/po/POTFILES.in
new file mode 100644
index 0000000..af2b69d
--- /dev/null
+++ b/packages/cdebconf-entropy/debian/po/POTFILES.in
@@ -0,0 +1 @@
+[type: gettext/rfc822deb] cdebconf-newt-entropy.templates
diff --git a/packages/cdebconf-entropy/debian/rules b/packages/cdebconf-entropy/debian/rules
index 72fa9c9..ad5a3ae 100755
--- a/packages/cdebconf-entropy/debian/rules
+++ b/packages/cdebconf-entropy/debian/rules
@@ -73,6 +73,7 @@ binary-arch: build install
 	dh_testroot
 	dh_installchangelogs 
 	dh_installdocs
+	dh_installdebconf
 	dh_install --sourcedir=debian/tmp
 	dh_link
 	dh_strip
diff --git a/packages/cdebconf-entropy/newt-plugin-entropy.c b/packages/cdebconf-entropy/newt-plugin-entropy.c
index d6cf346..964f290 100644
--- a/packages/cdebconf-entropy/newt-plugin-entropy.c
+++ b/packages/cdebconf-entropy/newt-plugin-entropy.c
@@ -8,6 +8,8 @@
  * 
  */ 
 
+#define _GNU_SOURCE
+
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/mman.h>
@@ -72,15 +74,30 @@ help_text(struct frontend *obj)
 }
 
 static const char *
+action_text(struct frontend *obj)
+{
+    return question_get_text(obj, "debconf/entropy/text/action", "Enter random characters");
+}
+
+static const char *
+entropy_help_text(struct frontend *obj)
+{
+    return question_get_text(obj, "debconf/entropy/text/help",
+        "You can help speed up the process by entering random characters on "
+        "the keyboard, or just wait until enough keydata has been collected. "
+        "(NOTE: this can take a long time)");
+}
+
+static const char *
 success_text(struct frontend *obj, struct question *q)
 {
     const char *success;
 
     if (NULL == (success = question_get_variable(q, "SUCCESS"))) {
-        success = "partman-crypto/entropy-success";
+        success = "debconf/entropy/success";
     }
     return question_get_text(obj, success, 
-      "Key data has been created successfully.");
+      "Enough entropy has been gathered.");
 }
 
 static int 
@@ -222,8 +239,7 @@ prepare_window(newtComponent *form, struct frontend *obj, struct question *q, in
     int t_width, t_height;
     int t_width_buttons, t_width_title, t_width_scroll = 0;
     int win_width, win_height;
-    char *ext_description;
-    char *short_description;
+    char *description;
     const char *result;
 
 #ifdef HAVE_LIBTEXTWRAP
@@ -240,18 +256,18 @@ prepare_window(newtComponent *form, struct frontend *obj, struct question *q, in
     /*  There are 5 characters for sigils, plus 4 for borders */
     strtruncate(obj->title, win_width-9);
 
-    ext_description = question_get_field((q), "", "extended_description");
-    short_description = question_get_field(q, "", "description");
+    asprintf(&description, "%s\n\n%s", question_get_field((q), "", "description"),
+        entropy_help_text(obj));
 
 #ifdef HAVE_LIBTEXTWRAP
     textwrap_init(&tw);
     textwrap_columns(&tw, win_width - 2 - 2*TEXT_PADDING);
-    wrappedtext = textwrap(&tw, ext_description);
-    free(ext_description);
-    ext_description = wrappedtext;
+    wrappedtext = textwrap(&tw, description);
+    free(description);
+    description = wrappedtext;
 #endif
 
-    t_height = cdebconf_newt_get_text_height(ext_description, win_width);
+    t_height = cdebconf_newt_get_text_height(description, win_width);
     if (t_height + 6 + 4 <= height-5)
         win_height = t_height + 6 + 4;
     else {
@@ -261,7 +277,7 @@ prepare_window(newtComponent *form, struct frontend *obj, struct question *q, in
     }
 
     t_height = win_height - (6 + 4);
-    t_width = cdebconf_newt_get_text_width(ext_description);
+    t_width = cdebconf_newt_get_text_width(description);
     t_width_buttons = 2*BUTTON_PADDING;
     t_width_buttons += cdebconf_newt_get_text_width(goback_text(obj)) + 3;
     t_width_buttons += cdebconf_newt_get_text_width(continue_text(obj)) + 3;
@@ -292,10 +308,9 @@ prepare_window(newtComponent *form, struct frontend *obj, struct question *q, in
     newtFormAddComponent(*form, bOK);
 
     newtScaleSet(scale, 0);
-    newtTextboxSetText(textbox, ext_description);
-    newtTextboxSetText(textbox2, short_description);
-    free(ext_description);
-    free(short_description);
+    newtTextboxSetText(textbox, description);
+    newtTextboxSetText(textbox2, action_text(obj));
+    free(description);
 }
 
 /* vim:set ts=4 sw=4 expandtab: */

commit 51a2f439f1b61bc0b4ec9ec63ddf43be962adc8e
Author: Jérémy Bobbio <lunar@debian.org>
Date:   Sun Mar 23 17:32:12 2008 +0100

    Properly handle the "backup" capability in the newt plugin
    
    The newt plugin now properly handles the "backup" capability: the "Go
    Back" button was previously always available.
---
 packages/cdebconf-entropy/debian/changelog      |    2 ++
 packages/cdebconf-entropy/newt-plugin-entropy.c |    9 +++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/packages/cdebconf-entropy/debian/changelog b/packages/cdebconf-entropy/debian/changelog
index 49f5852..fb1c1a2 100644
--- a/packages/cdebconf-entropy/debian/changelog
+++ b/packages/cdebconf-entropy/debian/changelog
@@ -10,6 +10,8 @@ cdebconf-entropy (0.7) UNRELEASED; urgency=low
     "SUCCESS" variable.
   * Strings only relevant to the newt entropy plugin are now in templates
     shipped with cdebconf-newt-entropy.
+  * The newt plugin now properly handle the "backup" capability: the "Go Back"
+    button was previously always available.
 
  -- Jérémy Bobbio <lunar@debian.org>  Sun, 23 Mar 2008 20:28:57 +0100
 
diff --git a/packages/cdebconf-entropy/newt-plugin-entropy.c b/packages/cdebconf-entropy/newt-plugin-entropy.c
index 964f290..95afa4b 100644
--- a/packages/cdebconf-entropy/newt-plugin-entropy.c
+++ b/packages/cdebconf-entropy/newt-plugin-entropy.c
@@ -299,9 +299,14 @@ prepare_window(newtComponent *form, struct frontend *obj, struct question *q, in
     scale = newtScale(TEXT_PADDING, 1+t_height+1, win_width-2*TEXT_PADDING, keysize);
     textbox2 = newtTextbox(TEXT_PADDING, 1+t_height+3, t_width, 1, tflags);
     entry = newtEntry(TEXT_PADDING, 1+t_height+5, "", t_width, &result, eflags);
-    bCancel = newtCompactButton((TEXT_PADDING + BUTTON_PADDING - 1), win_height-2, goback_text(obj));
 
-    newtFormAddComponents(*form, scale, textbox, textbox2, entry, bCancel, NULL);
+    newtFormAddComponents(*form, scale, textbox, textbox2, entry, NULL);
+    if (obj->methods.can_go_back(obj, q)) {
+        bCancel = newtCompactButton((TEXT_PADDING + BUTTON_PADDING - 1), win_height-2, goback_text(obj));
+        newtFormAddComponents(*form, bCancel, NULL);
+    } else {
+        bCancel = NULL;
+    }
 
     bOK = newtCompactButton((win_width - TEXT_PADDING - BUTTON_PADDING - strwidth(continue_text(obj))-3), win_height-2, continue_text(obj));
     newtComponentTakesFocus(bOK, 0);

commit 99219f53a6aead9d0366b03412dc0c8290d8e5ba
Author: Jérémy Bobbio <lunar@debian.org>
Date:   Sun Mar 23 14:21:33 2008 +0000

    Make cdebconf-newt-entropy "Provides" cdebconf-entropy
    
    As different packages will be needed for the various frontends, having a
    cdebconf-entropy virtual package will allow more flexibility on the
    packages that will be loaded.
---
 packages/cdebconf-entropy/debian/changelog |    1 +
 packages/cdebconf-entropy/debian/control   |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/packages/cdebconf-entropy/debian/changelog b/packages/cdebconf-entropy/debian/changelog
index fb1c1a2..3435c93 100644
--- a/packages/cdebconf-entropy/debian/changelog
+++ b/packages/cdebconf-entropy/debian/changelog
@@ -12,6 +12,7 @@ cdebconf-entropy (0.7) UNRELEASED; urgency=low
     shipped with cdebconf-newt-entropy.
   * The newt plugin now properly handle the "backup" capability: the "Go Back"
     button was previously always available.
+  * Make cdebconf-newt-entropy "Provides" cdebconf-entropy.
 
  -- Jérémy Bobbio <lunar@debian.org>  Sun, 23 Mar 2008 20:28:57 +0100
 
diff --git a/packages/cdebconf-entropy/debian/control b/packages/cdebconf-entropy/debian/control
index ba654a4..1807ed4 100644
--- a/packages/cdebconf-entropy/debian/control
+++ b/packages/cdebconf-entropy/debian/control
@@ -11,6 +11,7 @@ Package: cdebconf-newt-entropy
 Architecture: any
 Section: debian-installer
 Depends: cdebconf-newt-udeb, ${shlibs:Depends}
+Provides: cdebconf-entropy
 XC-Package-Type: udeb
 Description: cdebconf newt plugin for reading from /dev/random
  cdebconf plugin to facilitate reading random data from /dev/random.

commit 66dc43310d09be88b5ea160ffd2ca70ab65977ae
Author: Jérémy Bobbio <lunar@debian.org>
Date:   Sun Mar 23 17:22:28 2008 +0100

    Add entropy plugin for the GTK+ frontend
    
    cdebconf-entropy now builds a new package, cdebconf-gtk-entropy, and thus
    Build-Depends on libgtk-directfb-2.0-dev.
---
 packages/cdebconf-entropy/Makefile.in              |    9 +
 packages/cdebconf-entropy/configure.ac             |    6 +
 .../debian/cdebconf-gtk-entropy.install            |    1 +
 .../debian/cdebconf-gtk-entropy.templates          |   14 +
 packages/cdebconf-entropy/debian/changelog         |    3 +
 packages/cdebconf-entropy/debian/control           |   13 +-
 packages/cdebconf-entropy/debian/po/POTFILES.in    |    1 +
 packages/cdebconf-entropy/gtk-plugin-entropy.c     |  363 ++++++++++++++++++++
 8 files changed, 409 insertions(+), 1 deletions(-)

diff --git a/packages/cdebconf-entropy/Makefile.in b/packages/cdebconf-entropy/Makefile.in
index 466c3b1..c02b298 100644
--- a/packages/cdebconf-entropy/Makefile.in
+++ b/packages/cdebconf-entropy/Makefile.in
@@ -12,6 +12,8 @@ PACKAGE=@PACKAGE@
 CC=@CC@
 CFLAGS=@CFLAGS@ -I.
 LDFLAGS=@LDFLAGS@
+GTK_CFLAGS=@GTK_CFLAGS@
+GTK_LIBS=@GTK_LIBS@
 
 FRONTENDS=@FRONTENDS@
 PLUGIN_MODULES=$(addsuffix -plugin-$(PACKAGE).so,$(FRONTENDS))
@@ -27,6 +29,9 @@ install: $(PLUGIN_MODULES)
 newt-plugin-$(PACKAGE).so: newt-plugin-$(PACKAGE).opic
 	$(CC) $(LDFLAGS) -shared -lnewt -ltextwrap -o $@ newt-plugin-$(PACKAGE).opic
 
+gtk-plugin-$(PACKAGE).so: gtk-plugin-$(PACKAGE).opic
+	$(CC) $(LDFLAGS) -shared -o $@ $^ $(GTK_LIBS)
+
 clean:
 	rm -f $(PLUGIN_MODULES)
 	rm -f *.opic
@@ -35,6 +40,10 @@ distclean: clean
 	rm -f config.log config.status
 	rm -f Makefile
 
+gtk-%.opic: gtk-%.c
+	@echo "Compiling $< to $@"
+	$(CC) $(CFLAGS) $(GTK_CFLAGS) -fPIC -o $@ -c $<
+
 %.opic: %.c
 	@echo "Compiling $< to $@"
 	$(CC) $(CFLAGS) -fPIC -o $@ -c $<
diff --git a/packages/cdebconf-entropy/configure.ac b/packages/cdebconf-entropy/configure.ac
index dc895f4..1e5695b 100644
--- a/packages/cdebconf-entropy/configure.ac
+++ b/packages/cdebconf-entropy/configure.ac
@@ -16,6 +16,12 @@ fi
 AC_CHECK_LIB(newt, newtInit, FRONTENDS="$FRONTENDS newt", echo
  "*** Cannot build Newt plugin ***")
 
+PKG_CHECK_MODULES(GTK, [gtk+-directfb-2.0],
+ FRONTENDS="$FRONTENDS gtk",
+ echo "*** Cannot build GTK+ plugin ***")
+
+AC_SUBST(GTK_CFLAGS)
+AC_SUBST(GTK_LIBS)
 AC_SUBST(FRONTENDS)
 AC_SUBST(PACKAGE)
 
diff --git a/packages/cdebconf-entropy/debian/cdebconf-gtk-entropy.install b/packages/cdebconf-entropy/debian/cdebconf-gtk-entropy.install
new file mode 100644
index 0000000..3a7472e
--- /dev/null
+++ b/packages/cdebconf-entropy/debian/cdebconf-gtk-entropy.install
@@ -0,0 +1 @@
+usr/lib/cdebconf/frontend/gtk
diff --git a/packages/cdebconf-entropy/debian/cdebconf-gtk-entropy.templates b/packages/cdebconf-entropy/debian/cdebconf-gtk-entropy.templates
new file mode 100644
index 0000000..9fa6522
--- /dev/null
+++ b/packages/cdebconf-entropy/debian/cdebconf-gtk-entropy.templates
@@ -0,0 +1,14 @@
+Template: debconf/entropy/gtk/action
+Type: text
+# :sl3:
+_Description: Enter random characters or move mouse randomly
+
+Template: debconf/entropy/gtk/help
+Type: text
+# :sl3:
+_Description: You can help speed up the process by entering random characters on the keyboard or by moving the mouse randomly, or just wait until enough keydata has been collected. (NOTE: this can take a long time)
+
+Template: debconf/entropy/success
+Type: text
+# :sl5:
+_Description: Enough entropy has been gathered.
diff --git a/packages/cdebconf-entropy/debian/changelog b/packages/cdebconf-entropy/debian/changelog
index 3435c93..16cbe1d 100644
--- a/packages/cdebconf-entropy/debian/changelog
+++ b/packages/cdebconf-entropy/debian/changelog
@@ -13,6 +13,9 @@ cdebconf-entropy (0.7) UNRELEASED; urgency=low
   * The newt plugin now properly handle the "backup" capability: the "Go Back"
     button was previously always available.
   * Make cdebconf-newt-entropy "Provides" cdebconf-entropy.
+  * Add an entropy plugin for the GTK+ frontend, shipped in
+    cdebconf-gtk-entropy.  This adds a Build-Depends on
+    libgtk-directfb-2.0-dev.
 
  -- Jérémy Bobbio <lunar@debian.org>  Sun, 23 Mar 2008 20:28:57 +0100
 
diff --git a/packages/cdebconf-entropy/debian/control b/packages/cdebconf-entropy/debian/control
index 1807ed4..95c9609 100644
--- a/packages/cdebconf-entropy/debian/control
+++ b/packages/cdebconf-entropy/debian/control
@@ -3,7 +3,7 @@ Priority: extra
 Section: debian-installer
 Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
 Uploaders: Max Vozeler <xam@debian.org>
-Build-Depends: debhelper (>= 4.2), libnewt-dev, libtextwrap-dev, libdebconfclient0-dev (>> 0.123)
+Build-Depends: debhelper (>= 4.2), libnewt-dev, libtextwrap-dev, libdebconfclient0-dev (>> 0.123), libgtk-directfb-2.0-dev
 Standards-Version: 3.7.2
 Vcs-Svn: svn://svn.debian.org/d-i/trunk/packages/cdebconf-entropy
 
@@ -17,3 +17,14 @@ Description: cdebconf newt plugin for reading from /dev/random
  cdebconf plugin to facilitate reading random data from /dev/random.
  Asks the user to enter random characters on the keyboard and shows a
  progressbar with percent-of-data read.
+
+Package: cdebconf-gtk-entropy
+Architecture: any
+Section: debian-installer
+Depends: cdebconf-gtk-udeb, ${shlibs:Depends}
+Provides: cdebconf-entropy
+XC-Package-Type: udeb
+Description: cdebconf gtk plugin for reading from /dev/random
+ cdebconf plugin to facilitate reading random data from /dev/random.
+ Asks the user to enter random characters on the keyboard and random mouse
+ movements while a progressbar shows the amount of entropy already gathered.
diff --git a/packages/cdebconf-entropy/debian/po/POTFILES.in b/packages/cdebconf-entropy/debian/po/POTFILES.in
index af2b69d..1e9e7c3 100644
--- a/packages/cdebconf-entropy/debian/po/POTFILES.in
+++ b/packages/cdebconf-entropy/debian/po/POTFILES.in
@@ -1 +1,2 @@
 [type: gettext/rfc822deb] cdebconf-newt-entropy.templates
+[type: gettext/rfc822deb] cdebconf-gtk-entropy.templates
diff --git a/packages/cdebconf-entropy/gtk-plugin-entropy.c b/packages/cdebconf-entropy/gtk-plugin-entropy.c
new file mode 100644
index 0000000..64094d6
--- /dev/null
+++ b/packages/cdebconf-entropy/gtk-plugin-entropy.c
@@ -0,0 +1,363 @@
+/*
+ * cdebconf gtk plugin to get random data
+ *
+ * Copyright © 2008 Jérémy Bobbio <lunar@debian.org>
+ * See debian/copyright for license.
+ *
+ */
+
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include <cdebconf/frontend.h>
+#include <cdebconf/cdebconf_gtk.h>
+
+#include <gtk/gtk.h>
+
+#define MODULE "entropy"
+#define FIFO "/var/run/random.fifo"
+#define DEFAULT_KEYSIZE 2925
+
+/* Here's the plugin! */
+int cdebconf_gtk_handler_entropy(struct frontend * fe,
+                                 struct question * question,
+                                 GtkWidget * question_box);
+
+struct entropy {
+    struct frontend * fe;
+    GtkWidget * progress_bar;
+    GtkWidget * continue_button;
+    GtkWidget * entry;
+    guint64 keysize;
+    const char * fifo;
+    const char * success_template;
+    guint64 bytes_read;
+    int random_fd;
+    int fifo_fd;
+    guint8 random_byte;
+    GThread * gathering_thread;
+};
+
+static void handle_continue(GtkWidget * button, struct entropy * entropy_data)
+{
+    cdebconf_gtk_set_answer_ok(entropy_data->fe);
+}
+
+static gboolean add_help_text(struct entropy * entropy_data,
+                              GtkWidget * container)
+{
+    GtkWidget * label;
+    char * help_text;
+
+    help_text = cdebconf_gtk_get_text(
+        entropy_data->fe, "debconf/entropy/gtk/help",
+        "You can help speed up the process by entering random characters on "
+        "the keyboard or by moving the mouse randomly, or just wait until "
+        "enough keydata has been collected. (NOTE: this can take a long "
+        "time)");
+    label = gtk_label_new(help_text);
+    g_free(help_text);
+
+    gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
+    gtk_misc_set_alignment(GTK_MISC(label), 0 /* left */, 0 /* top */);
+    gtk_box_pack_start(GTK_BOX(container), label, FALSE /* no expand */,
+                       TRUE /* fill */, DEFAULT_PADDING);
+
+    return TRUE;
+}
+
+static gboolean add_action_text(struct entropy * entropy_data,
+                                GtkWidget * container)
+{
+    GtkWidget * label;
+    char * action_text;
+
+    action_text = cdebconf_gtk_get_text(
+        entropy_data->fe, "debconf/entropy/gtk/action",
+        "Enter random characters or random mouse movements");
+    label = gtk_label_new(action_text);
+    g_free(action_text);
+
+    gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
+    gtk_misc_set_alignment(GTK_MISC(label), 0 /* left */, 0 /* top */);
+    gtk_box_pack_start(GTK_BOX(container), label, FALSE /* no expand */,
+                       TRUE /* fill */, DEFAULT_PADDING);
+
+    return TRUE;
+}
+
+static GtkWidget * create_entropy_widget(struct entropy * entropy_data)
+{
+    GtkWidget * vbox;
+    GtkWidget * continue_button;
+    GtkWidget * progress_bar;
+    GtkWidget * entry;
+
+    continue_button = cdebconf_gtk_create_continue_button(entropy_data->fe);
+    if (NULL == continue_button) {
+        g_critical("cdebconf_gtk_create_continue_button failed.");
+        return NULL;
+    }
+    gtk_widget_set_sensitive(continue_button, FALSE);
+    g_signal_connect(continue_button, "clicked", G_CALLBACK(handle_continue),
+                     entropy_data);
+    g_object_ref(G_OBJECT(continue_button));
+    entropy_data->continue_button = continue_button;
+
+    vbox = gtk_vbox_new(FALSE /* not homogenous */, DEFAULT_PADDING);
+    if (NULL == vbox) {
+        g_critical("gtk_vbox_new failed.");
+        return NULL;
+    }
+
+    if (!add_help_text(entropy_data, vbox)) {
+        g_critical("add_help_text failed.");
+        return NULL;
+    }
+
+    if (NULL == (progress_bar = gtk_progress_bar_new())) {
+        g_critical("gtk_progress_bar_new failed.");
+        return NULL;
+    }
+    /* write a space to prepare progress bar height to receive the success
+     * confirmation at the end. */
+    gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progress_bar), " ");
+    gtk_box_pack_start(GTK_BOX(vbox), progress_bar, FALSE /* no expand */,
+                       FALSE /* no fill */, DEFAULT_PADDING);
+    g_object_ref(G_OBJECT(progress_bar));
+    entropy_data->progress_bar = progress_bar;
+
+    if (!add_action_text(entropy_data, vbox)) {
+        g_critical("add_action_text failed.");
+        return NULL;
+    }
+
+    entry = gtk_entry_new();
+    if (NULL == entry) {
+        g_critical("gtk_entry_new failed.");
+        return NULL;
+    }
+    gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE /* password style */);
+    gtk_entry_set_activates_default(GTK_ENTRY(entry),
+                                    TRUE /* activate on Enter */);
+    gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE /* no expand */,
+                       FALSE /* no fill */, DEFAULT_PADDING);
+    g_object_ref(G_OBJECT(entry));
+    entropy_data->entry = entry;
+
+    return vbox;
+}
+
+static void refresh_progress_bar(struct entropy * entropy_data)
+{
+    gdk_threads_enter();
+    gtk_progress_bar_set_fraction(
+        GTK_PROGRESS_BAR(entropy_data->progress_bar),
+        (gdouble) entropy_data->bytes_read /
+        (gdouble) entropy_data->keysize);
+    gdk_threads_leave();
+}
+
+static gboolean move_byte(struct entropy * entropy_data)
+{
+    gssize n;
+
+    n = read(entropy_data->random_fd, &entropy_data->random_byte,
+             sizeof (guint8));
+    if (1 > n) {
+        g_critical("read failed: %s", strerror(errno));
+        return FALSE;
+    }
+    n = write(entropy_data->fifo_fd, &entropy_data->random_byte,
+              sizeof (guint8));
+    if (1 > n) {
+        g_critical("write failed: %s", strerror(errno));
+        return FALSE;
+    }
+    entropy_data->random_byte = 0;
+    return TRUE;
+}
+
+static void allow_continue(struct entropy * entropy_data)
+{
+    gchar * label;
+
+    label = cdebconf_gtk_get_text(
+        entropy_data->fe, entropy_data->success_template,
+        "Enough entropy has been gathered.");
+    gtk_progress_bar_set_text(
+        GTK_PROGRESS_BAR(entropy_data->progress_bar), label);
+    g_free(label);
+    gtk_widget_set_sensitive(entropy_data->continue_button, TRUE);
+}
+
+static void * gather_entropy(struct entropy * entropy_data)
+{
+    while (entropy_data->bytes_read < entropy_data->keysize) {
+        if (DC_NO_ANSWER != cdebconf_gtk_get_answer(entropy_data->fe)) {
+            /* answer set by others, let's quit */
+            return NULL;
+        }
+        if (!move_byte(entropy_data)) {
+            cdebconf_gtk_set_answer_notok(entropy_data->fe);
+            return NULL;
+        }
+        entropy_data->bytes_read++;
+        refresh_progress_bar(entropy_data);
+    }
+    allow_continue(entropy_data);
+    return NULL /* no one cares */;
+}
+
+static void destroy_entropy(struct entropy * entropy_data)
+{
+    if (NULL != entropy_data->gathering_thread) {
+        (void) g_thread_join(entropy_data->gathering_thread);
+    }
+    if (0 < entropy_data->fifo_fd) {
+        (void) close(entropy_data->fifo_fd);
+    }
+    if (NULL != entropy_data->fifo) {
+        (void) unlink(entropy_data->fifo);
+    }
+    if (0 < entropy_data->random_fd) {
+        (void) close(entropy_data->random_fd);
+    }
+    (void) munlock(&entropy_data->random_byte, sizeof (guint8));
+    if (NULL != entropy_data->progress_bar) {
+        g_object_unref(G_OBJECT(entropy_data->progress_bar));
+    }
+    if (NULL != entropy_data->entry) {
+        g_object_unref(G_OBJECT(entropy_data->entry));
+    }
+    if (NULL != entropy_data->continue_button) {
+        g_object_unref(G_OBJECT(entropy_data->continue_button));
+    }
+    g_free(entropy_data);
+}
+
+static struct entropy * init_entropy(struct frontend * fe,
+                                     struct question * question)
+{
+    struct entropy * entropy_data;
+
+    if (NULL == (entropy_data = g_malloc0(sizeof (struct entropy)))) {
+        g_critical("g_malloc0 failed.");
+        return NULL;
+    }
+    entropy_data->fe = fe;
+    if (-1 == mlock(&entropy_data->random_byte, sizeof (guint8))) {
+        g_critical("mlock failed: %s", strerror(errno));
+        goto failed;
+    }
+    entropy_data->success_template = question_get_variable(
+        question, "SUCCESS");
+    if (NULL == entropy_data->success_template) {
+        entropy_data->success_template = "debconf/entropy/success";
+    }
+    entropy_data->random_fd = open("/dev/random", O_RDONLY);
+    if (-1 == entropy_data->random_fd) {
+        g_critical("open random_fd failed: %s", strerror(errno));
+        goto failed;
+    }
+    entropy_data->fifo = question_get_variable(question, "FIFO");
+    if (NULL == entropy_data->fifo) {
+        entropy_data->fifo = FIFO;
+    }
+    if (-1 == mkfifo(entropy_data->fifo, 0600)) {
+        g_critical("mkfifo failed: %s", strerror(errno));
+        goto failed;
+    }
+    entropy_data->fifo_fd = open(entropy_data->fifo, O_WRONLY);
+    if (-1 == entropy_data->fifo_fd) {
+        g_critical("open fifo_fd failed: %s", strerror(errno));
+        goto failed;
+    }
+    return entropy_data;
+
+failed:
+    destroy_entropy(entropy_data);
+    return NULL;
+}
+
+static void cleanup(struct question * question, struct entropy * entropy_data)
+{
+    destroy_entropy(entropy_data);
+}
+
+static gboolean set_keysize(struct entropy * entropy_data,
+                            struct question * question) {
+    const char * keysize_string;
+
+    keysize_string = question_get_variable(question, "KEYSIZE");
+    if (NULL == keysize_string) {
+        entropy_data->keysize = DEFAULT_KEYSIZE;
+        return TRUE;
+    }
+    entropy_data->keysize = g_ascii_strtoull(
+        keysize_string, NULL /* don't get last parsed byte */,
+        0 /* default base */);
+    if (G_MAXUINT64 == entropy_data->keysize) {
+        g_critical("keysize out of range");
+        return FALSE;
+    }
+    if (0 == entropy_data->keysize) {
+        g_critical("can't parse KEYSIZE");
+        return FALSE;
+    }
+    return TRUE;
+}
+
+int cdebconf_gtk_handler_entropy(struct frontend * fe,
+                                 struct question * question,
+                                 GtkWidget * question_box)
+{
+    struct entropy * entropy_data;
+    GtkWidget * widget;
+
+    if (!IS_QUESTION_SINGLE(question)) {
+        g_critical("entropy plugin does not work alongside other questions.");
+        return DC_NOTOK;
+    }
+    if (NULL == (entropy_data = init_entropy(fe, question))) {
+        g_critical("init_entropy failed.");
+        return DC_NOTOK;
+    }
+    if (!set_keysize(entropy_data, question)) {
+        g_critical("set_keysize failed.");
+        goto failed;
+    }
+    if (NULL == (widget = create_entropy_widget(entropy_data))) {
+        g_critical("create_widget failed.");
+        goto failed;
+    }
+
+    entropy_data->gathering_thread = g_thread_create(
+        (GThreadFunc) gather_entropy, entropy_data,
+        TRUE /* joinable */, NULL /* no gerror */);
+    if (NULL == entropy_data->gathering_thread) {
+        g_critical("g_thread_create failed.");
+        goto failed;
+    }
+
+    cdebconf_gtk_add_common_layout(fe, question, question_box, widget);
+
+    gtk_widget_grab_focus(entropy_data->entry);
+
+    cdebconf_gtk_register_setter(fe, SETTER_FUNCTION(cleanup), question,
+                                 entropy_data);
+
+    return DC_OK;
+
+failed:
+    destroy_entropy(entropy_data);
+    return DC_NOTOK;
+}
+
+/* vim: et sw=4 si
+ */

commit f15a77d2e51de567609a0a1b0104b202b25ee830
Author: Jérémy Bobbio <lunar@debian.org>
Date:   Sun Mar 30 03:14:08 2008 +0000

    Add entropy plugin for the text frontend
---
 packages/cdebconf-entropy/Makefile.in              |    3 +
 packages/cdebconf-entropy/configure.ac             |    2 +
 .../debian/cdebconf-text-entropy.install           |    1 +
 .../debian/cdebconf-text-entropy.templates         |   14 +
 packages/cdebconf-entropy/debian/changelog         |    3 +
 packages/cdebconf-entropy/debian/control           |   11 +
 packages/cdebconf-entropy/text-plugin-entropy.c    |  318 ++++++++++++++++++++
 7 files changed, 352 insertions(+), 0 deletions(-)

diff --git a/packages/cdebconf-entropy/Makefile.in b/packages/cdebconf-entropy/Makefile.in
index c02b298..5eb05fc 100644
--- a/packages/cdebconf-entropy/Makefile.in
+++ b/packages/cdebconf-entropy/Makefile.in
@@ -26,6 +26,9 @@ install: $(PLUGIN_MODULES)
 		install -m644 $$p $(DESTDIR)/$(moddir)/$${p%%-*}/$${p#*-} ; \
 	done
 
+text-plugin-$(PACKAGE).so: text-plugin-$(PACKAGE).opic
+	$(CC) $(LDFLAGS) -shared -o $@ text-plugin-$(PACKAGE).opic
+
 newt-plugin-$(PACKAGE).so: newt-plugin-$(PACKAGE).opic
 	$(CC) $(LDFLAGS) -shared -lnewt -ltextwrap -o $@ newt-plugin-$(PACKAGE).opic
 
diff --git a/packages/cdebconf-entropy/configure.ac b/packages/cdebconf-entropy/configure.ac
index 1e5695b..26adf25 100644
--- a/packages/cdebconf-entropy/configure.ac
+++ b/packages/cdebconf-entropy/configure.ac
@@ -13,6 +13,8 @@ if test "$with_debug" == "yes"; then
   CFLAGS="$CFLAGS -g -D_DEBUG_"
 fi
 
+FRONTENDS="text"
+
 AC_CHECK_LIB(newt, newtInit, FRONTENDS="$FRONTENDS newt", echo
  "*** Cannot build Newt plugin ***")
 
diff --git a/packages/cdebconf-entropy/debian/cdebconf-text-entropy.install b/packages/cdebconf-entropy/debian/cdebconf-text-entropy.install
new file mode 100644
index 0000000..400ba91
--- /dev/null
+++ b/packages/cdebconf-entropy/debian/cdebconf-text-entropy.install
@@ -0,0 +1 @@
+usr/lib/cdebconf/frontend/text
diff --git a/packages/cdebconf-entropy/debian/cdebconf-text-entropy.templates b/packages/cdebconf-entropy/debian/cdebconf-text-entropy.templates
new file mode 100644
index 0000000..17ef2e3
--- /dev/null
+++ b/packages/cdebconf-entropy/debian/cdebconf-text-entropy.templates
@@ -0,0 +1,14 @@
+Template: debconf/entropy/text/action
+Type: text
+# :sl3:
+_Description: Enter random characters
+
+Template: debconf/entropy/text/help
+Type: text
+# :sl3:
+_Description: You can help speed up the process by entering random characters on the keyboard, or just wait until enough keydata has been collected. (NOTE: this can take a long time)
+
+Template: debconf/entropy/success
+Type: text
+# :sl5:
+_Description: Enough entropy has been gathered.
diff --git a/packages/cdebconf-entropy/debian/changelog b/packages/cdebconf-entropy/debian/changelog
index 16cbe1d..ffd98f0 100644
--- a/packages/cdebconf-entropy/debian/changelog
+++ b/packages/cdebconf-entropy/debian/changelog
@@ -16,6 +16,9 @@ cdebconf-entropy (0.7) UNRELEASED; urgency=low
   * Add an entropy plugin for the GTK+ frontend, shipped in
     cdebconf-gtk-entropy.  This adds a Build-Depends on
     libgtk-directfb-2.0-dev.
+  * Add an entropy plugin for the text frontend, shipped in
+    cdebconf-text-entropy.
+  (Closes: #381896)
 
  -- Jérémy Bobbio <lunar@debian.org>  Sun, 23 Mar 2008 20:28:57 +0100
 
diff --git a/packages/cdebconf-entropy/debian/control b/packages/cdebconf-entropy/debian/control
index 95c9609..93d2a36 100644
--- a/packages/cdebconf-entropy/debian/control
+++ b/packages/cdebconf-entropy/debian/control
@@ -7,6 +7,17 @@ Build-Depends: debhelper (>= 4.2), libnewt-dev, libtextwrap-dev, libdebconfclien
 Standards-Version: 3.7.2
 Vcs-Svn: svn://svn.debian.org/d-i/trunk/packages/cdebconf-entropy
 
+Package: cdebconf-text-entropy
+Architecture: any
+Section: debian-installer
+Depends: cdebconf-text-udeb, ${shlibs:Depends}
+Provides: cdebconf-entropy
+XC-Package-Type: udeb
+Description: cdebconf text plugin for reading from /dev/random
+ cdebconf plugin to facilitate reading random data from /dev/random.
+ Asks the user to enter random characters on the keyboard and shows a
+ progressbar with percent-of-data read.
+
 Package: cdebconf-newt-entropy
 Architecture: any
 Section: debian-installer
diff --git a/packages/cdebconf-entropy/text-plugin-entropy.c b/packages/cdebconf-entropy/text-plugin-entropy.c
new file mode 100644
index 0000000..917efb1
--- /dev/null
+++ b/packages/cdebconf-entropy/text-plugin-entropy.c
@@ -0,0 +1,318 @@
+/*
+ * cdebconf newt plugin to get random data
+ *
+ * Copyright © 2008 by Jérémy Bobbio <lunar@debian.org>
+ * See debian/copyright
+ *
+ */ 
+
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <sys/ioctl.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <limits.h>
+#include <syslog.h>
+#include <errno.h>
+#include <termios.h>
+
+#include <cdebconf/frontend.h>
+#include <cdebconf/question.h>
+
+/* XXX: from cdebconf/strutl.c ; should not be defined like that */
+extern int strtruncate (char * what, size_t maxsize);
+extern size_t strwidth (const char * what);
+extern int strwrap(const char * str, const int width, char * lines[],
+                   int maxlines);
+
+
+#define MODULE "entropy"
+#define FIFO "/var/run/random.fifo"
+#define DEFAULT_KEYSIZE 2925
+
+/* XXX: both should be exported by text frontend. */
+#define error(fmt, args...) syslog(LOG_ERR, MODULE ": " fmt, ##args)
+#define CHAR_GOBACK '<'
+
+int cdebconf_text_handler_entropy(struct frontend * fe,
+                                  struct question * question);
+
+struct entropy {
+    struct frontend * fe;
+    struct question * question;
+    long keysize;
+    long bytes_read;
+    const char * fifo;
+    const char * success_template;
+    int random_fd;
+    int fifo_fd;
+    char random_byte;
+    int is_backing_up;
+};
+
+static void destroy_entropy(struct entropy * entropy_data)
+{
+    if (0 < entropy_data->fifo_fd) {
+        (void) close(entropy_data->fifo_fd);
+    }
+    if (NULL != entropy_data->fifo) {
+        (void) unlink(entropy_data->fifo);
+    }
+    if (0 < entropy_data->random_fd) {
+        (void) close(entropy_data->random_fd);
+    }
+    (void) munlock(&entropy_data->random_byte, sizeof (char));
+    free(entropy_data);
+}
+
+static int move_byte(struct entropy * entropy_data)
+{
+    size_t n;
+
+    n = read(entropy_data->random_fd, &entropy_data->random_byte,
+             sizeof (char));
+    if (1 > n) {
+        error("read failed: %s", strerror(errno));
+        return DC_NOTOK;
+    }
+    n = write(entropy_data->fifo_fd, &entropy_data->random_byte,
+              sizeof (char));
+    if (1 > n) {
+        error("write failed: %s", strerror(errno));
+        return DC_NOTOK;
+    }
+    entropy_data->random_byte = 0;
+    return DC_OK;
+}
+
+static int set_keysize(struct entropy * entropy_data,
+                       struct question * question) {
+    const char * keysize_string;
+
+    keysize_string = question_get_variable(question, "KEYSIZE");
+    if (NULL == keysize_string) {
+        entropy_data->keysize = DEFAULT_KEYSIZE;
+        return DC_OK;
+    }
+    entropy_data->keysize = strtol(keysize_string, NULL, 10);
+    if (0 >= entropy_data->keysize || LONG_MAX == entropy_data->keysize) {
+        error("keysize out of range");
+        return DC_NOTOK;
+    }
+    return DC_OK;
+}
+
+static struct entropy * init_entropy(struct frontend * fe,
+                                     struct question * question)
+{
+    struct entropy * entropy_data;
+
+    if (NULL == (entropy_data = malloc(sizeof (struct entropy)))) {
+        error("malloc failed.");
+        return NULL;
+    }
+    memset(entropy_data, 0, sizeof (struct entropy));
+    entropy_data->fe = fe;
+    entropy_data->question = question;
+    if (-1 == mlock(&entropy_data->random_byte, sizeof (char))) {
+        error("mlock failed: %s", strerror(errno));
+        goto failed;
+    }
+    entropy_data->success_template = question_get_variable(
+        question, "SUCCESS");
+    if (NULL == entropy_data->success_template) {
+        entropy_data->success_template = "debconf/entropy/success";
+    }
+    entropy_data->random_fd = open("/dev/random", O_RDONLY);
+    if (-1 == entropy_data->random_fd) {
+        error("open random_fd failed: %s", strerror(errno));
+        goto failed;
+    }
+    entropy_data->fifo = question_get_variable(question, "FIFO");
+    if (NULL == entropy_data->fifo) {
+        entropy_data->fifo = FIFO;
+    }
+    if (-1 == mkfifo(entropy_data->fifo, 0600)) {
+        error("mkfifo failed: %s", strerror(errno));
+        goto failed;
+    }
+    entropy_data->fifo_fd = open(entropy_data->fifo, O_WRONLY);
+    if (-1 == entropy_data->fifo_fd) {
+        error("open fifo_fd failed: %s", strerror(errno));
+        goto failed;
+    }
+    return entropy_data;
+
+failed:
+    destroy_entropy(entropy_data);
+    return NULL;
+
+}
+
+/* XXX: Should be exported by text frontend. */
+static int getwidth(void)
+{
+    static int res = 80;
+    static int inited = DC_NOTOK;
+    int fd;
+    struct winsize ws;
+
+    if (inited == DC_NOTOK) {
+        inited = DC_OK;
+        if (0 < (fd = open("/dev/tty", O_RDONLY))) {
+            if (0 == ioctl(fd, TIOCGWINSZ, &ws) && 0 < ws.ws_col)
+                res = ws.ws_col;
+            close(fd);
+        }
+    }
+    return res;
+}
+
+/* XXX: Should be exported by text frontend. */
+static void wrap_print(const char *str)
+{
+    int i;
+    int line_count;
+    char * lines[500];
+
+    line_count = strwrap(str, getwidth() - 1, lines, 499);
+
+    for (i = 0; i < line_count; i++) {
+        printf("%s\n", lines[i]);
+        free(lines[i]);
+    }
+}
+
+static void print_action(struct entropy * entropy_data)
+{
+    printf("%s: ",
+        question_get_text(entropy_data->fe, "debconf/entropy/text/action",
+                          "Enter random characters"));
+}
+
+static void print_help(struct entropy * entropy_data)
+{
+    wrap_print(question_get_text(
+        entropy_data->fe, "debconf/entropy/text/help",
+        "You can help speed up the process by entering random characters on "
+        "the keyboard, or just wait until enough keydata has been collected. "
+        "(NOTE: this can take a long time)"));
+    printf("\n");
+}
+
+static void print_success(struct entropy * entropy_data)
+{
+    wrap_print(question_get_text(
+        entropy_data->fe, entropy_data->success_template,
+        "Enough entropy has been gathered."));
+    printf("\n");
+}
+
+static void print_progress(struct entropy * entropy_data)
+{
+    unsigned int progress;
+
+    progress = (double) (entropy_data->bytes_read) /
+               (double) (entropy_data->keysize) * 100.0;
+    if (0 == (progress % 10)) {
+        printf("\n---> %d%%\n", progress);
+        if (100 == progress) {
+            print_success(entropy_data);
+        } else {
+            print_action(entropy_data);
+        }
+    }
+}
+
+static int handle_input(struct entropy * entropy_data)
+{
+    int c;
+
+    c = fgetc(stdin);
+    if (entropy_data->fe->methods.can_go_back(entropy_data->fe,
+                                              entropy_data->question)) {
+        if (CHAR_GOBACK == c) {
+            entropy_data->is_backing_up = DC_OK;
+        } else if (('\n' == c || '\r' == c) && entropy_data->is_backing_up) {
+            return DC_GOBACK;
+        } else {
+            entropy_data->is_backing_up = DC_NOTOK;
+        }
+    }
+    return DC_OK;
+}
+
+static void wait_enter(void) {
+    int c;
+
+    do {
+        c = fgetc(stdin);
+    } while ('\n' != c && '\r' != c);
+}
+
+static int gather_entropy(struct entropy * entropy_data)
+{
+    struct termios oldt;
+    struct termios newt;
+    fd_set fds;
+
+    print_progress(entropy_data);
+
+    tcgetattr(0, &oldt);
+    memcpy(&newt, &oldt, sizeof (struct termios));
+    cfmakeraw(&newt);
+    while (entropy_data->bytes_read < entropy_data->keysize) {
+        tcsetattr(0, TCSANOW, &newt);
+        FD_ZERO(&fds);
+        FD_SET(0, &fds);
+        FD_SET(entropy_data->random_fd, &fds);
+        if (-1 == select(entropy_data->random_fd + 1/* highest fd */,
+                         &fds, NULL /* no write fds */,
+                         NULL /* no except fds */, NULL /* no timeout */)) {
+            error("select failed: %s", strerror(errno));
+            return DC_NOTOK;
+        }
+        if (FD_ISSET(STDIN_FILENO, &fds)) {
+            if (DC_GOBACK == handle_input(entropy_data)) {
+                tcsetattr(0, TCSANOW, &oldt);
+                return DC_GOBACK;
+            }
+            fputc('*', stdout);
+        }
+        tcsetattr(0, TCSANOW, &oldt);
+        if (FD_ISSET(entropy_data->random_fd, &fds)) {
+            move_byte(entropy_data);
+            entropy_data->bytes_read++;
+            print_progress(entropy_data);
+        }
+    }
+    wait_enter();
+    return DC_OK;
+}
+
+int cdebconf_text_handler_entropy(struct frontend * fe,
+                                  struct question * question)
+{
+    struct entropy * entropy_data;
+    int ret;
+
+    if (NULL == (entropy_data = init_entropy(fe, question))) {
+        error("init_entropy falied.");
+        return DC_NOTOK;
+    }
+    if (!set_keysize(entropy_data, question)) {
+        error("set_keysize failed.");
+        ret = DC_NOTOK;
+        goto out;
+    }
+    print_help(entropy_data);
+    ret = gather_entropy(entropy_data);
+
+out:
+    destroy_entropy(entropy_data);
+    return ret;
+}

commit f5df9f15b0dd3fde38057702d7779aff65b77b0a
Author: Jérémy Bobbio <lunar@debian.org>
Date:   Sun Mar 23 14:10:28 2008 +0000

    Add a test suite for the entropy plugin
---
 packages/cdebconf/src/test/entropy.config    |   34 ++++++++++++++++++++++++++
 packages/cdebconf/src/test/entropy.templates |   23 +++++++++++++++++
 2 files changed, 57 insertions(+), 0 deletions(-)

diff --git a/packages/cdebconf/src/test/entropy.config b/packages/cdebconf/src/test/entropy.config
new file mode 100755
index 0000000..fa8e641
--- /dev/null
+++ b/packages/cdebconf/src/test/entropy.config
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+randfifo=/tmp/random.fifo
+
+empty_fifo() {
+        while [ ! -p $randfifo ]; do
+                sleep 1
+        done
+        cat $randfifo >/dev/null
+}
+
+. ../client/confmodule
+
+db_capb backup
+echo "capb: $RET"
+if ! echo "$RET" | grep -w plugin-entropy; then
+        echo "entropy plugin not available"
+        exit 1
+fi
+
+empty_fifo & PID=$!
+
+db_subst test/entropy DEVICE /dev/sda1
+db_subst test/entropy FIFO $randfifo
+db_subst test/entropy SUCCESS test/success
+db_subst test/entropy KEYSIZE 128
+db_fset test/entropy seen false
+db_input high test/entropy
+db_go
+
+echo "$RET"
+
+kill $PID
+rm -f $randfifo
diff --git a/packages/cdebconf/src/test/entropy.templates b/packages/cdebconf/src/test/entropy.templates
new file mode 100644
index 0000000..c3a97f5
--- /dev/null
+++ b/packages/cdebconf/src/test/entropy.templates
@@ -0,0 +1,23 @@
+Template: test/entropy
+Type: entropy
+Description: The encryption key for ${DEVICE} is now being created.
+
+Template: test/success
+Type: text
+Description: Key data has been created successfully!
+
+Template: debconf/entropy/text/action
+Type: text
+Description: Enter random characters
+
+Template: debconf/entropy/text/help
+Type: text
+Description: You can help speed up the process by entering random characters on the keyboard, or just wait until enough keydata has been collected. (NOTE: this can take a long time)
+
+Template: debconf/entropy/gtk/action
+Type: text
+Description: Enter random characters or random mouse mouvements
+
+Template: debconf/entropy/gtk/help
+Type: text
+Description: You can help speed up the process by entering random characters on the keyboard or by moving the mouse randomly, or just wait until enough keydata has been collected. (NOTE: this can take a long time)

commit 4b38082414b0b94847f770ad5c0dc5f828de957f
Author: Jérémy Bobbio <lunar@debian.org>
Date:   Sun Mar 23 21:53:26 2008 +0100

    Normalize case indentation in crypto-base.sh
---
 packages/partman/partman-crypto/lib/crypto-base.sh |   36 ++++++++++----------
 1 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/packages/partman/partman-crypto/lib/crypto-base.sh b/packages/partman/partman-crypto/lib/crypto-base.sh
index 800b1a2..bff76aa 100644
--- a/packages/partman/partman-crypto/lib/crypto-base.sh
+++ b/packages/partman/partman-crypto/lib/crypto-base.sh
@@ -60,16 +60,16 @@ swap_is_safe () {
 
 	for swap in $(cat /proc/swaps); do
 		case $swap in
-		Filename*)
+		    Filename*)
 			continue
 			;;
-		/dev/loop*)
+		    /dev/loop*)
 			loop_is_safe ${swap%% *} || return 1
 			;;
-		/dev/mapper/*)
+		    /dev/mapper/*)
 			dm_is_safe ${swap%% *} || return 1
 			;;
-		*)
+		    *)
 			# Presume not safe
 			return 1
 			;;
@@ -119,11 +119,11 @@ setup_loopaes () {
 	[ -x /sbin/losetup-aes ] || return 1
 
 	case $keytype in
-	keyfile)
+	    keyfile)
 		opts="-K $keyfile"
 		pass="$keyfile.pass"
 		;;
-	random)
+	    random)
 		opts="-H random"
 		pass="/dev/null"
 		;;
@@ -206,7 +206,7 @@ setup_cryptdev () {
 	done
 
 	case $type in
-	dm-crypt)
+	    dm-crypt)
 		cryptdev=$(mapdevfs $realdev)
 		cryptdev="${cryptdev##*/}_crypt"
 		if [ -b "/dev/mapper/$cryptdev" ]; then
@@ -225,7 +225,7 @@ setup_cryptdev () {
 		cryptdev="/dev/mapper/$cryptdev"
 		;;
 
-	loop-AES)
+	    loop-AES)
 		cryptdev=$(get_free_loop);
 		if [ -z "$cryptdev" ]; then
 			return 1
@@ -549,14 +549,14 @@ crypto_set_defaults () {
 	[ -d $part ] || return 1
 
 	case $type in
-	dm-crypt)
+	    dm-crypt)
 		echo aes > $part/cipher
 		echo 256 > $part/keysize
 		echo cbc-essiv:sha256 > $part/ivalgorithm
 		echo passphrase > $part/keytype
 		echo sha256 > $part/keyhash
 		;;
-	loop-AES)
+	    loop-AES)
 		echo AES256 > $part/cipher
 		echo keyfile > $part/keytype
 		rm -f $part/keysize
@@ -576,13 +576,13 @@ crypto_prepare_method () {
 
 	[ -d $part ] || return 1
 	case $type in
-	dm-crypt)
+	    dm-crypt)
 		package="partman-crypto-dm"
 		;;
-	loop-AES)
+	    loop-AES)
 		package="partman-crypto-loop"
 		;;
-	*)
+	    *)
 		return 1
 		;;
 	esac
@@ -608,13 +608,13 @@ crypto_check_required_tools() {
 
 	tools="blockdev-keygen"
 	case $1 in
-	dm-crypt)
+	    dm-crypt)
 		tools="$tools dmsetup cryptsetup"
 		;;
-	loop-AES)
+	    loop-AES)
 		tools="$tools gpg base64"
 		;;
-	*)
+	    *)
 		return 1
 	esac
 
@@ -635,10 +635,10 @@ crypto_check_required_options() {
 	type=$2
 
 	case $type in
-	dm-crypt)
+	    dm-crypt)
 		options="cipher keytype keyhash ivalgorithm keysize"
 		;;
-	loop-AES)
+	    loop-AES)
 		options="cipher keytype"
 		;;
 	esac

commit 01aa34ef0ed770672c14c3a032659fdae9617a0f
Author: Jérémy Bobbio <lunar@debian.org>
Date:   Sun Mar 23 14:26:45 2008 +0000

    Update partman-crypto for the new cdebconf-entropy usage
    
    This changes require cdebconf-entropy (>= 0.7).
    
    partman-crypto-dm and parman-crypto-loop now depend on the virtual
    cdebconf-entropy instead of cdebconf-newt-entropy to be independant of the
    frontend used.  The package with the relevant plugin is loaded dynamically
    in crypto_prepare_method.
    
    partman-crypto/entropy-success is a new template which will be be
    displayed when enough entropy has been gathered.
    
    The "entropy" question type is used instead of "entropy-text".
    
    The FIFO and SUCCESS variables are properly substituted before displaying
    partman-crypto/entropy.
---
 packages/partman/partman-crypto/blockdev-keygen    |   12 +++++++-----
 packages/partman/partman-crypto/debian/changelog   |   13 +++++++++++++
 packages/partman/partman-crypto/debian/control     |    4 ++--
 .../partman-crypto/debian/partman-crypto.templates |   16 ++++++++--------
 packages/partman/partman-crypto/lib/crypto-base.sh |    5 +++--
 5 files changed, 33 insertions(+), 17 deletions(-)

diff --git a/packages/partman/partman-crypto/blockdev-keygen b/packages/partman/partman-crypto/blockdev-keygen
index d023ff4..3d727f6 100755
--- a/packages/partman/partman-crypto/blockdev-keygen
+++ b/packages/partman/partman-crypto/blockdev-keygen
@@ -95,30 +95,32 @@ have_entropy_plugin () {
 	db_capb
 	set -- $RET
 	for cap; do
-		if [ "$cap" = plugin-entropy-text ]; then
+		if [ "$cap" = plugin-entropy ]; then
 			return 0
 		fi
 	done
 	return 1
 }
 
+# Fifo provided by cdebconf-entropy plugins
+randfifo=/var/run/random.fifo
+
 call_entropy_plugin () {
 	local keybytes
 	keybytes=$1
 
-	templ=partman-crypto/entropy-text
+	templ=partman-crypto/entropy
 	db_fset $templ seen false
 	db_subst $templ DEVICE "$description"
+	db_subst $templ FIFO $randfifo
 	db_subst $templ KEYSIZE "$keybytes"
+	db_subst $templ SUCCESS partman-crypto/entropy-success
 	db_input critical $templ
 	db_go || return 1
 
 	return 0
 }
 
-# Fifo provided by cdebconf-entropy plugins
-randfifo=/var/run/random.fifo
-
 gnupg_encrypt () {
 	local keyfile passfifo gpgopts
 	keyfile=$1
diff --git a/packages/partman/partman-crypto/debian/changelog b/packages/partman/partman-crypto/debian/changelog
index 8c6f31e..be5042c 100644
--- a/packages/partman/partman-crypto/debian/changelog
+++ b/packages/partman/partman-crypto/debian/changelog
@@ -1,3 +1,16 @@
+partman-crypto (29) UNRELEASED; urgency=low
+
+  * Make partman-crypto-dm and parman-crypto-loop depends on the virtual
+    cdebconf-entropy instead of cdebconf-newt-entropy to be independant of the
+    frontend used.  Requires cdebconf-entropy (>= 0.7).
+  * Add partman-crypto/entropy-success template which will be be displayed
+    when enough entropy has been gathered.
+  * Use the "entropy" question type instead of "entropy-text".
+  * Substitute FIFO and SUCCESS variables before displaying
+    partman-crypto/entropy.
+
+ -- Jérémy Bobbio <lunar@debian.org>  Sun, 23 Mar 2008 14:22:31 +0000
+
 partman-crypto (28) unstable; urgency=low
 
   [ Max Vozeler ]
diff --git a/packages/partman/partman-crypto/debian/control b/packages/partman/partman-crypto/debian/control
index 3c3faa6..9340582 100644
--- a/packages/partman/partman-crypto/debian/control
+++ b/packages/partman/partman-crypto/debian/control
@@ -15,11 +15,11 @@ Description: Add to partman support for block device encryption
 Package: partman-crypto-dm
 XC-Package-Type: udeb
 Architecture: all
-Depends: partman-crypto, crypto-modules, cryptsetup-udeb, cdebconf-newt-entropy (>= 0.3)
+Depends: partman-crypto, crypto-modules, cryptsetup-udeb, cdebconf-entropy
 Description: Add to partman support for dm-crypt encryption
 
 Package: partman-crypto-loop
 XC-Package-Type: udeb
 Architecture: all
-Depends: partman-crypto, loop-aes-modules, mount-aes-udeb, gnupg-udeb, cdebconf-newt-entropy (>= 0.3)
+Depends: partman-crypto, loop-aes-modules, mount-aes-udeb, gnupg-udeb, cdebconf-entropy
 Description: Add to partman support for loop-AES encryption
diff --git a/packages/partman/partman-crypto/debian/partman-crypto.templates b/packages/partman/partman-crypto/debian/partman-crypto.templates
index 022f121..9fc32c6 100644
--- a/packages/partman/partman-crypto/debian/partman-crypto.templates
+++ b/packages/partman/partman-crypto/debian/partman-crypto.templates
@@ -353,15 +353,15 @@ _Description: Use weak passphrase?
  You entered a passphrase that consists of less than ${MINIMUM} characters,
  which is considered too weak. You should choose a stronger passphrase.
 
-Template: partman-crypto/entropy-text
-Type: entropy-text
+Template: partman-crypto/entropy
+Type: entropy
 # :sl3:
-_Description: Enter random characters
- The encryption key for ${DEVICE} is now being created.
- .
- You can help speed up the process by entering random characters on
- the keyboard, or just wait until enough keydata has been collected.
- (NOTE: this can take a long time)
+_Description: The encryption key for ${DEVICE} is now being created.
+
+Template: partman-crypto/entropy-success
+Type: text
+# :sl3:
+_Description: Key data has been created successfully.
 
 Template: partman-crypto/keyfile-problem
 Type: error
diff --git a/packages/partman/partman-crypto/lib/crypto-base.sh b/packages/partman/partman-crypto/lib/crypto-base.sh
index bff76aa..c33cd1f 100644
--- a/packages/partman/partman-crypto/lib/crypto-base.sh
+++ b/packages/partman/partman-crypto/lib/crypto-base.sh
@@ -575,12 +575,13 @@ crypto_prepare_method () {
 	package=''
 
 	[ -d $part ] || return 1
+        package="cdebconf-$DEBIAN_FRONTEND-entropy"
 	case $type in
 	    dm-crypt)
-		package="partman-crypto-dm"
+		package="$package partman-crypto-dm"
 		;;
 	    loop-AES)
-		package="partman-crypto-loop"
+		package="$package partman-crypto-loop"
 		;;
 	    *)
 		return 1

Attachment: signature.asc
Description: Digital signature


Reply to: