I have an install script for the operating system that I'm setting up and, in part of the script, I need to install the graphics card drivers. In order to do this, I'm required to switch to runlevel 2 using the command
init 2
So, if the script consists of
# In run level 3
echo "The";
init 2;
echo "quick";
init 3;
echo "brown";
, the only thing that is being printed is "The" due to the fact that the script is stopped in its tracks when the init command is sent. I'd like to make the installation of the operating system as automated as possible, but this seems to throw a wrench into the process. Any help would be very much appreciated.
Cheers, Charlie
From serverfault
candrews
-
As a general approach, what you could do is, in your script:
- create an 'init script' named scriptname dynamically, with the commands you need to execute in that particular run level.
- create the necessary symlinks from /etc/rc*runlevel*.d/S99*scriptname*.
- switch to the runlevel by invoking init runlevel
- init script scriptname will be executed
- scriptname could disable itself after running by removing the symlink /etc/rc*runlevel*.d/S99*scriptname*, and then repeat from 1 to 5.
It feels a bit ugly, but it does work (did it a long time ago).
candrews : Thank you! I'll be trying this out later today, but it seems like this strategy should do the trick.From Vincent De Baere
0 comments:
Post a Comment