From 6ec7a6a4622f4540e3e32660425f8d59413a87ee Mon Sep 17 00:00:00 2001 From: Miguel Jacq Date: Sun, 9 Feb 2025 09:02:18 +1100 Subject: [PATCH] Add cleanup part to snapcraft --- snap/snapcraft.yaml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 9c489286..6094abb8 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -222,3 +222,30 @@ parts: override-build: | cd meek-client go build -o $SNAPCRAFT_PART_INSTALL/bin/meek-client ./... + + # This part removes all the files in this snap which already exist in + # connected content and base snaps. Since these files will be available + # at runtime from the content and base snaps, they do not need to be + # included in this snap itself. + # + # More info: https://forum.snapcraft.io/t/reducing-the-size-of-desktop-snaps/17280#heading--cleanup-part + # + cleanup: + after: # Make this part run last; list all your other parts here + - onionshare-cli + - onionshare + - tor + - libevent + - obfs4 + - snowflake-client + - meek-client + plugin: nil + build-snaps: # List all content-snaps and base snaps you're using here + - core22 + - go/latest/stable + - gnome-42-2204-sdk + override-prime: | + set -eux + for snap in core22 go/latest/stable gnome-42-2204-sdk; do # List all content-snaps and base snaps you're using here + cd "/snap/$snap/current" && find . -type f,l -exec rm -f "$CRAFT_PRIME/{}" \; + done