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

Re: Including git commands in preseed



Todd Maurice wrote:
> #!/bin/bash
> echo Hello World

That output show should up in vt 4.  Use Alt-F4 at installation time
to see the output there.

I would make the output more visible.  I would make it LOUD.

  #!/bin/bash
  echo ================================================================
  echo ================================================================
  echo Hello World
  echo ================================================================
  echo ================================================================

> Preseed entry take 1:
> d-i preseed/late_command string in-target wget -O /var/tmp/hello https://raw.github.com/drgdel/a/master/1; in-target sh /var/tmp/hello
> 
> The installation downloaded the script but there is no auto run (no
> matter if I log as root or user).

Stop.  What?  You say, "no matter if I log as root or user".  What and
when are you talking about there?  The late_command runs at
installation time.  At installation time there is no ability to log
into the machine as either root or user.  There are additional VTs
such as Alt-F2 and Alt-F3, press Enter to get a console, for terminals
to be used during the installation.  But that is root only.  There
isn't a way to log in as a user at that time.

I think that is a clue that you are doing something completely different!

> Typing 
> sh /var/tmp/hello
> 
> when logged, runs the script.

Yes.  That is *after* the installation because files in /var/tmp
persist after the reboot.

> I tried the preseed entry take 2 with your suggested script (same
> syntax just changed 1 for 2 in the ).

> d-i preseed/late_command string in-target wget -O root/script.sh https://raw.github.com/drgdel/a/master/2; chmod 700 /target/root/script.sh; in-target sh /root/script.sh
> 
> https://raw.github.com/drgdel/a/master/2
> Content:
> #!/bin/sh
> exec </dev/null >/var/tmp/bootstrap.out 2>&1
> echo Hello World
> exit 0
> 
> It created a file containing the text Hello World. No autorun.

You have stated a conflict.  You said it created the file
/var/tmp/bootstrap.out with the contents "Hello World".  That means
that it ran.  But then you said it didn't run.  Those two statements
conflict.

Please say *exactly* what you mean by "autorun" because I think there
lies the confusion.

The late_command runs at debian-installer time.  It runs during the
installation of the system.  That's it.  It never runs again after
that point.  If it ran during installation then the task was done.

> So while there is a problem with the script, I can't get even a
> simple one to boot automatically.

Again, "boot automatically"??  What is this?  You appear to be talking
about something completely different from a preseed late_command
running at installation time.

The late_command runs during the system installation time.  It runs
once only.  (On my system the debian-installer says 27% at the time
that it runs.  But that is no matter.)  If the late_command hangs and
does not complete then the debian-installer will be blocked waiting
for it to complete.  The d-i cannot proceed until the late_command
exits.

After that point in the installation the d-i will continue on with the
installation.  Eventually d-i will ask to reboot the system (asking
can be preseeded away) and the system will reboot.  After the reboot
you can log in either as root or as the first user created during the
installation.  There is no execution of late_command again at any
point after it was run the one time during installation before the
first reboot.

Perhaps what you are trying to do could be more easily accomplished by
creating a package of it and then installing the package?

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: