加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

大略理解 lightdm 的启动流程

(2014-07-04 11:22:12)
标签:

lightdm

xwindow

linux

计算机

科技

这个是我的原创,因为我是菜鸟,所以很可能有错,如果你要转载,请注明转载于我的博客。欢迎在评论中指出拼写,语法以及技术错误。谢谢。
主要的参考资料来自于
https://wiki.archlinux.org/index.php/LightDM
https://wiki.ubuntu.com/LightDM
The setting of lightdm seems hard to understand. So I use one day to study how it works.
As a example, the unity-greeter in Ubuntu 14.04 is employed to illustrate its initialization process.
The default configuration files of lightdm is in /usr/share/lightdm/lightdm.conf.d (maybe including lightdm.conf) ,
To override above setting,  /etc/lightdm/lightdm.conf is used. The ".conf" files define which greeter will be used.
in /usr/share/lightdm/lightdm.conf.d/50-unity-greeter.conf

[SeatDefaults]
greeter-session-unity-greeter=unity-greeter
#######################
#display-setup-script=command
#display-stopped-script=command (Not in Ubuntu 12.04 LTS)
#greeter-setup-script=command
#session-setup-script=command
#session-cleanup-script=command
#session-wrapper=command
#greeter-wrapper=command (Not in Ubuntu 12.04 LTS)
########################
is setting.  "session-wrapper" is a the command to run for a session. This command is run as the user and needs to exec the command passed in the arguments to complete running the session. Use this if you need to do special setup for a user session. Note the default is 'lightdm-session' so you should chain to this if you need to override this setting. And /usr/sbin/lightdm-session will chain load the traditional Xsession scripts.
"unity-greeter" is a ".desktop" file in /usr/share/xgreeters.
[Desktop Entry]
Name=Unity Greeter
Comment=Unity Greeter
Exec=unity-greeter
Type=Application
X-Ubuntu-Gettext-Domain=unity-greeter

The "unity-greeter" on the "Exec" line is a binary executable file placed in /usr/sbin/. If you check the log file /var/log/lightdm/lightdm.log, you will find that unity-greeter is executed by /usr/lib/lightdm/lightdm-greeter-session.
The appearance of the login screen is setting by /usr/share/glib-2.0/schemas/com.canonical.unity-greeter.gschema.xml. To make any modifications  take effect, glib-compile-schemas should be used.

In /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf
[SeatDefaults]
user-session=ubuntu

This sets that lightdm will find "ubuntu.desktop" files in /usr/share/xsessions. This can be modified on login screen by users. The information of user's xsession is strored in $HOME/.dmrc. Actually, the contents in .dmrc is the last-selected xsession. The contents of "/usr/share/xsessions/ubuntu.desktop" is
[Desktop Entry]
Name=Ubuntu
Comment=This session logs you into Ubuntu
Exec=gnome-session --session=ubuntu
TryExec=unity
Icon=
Type=Application
X-LightDM-DesktopName=Unity
X-Ubuntu-Gettext-Domain=gnome-session-3.0

The "Exec" entry set use gnome-session --session=ubuntu. This entry let the gnome-session to find "ubuntu.session" in $XDG_CONFIG_HOME/gnome-session/sessions,  $XDG_CONFIG_DIRS/gnome-session/sessions  and  $XDG_DATA_DIRS/gnome-session/sessions. On my system it is placed at /usr/share/gnome-session/sessions/. The contents of ubuntu.session are

[GNOME Session]
Name=Ubuntu
RequiredComponents=unity-settings-daemon;compiz;
DesktopName=Unity

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有