Trying to create first snap package for Dart-sdk

Hi, everyone. Complete newbie for snap and packaging in general. I am trying to create a snap package for the Dart Language sdk. It is a simple zip file that you have to unzip and place in a directory with user privileges, and set environment variables. Here is my snapcraft.yaml.

name: dart-sdk
version: 2.0.0
summary: Dart Language SDK
description: This includes the Dart SDK, and adds environment variables for the skd and pub package manager. For more information on the Dart Language, please visit www.dartlang.org

confinement: classic

parts:
dart-sdk:
plugin: dump
source: https://storage.googleapis.com/dart-archive/channels/stable/release/2.0.0/sdk/dartsdk-linux-x64-release.zip

build-packages:
  - wget
  - unzip

once I create the snap, I type in: snap install --classic --dangerous dart-sdk_2.0.0_amd64.snap

This installs the snap under: /snap/dart-sdk/current/dart-sdk, but I have several problems.

  1. The sdk requires root access. I need it to allow for user access without the user doing a chmod.
  2. I need to change the environment variables, but I could not figure this out from the documentation.

Can anyone help? Thanks.

3 Likes

I’m interested in a dart snap as well, any progress?

1 Like

Unfortunately, no. As you can see, I don’t have a single answer, and I even gave a bounty out for it.

1 Like

Joining the request.
Dart snap can be wonderful and after that maybe even flutter snap.

If you are trying to create dart snap with the sdk inside go to my post.

1 Like

First of all, let me ask you to please move to snapcraft 3.0 (https://snapcraft.io/snapcraft) https://docs.snapcraft.io/t/upgrading-snapcraft/11658

You are using classic confinement which you allow you to sudo and such, how is root access instrumented?

There is an environment keyword that can live at the root of the project’s snapcraft.yaml or within the definition of an apps entry. Worth mentioning, this pasted snapcraft.yaml has no apps entry.

1 Like

You are using classic confinement which you allow you to sudo and such, how is root access instrumented?

I want to type in “dart-sdk” and access the file. however, under the current setup, I have to use “sudo dart-sdk.” As an sdk, it requires access without root. Is there a way to set this up so that you don’t need the sudo? Thanks for the other suggestions. I will look into those.

Nothing spikes as wrong in the snapcraft.yaml you shared. I wonder if something is being triggered by the logic in dart itself to require sudo