dbus: catch new services without reboot (#20871)

DBus daemon now loads its config from /run/current-system/dbus.
Reloading the daemon makes it re-read that file and catch the updates
after a system upgrade.
This commit is contained in:
Guillaume Maudoux 2017-01-27 14:46:13 +01:00 committed by Franz Pletz
parent da1cd49747
commit 29667f639c

View File

@ -31,9 +31,6 @@ let
cp ${pkgs.dbus.out}/share/dbus-1/{system,session}.conf $out
# avoid circular includes
sed -ri 's@(<include ignore_missing="yes">/etc/dbus-1/(system|session)\.conf</include>)@<!-- \1 -->@g' $out/{system,session}.conf
# include by full path
sed -ri "s@/etc/dbus-1/(system|session)-@$out/\1-@" $out/{system,session}.conf
@ -98,11 +95,6 @@ in
environment.systemPackages = [ pkgs.dbus.daemon pkgs.dbus ];
environment.etc = singleton
{ source = configDir;
target = "dbus-1";
};
users.extraUsers.messagebus = {
uid = config.ids.uids.messagebus;
description = "D-Bus system message bus daemon user";
@ -134,8 +126,8 @@ in
reloadIfChanged = true;
restartTriggers = [ configDir ];
serviceConfig.ExecStart = [
""
"${lib.getBin pkgs.dbus}/bin/dbus-daemon --config-file=${configDir}/system.conf ${daemonArgs}"
"" # Default dbus.service has two entries, we need to override both.
"${lib.getBin pkgs.dbus}/bin/dbus-daemon --config-file=/run/current-system/dbus/system.conf ${daemonArgs}"
];
};
@ -145,13 +137,17 @@ in
reloadIfChanged = true;
restartTriggers = [ configDir ];
serviceConfig.ExecStart = [
""
"${lib.getBin pkgs.dbus}/bin/dbus-daemon --config-file=${configDir}/session.conf ${daemonArgs}"
"" # Default dbus.service has two entries, we need to override both.
"${lib.getBin pkgs.dbus}/bin/dbus-daemon --config-file=/run/current-system/dbus/session.conf ${daemonArgs}"
];
};
sockets.dbus.wantedBy = mkIf cfg.socketActivated [ "sockets.target" ];
};
environment.pathsToLink = [ "/etc/dbus-1" "/share/dbus-1" ];
system.extraSystemBuilderCmds = ''
ln -s ${configDir} $out/dbus
'';
};
}