Skip to content

Commit

Permalink
Merge pull request #224 from simondeziel/snap-improvements
Browse files Browse the repository at this point in the history
Reduce snap size
  • Loading branch information
tomponline authored Dec 5, 2023
2 parents a4d31f0 + dfda303 commit aec4908
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1585,13 +1585,18 @@ parts:
- raft
- sqlite
- squashfs-tools-ng
- swtpm
- vim
- virtiofsd
- xfs
- xz
- wrappers
- xtables
- zfs-0-8
- zfs-2-0
- zfs-2-1
- zfs-2-2
- zstd
- lxc
- lxcfs
- criu
Expand All @@ -1603,6 +1608,13 @@ parts:
override-prime: |
set -x
# XXX: remove unneeded files/directories
rm -rf "${CRAFT_PRIME}/lib/python3/dist-packages/*.egg-info/"
rm -rf "${CRAFT_PRIME}/lib/systemd/"
rm -rf "${CRAFT_PRIME}/lib/udev/"
rm -rf "${CRAFT_PRIME}/usr/local/"
rm -rf "${CRAFT_PRIME}/usr/share/"
# Strip binaries (excluding shell scripts)
find "${CRAFT_PRIME}"/bin -type f \
-not -path "${CRAFT_PRIME}/bin/ceph" \
Expand All @@ -1614,11 +1626,13 @@ parts:
-not -path "${CRAFT_PRIME}/bin/xfs_admin" \
-exec strip -s {} +
# Strip all versions of zfs utils
find "${CRAFT_PRIME}"/zfs-*/ -type f \
-exec strip -s {} +
# Strip libraries (excluding python3 scripts)
find "${CRAFT_PRIME}"/lib -type f \
-not -path "${CRAFT_PRIME}/lib/python3/*" \
-not -path "${CRAFT_PRIME}/lib/udev/rules.d/*" \
-not -path "${CRAFT_PRIME}/lib/systemd/system/*" \
-exec strip -s {} +
if [ "$(uname -m)" != "riscv64" ]; then
Expand All @@ -1630,8 +1644,7 @@ parts:
# XXX: look for broken symlinks indicating missing/invalid prime
broken_symlinks="$(find "${CRAFT_PRIME}/" -xtype l \
-not -path "${CRAFT_PRIME}/lxc/config/common.conf.d/*" \
-not -path "${CRAFT_PRIME}/usr/share/doc/uuid-runtime/*")"
-not -path "${CRAFT_PRIME}/lxc/config/common.conf.d/*")"
if [ -n "${broken_symlinks}" ]; then
echo "Found broken symlinks:"
echo "${broken_symlinks}"
Expand Down

0 comments on commit aec4908

Please sign in to comment.