GijsTimmers / kotnetcli

An easy automated way to log in on Kotnet.
GNU General Public License v3.0
5 stars 4 forks source link

Create a systemd service file to run kotnetcli as a startup script #61

Closed GijsTimmers closed 8 years ago

GijsTimmers commented 9 years ago

When an Arch user boots his computer, systemd services are executed. It would be nice to create one for kotnetcli, for a seamless Kotnet login. An Arch user should run:

sudo systemd enable kotnetcli.service

to enable this startup script.

Ubuntu will be moving to systemd as well, so the core developers won't put effort in creating upstart scripts. That doesn't mean we don't allow these scripts; just open up a pull request if you've created one yourself and we'll gladly merge it.

GijsTimmers commented 8 years ago

Some things to think about before coding:

import distutils.spawn
distutils.spawn.find_executable("kotnetcli")

An alternative is hardcoding the desired location in setup.py, so that kotnetcli is in the same directory on every distro. I'd rather not go with this approach, though.

BROWSER_CONN_CHECK_TIMEOUT = 1.5: limits the amount of time that kotnetcli may use to check whether we're on the Kotnet network; BROWSER_SEND_CRED_TIMEOUT = 5.0: limits the amount of time that kotnetcli may use to send the credentials.

As sending the credentials is usually the 'speed determining step', I propose to put a limit on this step, rather than creating a mechanism that times every part of the login process.

@jovanbulck : please share your thoughts.

jovanbulck commented 8 years ago

Good points; some thoughts:

While accessing systemd from python seems to be fairly easy, I believe launching kotnetcli this early is neither possible, nor desirable:

Summarized, systemd should in my opinion only be used for things that are (i) common for the entire system (i.e. not user-specific), and (ii) relatively lightweight. Currently, kotnetcli is neither of those.

Of course, the user could add kotnetcli to the auto-start applications for his or her specific desktop environments. (As far as I can tell, this would not require additional support from our side. Meaningful exit codes, as discussed in issue #55, will of course help shell-scripting users.)

GijsTimmers commented 8 years ago

Agreed.