Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Snap build #181

Merged
merged 3 commits into from
May 21, 2021
Merged

Add support for Snap build #181

merged 3 commits into from
May 21, 2021

Conversation

gjolly
Copy link
Contributor

@gjolly gjolly commented May 4, 2021

Add a snapcraft.yaml file to configure the snapcraft build.

To build and install the snap (assuming snapcraft utility is installed):

snapcraft
sudo snap install --classic --dangerous gmailctl_$(git describe --tags --abbrev=0)-$(git rev-parse --short HEAD)_amd64.snap

The snap requires "classic" isolation because it's relying on config files in $HOME.

Add a snapcraft.yaml file to configure the snapcraft build.
Copy link
Owner

@mbrt mbrt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with how snap works. How do users use it? Could you update the README if this is another way to install gmailctl?

snap/snapcraft.yaml Show resolved Hide resolved
"classic" confinement requires approval to be pushed to the snap store
and it was possible (using a few hacks) to use strict confinement.

List of "hacks":
 - use xdg-open to open the an editor outside of the snap container
 - use a wrapper around xdg-open to wait for a user input
 - make $TMPDIR point to $SNAP_USER_DATA to allow xdg-open to open the
   config file
 - use homeishome-launcher to make sure Go returns the right path when
   using usr.HomeDir
@gjolly
Copy link
Contributor Author

gjolly commented May 6, 2021

I just pushed an other commit to add the documentation to the README and use strict confinement. I tried to document snapcraft.yaml as much as I could so anyone could understand what is going on.
I also pushed it to the store if you want to try it: https://snapcraft.io/gmailctl

Copy link
Owner

@mbrt mbrt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes and sorry for the delay in responding! We're almost there.

@@ -0,0 +1,11 @@
#!/bin/bash
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this script is used only by snap, could you move it under the snap directory?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My turn to apology for the delay 😄 . I moved it under snap/local. I couldn't move it under snap directly, it was raising this error:

The 'snap' directory is meant specifically for snapcraft, but it contains the following non-snapcraft-related paths, which is unsupported and will cause unexpected behavior:
- editor-wrapper.sh

If you must store these files within the 'snap' directory, move them to 'snap/local', which is ignored by snapcraft.

snap/snapcraft.yaml Show resolved Hide resolved
@mbrt
Copy link
Owner

mbrt commented May 21, 2021

Thank you @gjolly!

@mbrt mbrt merged commit caef37b into mbrt:master May 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants