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

Diff of /eclass/systemd.eclass

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

Revision 1.30 Revision 1.31
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.30 2013/09/12 11:46:41 mgorny Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/systemd.eclass,v 1.31 2013/10/22 15:14:40 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
214 local ud=$(_systemd_get_unitdir) 214 local ud=$(_systemd_get_unitdir)
215 local destname=${service##*/} 215 local destname=${service##*/}
216 216
217 dodir "${ud}"/"${target}".wants && \ 217 dodir "${ud}"/"${target}".wants && \
218 dosym ../"${service}" "${ud}"/"${target}".wants/"${destname}" 218 dosym ../"${service}" "${ud}"/"${target}".wants/"${destname}"
219}
220
221# @FUNCTION: systemd_enable_ntpunit
222# @USAGE: <NN-name> <service>...
223# @DESCRIPTION:
224# Add an NTP service provider to the list of implementations
225# in timedated. <NN-name> defines the newly-created ntp-units.d priority
226# and name, while the remaining arguments list service units that will
227# be added to that file.
228#
229# Uses doins, thus it is fatal in EAPI 4 and non-fatal in earlier
230# EAPIs.
231#
232# Doc: http://www.freedesktop.org/wiki/Software/systemd/timedated/
233systemd_enable_ntpunit() {
234 debug-print-function ${FUNCNAME} "${@}"
235 if [[ ${#} -lt 2 ]]; then
236 die "Usage: systemd_enable_ntpunit <NN-name> <service>..."
237 fi
238
239 local ntpunit_name=${1}
240 local services=( "${@:2}" )
241
242 if [[ ${ntpunit_name} != [0-9][0-9]-* ]]; then
243 die "ntpunit.d file must be named NN-name where NN are digits."
244 elif [[ ${ntpunit_name} == *.list ]]; then
245 die "The .list suffix is appended implicitly to ntpunit.d name."
246 fi
247
248 local unitdir=$(systemd_get_unitdir)
249 local s
250 for s in "${services[@]}"; do
251 if [[ ! -f "${D}${unitdir}/${s}" ]]; then
252 die "ntp-units.d provider ${s} not installed (yet?) in \${D}."
253 fi
254 echo "${s}" >> "${T}"/${ntpunit_name}.list
255 done
256
257 (
258 insinto "$(_systemd_get_utildir)"/ntp-units.d
259 doins "${T}"/${ntpunit_name}.list
260 )
261 local ret=${?}
262
263 rm "${T}"/${ntpunit_name}.list || die
264
265 return ${ret}
219} 266}
220 267
221# @FUNCTION: systemd_with_unitdir 268# @FUNCTION: systemd_with_unitdir
222# @USAGE: [<configure-option-name>] 269# @USAGE: [<configure-option-name>]
223# @DESCRIPTION: 270# @DESCRIPTION:

Legend:
Removed from v.1.30  
changed lines
  Added in v.1.31

  ViewVC Help
Powered by ViewVC 1.1.20