Building native apps

Jamie Strandboge jamie at canonical.com
Wed Feb 18 19:00:03 UTC 2015


On 02/18/2015 09:14 AM, Gábor Paller wrote:
> I ran into one more apparmor issue. My apparmor file currently looks like:
> 
> {
>     "template": "default",
>     "policy_vendor": "ubuntu-snappy",
>     "policy_version": 1.3,
>     "policy_groups": [
>         "networking"
>     ],
>     "read_path": [
> "/dev/video0",
> "/home/ubuntu/"
>    ],
>    "write_path": [
> "/dev/video0",
> "/home/ubuntu/"
>    ]
> }
> 
> I added /home/ubuntu because I want to save output files there, e.g.
> /home/ubuntu/1.jpg.

Apps have their own writable area according to the snappy FHS:
https://developer.ubuntu.com/en/snappy/guides/filesystem-layout/

Specifically:
/home/user/apps/<app-name>/<version>/

You can use this directory without having to add any additional permissions.
SNAPP_APP_USER_DATA_PATH is exported to the environment with this path.

(and as mentioned elsewhere on this list, when phase 1 of hw access is finished
you can also drop the /dev/video0)

> 
> Now I bump the version, install the package but still, the output file cannot be
> saved.
> 
> root at localhost:~/snappy-bin# ./fswebcam.fswebcam -d /dev/video0 2_2.jpg 
> ...
> Error opening file for output: 2_2.jpg                                          
> fopen: Permission denied 
> 
> The thing works perfectly when invoked directly from under the /apps tree.
> 
Can you paste the denial? ('sudo journalctl -k | grep DEN' at the time of the
denial)

Thanks!

> Regards,
> Gabor
> 
> 
> On Tue, Feb 17, 2015 at 7:18 PM, Sergio Schvezov <sergio.schvezov at canonical.com
> <mailto:sergio.schvezov at canonical.com>> wrote:
> 
>     On martes, 17 de febrero de 2015 13h'45:52 UTC, Gábor Paller wrote:
> 
>         Thanks, Sergio, this was a very useful example. Something is still not
>         right on my side, however.
> 
>         I restructured my package according to your example and created an apparmor
>         file. Here is the apparmor file right from the device (to prove that it was
>         correctly packaged and installed :-))
> 
> 
>     Apparmor hooks only run if you bump the version (reinstalling over the same
>     version that was installed will not run the hooks).
> 
> 
> 
> 
>     -- 
>     Sent using Dekko from my Ubuntu device
> 
> 
> 
> 


-- 
Jamie Strandboge                 http://www.ubuntu.com/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/snappy-app-devel/attachments/20150218/940c2eff/attachment.pgp>


More information about the snappy-app-devel mailing list