diff --git a/doc/man/8/ceph-detect-init.rst b/doc/man/8/ceph-detect-init.rst new file mode 100644 index 0000000000000..aeb3316e5039c --- /dev/null +++ b/doc/man/8/ceph-detect-init.rst @@ -0,0 +1,54 @@ +:orphan: + +============================================================ + ceph-detect-init -- display the init system Ceph should use +============================================================ + +.. program:: ceph-detect-init + +Synopsis +======== + +| **ceph-detect-init** [--verbose] [--use-rhceph] [--default *init*] + +Description +=========== + +:program:`ceph-detect-init` is a utility that prints the init system +Ceph uses. It can be one of ``sysvinit``, ``upstart`` or ``systemd``. +The init system Ceph uses may not be the default init system of the +host operating system. For instance on Debian Jessie, Ceph may use +``sysvinit`` although ``systemd`` is the default. + +If the init system of the host operating system is unknown, return on +error, unless :option:`--default` is specified. + +Options +======= + +.. option:: --use-rhceph + + When an operating system identifies itself as Red Hat, it is + treated as if it was CentOS. With :option:`--use-rhceph` it is + treated as RHEL instead. + +.. option:: --default INIT + + If the init system of the host operating system is unkown, return + the value of *INIT* instead of failing with an error. + +.. option:: --verbose + + Display additional information for debugging. + +Availability +============ + +:program:`ceph-detect-init` is part of Ceph, a massively scalable, open-source, distributed storage system. Please refer to +the Ceph documentation at http://ceph.com/docs for more information. + +See also +======== + +:doc:`ceph-disk `\(8), +:doc:`ceph-deploy `\(8) diff --git a/man/Makefile-server.am b/man/Makefile-server.am index 794275b543172..fe05b2ed0e376 100644 --- a/man/Makefile-server.am +++ b/man/Makefile-server.am @@ -15,6 +15,7 @@ endif if WITH_OSD dist_man_MANS += \ ceph-clsinfo.8 \ + ceph-detect-init.8 \ ceph-disk.8 \ ceph-osd.8 \ osdmaptool.8 diff --git a/src/Makefile.am b/src/Makefile.am index 97505da3ae250..92cb4a206ccf1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -12,6 +12,7 @@ endif include arch/Makefile.am include auth/Makefile.am include brag/Makefile.am +include ceph-detect-init/Makefile.am include crush/Makefile.am include mon/Makefile.am include mds/Makefile.am diff --git a/src/ceph-detect-init/Makefile.am b/src/ceph-detect-init/Makefile.am new file mode 100644 index 0000000000000..72741afe339fb --- /dev/null +++ b/src/ceph-detect-init/Makefile.am @@ -0,0 +1,69 @@ +# +# Copyright (C) 2015 SUSE LINUX GmbH +# Copyright (C) 2015 +# +# Author: Owen Synge +# Author: Loic Dachary +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see ``. +# +check_SCRIPTS += ceph-detect-init/run-tox.sh + +EXTRA_DIST += \ + ceph-detect-init/AUTHORS.rst \ + ceph-detect-init/ceph_detect_init/centos/__init__.py \ + ceph-detect-init/ceph_detect_init/exc.py \ + ceph-detect-init/ceph_detect_init/main.py \ + ceph-detect-init/ceph_detect_init/__init__.py \ + ceph-detect-init/ceph_detect_init/rhel/__init__.py \ + ceph-detect-init/ceph_detect_init/fedora/__init__.py \ + ceph-detect-init/ceph_detect_init/debian/__init__.py \ + ceph-detect-init/ceph_detect_init/suse/__init__.py \ + ceph-detect-init/integration/centos-6.dockerfile \ + ceph-detect-init/integration/debian-wheezy.dockerfile \ + ceph-detect-init/integration/debian-sid.dockerfile \ + ceph-detect-init/integration/debian-jessie.dockerfile \ + ceph-detect-init/integration/opensuse-13.1.dockerfile \ + ceph-detect-init/integration/fedora-21.dockerfile \ + ceph-detect-init/integration/ubuntu-14.04.dockerfile \ + ceph-detect-init/integration/test_main.py \ + ceph-detect-init/integration/opensuse-13.2.dockerfile \ + ceph-detect-init/integration/ubuntu-12.04.dockerfile \ + ceph-detect-init/integration/centos-7.dockerfile \ + ceph-detect-init/integration/ubuntu-15.04.dockerfile \ + ceph-detect-init/integration/debian-squeeze.dockerfile \ + ceph-detect-init/Makefile.am \ + ceph-detect-init/MANIFEST.in \ + ceph-detect-init/README.rst \ + ceph-detect-init/requirements.txt \ + ceph-detect-init/run-tox.sh \ + ceph-detect-init/setup.py \ + ceph-detect-init/test-requirements.txt \ + ceph-detect-init/tests/test_all.py \ + ceph-detect-init/tox.ini + +all-local:: + cd ceph-detect-init ; python setup.py build + +clean-local:: + cd ceph-detect-init ; python setup.py clean ; rm -fr wheelhouse .tox build .coverage *.egg-info + +install-data-local:: + cd ceph-detect-init ; \ + if lsb_release -si | grep --quiet 'Ubuntu\|Debian\|Devuan' ; then \ + options=--install-layout=deb ; \ + else \ + options=--prefix=/usr ; \ + fi ; \ + python setup.py install --root=$(DESTDIR) $$options diff --git a/src/ceph-disk b/src/ceph-disk index a0bf9efc5b217..df05547e7029c 100755 --- a/src/ceph-disk +++ b/src/ceph-disk @@ -262,7 +262,10 @@ def which(executable): for location in locations: executable_path = os.path.join(location, executable) - if os.path.exists(executable_path): + LOG.debug('does ' + executable_path + ' exists ?') + if (os.path.isfile(executable_path) and + os.access(executable_path, os.X_OK)): + LOG.debug('yes, ' + executable_path + ' exists') return executable_path