[arch-releng] [PATCH 5/5] [configs/releng] Rework automated_script() from initscript hooks to /root/.zlogin
Charles
ce at vejnar.org
Thu Sep 20 10:08:38 EDT 2012
Le 19/09/2012 23:39, Gerardo Exequiel Pozzi a écrit :
> On 09/19/2012 12:55 PM, Charles wrote:
>> Le 17/09/2012 14:46, Gerardo Exequiel Pozzi a écrit :
>>> On 09/17/2012 09:38 AM, Charles wrote:
>>>> Le 17/09/2012 14:26, Gerardo Exequiel Pozzi a écrit :
>>>>> On 09/17/2012 09:22 AM, Gerardo Exequiel Pozzi wrote:
>>>>>> On 09/17/2012 06:42 AM, Charles wrote:
>>>>>>> Le 17/09/2012 01:12, Gerardo Exequiel Pozzi a écrit :
>>>>>>>> On 09/16/2012 06:01 PM, Charles wrote:
>>>>>>>>> Le 12/09/2012 09:10, Gerardo Exequiel Pozzi a écrit :
>>>>>>>>>> Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386 at yahoo.com.ar>
>>>>>>>>>> ---
>>>>>>>>>> .../releng/root-image/root/.automated_script.sh | 34
>>>>>>>>>> ++++++++++++++++++++++
>>>>>>>>>> configs/releng/root-image/root/.zlogin | 1 +
>>>>>>>>>> 2 files changed, 35 insertions(+)
>>>>>>>>>> create mode 100755
>>>>>>>>>> configs/releng/root-image/root/.automated_script.sh
>>>>>>>>>> create mode 100644 configs/releng/root-image/root/.zlogin
>>>>>>>>>>
>>>>>>>>>> diff --git
>>>>>>>>>> a/configs/releng/root-image/root/.automated_script.sh
>>>>>>>>>> b/configs/releng/root-image/root/.automated_script.sh
>>>>>>>>>> new file mode 100755
>>>>>>>>>> index 0000000..859452f
>>>>>>>>>> --- /dev/null
>>>>>>>>>> +++ b/configs/releng/root-image/root/.automated_script.sh
>>>>>>>>>> @@ -0,0 +1,34 @@
>>>>>>>>>> +#!/bin/bash
>>>>>>>>>> +
>>>>>>>>>> +script_cmdline ()
>>>>>>>>>> +{
>>>>>>>>>> + local param
>>>>>>>>>> + for param in $(< /proc/cmdline); do
>>>>>>>>>> + case "${param}" in
>>>>>>>>>> + script=*) echo "${param##*=}" ; return 0 ;;
>>>>>>>>>> + esac
>>>>>>>>>> + done
>>>>>>>>>> +}
>>>>>>>>>> +
>>>>>>>>>> +automated_script ()
>>>>>>>>>> +{
>>>>>>>>>> + local script rt
>>>>>>>>>> + script="$(script_cmdline)"
>>>>>>>>>> + if [[ -n "${script}" ]]; then
>>>>>>>>>> + 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
>>>>>>>>>> + /tmp/startup_script
>>>>>>>>>> + fi
>>>>>>>>>> + fi
>>>>>>>>>> +}
>>>>>>>>>> +
>>>>>>>>>> +if [[ $(tty) == "/dev/tty1" ]]; then
>>>>>>>>>> + automated_script
>>>>>>>>>> +fi
>>>>>>>>>> diff --git a/configs/releng/root-image/root/.zlogin
>>>>>>>>>> b/configs/releng/root-image/root/.zlogin
>>>>>>>>>> new file mode 100644
>>>>>>>>>> index 0000000..f598e43
>>>>>>>>>> --- /dev/null
>>>>>>>>>> +++ b/configs/releng/root-image/root/.zlogin
>>>>>>>>>> @@ -0,0 +1 @@
>>>>>>>>>> +~/.automated_script.sh
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> Two problems:
>>>>>>>>> - when the script is run, the network is not ready, making
>>>>>>>>> automated_script to fail. Adding the parameter
>>>>>>>>> "--retry-connrefused" to wget will fixed it.
>>>>>>>> "network ready" issues is a thing that should be fixed in some
>>>>>>>> way. For now adding such switch seems to be fine ;)
>>>>>>>>> - the hook /etc/rc.d/functions.d/automated_script has not been
>>>>>>>>> removed.
>>>>>>>> Is removed, ensure that you are working on clean enviroment
>>>>>>>> (remove files from /usr/share/archiso, etc)
>>>>>>>>
>>>>>>>> rm -r /usr/lib/initcpio/archiso_*
>>>>>>>> /usr/lib/initcpio/hooks/archiso*
>>>>>>>> /usr/lib/initcpio/install/archiso* /usr/share/doc/archiso
>>>>>>>> /usr/share/archiso /usr/sbin/mkarchiso
>>>>>>>>>
>>>>>>>>> Thanks for trying to make this function work. Very useful to me !
>>>>>>>> Thanks you for testing.
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>>
>>>>>>>>> Charles
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> Hi Gerardo,
>>>>>>>
>>>>>>> > Is removed, ensure that you are working on clean enviroment
>>>>>>> (remove files from /usr/share/archiso, etc)
>>>>>>>
>>>>>>> I don't get that. the file
>>>>>>> "http://projects.archlinux.org/archiso.git/tree/configs/releng/root-image/etc/rc.d/functions.d/automated_script"
>>>>>>> is still there, isn't it ? or is there another patch ?
>>>>>>>
>>>>>>> Charles
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> These RFC patchs are not merged in master and main repo. Only in
>>>>>> my repo, inside experimental branch.
>>>>>>
>>>>>> https://github.com/djgera/archiso/compare/master...experimental
>>>>>>
>>>>>>
>>>>>>
>>>>> When you tested this, how do you do? Only applied this patch over
>>>>> master?
>>>>>
>>>> Yes
>>>>
>>> Oooh thats wrong, you need to apply all patches, or just use my
>>> experimetal branch. Otherwise non-native systemd things will be used.
>>>
>>> I guess this was your problem about no network available... If you
>>> have some time, you can build again but using "experimental" branch,
>>> and removing --retry-connrefused, at least in my case works, when I
>>> made this patch.
>>>
>>> Thanks.
>>>
>>>
>> Sorry. I build a new image from your experimental branch. It's working.
>>
>> The only weird thing are the ton of messages at reboot, which you
>> already mentioned.
>>
>> Thanks
>>
>> Charles
>>
> Nice, thanks for confirmation. Anyway I will keep that switch, seems
> to be a good idea.
>
> Anyway I will keep that switch, seems to be a good idea.
I think so too. Doesn't harm and make things more robust.
More information about the arch-releng
mailing list