Using git from a program

nothing else? no git-http-fetch for example?

Nope, nothing else at allā€¦ Thatā€™s the only place I can find git-core tooā€¦

ok, so thatā€™s probably what youā€™re missing.

Any idea how I can get it? I am clueless thereā€¦ Currently testing if git-all worksā€¦

it looks like youā€™re not packaging git at all, so start by doing that. Again if you look at the icdiff yaml, look at the ppa part (so you get the latest git), and then in the icdiff part look at stage-packages as well as the aforementioned organise and stage sections.

to get git working, I believe you need the following in your yaml:

parts:
  ...
  some-part:
    ...
    stage-packages:
    - git-core

...
environment:
  GIT_EXEC_PATH: $SNAP/usr/lib/git-core

The ... indicates that thereā€™s a lot that Iā€™ve omitted for brevity.

1 Like

Thatā€™s got it working Daniel, thanks a tonne!

1 Like

@ijohnson I now have it working in confinement devmode and am trying to get it published to stable.

When I change confinement to strict and install using snap install --edge nsm it installs but cannot create/delete/open files as needed (it still works fine when I do snap install --edge --devmode nsm). How do I use the home and removable-media interfaces with strict confinement? Anyone else reading happen to know the answer?

The home and removable-media interfaces should auto-connect if you are running on a classic distro (i.e. not on Ubuntu Core) and if they are specified in your snapcraft.yaml.

You will need to modify your app to something like the following to declare the interfaces:

apps:
  nsm:
    command: nsm
    plugs:
      - home
      - removable-media
    environment:
      LD_LIBRARY_PATH: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pulseaudio
      DISABLE_WAYLAND: '1'
      GIT_TEMPLATE_DIR: $SNAP/usr/share/git-core/templates
      GIT_EXEC_PATH: $SNAP/usr/lib/git-core

you probably want to keep the original LD_LIBRARY_PATH here and extend it instead of replacing ā€¦:

LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pulseaudio

(might need some quoting though)

I can now create/delete/open files as needed when using snap install --edge nsm, however when I try to use git clone/push I am getting for example fatal: unable to access 'https://gitlab.com/pokebots/parchment-site.git/': Could not resolve host: gitlab.com.

It works fine when I use snap install --edge --devmode nsm. Anyone got any suggestions on what might be causing it? Would perhaps classic confinement be the solution?

Edit: Am heading to bed, will try peopleā€™s suggestions in the morning. Otherwise is there a way to get the install pages to tell people to use snap install --edge --devmode nsm?

Nobody has any ideas?

Do you get any denials in journalctl -e --no-pager | grep DENIED when you run it without devmode?

I get Unprivileged users cannot access messages, unless persistent log storage is enabled. Users in the 'systemd-journal' group may always access messages. Both from --edge and from --edge --devmode.

Both output nothing if I run them with sudo.

I have tried using git-all as the stage package rather than git-core and still no love. Anyone got any other suggestions to try? Would it be worth trying classic confinement?

I have had to give up for the moment and have resorted to making an install page suggesting users use snap install --edge --devmode nsm. See the new nsm install page. Is there a way to get the install pages here to have the install command snap install --edge --devmode nsm?

Also nsm seems to have disappeared from the snap store feature? Does anyone know what might have caused that?

did you try adding the network and network-bind plugs to your app entry in snapcraft.yaml ?

@ogra that fixed my problem perfectly. A big thankyou to everyone who has helped me get my first program published in an app store for the first time! If you make websites please do check out nifty site manager.

The last thing I need to work out is how to have nsm be available on stable when publishing from GitHub?

Also how do you get a verified account?

Congratulations :tada:

To release it on stable you can use snapcraft release nsm $REVISION stable where revision number is the revision the store assigned your snap. See snapcraft list-revisions nsm for the revisions available to release. Thereā€™s a doc page here for this process: Releasing your app

Alternatively, you can go to snapcraft.io/nsm/releases and use the GUI there to do the release. See Release management and Using the Snap Store for some examples of how to use the snap store management pages

I suspect I need classic confinement. When I release nsm to stable and install nsm using snap install nsm I can no longer create/modify/delete (hidden) files, configure/use git etcā€¦ Should I put an application in for classic confinement?

Edit: Nevermind, it seems to be working from stable now. Thanks again everyone for your help, itā€™s really appreciated!

3 Likes