commit: a3a1544a8631af9e79bddb408c29f2c4f5b1af55
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Jun 1 00:14:59 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jun 11 06:11:59 2024 +0000
URL:
https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=a3a1544a
Add the has_openrc() and has_systemd() functions
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
functions.sh | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/functions.sh b/functions.sh
index ec1f339..9736747 100644
--- a/functions.sh
+++ b/functions.sh
@@ -344,6 +344,24 @@ get_bootparam()
return 1
)
+#
+# Determines whether OpenRC appears to be operational as a service manager in
+# the context of the present root filesystem namespace.
+#
+has_openrc()
+{
+ test -d /run/openrc
+}
+
+#
+# Determines whether systemd appears to be operational as a service manager in
+# the context of the present root filesystem namespace.
+#
+has_systemd()
+{
+ test -d /run/systemd
+}
+
#
# Determines whether the first parameter is a valid identifier (variable name).
#