diff options
author | Michał Górny <mgorny@gentoo.org> | 2013-04-13 22:35:53 +0000 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2013-04-13 22:35:53 +0000 |
commit | 7b28651d53d50481782c2046e7828468205d74e1 (patch) | |
tree | c79e76e0a390e46ba3169957eea38d016c542fdc /eclass/systemd.eclass | |
parent | vanilla-3.8.7 + genpatches-3.8-9 + grsecurity-2.9.1-3.8.7-201304122027 (diff) | |
download | gentoo-2-7b28651d53d50481782c2046e7828468205d74e1.tar.gz gentoo-2-7b28651d53d50481782c2046e7828468205d74e1.tar.bz2 gentoo-2-7b28651d53d50481782c2046e7828468205d74e1.zip |
Use pkg-config to query systemd directories.
Diffstat (limited to 'eclass/systemd.eclass')
-rw-r--r-- | eclass/systemd.eclass | 41 |
1 files changed, 37 insertions, 4 deletions
diff --git a/eclass/systemd.eclass b/eclass/systemd.eclass index 42c373906a0c..f59c26339c2e 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.22 2013/03/18 06:29:03 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/systemd.eclass,v 1.23 2013/04/13 22:35:53 mgorny Exp $ # @ECLASS: systemd.eclass # @MAINTAINER: @@ -25,17 +25,25 @@ # } # @CODE +inherit toolchain-funcs + case ${EAPI:-0} in 0|1|2|3|4|5) ;; *) die "${ECLASS}.eclass API in EAPI ${EAPI} not yet established." esac +DEPEND="virtual/pkgconfig" + # @FUNCTION: _systemd_get_unitdir # @INTERNAL # @DESCRIPTION: # Get unprefixed unitdir. _systemd_get_unitdir() { - echo /usr/lib/systemd/system + if $(tc-getPKG_CONFIG) --exists systemd; then + echo "$($(tc-getPKG_CONFIG) --variable=systemdsystemunitdir systemd)" + else + echo /usr/lib/systemd/system + fi } # @FUNCTION: systemd_get_unitdir @@ -49,6 +57,18 @@ systemd_get_unitdir() { echo "${EPREFIX}$(_systemd_get_unitdir)" } +# @FUNCTION: _systemd_get_userunitdir +# @INTERNAL +# @DESCRIPTION: +# Get unprefixed userunitdir. +_systemd_get_userunitdir() { + if $($(tc-getPKG_CONFIG) --exists systemd); then + echo "$($(tc-getPKG_CONFIG) --variable=systemduserunitdir systemd)" + else + echo /usr/lib/systemd/user + fi +} + # @FUNCTION: systemd_get_userunitdir # @DESCRIPTION: # Output the path for the systemd user unit directory (not including @@ -58,7 +78,19 @@ systemd_get_userunitdir() { has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= debug-print-function ${FUNCNAME} "${@}" - echo "${EPREFIX}/usr/lib/systemd/user" + echo "${EPREFIX}$(_systemd_get_userunitdir)" +} + +# @FUNCTION: _systemd_get_utildir +# @INTERNAL +# @DESCRIPTION: +# Get unprefixed utildir. +_systemd_get_utildir() { + if $($(tc-getPKG_CONFIG) --exists systemd); then + echo "$($(tc-getPKG_CONFIG) --variable=systemdutildir systemd)" + else + echo /usr/lib/systemd + fi } # @FUNCTION: systemd_get_utildir @@ -70,7 +102,7 @@ systemd_get_utildir() { has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= debug-print-function ${FUNCNAME} "${@}" - echo "${EPREFIX}/usr/lib/systemd" + echo "${EPREFIX}$(_systemd_get_utildir)" } # @FUNCTION: systemd_dounit @@ -210,6 +242,7 @@ systemd_update_catalog() { debug-print-function ${FUNCNAME} "${@}" # Make sure to work on the correct system. + local journalctl=${EPREFIX}/usr/bin/journalctl if [[ -x ${journalctl} ]]; then ebegin "Updating systemd journal catalogs" |