[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

How to run a script when the live system boots



Hello,

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

#!/bin/sh
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_clean
lh_config -b iso
lh_build

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.

Best wishes
Oliver

------------------
P.S. At 09/09/2009 Tim Legg had the same question but received no answer. Quotation:

From: "Tim Legg" <postfix_list@timothylegg.com>
To: debian-live@lists.debian.org
Reply-To: postfix_list@timothylegg.com
Subject: Clarifying the FAQ: Running a script after booting from CD
Date: Wed, 9 Sep 2009 15:51:56 -0500 (CDT)
User-Agent: SquirrelMail/1.4.15

After booting using a CD, I would like a script to run.

I did find an entry in the FAQ at:

http://wiki.debian.org/DebianLive/FAQ#Q.3AHowdoIaddascriptrunningimmediatelyafterallotherscriptswhenthelivesystemboots.3F

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
config/chroot_local-includes/usr/share/initramfs-tools/scripts/live-bottom/99script

and then I ran chmod -x on that path

$ chmod +x
config/chroot_local-includes/usr/share/initramfs-tools/scripts/live-bottom/99script

I got my script which has already had its permissions and executable flag
set and copied it there

$ cp script.scr
~/live/config/chroot_local-includes/usr/share/initramfs-tools/scripts/live-bottom/99script

but when I become root and:

# lh_build

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.

Tim Legg




-- 
os.news@gmx.de <os.news@gmx.de>


Reply to: