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

Re: Preseeing w/o asking a question



On Thursday 08 Sep 2005 18:23, Joey Hess wrote:
> > It was a single line, but a big(ish) one (77 characters, iirc).  I've
> > reduced its size (52 characters, now) and it seems to be working.  Is
> > there some limit to the size of a string?
>
> It's possible to run into some limits once the string is 20000 character
> long or so (ARG_MAX), but it's more likely that your first command
> exited nonzero and your truncated one succeeds.

Nope, this is all a red-herring.

The real problem was that base-config/late_command is sensitive to cwd after 
the script exits.  As an illustration, try:
    base-config     base-config/late_command string  cd /tmp
For me, this is sufficient to stall the installer.

There's a trivial patch to base-config below that should fix the problem (but 
I haven't tested it :^).  Alternatively, one could eval the $PRESEED_COMMAND 
within a new shell for better protection (rather than in base-config's 
shell).

Meanwhile, being careful to make sure the script ends with the same cwd as it 
starts is a work-around.

Cheers,

Paul.


--- lib/menu/finish-orig        2005-09-09 11:36:30.892331830 +0100
+++ lib/menu/finish     2005-09-09 11:35:39.678301614 +0100
@@ -30,8 +30,10 @@
        # See if there is a preseeded command. If so, run it.
        PRESEED_COMMAND=$($0 get_preseed_command 4>&1 || true)
        if [ -n "$PRESEED_COMMAND" ]; then
+               curdir=$(pwd)
                # TODO error handling (needs error dialog)
                eval $PRESEED_COMMAND || true
+               cd $(curdir)
        fi

        DMS=""

Attachment: pgpvBS76mBftX.pgp
Description: PGP signature


Reply to: