Request to allow classic confinement on the mget snap

The snap mget, whose source code is hosted on github https://github.com/weaming/mget, need the permission to save file to the system disk.

@evan, @popey and/or @Wimpress - can someone take a look at this?

Ping @evan, @popey and/or @Wimpress - can someone take a look at this?

I would suggest there is no inherent need for the application to require classic confinement. As an alternative to wget it is a downloader of files from a network source. The destination file is specified by the user and so a more appropriate use in my opinion would be to apply the home interface and allow the application to download into the user’s home folder through that permission.

I’m a new one to snapcraft. Then the question is how to get the permission to write file to user’s HOME path?

Add a plug of type home to your snapcraft.yaml

plugs:
  home:

As such I’m -1 for classic confinement

1 Like

what’s the value after home:?

Nothing, that’s all you need.

Normally you can add attributes, labels or pick the interface type but here everything is inferred.

thx, it’s auto building…

1 Like

failed building . My config : snapcraft.yaml

build log:

Preparing to build mget 
Building mget 
go build -o /build/mget/parts/mget/go/bin/mget github.com/weaming/mget
Staging mget 
Priming mget 
cannot find section 
Failed to update '/build/mget/prime/bin/mget'. Retrying after stripping the .note.go.buildid from the elf file.
Snapping 'mget' ...

Snapped mget_0.1.1_i386.snap
Revoking proxy token...
RUN: /usr/share/launchpad-buildd/slavebin/in-target scan-for-processes --backend=lxd --series=xenial --arch=i386 SNAPBUILD-201868
Scanning for processes to kill in build SNAPBUILD-201868
RUN: /usr/share/launchpad-buildd/slavebin/in-target umount-chroot --backend=lxd --series=xenial --arch=i386 SNAPBUILD-201868
Stopping target for build SNAPBUILD-201868
/usr/lib/python2.7/dist-packages/pylxd/model.py:116: UserWarning: Attempted to set unknown attribute "description" on instance of "Container"
  key, self.__class__.__name__
RUN: /usr/share/launchpad-buildd/slavebin/in-target remove-build --backend=lxd --series=xenial --arch=i386 SNAPBUILD-201868

You’ve included colons indicating that home and network are key-value pairs with no values. You need to define them as just a value, i.e. without the : suffix.

plugs:
  - home
  - network

Edit: On looking closer, you’ve also put plugs at the top-level, not under the app. Try:

apps:
  mget:
    command: mget
    plugs:
    - home
    - network

This is correct syntax, are you sure this is an issue?

the colons surely are an issue … toplevel plugs vs app plugs shouldnt … (though the app plugs are surely cleaner and the desired way)

Fixed it and published to stable channel, happy using it!

It’s a taste of snap, I will not change this snapcraft.yaml file any more, and it will auto build when I push to github.

I did not find any pros for using snap, maybe relevant with my work environment without any ubuntu-core system.

1 Like