Re: [arch-releng] [PATCH] [syslinux-iso] Add automated_script support
On Thu, 03 Feb 2011 17:45:55 +0100
Charles Vejnar <ce@vejnar.org> wrote:
Hi,
Sorry for the delay.
- it checks if the kernel has a "script" argument (as given by the
bootloader - never in the official builds -
You mean this option we are working on won't be usable with the next official build ?!
I mean that after your patch will be applied, we won't configure the release media to use a script argument by default, because there is nothing special to use it for. specifying a specific script argument makes most sense for custom builds or booting over pxe. Or tell me why I'm wrong.
OK. Sorry I misunderstood you. You are right.
The patch I proposed is designed for automatic install and is working for this purpose.
There's working and properly working. I would like to see you address the concerns I sent in my earlier mail. (or at the very least let us know if and why my concerns are invalid)
But if you want to introduce root autologin, and put something in .bash_profile to autostart a manual or a automatic install, it is a good idea and not only for the case of an automatic install.
no. users should be able to use the media as live / recovery system. it's not our job to dictate what they should do.
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.
I would really appreciate to be able to use this script option without modifying the iso.
of course, that's the idea. like I said above. 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 ? If yes, I will propose a patch.
In my opinion, always activated auto-login would be great.
I agree, at least on tty1 an auto root-login would be useful. other terminals can remain as they are.
Should I propose patches ?
Yes.
I take it you're a member of the mailing list now?
Yes, and liking Archlinux more and more :)
Dieter
On Thu, 03 Feb 2011 21:04:51 +0100 Charles Vejnar <ce@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
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@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
On Fri, 04 Feb 2011 12:07:08 +0100 Charles Vejnar <ce@vejnar.org> wrote:
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@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
looks good.
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
why like this and not just run login -f root directly from inittab?
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
this seems good, although you should probably error out if anything failed (aif/wget/ifconfig/sed calls), so that the 2nd http request only happens if everything went fine. using /bin/bash -e on the first line should do just that.
The MOTD get displayed in both cases.
thanks, this is starting to look good. but you will need to provide patches (using git-format-patch and git-send-mail) and don't forget to add a patch for the official installation guide in the aif repository. anyway, I'm at FOSDEM all weekend, so if you happen to be there, let me know (or find me: I'm the only guy in the world with a black Arch Linux polo) Dieter
Le samedi 5 février 2011 11:12:21, Dieter Plaetinck a écrit :
On Fri, 04 Feb 2011 12:07:08 +0100
Charles Vejnar <ce@vejnar.org> wrote:
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@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
looks good.
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
why like this and not just run login -f root directly from inittab?
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
this seems good, although you should probably error out if anything failed (aif/wget/ifconfig/sed calls), so that the 2nd http request only happens if everything went fine. using /bin/bash -e on the first line should do just that.
The MOTD get displayed in both cases.
thanks, this is starting to look good. but you will need to provide patches (using git-format-patch and git-send-mail) and don't forget to add a patch for the official installation guide in the aif repository.
anyway, I'm at FOSDEM all weekend, so if you happen to be there, let me know (or find me: I'm the only guy in the world with a black Arch Linux polo)
Dieter
Hi Dieter, The -l agetty option only accepts the name of a program with parameters (I tested it). So we have to use a script. For the two example scripts, I think a "set -e" will be OK. I am sending patches directly to you. Charles
The -l agetty option only accepts the name of a program with parameters (I tested it). So we have to use a script.
did you mean *without* parameters?
I am sending patches directly to you.
don't. send to the mailing list. that's what it's for. Dieter
Le 08/02/2011 09:38, Dieter Plaetinck a écrit :
The -l agetty option only accepts the name of a program with parameters (I tested it). So we have to use a script.
did you mean *without* parameters?
Yes, sorry.
I am sending patches directly to you.
don't. send to the mailing list. that's what it's for.
Dieter
participants (2)
-
Charles Vejnar
-
Dieter Plaetinck