Merge lp:~mvo/click/lp1394256-run-user-hooks into lp:click/devel

Proposed by Michael Vogt
Status: Merged
Merged at revision: 550
Proposed branch: lp:~mvo/click/lp1394256-run-user-hooks
Merge into: lp:click/devel
Diff against target: 61 lines (+42/-0)
1 file modified
lib/click/user.vala (+42/-0)
To merge this branch: bzr merge lp:~mvo/click/lp1394256-run-user-hooks
Reviewer Review Type Date Requested Status
Colin Watson Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+242272@code.launchpad.net

Description of the change

This branch ensures that click user hooks are run for all logged in users when click is used with "--all-users".

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:549
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~mvo/click/lp1394256-run-user-hooks/+merge/242272/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/click-devel-ci/121/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/click-devel-vivid-amd64-ci/5
    SUCCESS: http://jenkins.qa.ubuntu.com/job/click-devel-vivid-armhf-ci/5
        deb: http://jenkins.qa.ubuntu.com/job/click-devel-vivid-armhf-ci/5/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/click-devel-vivid-i386-ci/5

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/click-devel-ci/121/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/click/user.vala'
2--- lib/click/user.vala 2014-09-29 13:23:12 +0000
3+++ lib/click/user.vala 2014-11-19 21:33:40 +0000
4@@ -33,8 +33,21 @@
5 * symlinks per user.
6 */
7
8+
9 namespace Click {
10
11+ struct LogindUser {
12+ uint32 uid;
13+ string name;
14+ string ObjectPath;
15+ }
16+
17+ /* the logind dbus interface */
18+ [DBus (name = "org.freedesktop.login1.Manager")]
19+ interface LogindManager : Object {
20+ public abstract LogindUser[] ListUsers () throws IOError;
21+ }
22+
23 /* Pseudo-usernames selected to be invalid as a real username, and alluding
24 * to group syntaxes used in other systems.
25 */
26@@ -596,6 +609,35 @@
27 if (! is_pseudo_user)
28 package_install_hooks (db, package,
29 old_version, version, name);
30+
31+ // run user hooks for all logged in users
32+ if (name == ALL_USERS)
33+ run_user_hooks_for_all_logged_in_users (package, old_version, version);
34+ }
35+
36+ private void
37+ run_user_hooks_for_all_logged_in_users (string package, string? old_version,
38+ string version) throws IOError
39+ {
40+ try {
41+ LogindManager logind = Bus.get_proxy_sync (
42+ BusType.SYSTEM,
43+ "org.freedesktop.login1",
44+ "/org/freedesktop/login1");
45+ var users = logind.ListUsers();
46+ foreach (LogindUser user in users)
47+ {
48+ // FIXME: ideally we would read from /etc/adduser.conf
49+ if(user.uid >= 1000 && user.uid <= 30000)
50+ {
51+ package_install_hooks (db, package,
52+ old_version, version, user.name);
53+ }
54+ }
55+ } catch (Error e) {
56+ warning ("Can not connect to logind");
57+ return;
58+ }
59 }
60
61 private bool

Subscribers

People subscribed via source and target branches

to all changes: