summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2013-07-27 10:36:55 +0000
committerMichał Górny <mgorny@gentoo.org>2013-07-27 10:36:55 +0000
commitaa4bbf7270f930d9b88babad4890a94459952e0a (patch)
treea3a5946f57ea9c2e6a95cd52102c180cee566860 /eclass
parentRemove pytest dependency (bug 452546). (diff)
downloadhistorical-aa4bbf7270f930d9b88babad4890a94459952e0a.tar.gz
historical-aa4bbf7270f930d9b88babad4890a94459952e0a.tar.bz2
historical-aa4bbf7270f930d9b88babad4890a94459952e0a.zip
Introduce systemd_is_booted() to allow ebuilds to warn consistently for things that require systemd. Bug #478342.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/ChangeLog6
-rw-r--r--eclass/systemd.eclass24
2 files changed, 28 insertions, 2 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog
index 287193ab0ede..f14179522ab5 100644
--- a/eclass/ChangeLog
+++ b/eclass/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog for eclass directory
# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.895 2013/07/27 10:18:13 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.896 2013/07/27 10:36:55 mgorny Exp $
+
+ 27 Jul 2013; Michał Górny <mgorny@gentoo.org> systemd.eclass:
+ Introduce systemd_is_booted() to allow ebuilds to warn consistently for
+ things that require systemd. Bug #478342.
27 Jul 2013; Michał Górny <mgorny@gentoo.org> subversion.eclass:
Export working copy information after the update rather than in
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}
+}