We have moved to a new Sailfish OS Forum. Please start new discussions there.
2

Situations app to stop Alien-dalvik via a command [answered]

asked 2020-06-20 11:45:00 +0300

branja6 gravatar image

Ahoy, sailors

I've searched everywhere, and I couldn't find a way to do it. I would like to set the Situations app to stop Alien Dalvik when I go into an airplane mode. It should be quite easy, I guess, but I am a bit of noob. It seems that the Situations app can use custom commands, which is excellent. The only problem I have is that I have to stop Alien Dalvik via this command "systemctl stop aliendalvik.service", and it only works if I type it with root privileges.

Any help is appreciated.

Thx in advance

The question has been closed for the following reason "the question is answered, an answer was accepted" by olf
close date 2020-06-20 23:06:08.409437

add a comment

3 Answers

Sort by » oldest newest most voted
3

answered 2020-06-20 14:32:24 +0300

pawel gravatar image

download dalvik stop from openrepos. then use situatons to start an app and select dalvik stop

you dont even need cmdline for that

i have set it up like that, in my case trigger is a time, but ...

link

Comments

That is amazing! I will try it out right away. Thanks a ton, Pawel.

branja6 ( 2020-06-20 15:09:10 +0300 )
add a comment
3

answered 2020-06-20 22:54:58 +0300

ziellos gravatar image

The academic answer would be to install and configure sudo. A bit more work than installing an app, but you have to do it only once.

When configured correctly, user nemo may execute privileged commands such as systemctl to control services. You can then use such commands in Situations or in any other context. No clear-text passwords, no security risk.

link

Comments

So far, I know only how to install sudo, but to configure it to get what I want is still a mystery to me. :) If you care to explain, I'm all ears. @ziellos

branja6 ( 2020-06-20 23:31:20 +0300 )

All I did after the sudo installation was to include entries for the desired privileged commands in /etc/sudoers:

nemo     ALL = NOPASSWD: /usr/bin/dbus-send
nemo     ALL = NOPASSWD: /bin/systemctl
nemo     ALL = NOPASSWD: /usr/bin/connmanctl

With these settings, the Situations app is able to control flight mode, wifi, and systemd services via shell scripts.

ziellos ( 2020-06-23 11:08:32 +0300 )

Thank you very much for this! Next stop for me: learning how to make shell scripts.

branja6 ( 2020-06-23 11:28:05 +0300 )

If you only want to start/stop Alien Dalvik using Situations, the following commands should be sufficient (with a working sudo configuration):

Stop service:

sudo /bin/systemctl stop aliendalvik.service

Start service:

sudo /bin/systemctl start aliendalvik.service

However, creating small shell scripts that are triggered by Situations switching may be preferable because you can then simply extend the scripts to add functionality.

ziellos ( 2020-06-23 11:51:40 +0300 )
add a comment
2

answered 2020-06-20 15:35:03 +0300

updated 2020-06-20 15:35:56 +0300

Thanks @pawel there is still lots to discover on openrepos ;)

But does really every command line needs an 'app'?

@branja6
You may achieve it via

echo myPasswd | devel-su -c systemctl stop aliendalvik

This is a bit of security concerning but if you put into an executable sh script and hide it somewhere under /bin ? hmm (I did it a few times on N900)

link

Comments

Excellent! I will tamper with this code as well. Thank you very much, Peter.

branja6 ( 2020-06-20 15:45:26 +0300 )
add a comment

Question tools

Follow
3 followers

Stats

Asked: 2020-06-20 11:45:00 +0300

Seen: 469 times

Last updated: Jun 20 '20