Re: How to run a script when the live system boots
2009/10/27 email@example.com <firstname.lastname@example.org>:
> I tried to run a script immediately after all other scripts when the live system boots. I read the FAQ and did the following:
> mkdir -p config/chroot_local-includes/usr/share/initramfs-tools/scripts/live-bottom
> Then I wrote the following script
> touch /root/test.txt
> and saved it as "99script"
> chmod +x 99script
> cp /usr/share/live-helper/examples/hooks/update-initramfs.sh config/chroot_local-hooks
> lh_config -b iso
> Then I booted the LiveCD but the script wasn't executed. There was no file /root/test.txt.
> Can you tell what is wrong? Thank you very much.
As tomas said, the file will not be in /root/. For that you should
touch the file in /root/root/. If the script worked, the file should
be in /test.txt.
Chances are that, because you already executed lh_build before, the
debootstrap stage wasn't updated and the cached one was used, so the
initramfs is not updated and the script will not be in
/usr/share/initramfs-tools/scripts/live-bottom. You can confirm it
looking at the /usr/share/initramfs-tools/scripts/live-bottom/
directory after the system has booted. If the script is not there, run
"lh_clean" and also "lh_clean --stage" so the cached stage is cleared
and a new one is created in the next lh_build. Ofcourse, you have to
include the /usr/share/live-helper/examples/hooks/update-initramfs.sh
script in your hooks to make sure the initramfs is updated.
Rui M. P. Bernardo