Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 36325 - Request for addition to /sbin/functions.sh to make it possible to set the softlevel during execution of the boot runlevel
Summary: Request for addition to /sbin/functions.sh to make it possible to set the sof...
Status: RESOLVED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-12-22 16:59 UTC by Martin Aspeli
Modified: 2006-10-04 23:39 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Aspeli 2003-12-22 16:59:42 UTC
To improve the configuration of hprofile <http://hprofile.sf.net> (which I wrote),  and in general to make the use of config profiles (as controlled via RC_USE_CONFIG_PROFILES) more flexible, I would like a mechanism to set the DEFAULTLEVEL variable not only from the kernel command line, but also during the execution of the "boot" runlevel.

The advantage of this would be that a script executed from the "boot" runlevel could determine the profile based on the current state of the system (in my example, it would have to detect whether Gentoo was started from the normal dualboot configuration, or within VMWare for windows; other uses may be if the machine was booted in a docking station or not, whether a particular network connection could be made, etc.). Hence, an appropriate runlevel could be detected and selected automatically, negating the need to have multiple options in the GRUB or LILO menu.

From my initial analysis of /sbin/functions.sh and /sbin/rc, I think the easiest way for this to happen would be if the get_bootconfig() function in /sbin/functions.sh would check a file called, say, ${svcdir}/defaultlevel for the name of the default runlevel if the "softlevel" option was not set in /proc/cmdline, and set the newsoftlevel variable to this. 

Reproducible: Always
Steps to Reproduce:
N/A
Comment 1 Martin Aspeli 2003-12-22 17:35:19 UTC
I had another look and noticed I could set the runlevel to be started after boot by putting its name in /var/init.d/ksoftlevel. I created another 'boot' runlevel service which determines the correct runlevel, and writes the name of this to /var/init.d/ksoftlevel (effectively overwriting the value of ${DEFAULTLEVEL} from setup_defaultlevels(), which is stored in that file when /sbin/rc is called with the 'boot' option). 

This appears to work, but is it safe? Or is it simply a side-effect of the current implementation of /sbin/rc (which seems to use /var/init.d/ksoftlevel as a temporary store for the ${DEFAULTLEVEL} variable). Or put differently, is ksoftlevel intended to be used in this way? If not, why not?

I also discovered that the simple modification requested above probably wouldn't work, because the setup_defaultlevels() function is only called when the 'boot' runlevel is first entered, so any modification that depends on services started during 'boot' would not have a chance to affect it.
Comment 2 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2006-10-04 23:39:06 UTC
tracing old bugs here.
i'm pretty certain this functionality is present in the system now, since you filed this bug in 2003. if not, please reopen.