[arch-releng] [PATCH] [syslinux-iso] Add automated_script support
Gerardo Exequiel Pozzi
vmlinuz386 at yahoo.com.ar
Sat Jan 29 17:28:19 EST 2011
On 01/28/2011 10:19 AM, Dieter Plaetinck wrote:
> On Thu, 27 Jan 2011 22:25:13 -0300
> Gerardo Exequiel Pozzi<vmlinuz386 at yahoo.com.ar> wrote:
>
>> Via kernel parameter "script=/path/to/script".
>> /path/to/script can be a ftp:// or http:// or an absolute path.
>>
>> Original idea by "Charles", I just changes few things to use
>> initscripts hooks.
>>
>> https://bbs.archlinux.org/viewtopic.php?id=111925
>>
>> Signed-off-by: Gerardo Exequiel Pozzi<vmlinuz386 at yahoo.com.ar>
>> ---
>> .../overlay/etc/rc.d/functions.d/automated_script | 21
>> ++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-)
>> create mode 100644
>> configs/syslinux-iso/overlay/etc/rc.d/functions.d/automated_script
>>
>> diff --git
>> a/configs/syslinux-iso/overlay/etc/rc.d/functions.d/automated_script
>> b/configs/syslinux-iso/overlay/etc/rc.d/functions.d/automated_script
>> new file mode 100644 index 0000000..4637ee1 --- /dev/null
>> +++
>> b/configs/syslinux-iso/overlay/etc/rc.d/functions.d/automated_script
>> @@ -0,0 +1,21 @@ +. /etc/archiso/functions
>> +
>> +automated_script ()
>> +{
>> + script="$(cmdline_param script)"
>> + if [ -n $script ] ; then
>> + stat_busy "Running $script"
>> + if [[ $script =~ ^http:// || $script =~ ^ftp:// ]] ; then
>> + wget "$script" -q -O /tmp/startup_script>/dev/null
>> + else
>> + cp $script /tmp/startup_script
>> + fi
>> + if [ -s /tmp/startup_script ] ; then
>> + chmod +x /tmp/startup_script
>> + /tmp/startup_script
>> + fi
>> + stat_done
>> + fi
>> +}
>> +
>> +add_hook multi_end automated_script
> Can you explain how it works?
> An explanation will be needed for the README anyway.
> If it does what I think it does, then we need to put it in the official
> installation guide as well.
>
> What I think it does:
> - this hook is always executed during boot (independent of boot metod
> such as pxe, cd-rom or usb)
yes.
> - it checks if the kernel has a "script" argument (as given by the
> bootloader - never in the official builds - but can easily be
> specified when booting over pxe, or making your own iso builds)
yes.
> - it will download the script if it starts with 'http://' or 'ftp://',
> otherwise it will copy it (in this case, you should have have built
> your own images with the script in them, otherwise there is no way
> to have acess to the script, or is there? (network mount?))
yes.
> - it then executes the script if it is copied/downloaded successfully.
> in the script you can put something like 'aif -p automatic -c<path
> to config>' or 'aif -p interactive'.
>
Not exactly, depends on what you want.
> I would suggest some error handling.
> if the wget fails (and/or /tmp/startup_script does not exist), you
> should not do a stat_done, but stat_error or whatever it's called.
> another thing, if /tmp/startup_script takes a long time (like, when
> running aif), doing this all in the "boot process" and then doing a
> stat_done doesn't seem right. aif is supposed to be run after boot has
> completed. (to which extent this gives problems, I don't know, maybe
> the ncurses dialogs will be rendered incorrectly etc)
> also, we use MOTD to show some info before the installation is
> invoked, with this approach it will show the MOTD after aif has run.
>
Yes. Errors must be catched. According to Charles, this works OK.
@Charles: aif tested via the script?
I guess that MOTD will never appears (guessing an automatic reboot).
Anyway all these things are responsability of the script creator.
This patch only add support to launch a custom script, what and how
things are doing by script is another issue.
PS1: Charles, please suscribe to arch-releng ML, so can follow thing
more easily.
PS2: I am a bit busy these days.
> Dieter
>
--
Gerardo Exequiel Pozzi
\cos^2\alpha + \sin^2\alpha = 1
More information about the arch-releng
mailing list