summaryrefslogtreecommitdiffstats
path: root/meta-phosphor/classes/obmc-phosphor-dbus-service.bbclass
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@fuzziesquirrel.com>2016-08-15 22:35:58 -0400
committerPatrick Williams <patrick@stwcx.xyz>2016-09-06 01:55:34 +0000
commit58700d1e5e5a168cada948fce2fb26937e95fc3e (patch)
tree05d37269ffe3c88718a7ac08ca416e08928594ac /meta-phosphor/classes/obmc-phosphor-dbus-service.bbclass
parent6b136a4377c420f8c6d46dca6f07a6d3bf471bae (diff)
downloadtalos-openbmc-58700d1e5e5a168cada948fce2fb26937e95fc3e.tar.gz
talos-openbmc-58700d1e5e5a168cada948fce2fb26937e95fc3e.zip
Allow package wide user specificiation
Allow the user to be specified package wide or per unit. Change-Id: I19a56001bd2115462f132c3079690c4b2d0a5ddf Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'meta-phosphor/classes/obmc-phosphor-dbus-service.bbclass')
-rw-r--r--meta-phosphor/classes/obmc-phosphor-dbus-service.bbclass37
1 files changed, 26 insertions, 11 deletions
diff --git a/meta-phosphor/classes/obmc-phosphor-dbus-service.bbclass b/meta-phosphor/classes/obmc-phosphor-dbus-service.bbclass
index 4066c6c1a..c5d50d002 100644
--- a/meta-phosphor/classes/obmc-phosphor-dbus-service.bbclass
+++ b/meta-phosphor/classes/obmc-phosphor-dbus-service.bbclass
@@ -21,10 +21,10 @@
# dbus activation file with the same name with .service appended.
# If one is found, it added to the package and used verbatim.
# If it is not found, a default one is generated and used.
-
-# DBUS_USER_${PN}_org.openbmc.Foo = "dbususer"
-# The user a service should be configured to run as. If unspecified
-# no User property is added.
+#
+# DBUS_USER_${PN} = "dbususer"
+# DBUS_USER_${unit} = "dbususer"
+# The user a service/pkg should be configured to run as.
inherit dbus-dir
@@ -77,11 +77,19 @@ python dbus_do_postinst() {
python() {
searchpaths = d.getVar('FILESPATH', True)
+ def get_user(d, service, pkg):
+ user = d.getVar(
+ 'DBUS_USER_%s' % service, True)
+ if user is None:
+ user = d.getVar(
+ 'DBUS_USER_%s' % pkg, True) or 'root'
+ return user
+
+
def add_dbus_config(d, service, pkg):
path = bb.utils.which(searchpaths, '%s.conf' % service)
if not os.path.isfile(path):
- user = d.getVar(
- 'DBUS_USER_%s_%s' % (pkg, service), True) or 'root'
+ user = get_user(d, service, pkg)
set_append(d, '_DEFAULT_DBUS_CONFIGS', '%s:%s' % (
service, user))
else:
@@ -100,18 +108,25 @@ python() {
def add_sd_user(d, prefix, service, pkg):
+ var = None
user = d.getVar(
- 'DBUS_USER_%s_%s' % (pkg, service), True)
+ 'DBUS_USER_%s' % service, True)
if user:
- set_append(d, 'SYSTEMD_USER_%s_%s%s.service' % (
- pkg, prefix, service), user)
+ var = 'SYSTEMD_USER_%s%s.service' % (prefix, service)
+ else:
+ user = d.getVar(
+ 'DBUS_USER_%s' % pkg, True)
+ if user:
+ var = 'SYSTEMD_USER_%s' % pkg
+
+ if var and user not in listvar_to_list(d, var):
+ set_append(d, var, user)
def add_dbus_activation(d, service, pkg):
path = bb.utils.which(searchpaths, '%s.service' % service)
if not os.path.isfile(path):
- user = d.getVar(
- 'DBUS_USER_%s_%s' % (pkg, service), True) or 'root'
+ user = get_user(d, service, pkg)
set_append(d, '_DEFAULT_DBUS_ACTIVATIONS', '%s:%s' % (
service, user))
else:
OpenPOWER on IntegriCloud