how to run root cmds when starting xorg?
toreld at netscape.net
Mon Feb 26 00:04:09 UTC 2007
"deeptech71 at gmail.com wrote:
> Norberto Meijome wrote:
>> On Sun, 25 Feb 2007 00:24:49 +0100
>> deeptech71 at gmail.com wrote:
>>> From: deeptech71 at gmail.com
>>> To: freebsd-questions at freebsd.org
>>> Subject: how to run root cmds when starting xorg?
>>> Date: Sun, 25 Feb 2007 00:24:49 +0100
>>> Sender: owner-freebsd-questions at freebsd.org
>>> User-Agent: Thunderbird 188.8.131.52 (Windows/20061207)
>>> how do i exec a kldload script when starting ttyv8 kdm (or xorg) ?
>> modify the xorg or kdm startup script?
> Xorg's xinitrc is a user script. Or does one of the X server or client thing
> start as root? If so, which script runs? xinitrc didnt work..
> "...../kdm -nodaemon": exactly which one (if any) executed as root?
The startup script is /usr/X11R6/lib/X11/xdm/Xsetup_0. You may also
want to have a look at /usr/X11R6/lib/X11/xdm/Xsession. This latter
file will call up ~/.xsession, which is where we normally put commands
at the beginning of an X session called up through xdm. What I do in
that file is to call nvidia-settings and display a background image. I
guess ~/.xsession is the right place to put a kldload - this file may be
simply a symlink to .xinitrc (if the setup you want is in this file).
>> why do you need such thing?
> I want to load sound support only when in a desktop environment, and
> auto-disable it when moving back to a console. That is, I need a script that
> loads sound when starting, and unloads when exiting kdm.
Okay, when you revert to the console, /usr/X11R6/lib/X11/xdm/Xreset may
be the right place to put a kldunload. Or maybe you could use
GiveConsole and TakeConsole (in the same directory) to accomplish these
tasks. I hope more expert users will chime in with more information
about the difference between these various command files.
Have a look at "man xdm" as well as /usr/X11R6/lib/X11/xdm/xdm-config.
For some reason, not many users appear to use xdm. The majority
apparently prefer kdm or gdm or just .xinitrc. I find that odd myself.
More information about the freebsd-questions