]> git.proxmox.com Git - ceph.git/blame - ceph/src/ceph-detect-init/ceph_detect_init/debian/__init__.py
update sources to v12.1.0
[ceph.git] / ceph / src / ceph-detect-init / ceph_detect_init / debian / __init__.py
CommitLineData
31f18b77
FG
1import os
2import subprocess
3
7c673cae
FG
4distro = None
5release = None
6codename = None
7
8
9def 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'