Add a detect_os module to detect configuration files on the current system.
[lxde/lxadmin.git] / src / common / detect_os.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 #
4 # Copyright 2010 Julien Lavergne <gilir@ubuntu.com>
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 # MA 02110-1301, USA.
20
21 import os
22 import platform
23
24 #Detect Linux distribution
25 os_detection = platform.dist()
26
27 #Detect session
28 session = os.environ['DESKTOP_SESSION']
29
30 def get_lxdm_config():
31 if os_detection[0] == 'Ubuntu':
32 if session == 'Lubuntu':
33 config_lxdm = '/etc/xdg/lubuntu/lxdm/lxdm.conf'
34 else:
35 config_lxdm = '/etc/xdg/lxdm/default.conf'
36 else:
37 config_lxdm = '/etc/lxdm/lxdm.conf'
38
39 return config_lxdm