summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2013-10-22 15:14:40 +0000
committerMichał Górny <mgorny@gentoo.org>2013-10-22 15:14:40 +0000
commit018b1a09bc013575aa2852dbc90cd240b970e131 (patch)
treecab3e785aac5056c9cf163bd670df702d417a61b /eclass
parentsci-libs/bmrblib: Verion Bump (diff)
downloadgentoo-2-018b1a09bc013575aa2852dbc90cd240b970e131.tar.gz
gentoo-2-018b1a09bc013575aa2852dbc90cd240b970e131.tar.bz2
gentoo-2-018b1a09bc013575aa2852dbc90cd240b970e131.zip
Add systemd_enable_ntpunit wrt bug #458132.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/ChangeLog5
-rw-r--r--eclass/systemd.eclass49
2 files changed, 52 insertions, 2 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog
index 0332ff98f1e1..c600d57a2ef5 100644
--- a/eclass/ChangeLog
+++ b/eclass/ChangeLog
@@ -1,6 +1,9 @@
# ChangeLog for eclass directory
# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1029 2013/10/20 21:45:31 pesa Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1030 2013/10/22 15:14:40 mgorny Exp $
+
+ 22 Oct 2013; Michał Górny <mgorny@gentoo.org> systemd.eclass:
+ Add systemd_enable_ntpunit wrt bug #458132.
20 Oct 2013; Davide Pesavento <pesa@gentoo.org> qt4-build.eclass:
Updates from qt overlay: drop USE="c++0x" from 4.8.5 and later versions; warn
diff --git a/eclass/systemd.eclass b/eclass/systemd.eclass
index c4623fba0fd2..c2dafbfc30c3 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.30 2013/09/12 11:46:41 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/systemd.eclass,v 1.31 2013/10/22 15:14:40 mgorny Exp $
# @ECLASS: systemd.eclass
# @MAINTAINER:
@@ -218,6 +218,53 @@ systemd_enable_service() {
dosym ../"${service}" "${ud}"/"${target}".wants/"${destname}"
}
+# @FUNCTION: systemd_enable_ntpunit
+# @USAGE: <NN-name> <service>...
+# @DESCRIPTION:
+# Add an NTP service provider to the list of implementations
+# in timedated. <NN-name> defines the newly-created ntp-units.d priority
+# and name, while the remaining arguments list service units that will
+# be added to that file.
+#
+# Uses doins, thus it is fatal in EAPI 4 and non-fatal in earlier
+# EAPIs.
+#
+# Doc: http://www.freedesktop.org/wiki/Software/systemd/timedated/
+systemd_enable_ntpunit() {
+ debug-print-function ${FUNCNAME} "${@}"
+ if [[ ${#} -lt 2 ]]; then
+ die "Usage: systemd_enable_ntpunit <NN-name> <service>..."
+ fi
+
+ local ntpunit_name=${1}
+ local services=( "${@:2}" )
+
+ if [[ ${ntpunit_name} != [0-9][0-9]-* ]]; then
+ die "ntpunit.d file must be named NN-name where NN are digits."
+ elif [[ ${ntpunit_name} == *.list ]]; then
+ die "The .list suffix is appended implicitly to ntpunit.d name."
+ fi
+
+ local unitdir=$(systemd_get_unitdir)
+ local s
+ for s in "${services[@]}"; do
+ if [[ ! -f "${D}${unitdir}/${s}" ]]; then
+ die "ntp-units.d provider ${s} not installed (yet?) in \${D}."
+ fi
+ echo "${s}" >> "${T}"/${ntpunit_name}.list
+ done
+
+ (
+ insinto "$(_systemd_get_utildir)"/ntp-units.d
+ doins "${T}"/${ntpunit_name}.list
+ )
+ local ret=${?}
+
+ rm "${T}"/${ntpunit_name}.list || die
+
+ return ${ret}
+}
+
# @FUNCTION: systemd_with_unitdir
# @USAGE: [<configure-option-name>]
# @DESCRIPTION: