How to run a script when the live system boots
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
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.
P.S. At 09/09/2009 Tim Legg had the same question but received no answer. Quotation:
From: "Tim Legg" <firstname.lastname@example.org>
Subject: Clarifying the FAQ: Running a script after booting from CD
Date: Wed, 9 Sep 2009 15:51:56 -0500 (CDT)
After booting using a CD, I would like a script to run.
I did find an entry in the FAQ at:
I don't understand the instructions. Maybe somebody could clarify. Here
is how I interpreted to answer in the FAQ.
So I created the directory that didn't exist.
$ mkdir -p
and then I ran chmod -x on that path
$ chmod +x
I got my script which has already had its permissions and executable flag
set and copied it there
$ cp script.scr
but when I become root and:
It goes on with all it's business and exits successfully, but never
creates an image. The tail end of it's output is below.
Hit http://ftp.us.debian.org lenny/main Packages
Reading package lists... Done
P: Deconfiguring file /etc/hostname
P: Deconfiguring file /bin/hostname
P: Deconfiguring file /etc/resolv.conf
P: Deconfiguring file /etc/hosts
P: Begin unmounting filesystems...
The reference in the FAQ for the example script says it can be found at
/usr/share/live-helper/examples/hooks/update-initramfs.sh I followed the
instructions in the file by copying it to ~/live/config/chroot_local-hooks
, but lh_build exited with an error.
I have been able to successfully create an image by running lh_config and
then lh_build in a separate directory with none of the files modified.