diff options
author | Michał Górny <mgorny@gentoo.org> | 2013-07-27 10:36:55 +0000 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2013-07-27 10:36:55 +0000 |
commit | 1c7ac2921f219663d991908e1e6ebd4acfbe8d24 (patch) | |
tree | be4145802540cda2160a645c05c9c56e86660a4f /eclass/systemd.eclass | |
parent | Remove pytest dependency (bug 452546). (diff) | |
download | gentoo-2-1c7ac2921f219663d991908e1e6ebd4acfbe8d24.tar.gz gentoo-2-1c7ac2921f219663d991908e1e6ebd4acfbe8d24.tar.bz2 gentoo-2-1c7ac2921f219663d991908e1e6ebd4acfbe8d24.zip |
Introduce systemd_is_booted() to allow ebuilds to warn consistently for things that require systemd. Bug #478342.
Diffstat (limited to 'eclass/systemd.eclass')
-rw-r--r-- | eclass/systemd.eclass | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/eclass/systemd.eclass b/eclass/systemd.eclass index 166c7beadd13..45666316d4c6 100644 --- a/eclass/systemd.eclass +++ b/eclass/systemd.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/systemd.eclass,v 1.25 2013/04/13 22:49:21 floppym Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/systemd.eclass,v 1.26 2013/07/27 10:36:55 mgorny Exp $ # @ECLASS: systemd.eclass # @MAINTAINER: @@ -252,3 +252,25 @@ systemd_update_catalog() { debug-print "${FUNCNAME}: journalctl not found." fi } + +# @FUNCTION: systemd_is_booted +# @DESCRIPTION: +# Check whether the system was booted using systemd. +# +# This should be used purely for informational purposes, e.g. warning +# user that he needs to use systemd. Installed files or application +# behavior *must not* rely on this. Please remember to check MERGE_TYPE +# to not trigger the check on binary package build hosts! +# +# Returns 0 if systemd is used to boot the system, 1 otherwise. +# +# See: man sd_booted +systemd_is_booted() { + debug-print-function ${FUNCNAME} "${@}" + + [[ -d /run/systemd/system ]] + local ret=${?} + + debug-print "${FUNCNAME}: [[ -d /run/systemd/system ]] -> ${ret}" + return ${ret} +} |