/[gentoo-x86]/eclass/systemd.eclass
Gentoo

Diff of /eclass/systemd.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.22 Revision 1.23
1# Copyright 1999-2013 Gentoo Foundation 1# Copyright 1999-2013 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/systemd.eclass,v 1.22 2013/03/18 06:29:03 mgorny Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/systemd.eclass,v 1.23 2013/04/13 22:35:53 mgorny Exp $
4 4
5# @ECLASS: systemd.eclass 5# @ECLASS: systemd.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# systemd@gentoo.org 7# systemd@gentoo.org
8# @BLURB: helper functions to install systemd units 8# @BLURB: helper functions to install systemd units
23# systemd_to_myeconfargs 23# systemd_to_myeconfargs
24# autotools-utils_src_configure 24# autotools-utils_src_configure
25# } 25# }
26# @CODE 26# @CODE
27 27
28inherit toolchain-funcs
29
28case ${EAPI:-0} in 30case ${EAPI:-0} in
29 0|1|2|3|4|5) ;; 31 0|1|2|3|4|5) ;;
30 *) die "${ECLASS}.eclass API in EAPI ${EAPI} not yet established." 32 *) die "${ECLASS}.eclass API in EAPI ${EAPI} not yet established."
31esac 33esac
32 34
35DEPEND="virtual/pkgconfig"
36
33# @FUNCTION: _systemd_get_unitdir 37# @FUNCTION: _systemd_get_unitdir
34# @INTERNAL 38# @INTERNAL
35# @DESCRIPTION: 39# @DESCRIPTION:
36# Get unprefixed unitdir. 40# Get unprefixed unitdir.
37_systemd_get_unitdir() { 41_systemd_get_unitdir() {
42 if $(tc-getPKG_CONFIG) --exists systemd; then
43 echo "$($(tc-getPKG_CONFIG) --variable=systemdsystemunitdir systemd)"
44 else
38 echo /usr/lib/systemd/system 45 echo /usr/lib/systemd/system
46 fi
39} 47}
40 48
41# @FUNCTION: systemd_get_unitdir 49# @FUNCTION: systemd_get_unitdir
42# @DESCRIPTION: 50# @DESCRIPTION:
43# Output the path for the systemd unit directory (not including ${D}). 51# Output the path for the systemd unit directory (not including ${D}).
45systemd_get_unitdir() { 53systemd_get_unitdir() {
46 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= 54 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
47 debug-print-function ${FUNCNAME} "${@}" 55 debug-print-function ${FUNCNAME} "${@}"
48 56
49 echo "${EPREFIX}$(_systemd_get_unitdir)" 57 echo "${EPREFIX}$(_systemd_get_unitdir)"
58}
59
60# @FUNCTION: _systemd_get_userunitdir
61# @INTERNAL
62# @DESCRIPTION:
63# Get unprefixed userunitdir.
64_systemd_get_userunitdir() {
65 if $($(tc-getPKG_CONFIG) --exists systemd); then
66 echo "$($(tc-getPKG_CONFIG) --variable=systemduserunitdir systemd)"
67 else
68 echo /usr/lib/systemd/user
69 fi
50} 70}
51 71
52# @FUNCTION: systemd_get_userunitdir 72# @FUNCTION: systemd_get_userunitdir
53# @DESCRIPTION: 73# @DESCRIPTION:
54# Output the path for the systemd user unit directory (not including 74# Output the path for the systemd user unit directory (not including
56# installed. 76# installed.
57systemd_get_userunitdir() { 77systemd_get_userunitdir() {
58 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= 78 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
59 debug-print-function ${FUNCNAME} "${@}" 79 debug-print-function ${FUNCNAME} "${@}"
60 80
61 echo "${EPREFIX}/usr/lib/systemd/user" 81 echo "${EPREFIX}$(_systemd_get_userunitdir)"
82}
83
84# @FUNCTION: _systemd_get_utildir
85# @INTERNAL
86# @DESCRIPTION:
87# Get unprefixed utildir.
88_systemd_get_utildir() {
89 if $($(tc-getPKG_CONFIG) --exists systemd); then
90 echo "$($(tc-getPKG_CONFIG) --variable=systemdutildir systemd)"
91 else
92 echo /usr/lib/systemd
93 fi
62} 94}
63 95
64# @FUNCTION: systemd_get_utildir 96# @FUNCTION: systemd_get_utildir
65# @DESCRIPTION: 97# @DESCRIPTION:
66# Output the path for the systemd utility directory (not including 98# Output the path for the systemd utility directory (not including
68# installed. 100# installed.
69systemd_get_utildir() { 101systemd_get_utildir() {
70 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= 102 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
71 debug-print-function ${FUNCNAME} "${@}" 103 debug-print-function ${FUNCNAME} "${@}"
72 104
73 echo "${EPREFIX}/usr/lib/systemd" 105 echo "${EPREFIX}$(_systemd_get_utildir)"
74} 106}
75 107
76# @FUNCTION: systemd_dounit 108# @FUNCTION: systemd_dounit
77# @USAGE: unit1 [...] 109# @USAGE: unit1 [...]
78# @DESCRIPTION: 110# @DESCRIPTION:
208# See: http://www.freedesktop.org/wiki/Software/systemd/catalog 240# See: http://www.freedesktop.org/wiki/Software/systemd/catalog
209systemd_update_catalog() { 241systemd_update_catalog() {
210 debug-print-function ${FUNCNAME} "${@}" 242 debug-print-function ${FUNCNAME} "${@}"
211 243
212 # Make sure to work on the correct system. 244 # Make sure to work on the correct system.
245
213 local journalctl=${EPREFIX}/usr/bin/journalctl 246 local journalctl=${EPREFIX}/usr/bin/journalctl
214 if [[ -x ${journalctl} ]]; then 247 if [[ -x ${journalctl} ]]; then
215 ebegin "Updating systemd journal catalogs" 248 ebegin "Updating systemd journal catalogs"
216 journalctl --update-catalog 249 journalctl --update-catalog
217 eend $? 250 eend $?

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.23

  ViewVC Help
Powered by ViewVC 1.1.20