maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   SailfishOS (https://talk.maemo.org/forumdisplay.php?f=52)
-   -   [Announce] Dalvik resetter + Profile changer for Sailfish (https://talk.maemo.org/showthread.php?t=92545)

Schturman 2014-01-29 02:19

[Announce] Dalvik resetter + Profile changer for Sailfish
 
Finally I did it, I'm sure it's far to be perfect, but here is my two first app :D
May will be useful for someone...

1. Alien Dalvik restart - It's just bottom for quick refreshing aliendalvik service.
v0.3
* sudo not needed anymore (used helper from meShell post, thanks)

2. Profile changer - This is a small One click app for changing profile to silent and back to general. You can put this icon where you can quickly find it instead go to lockscreen..

v0.5
* sudo NOT required anymore, this version also update icon on your homescreen (thanks to Coderus).

v0.4
* sudo NOT required anymore, but also can't change icon on your homescreen.

v0.2
* small changes in the commands

http://imagizer.imageshack.us/v2/800...0/838/up8e.jpg http://imagizer.imageshack.us/v2/800...0/607/attf.jpg


Download from my OpenRepos:
1. AlienDalvik restart
2. Profile changer

Beware, use it on your own risk !!!

PS. If someone can create more buty icons, I will repackage them...

szopin 2014-01-29 02:23

Re: [Announce] 2 small and useful (maybe) app...
 
Quote:

Originally Posted by Schturman (Post 1409521)
Finally I did it, I'm sure it's far to be perfect, but here is my two first app :D
May will be useful for someone...

1. Alien Dalvik restart - It's just bottom for quick refreshing aliendalvik service.

2. Profile changer - This is a small One click app for changing profile to silent and back to general. You can put this icon where you can quickly find it instead go to lockscreen..


Both apps requared sudo installed on your phone. You can install it from mer-tools repository. (thanks to rcolistete)
Code:

$ devel-su
# ssu ar mer-tools
# ssu ur
# pkcon refresh
# pkcon install sudo

Also you need add this line: to:
Code:

nemo ALL=(ALL) NOPASSWD: ALL
to: /etc/sudoers (thanks to szopin)


That's all ;)


Download from my OpenRepos:
1. AlienDalvik restart
2. Profile changer

You should not require people to setup their privileged behaviour as yours. You could make your DL one line editable to insert password for those who don't need mer tools repo, or the change to how su is called.

And I seriosuly mean it, if someone follows your instructions just to install profile changer they should be aware they in the meantime allowed all semi-android(just make sailfish wrapper that runs 'sudo x') or other applications easy way in, this really should not be dep for anything

Schturman 2014-01-29 06:02

Re: [Announce] 2 small and useful (maybe) app...
 
Maybe you are right, I'm not developer and not so tech, I just did it because it was easy for me instead creating script with pass asking.
If you think it better to remove this post, I will remove..

PS. can you explain it please:
Quote:

just make sailfish wrapper that runs 'sudo x'

evk 2014-01-29 06:30

Re: [Announce] 2 small and useful (maybe) app...
 
It's not possible to use setuid?

Makeclick 2014-01-29 07:10

Re: [Announce] 2 small and useful (maybe) app...
 
reset alien is very good idea. its not that solid :D. many reboot because of that.

Boxeri 2014-01-29 07:21

Re: [Announce] 2 small and useful (maybe) app...
 
I also think that reset alien dalvik is really good idea! This is something that i do quite regularly on terminal because of connection problems on android side.

meShell 2014-01-29 07:37

Re: [Announce] 2 small and useful (maybe) app...
 
Quote:

Originally Posted by evk (Post 1409538)
It's not possible to use setuid?

setuid( 0 )

It is possible, I am using this "helper" to start my "vpnc" with a GUI-Button, because I did not get a response and did not find any "recommended way to run as privileged" via Sailfis-App.

So there are 3 steps.
  • compile helper program
  • change owner to root:root
  • change permissions to 4755


Example (added example with 2 commands seperated by "&&"):

Code:

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>

int main()
{
  setuid( 0 );
  system( "/usr/sbin/vpnc && /sbin/ip route add xxx.xxx.x.0/24 dev tun0);

  return 0;
}


compiled it with gcc on the phone like this:

Code:

gcc vpnc-helper.c -o vpnc-helper
devel-su
chown root:root vpnc-helper
chmod 4755 vpnc-helper


Schturman 2014-01-29 07:41

Re: [Announce] 2 small and useful (maybe) app...
 
Quote:

Originally Posted by evk (Post 1409538)
It's not possible to use setuid?

I don't really know how to do it...

My first target was to create working rpm file, that can be installable/uninstallable from desktop. Finally I got it...
But... when we press on the icon it run my script as USER and many commands I need to run as ROOT when I already user.. In my first version (sudo not installed yet) I used devel-su many times in one script, for example to run this command (echo silent > /usr/share/jolla-mods/temp) I needed write it like this to get it work:
Code:

echo rootme|devel-su -c sh -c "echo root|devel-su -c echo silent > /usr/share/jolla-mods/temp"
where is rootme = nemo user pass (from dev mode) and root = is root user pass
Too much weird combination :(
Now with sudo I run the same command like this (much easily):
Code:

sudo sh -c "sudo echo silent > /usr/share/jolla-profchanger/temp"
like you can see I used sudo twice because even I have sudo USER can't write to ROOT directory...

Also when and if I will learn how to package with root permission (I don't know what to write to .spec file for this), something like aegis manifest on N9, when after installation by pressing on the icon it will run script automatically as ROOT, it will be nice. But also here I have a problem.. For example this command we need to run as USER:
Code:

dbus-send --type=method_call --dest=com.nokia.profiled /com/nokia/profiled com.nokia.profiled.set_profile string:"silent"
I tried a meany diff variation to get i work under ROOT, but without success :(

Schturman 2014-01-29 08:00

Re: [Announce] 2 small and useful (maybe) app...
 
Quote:

Originally Posted by meShell (Post 1409551)
setuid( 0 )

It is possible, I am using this "helper" to start my "vpnc" with a GUI-Button, because I did not get a response and did not find any "recommended way to run as privileged" via Sailfis-App.

So there are 3 steps.
  • compile helper program
  • change owner to root:root
  • change permissions to 4755


Example (added example with 2 commands seperated by "&&"):

Code:

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>

int main()
{
  setuid( 0 );
  system( "/usr/sbin/vpnc && /sbin/ip route add xxx.xxx.x.0/24 dev tun0);

  return 0;
}

compiled it with gcc on the phone like this:

Code:

gcc vpnc-helper.c -o vpnc-helper
devel-su
chown root:root vpnc-helper
chmod 4755 vpnc-helper


Hmmm, thanks... don't sure If I understand it correctly, I need to create this files like your vpnc-helper to each command that I need to run as ROOT when I under USER?
For example in script included commands:
root command
user command
user command
root command
user command
Each root command is a different command, that mean I need a different my-helper files ?
And how I implement this and how to run this file in the script ?

Schturman 2014-01-29 08:16

Re: [Announce] 2 small and useful (maybe) app...
 
Quote:

Originally Posted by Boxeri (Post 1409549)
I also think that reset alien dalvik is really good idea! This is something that i do quite regularly on terminal because of connection problems on android side.

This is exactly a reason why i did it :) It make me crasy when it happens while driving with waze and i needed to open terminal to restart it :D

PS. if someone can create more beauty icons it will be nice :p


All times are GMT. The time now is 06:26.

vBulletin® Version 3.8.8