summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gilbert <floppym@gentoo.org>2016-10-09 13:40:43 -0400
committerMike Gilbert <floppym@gentoo.org>2016-10-09 13:41:13 -0400
commitb480b389a39dc6b8d9cdaf99c0e554ab82ef5ca8 (patch)
treef3280d3a6836c0ff08d5167b8a9a7af7c124f55b /eclass/systemd.eclass
parentprofiles: mask www-plugins/kaffeine-mozilla-plugin for removal (diff)
downloadgentoo-b480b389a39dc6b8d9cdaf99c0e554ab82ef5ca8.tar.gz
gentoo-b480b389a39dc6b8d9cdaf99c0e554ab82ef5ca8.tar.bz2
gentoo-b480b389a39dc6b8d9cdaf99c0e554ab82ef5ca8.zip
systemd.eclass: Add systemd_tmpfiles_create function
Bug: https://bugs.gentoo.org/462118
Diffstat (limited to 'eclass/systemd.eclass')
-rw-r--r--eclass/systemd.eclass21
1 files changed, 21 insertions, 0 deletions
diff --git a/eclass/systemd.eclass b/eclass/systemd.eclass
index f6cc004257c0..b00668e023a7 100644
--- a/eclass/systemd.eclass
+++ b/eclass/systemd.eclass
@@ -398,3 +398,24 @@ systemd_is_booted() {
debug-print "${FUNCNAME}: [[ -d /run/systemd/system ]] -> ${ret}"
return ${ret}
}
+
+# @FUNCTION: systemd_tmpfiles_create
+# @USAGE: <tmpfilesd> ...
+# @DESCRIPTION:
+# Invokes systemd-tmpfiles --create with given arguments.
+# Does nothing if ROOT != / or systemd-tmpfiles is not in PATH.
+# This function should be called from pkg_postinst.
+#
+# Generally, this function should be called with the names of any tmpfiles
+# fragments which have been installed, either by the build system or by a
+# previous call to systemd_dotmpfilesd. This ensures that any tmpfiles are
+# created without the need to reboot the system.
+systemd_tmpfiles_create() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ [[ ${EBUILD_PHASE} == postinst ]] || die "${FUNCNAME}: Only valid in pkg_postinst"
+ [[ ${#} -gt 0 ]] || die "${FUNCNAME}: Must specify at least one filename"
+ [[ ${ROOT} == / ]] || return 0
+ type systemd-tmpfiles &> /dev/null || return 0
+ systemd-tmpfiles --create "${@}"
+}