View previous topic :: View next topic |
Author |
Message |
butane317 n00b
Joined: 26 Jan 2006 Posts: 55
|
Posted: Wed Feb 14, 2007 10:27 am Post subject: Custom boot process (no login, go straight to a script) |
|
|
I want to have a working image of my computer's hard drive stored on a partition as a big tarball, and then have an option on grub where it can boot into some tiny distro stored on the hard drive who's only purpose is to move this tarball back onto the partitions and overwrite what's there. That way, when my grandparents (who will be using the computer) inevitably bork it, they can just select that option and it will magically work again. What I'm thinking of is just writing a shell script to do what I want, but how do I make it run automatically as the computer is booted instead of going to the login prompt? |
|
Back to top |
|
|
Lloeki Guru
Joined: 14 Jun 2006 Posts: 437 Location: France
|
Posted: Wed Feb 14, 2007 10:43 am Post subject: |
|
|
well, you might also be interested in unionfs, and other copy-on-write filesystems (if there are any).
you may also want to take a look at the init kernel parameter, e.g adding init=/bin/sh will start sh (as root) instead of sysvinit. _________________ Moved to using Arch Linux
Life is meant to be lived, not given up...
HOLY COW I'M TOTALLY GOING SO FAST OH F*** |
|
Back to top |
|
|
richard.scott Veteran
Joined: 19 May 2003 Posts: 1497 Location: Oxfordshire, UK
|
Posted: Mon Mar 19, 2007 10:44 pm Post subject: Re: Custom boot process (no login, go straight to a script) |
|
|
butane317 wrote: | ... how do I make it run automatically as the computer is booted instead of going to the login prompt? |
Hi,
Have a look at the /etc/inittab on the LiveCD. That does what you want. From what I remember they get inittab to call the script that starts a bash shell instead of the normal login.
They change the console spawning lines to the following in /etc/inittab
Code: | c0:12345:respawn:/sbin/agetty -nl /bin/bashlogin 38400 tty0 linux |
and the /bin/bashlogin has the following code:
Code: | #!/bin/bash
cat /etc/motd 2>/dev/null
cd /root
[[ -e .bash_profile ]] && source .bash_profile
exec -l /bin/bash -i |
What you could do is remove the "exec" line in /bin/bashlogin and add your custom restore code to the end.
I don't know if this will help tho as you'd need a totally seperate install of gentoo on this custom partition. |
|
Back to top |
|
|
richard.scott Veteran
Joined: 19 May 2003 Posts: 1497 Location: Oxfordshire, UK
|
Posted: Mon Mar 19, 2007 10:46 pm Post subject: |
|
|
Lloeki wrote: | ... adding init=/bin/sh will start sh (as root) instead of sysvinit. |
<Whistling> Just seen this and this looks easier if it works
You could (I guess) use init=/bin/custom to do the restore.
Nice one Lloeki |
|
Back to top |
|
|
|