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

post-boot script



El Friday 18 January 2008 20:24:02 Daniel Oberhoff va escriure:
> Ok. That could help. Is it in generally possible though to have a ?
> script running _after_ all this setup is completed and everything ?
> looks the same as if I had started a script from the shell into which ?
> I am dropped after booting?
>

normally those scripts can be written in the directory /etc/init.d and the OS 
executes them at start. 

Example, in the live-bottom directory we include a script to create an init 
procedure: 

**************************
	echo '#! /bin/sh

PATH=/sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin:/usr/local/bin
. /lib/init/vars.sh

. /lib/lsb/init-functions

# Read configuration variable file if it is present
[ -r /etc/live.vars ] && . /etc/live.vars

# Load the VERBOSE setting and other rcS variables
[ -f /etc/default/rcS ] && . /etc/default/rcS

do_start () {
...
}

do_stop () {
...
}

case "$1" in
  start)
	do_start
	;;
  restart|reload|force-reload)
	echo "Error: argument $1 not supported" >&2
	exit 3
	;;
  stop)
	do_stop
	;;
  *)
	echo "Usage: $0 start|stop" >&2
	exit 3
	;;
esac

:' > "${rootmnt}/etc/init.d/script"

	chmod a+x "${rootmnt}/etc/init.d/script"

	chroot ${rootmnt} update-rc.d script defaults

**************************

That contains code from my own version of initramfs, some variables or files 
could vary or not exist from the standard version.

> Best
>
> Daniel

I hope this helps,

Jordi




Reply to: