Sh-Script can´t write to /usr/share/harbour-mayapp/

I´m developing an App which needs to execute a Shell-Script.

This Shell-Script is located in /usr/share/harbour-mayapp/

and download/create files there. It only works with admin-rights (devel-su) but its executed as defaultuser when launching it over the .desktop-icon-file from the launcher.

How to Set the JailSail Permissions to have rights to write there with defaultuser?

Why?
There’s a reason why /usr/share is not writable by regular users on any Linux distribution. Generally speaking, if your app (or shell script in this case) is run as a normal user, it should write only to the user’s home directory. If it really needs to write somewhere else, it should be run as root.

3 Likes

In addition, if files are written all over the filesystem it is much harder to manually remove files (if one would want / need that) have it one logical place /home/user/myApp/cache OR /tmp

I thought every Sailfish-App can write to its own Directory (like configuration-stuff, tmp…etc), so i learned some new infos.

Ok, thank you for the hint, then i will use this logical place for temporary-files.

[Edit:]
App can´t read content from /tmp/ with Sailjail Enabled, so which Permission is to grant here (Userdirs, Pictures?)

I download to /tmp/ picture and textfile.

I’d recommened you download the files to you apps cache or data directory instead. If your app needs to download stuff for itself, there’s no need to save them in /usr/share. See QStandardPaths Class | Qt Core 5.6 for reference.

Just out of curiosity, what does your app need root privileges for?

Just out of curiosity, what does your app need root privileges for?

It doesn´t need it when i can access the the downloaded image directly into qml.
I do this by this way (Shellscript download image and description-text), because its not so trivial for me to archive that in qml. So this can be seen as workaround until i know how to archive that in qml.

I think QML supports loading image from the Internet, too: Image QML Type | Qt Quick 5.6 Parsing the description text for them could get more difficult, though, but I suppose you could replicate whatever parsing you do in the bash script in QML functions (which are essentially JavaScript).

I send you a PM with the complete Sourcecode so far.