Skip to content

Move the snap to core24 and replace the unity7 plug - #82

Draft
mapitman wants to merge 1 commit into
mainfrom
chore/snap-core24
Draft

mapitman wants to merge 1 commit into
mainfrom
chore/snap-core24

Conversation

@mapitman

Copy link
Copy Markdown
Owner

Finishes the snap items in #72. Draft: the snap is not built or tested. snapcraft is not available where I wrote this.

Changes

  • plugs: [home, desktop] replaces [home, unity7]. In snapd's interface definitions, both desktop and unity7 allow /usr/bin/xdg-open and the io.snapcraft.Launcher OpenURL/OpenFile D-Bus calls. The unity7 comment says this is duplicated from desktop. desktop is auto-connected. mdview opens the browser through xdg-open (via pkg/browser).
  • Removes environment: HOME: /home/$USER. snapd remaps HOME to the snap's private data directory, which is why the override existed. getTempDir now reads SNAP_REAL_HOME (snapd 2.46+, falls back to HOME), so ~/mdview-temp is still in the real home.
  • base: core24, with platforms: (amd64, arm64, armhf) in place of architectures:. craftctl was already in use.
  • Updates the snap test in main_test.go and CLAUDE.md.

Test before merging

  1. just snap on a machine with snapcraft (core24 build).
  2. sudo snap install --dangerous mdview_*.snap
  3. snap connections mdview shows desktop connected.
  4. mdview README.md opens the default browser, and the file is in ~/mdview-temp.
  5. Repeat with a snap-installed browser (Firefox), since it cannot read /tmp.
  6. Check that an image with a relative path still embeds.

If step 4 fails with a denial, check journalctl -xe | grep DENIED. Adding network and network-bind is the first thing to try; a forum report from 2018 saw an xdg-open failure with desktop that those plugs fixed.

Closes #72

Use the desktop plug instead of the transitional unity7 plug. Both let xdg-open reach snapd's launcher service (checked in snapd's interface definitions), and desktop is the interface unity7 duplicates that access from.

snapd points HOME at the snap's private data directory, which is why the snap forced HOME to /home/$USER. Read SNAP_REAL_HOME for ~/mdview-temp instead, and drop the override. It falls back to HOME outside that case.

Move to base core24, which needs platforms in place of architectures.

Closes #72
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.

Packaging metadata cleanup

1 participant