Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Custom boot process (no login, go straight to a script)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
butane317
n00b
n00b


Joined: 26 Jan 2006
Posts: 55

PostPosted: Wed Feb 14, 2007 10:27 am    Post subject: Custom boot process (no login, go straight to a script) Reply with quote

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
View user's profile Send private message
Lloeki
Guru
Guru


Joined: 14 Jun 2006
Posts: 437
Location: France

PostPosted: Wed Feb 14, 2007 10:43 am    Post subject: Reply with quote

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
View user's profile Send private message
richard.scott
Veteran
Veteran


Joined: 19 May 2003
Posts: 1497
Location: Oxfordshire, UK

PostPosted: Mon Mar 19, 2007 10:44 pm    Post subject: Re: Custom boot process (no login, go straight to a script) Reply with quote

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
View user's profile Send private message
richard.scott
Veteran
Veteran


Joined: 19 May 2003
Posts: 1497
Location: Oxfordshire, UK

PostPosted: Mon Mar 19, 2007 10:46 pm    Post subject: Reply with quote

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 :oops:

You could (I guess) use init=/bin/custom to do the restore.

Nice one Lloeki :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum