[arch-releng] [PATCH] [syslinux-iso] Add automated_script support

Charles Vejnar ce at vejnar.org
Fri Feb 4 06:07:08 EST 2011


Le jeudi 3 février 2011 21:21:08, Dieter Plaetinck a écrit :
> On Thu, 03 Feb 2011 21:04:51 +0100
> 
> Charles Vejnar <ce at vejnar.org> wrote:
> > I agree 100%. I am saying that, in case auto root-login is activated,
> > adding with the script something to .bash_profile compared the submited
> > patch is a better solution.
> 
> Not sure what you mean. the submitted patch only enables the script hook,
> so the patch would be a necessity before you can even add something to
> .bash_profile from the script.
> 
> > > but first address the concerns..
> > 
> > If I am not missing one, and if auto root-login is activated on tty1 then
> > your only remaining concerns was about error handling (stat_error in
> > case the script isn't retrieved correctly). Is that right ?
> 
> you should really look at the script yourself and imagine any possible
> thing that could go wrong, and make sure the script handles it properly.
> 
> my other concern is: if the user wants to run an automatic or interactive
> install (configured by the script): - the actual installation should not
> happen during the init process. - it should be run when the environment is
> set up correctly (i.e. user is logged in, .bash_profile and .bashrc are
> sourced) - it should be run after the MOTD has shown
> 
> I want to see 2 working scripts which actually implement starting an
> automatic and an interactive install (properly, as explained above).  We
> could ship those as example scripts in the archiso repository (I
> considered putting them in the overlay directory, so they end up on the
> images, but I don't think that's useful).
> 
> Also, the documentation needs to be updated for this:
> 1) the official installation guide (in AIF repository)
> 2) Maybe also the archiso README, I let Djgera decide on that
> 
> Dieter

Hi Dieter,

Here are my patches:

1/ Modified automated_script

. /etc/archiso/functions

automated_script ()
{
    script="$(cmdline_param script)"
    if [ -n $script ] ; then
        stat_busy "Configuring $script"
        if [[ $script =~ ^http:// || $script =~ ^ftp:// ]] ; then
            wget "$script" -q -O /tmp/startup_script >/dev/null
            rt=$?
        else
            cp $script /tmp/startup_script
            rt=$?
        fi
        if [ $rt -eq 0 ] ; then
            chmod +x /tmp/startup_script
            echo "/tmp/startup_script" >> /root/.bash_profile
            stat_done
        else
            stat_fail
        fi
    fi
}

add_hook multi_end automated_script

2/ Modified inittab

c1:2345:respawn:/sbin/agetty -n -l /usr/bin/autologin -8 38400 tty1 linux

3/ New /usr/bin/autologin

#!/bin/bash
/bin/login -f root

I tested successfully everyting (through PXE) with the following scripts:

#!/bin/bash
aif -p interactive

And also (for automatic install, this procedure needs a web server, I wrote 
something for that purpose and will publish it):

#!/bin/bash
mac=$(ifconfig eth0 | sed -n 's/.*HWaddr \([a-zA-Z0-9:]*\).*/\1/p')
wget "http://192.168.3.2:8086/get/$mac" -q -O /tmp/aif_profile >/dev/null
aif -p automatic -c /tmp/aif_profile
wget "http://192.168.3.2:8086/remove/$mac" -q -O - >/dev/null
reboot

The MOTD get displayed in both cases.

BTW, something changed in archlinux-2011.02.01-core-x86_64.iso; archiso-pxe-
server is working with archlinux-2011.01.09-core-x86_64.iso but not with the 
newer 2011.02.01 version (nbd-server problem).

Charles


More information about the arch-releng mailing list