Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I want to customize my run level scripts based upon a key combo pressed at boot.

How to I test for key presses as early as possible from boot? Do I need to do something special, like for example: lock the computer at run level 1 so I can prepare run level 5 scripts?

How do I go about this?

share|improve this question
    
Which OS/distro? –  Ignacio Vazquez-Abrams Mar 22 '12 at 3:43
    
Linux Mint Julia 10.04 based on Ubuntu –  bambuntu Mar 22 '12 at 4:24
2  
Can't you use different grub menus? –  brownian Mar 22 '12 at 10:46
    
Is it possible to make grub mv config files before it begins the boot process? I haven't found anything after looking. –  bambuntu Mar 22 '12 at 21:49

1 Answer 1

You can use read -N 1 -t 0.1 to try and capture a keypress in your sysinit script (/etc/rc.sysinit here, dunno what it is on Mint) and switch to the appropriate runlevel based on the captured character.

share|improve this answer
    
    
How would that look in a script? I'm having trouble just getting it to work on the command line. –  bambuntu Mar 27 '12 at 13:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.