X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Fceph-detect-init%2Fceph_detect_init%2Fdebian%2F__init__.py;fp=src%2Fceph%2Fsrc%2Fceph-detect-init%2Fceph_detect_init%2Fdebian%2F__init__.py;h=94217cdfa263b554c8446cfbacebc7dd4654654f;hb=812ff6ca9fcd3e629e49d4328905f33eee8ca3f5;hp=0000000000000000000000000000000000000000;hpb=15280273faafb77777eab341909a3f495cf248d9;p=stor4nfv.git diff --git a/src/ceph/src/ceph-detect-init/ceph_detect_init/debian/__init__.py b/src/ceph/src/ceph-detect-init/ceph_detect_init/debian/__init__.py new file mode 100644 index 0000000..94217cd --- /dev/null +++ b/src/ceph/src/ceph-detect-init/ceph_detect_init/debian/__init__.py @@ -0,0 +1,21 @@ +import os +import subprocess + +distro = None +release = None +codename = None + + +def choose_init(): + """Select a init system + + Returns the name of a init system (upstart, sysvinit ...). + """ + # yes, this is heuristics + if os.path.isdir('/run/systemd/system'): + return 'systemd' + if not subprocess.call('. /lib/lsb/init-functions ; init_is_upstart', + shell=True): + return 'upstart' + if os.path.isfile('/sbin/init') and not os.path.islink('/sbin/init'): + return 'sysvinit'