Hi all;<div><br></div><div>Here's the small helper we use in Endless; ideally we can modify it for future use in xdg-app.</div><div><br></div><div><a href="https://github.com/endlessm/eos-app-manager">https://github.com/endlessm/eos-app-manager</a><br></div><div><br></div><div>Ciao,</div><div> Emmanuele.<span></span></div><div><br><br>On Friday, 8 January 2016, Emmanuele Bassi <<a href="mailto:ebassi@gmail.com">ebassi@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi;<br>
<br>
On 8 January 2016 at 13:26, Richard Hughes <<a href="javascript:;" onclick="_e(event, 'cvml', 'hughsient@gmail.com')">hughsient@gmail.com</a>> wrote:<br>
> Hi all,<br>
><br>
> For gnome-software we need to do all actions with user permissions.<br>
> We'd then need a privileged helper to install applications<br>
> system-wide. Several thoughts come to mind:<br>
><br>
> 1. Just reuse PackageKit: I think this is using a steamroller to crack<br>
> a nut, and also ties us to a lot of the traditional problems, and<br>
> would also need us to support mixed-backend functionality<br>
> 2. Just use a pkexec binary: I think this would work, but doesn't give<br>
> us any of the progress information we need for a GUI client (i.e. is<br>
> fire-and-forget)<br>
> 3. Create a small daemon (possibly living in xdg-app git) which just<br>
> auto-launches, claims a bus name systemwide, does the operation and<br>
> then quits.<br>
<br>
At Endless we have a daemon like this. It used to be way too clever,<br>
until we dropped 99% of it and made it fairly dumb.<br>
<br>
The only things it does are:<br>
<br>
 * sit on the system bus via auto-activation<br>
 * use polkit to do privilege escalation<br>
 * install<br>
 * update<br>
 * remove<br>
<br>
There are added things, like running scripts and managing our own<br>
bundles - but the idea is to move it to use the xdg-app API as well<br>
while we transition to xdg-app.<br>
<br>
Currently the daemon is not open, but we've been meaning to make it<br>
public it up for a while, given its reduced scope. I'll try and see if<br>
I can get it done ASAP.<br>
<br>
> Option 3 makes most sense in my head, but does need the usual GDBus<br>
> overhead, XML interface files, dbus permission file, etc. We'd also<br>
> have to decide some key things like:<br>
><br>
> * default policy of who can do what: PK makes this even harder by<br>
> allowing "signed" applications to be installed without the admin<br>
> password<br>
<br>
We have a default policy that allows "admin" users to install without<br>
a password, and that has worked fairly well for us.<br>
<br>
> * do we support more than one operation to be done in parallel: making<br>
> things simple means we have to just have a percentage property without<br>
> worrying about "transactions" and things happening in threads<br>
<br>
We really, really do want operations to run in parallel as much as<br>
possible. Users already try to install/update/remove multiple apps.<br>
One of the reasons for the simplification of our privileged installer<br>
daemon was that it made parallel operations really easy to handle.<br>
<br>
You need a transaction object on the bus, sure; but you don't need<br>
weird queues, since the object will be kept alive until the operation<br>
is either terminated or cancelled.<br>
<br>
> * what should we log, and where?<br>
<br>
We use the systemd journal, but we can also log out to stderr when debugging.<br>
<br>
> * do we support adding and removing remotes system-wide as well, if so, policy?<br>
> * who can cancel operations: just the current user/should operations<br>
> be cancelled if the session also goes away?<br>
<br>
We already cancel any pending transaction if the sender goes away,<br>
which is fairly simple to do.<br>
<br>
Ciao,<br>
 Emmanuele.<br>
<br>
--<br>
<a href="https://www.bassi.io" target="_blank">https://www.bassi.io</a><br>
[@] ebassi [@<a href="http://gmail.com" target="_blank">gmail.com</a>]<br>
</blockquote></div><br><br>-- <br><a href="https://www.bassi.io" target="_blank">https://www.bassi.io</a><br>[@] ebassi [@<a href="http://gmail.com" target="_blank">gmail.com</a>]<br>