]>
Commit | Line | Data |
---|---|---|
31f18b77 FG |
1 | import os |
2 | import subprocess | |
3 | ||
7c673cae FG |
4 | distro = None |
5 | release = None | |
6 | codename = None | |
7 | ||
8 | ||
9 | def choose_init(): | |
10 | """Select a init system | |
11 | ||
12 | Returns the name of a init system (upstart, sysvinit ...). | |
13 | """ | |
31f18b77 FG |
14 | # yes, this is heuristics |
15 | if os.path.isdir('/run/systemd/system'): | |
16 | return 'systemd' | |
17 | if not subprocess.call('. /lib/lsb/init-functions ; init_is_upstart', | |
18 | shell=True): | |
19 | return 'upstart' | |
20 | if os.path.isfile('/sbin/init') and not os.path.islink('/sbin/init'): | |
21 | return 'sysvinit' |