maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   SailfishOS (https://talk.maemo.org/forumdisplay.php?f=52)
-   -   Script for call log (https://talk.maemo.org/showthread.php?t=92677)

kskoda 2014-02-11 23:36

Script for call log
 
1 Attachment(s)
Hi everyone!

Util we get official call log from Jolla and inspired by answer from kortsi at https://together.jolla.com/question/...lete-call-log/ I decided to create simple script which creates a html table and invokes browser to show it.

Also, I packed everything into tar file, so you can use it as application to show full call log. Icon I used to show this "application" was from my Nokia 808.

To use tar from attachment in this post, copy it to root directory (/) and un-tar as root:
Code:

devel-su
cd /
tar xvf call-log.0.1.tar

Contents of archive is as follows:
Code:

[nemo@localhost Downloads]$ tar -tvf call-log.0.1.tar
drwxrwxr-x nemo/nemo        0 2014-02-12 00:16 home/nemo/.call-log/
-rw-r--r-- nemo/nemo      168 2014-02-12 00:06 usr/share/applications/call-log.desktop
-rwxr-xr-x root/root      1375 2014-02-12 00:14 usr/share/call-log/call-log.sh
-rw-r--r-- root/root      8230 2014-02-11 22:59 usr/share/icons/hicolor/86x86/apps/call-log.png

Note: I am not a developer, so I used my bash/scripting knowledge to made this possible. Probably I didn't everything "by the book", so if I made some mistakes please let me know.

Of course, as usual, use it at your own risk :)

18.02.2014. added new version 0.3.

kortsi 2014-02-12 09:22

Re: Script for call log
 
That's clever. I had no idea it would be so easy to run a script from the app list, and fire up the browser. I will be using this. Thanks!

kskoda 2014-02-12 09:43

Re: Script for call log
 
Next step is to merge phone numbers with contacts database, but this seems a little harder because I have to join 2 databases.
I'm thinking to clone Events and Contacts tables into new sqlite DB, and then merge them with one query.

kskoda 2014-02-18 00:30

Re: Script for call log
 
Just uploaded version 0.3, in which contact names, mobile type and phone number are shown.
Unfortunately, this version needs sudo command/package installed because Contacts database needs privileged user. I downloaded mine from OpenRepos at https://openrepos.net/content/nieldk/sudo

After installation of "sudo", we need to add "nemo" to privileged user in /etc/sudoers with "visudo" command:
Code:

nemo ALL=(ALL) NOPASSWD: ALL

Crescendo 2015-02-03 02:19

Re: Script for call log
 
I just registered just to thank you for this awesome script, love it

Saturn 2015-02-15 08:32

Re: Script for call log
 
Quote:

Originally Posted by kskoda (Post 1413185)
Just uploaded version 0.3, in which contact names, mobile type and phone number are shown.
Unfortunately, this version needs sudo command/package installed because Contacts database needs privileged user. I downloaded mine from OpenRepos at https://openrepos.net/content/nieldk/sudo

After installation of "sudo", we need to add "nemo" to privileged user in /etc/sudoers with "visudo" command:
Code:

nemo ALL=(ALL) NOPASSWD: ALL

This is very good work and thanks for sharing.

If you allow me to suggest a small improvement; instead of giving more rights to nemo (which is kind of a security leak), you could give only to the script the elevated rights.
I didn't look too much into your script, but maybe you'll need to split all the sudo actions into a second script and call it from inside your main script that is executed as user.

Saturn 2015-02-15 11:34

Re: Script for call log
 
3 Attachment(s)
Here are some instructions to achieve the above:

1. Create a sudoers file to give the priviledges to a script:
Code:

visudo -f /etc/sudoers.d/callLogHelper
and add here the following;
Code:

ALL ALL = (root) NOPASSWD: /usr/share/call-log/callLogHelper.sh
2. Create the script in /usr/share/call-log/callLogHelper.sh
and add the two calls that need to be executed as root.

3. in the call-log.sh add the line:
Code:

sudo /usr/share/call-log/callLogHelper.sh
replacing the previous sudo lines.

attached are the files for clarity, just remove the ".txt" at the end.

Hope it helps.

peterleinchen 2015-02-15 19:02

Re: Script for call log
 
Oops, looks like I missed to hit the refresh button. :embarassed: (had that open since the morning and wanted to write this answer but did not find time during carneval ;))

Quote:

Originally Posted by Saturn (Post 1460839)
... If you allow me to suggest a small improvement; instead of giving more rights to nemo (which is kind of a security leak), you could give only to the script the elevated rights.

Second that.
Quote:

... split all the sudo actions into a second script and call it from inside your main script that is executed as user.
Even better.

Never do (smells like sudser package on N900):
Quote:

Originally Posted by kskoda (Post 1413185)
Code:

nemo ALL=(ALL) NOPASSWD: ALL

But maybe
Code:

nemo ALL=(ALL) NOPASSWD: /usr/share/call-log/callLog.sh
possibly add a "*" at the end for parameters to pass.

kskoda 2015-02-16 09:21

Re: Script for call log
 
Thanks to all for comments and suggestions! :)

As my Jolla is currently used by my wife (unfortunately I have to use device with dual SIM without Sailfish :( ), it will take some time to take your suggestions into scripts/tar.

Feel free to update your scripts in your Jollas, or even better when you update and test it send it to me and I'll update initial post.

coderus 2015-02-16 12:53

Re: Script for call log
 
why you want ot execute something with no password? The only you need is
Code:

nemo ALL=(ALL) ALL


All times are GMT. The time now is 20:46.

vBulletin® Version 3.8.8