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

Re: Including git commands in preseed



Todd Maurice wrote:
> "d-i preseed/late_command string wget -O/target/var/tmp/bootstrap http://file; in-target sh /var/tmp/bootstrap"

The example I gave was verbatim what I am using and is what works for me.

The above uses a different URL and one that doesn't look valid to
me.  Is that a literal "http://file"; there?  That isn't a valid URL
even for an local network.

> Error 127. I believe the problem is that wget needs in-target, as in "wget in -target -O". I'm doing this on Jessie.

"in-target" is for the late_command part not the wget part.  The wget
is in the debian-installer environment and so will work from the
initrd boot.

You could run wget from the target environment.  You would need to add
wget to the installation package list so as to ensure that it is
installed in your target system.  Otherwise I think it isn't installed
by default.  Not sure.

Regardless "wget in -target -O" isn't a valid set of options for wget.
As far as wget is concerned it is only running, reading from the
network, writing to the file designated by -O.  That write path file
name will either be /target/somethingsomething for a d-i initrd
environment installation, or it will be -O/somethingsomething without
the /target part if it is operating inside the chroot target.

> "d-i preseed/late_command string in-target wget -O /var/tmp/bootstrap http://file; in-target sh /var/tmp/bootstrap"
> Stops (hangs, freezes, does not continue) at 16% during the preseed part of the installation (script is 1kb and I left the install process running at 16% for an hour).

Note that a script error in the late_command can hang things.  Since
it hung there I can only assume that it is waiting for something.
Such as a command waiting to read stdin.  (The first thought that came
to mind was a grep that was reading stdin because I have seen that
several times before.  But only you know what is in your script.)

> "d-i preseed/late_command string in-target wget -O /var/tmp/bootstrap http://file;";
> Downloads the file but does not start it automatically (logical regarding the command).

Great.  If that works then wget is definitely already getting
installed in your target environment.  And somehow "http://file"; is
working for you by some method I can't fathom.

> "d-i preseed/late_command string in-target wget -O /var/tmp/bootstrap http://file; sh /var/tmp/bootstrap;"
> Works if I write it in terminal (wget part, after installation of course) but as part of the preseed, it says "failed with exit code 2". Logical since "in-target" is missing

I believe the in-target stops at the ';' and therefore you need a
second one after that before the "sh" command.

> "d-i preseed/late_command string in-target wget -O etc/postInstall.sh http://file;chmod 700 /target/etc/postInstall.sh"
> Downloads the file but does not start it automatically.
> 
> "d-i preseed/late_command string in-target wget -O root/script.sh https://raw.github.com/drgdel/test/master/test; chmod 700 /target/root/script.sh; in-target sh /root/script.sh"
> Stops (hangs, freezes, does not continue) at 16% during the preseed part of the installation (script is 1kb and I left the install process running at 16% for an hour).

Reinforces that there is a hang in the script.

> "d-i preseed/late_command string wget -O /target/root/late_command.sh  https://raw.github.com/drgdel/test/master/test; \
> in-target chmod 755 /root/late_command.sh; in-target /root/late_command.sh"
> Error 127.
> 
> I'm open any new suggestions that would enable me to wget the script and then make it run automatically as I login.

Make your script extremely simple for the test.  Just to verify that
it is running.  Then make it more complex as needed one step at a
time.  Along the way you will find out what is causing the hang.

At the top of the script I would redirect all output to a log file
that you can examine later.  I would redirect input from /dev/null so
that it won't hang waiting for keyboard input.

  #!/bin/sh
  exec </dev/null >/var/tmp/bootstrap.out 2>&1
  echo "Begin script"
  dostuffhere
  echo "End script"
  exit 0

I think it likely that simply redirecting all input from /dev/null
will cause the hang to fall through.  Because I will guess that some
command is stopped waiting for your input.  It will now get EOF and
likely continue.  But then you should be able to see it in the
redirected output and fix it.

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: