new attempt for purging unnecessary libs

This commit is contained in:
Greg DiCristofaro 2023-08-01 20:31:03 -04:00
parent c3a3f7ddbc
commit c83ac1b587

View File

@ -16,8 +16,6 @@
# Snap uses assertions to digitally sign snaps (https://snapcraft.io/docs/assertions). Otherwise, snaps need to be installed with the `--dangerous` flag # Snap uses assertions to digitally sign snaps (https://snapcraft.io/docs/assertions). Otherwise, snaps need to be installed with the `--dangerous` flag
# it would be best to install autopsy with `sudo snap install --dangerous autopsy` and then connect all super-priveleged interfaces or `sudo snap install --dangerous --devmode autopsy`` # it would be best to install autopsy with `sudo snap install --dangerous autopsy` and then connect all super-priveleged interfaces or `sudo snap install --dangerous --devmode autopsy``
# yaml reference here: https://snapcraft.io/docs/snapcraft-yaml-reference # yaml reference here: https://snapcraft.io/docs/snapcraft-yaml-reference
# sample yaml files here: https://github.com/videolan/vlc/blob/master/extras/package/snap/snapcraft.yaml, https://github.com/canonical/firefox-snap/blob/stable/snapcraft.yaml # sample yaml files here: https://github.com/videolan/vlc/blob/master/extras/package/snap/snapcraft.yaml, https://github.com/canonical/firefox-snap/blob/stable/snapcraft.yaml
name: autopsy name: autopsy
@ -50,6 +48,12 @@ plugs:
interface: browser-support interface: browser-support
allow-sandbox: true allow-sandbox: true
slots:
dbus-daemon:
interface: dbus
bus: session
name: org.sleuthkit.autopsy
apps: apps:
autopsy: autopsy:
# more on env vars here: https://snapcraft.io/docs/environment-variables # more on env vars here: https://snapcraft.io/docs/environment-variables
@ -74,35 +78,37 @@ apps:
GTK_USE_PORTAL: 1 GTK_USE_PORTAL: 1
command: autopsy/bin/autopsywrapper.sh command: autopsy/bin/autopsywrapper.sh
# More gnome info here: https://snapcraft.io/docs/gnome-extension # More gnome info here: https://snapcraft.io/docs/gnome-extension
extensions: [ gnome ] extensions: [gnome]
common-id: org.sleuthkit.autopsy common-id: org.sleuthkit.autopsy
plugs: plugs:
# taken from https://snapcraft.io/docs/supported-interfaces # taken from https://snapcraft.io/docs/supported-interfaces
- audio-playback - audio-playback
- block-devices - block-devices
- browser-sandbox - browser-sandbox
- desktop - desktop
- desktop-launch - desktop-launch
- desktop-legacy - desktop-legacy
- dm-crypt - dm-crypt
- fuse-support - fuse-support
- gsettings - gsettings
- hardware-observe - hardware-observe
- home - home
- hugepages-control - hugepages-control
- kernel-crypto-api - kernel-crypto-api
- mount-observe - mount-observe
- network - network
- network-bind - network-bind
- network-observe - network-observe
- network-setup-observe - network-setup-observe
- network-status - network-status
- opengl - opengl
- optical-drive - optical-drive
- removable-media - removable-media
- system-files-autopsy - system-files-autopsy
- system-files-hugepages - system-files-hugepages
- system-observe - system-observe
slots:
- dbus-daemon
parts: parts:
sleuthkit: sleuthkit:
@ -114,77 +120,91 @@ parts:
build-environment: [JAVA_HOME: /usr/lib/jvm/java-17-openjdk-amd64] build-environment: [JAVA_HOME: /usr/lib/jvm/java-17-openjdk-amd64]
# information on packages here: https://snapcraft.io/docs/package-repositories # information on packages here: https://snapcraft.io/docs/package-repositories
build-packages: build-packages:
- build-essential - build-essential
- autoconf - autoconf
- libtool - libtool
- automake - automake
- zip - zip
- openjdk-17-jdk - openjdk-17-jdk
- openjdk-17-jre - openjdk-17-jre
- ant - ant
- ant-contrib - ant-contrib
- ant-optional - ant-optional
- libpq-dev - libpq-dev
- testdisk - testdisk
- libafflib-dev - libafflib-dev
- libewf-dev - libewf-dev
- libvhdi-dev - libvhdi-dev
- libvmdk-dev - libvmdk-dev
stage-packages: stage-packages:
- libpq-dev - libpq-dev
- testdisk - testdisk
- libafflib-dev - libafflib-dev
- libewf-dev - libewf-dev
- libvhdi-dev - libvhdi-dev
- libvmdk-dev - libvmdk-dev
# taken from https://github.com/ubuntu/libreoffice/blob/7.3/snapcraft.yaml, https://github.com/ubuntu/thunderbird/blob/stable/snapcraft.yaml
prime:
- -usr/lib/*/libgio*
- -usr/lib/*/libglib*
- -usr/lib/*/libgm*
- usr/lib/*/lib*
- -usr/lib/*/libgtk*
- -usr/lib/*/libgdk*
- -usr/lib/*/libcairo*
- -usr/lib/*/libpango*
- -usr/lib/*/libwayland*
- usr/lib/*/mesa/lib*
- usr/share/java/
- usr/sbin/*
autopsy: autopsy:
after: [sleuthkit] after: [sleuthkit]
# information on packages here: https://snapcraft.io/docs/package-repositories # information on packages here: https://snapcraft.io/docs/package-repositories
build-packages: build-packages:
- zip - zip
- unzip - unzip
- openjdk-17-jdk - openjdk-17-jdk
- openjdk-17-jre - openjdk-17-jre
- ant - ant
- doxygen - doxygen
stage-packages: stage-packages:
- libde265-dev - libde265-dev
- libheif-dev - libheif-dev
- libpq-dev - libpq-dev
- testdisk - testdisk
- freeglut3 - freeglut3
- libpsm-infinipath1 - libpsm-infinipath1
- libpsm-infinipath1-dev - libpsm-infinipath1-dev
- libglu1-mesa - libglu1-mesa
- libgstreamer1.0-dev - libgstreamer1.0-dev
- libgstreamer-plugins-base1.0-dev - libgstreamer-plugins-base1.0-dev
- libgstreamer-plugins-bad1.0-dev - libgstreamer-plugins-bad1.0-dev
- libgstreamer1.0-0 - libgstreamer1.0-0
- gstreamer1.0-plugins-base - gstreamer1.0-plugins-base
- gstreamer1.0-plugins-good - gstreamer1.0-plugins-good
- gstreamer1.0-plugins-bad - gstreamer1.0-plugins-bad
- gstreamer1.0-plugins-ugly - gstreamer1.0-plugins-ugly
- gstreamer1.0-libav - gstreamer1.0-libav
- gstreamer1.0-tools - gstreamer1.0-tools
- gstreamer1.0-x - gstreamer1.0-x
- gstreamer1.0-alsa - gstreamer1.0-alsa
- gstreamer1.0-gl - gstreamer1.0-gl
- gstreamer1.0-gtk3 - gstreamer1.0-gtk3
- gstreamer1.0-qt5 - gstreamer1.0-qt5
- gstreamer1.0-pulseaudio - gstreamer1.0-pulseaudio
- openjdk-17-jre - openjdk-17-jre
- openjdk-17-jdk - openjdk-17-jdk
- perl - perl
# needed by solr to determine locally running ports # needed by solr to determine locally running ports
- lsof - lsof
plugin: nil plugin: nil
# source: https://github.com/sleuthkit/autopsy.git # source: https://github.com/sleuthkit/autopsy.git
source: https://github.com/gdicristofaro/autopsy.git source: https://github.com/gdicristofaro/autopsy.git
# source-branch: develop # source-branch: develop
source-branch: 8425-snap source-branch: 8425-snap
build-environment: build-environment:
- JAVA_HOME: /usr/lib/jvm/java-17-openjdk-amd64 - JAVA_HOME: /usr/lib/jvm/java-17-openjdk-amd64
- TSK_JAVA_LIB_PATH: $SNAPCRAFT_STAGE/usr/local/share/java - TSK_JAVA_LIB_PATH: $SNAPCRAFT_STAGE/usr/local/share/java
# information on parts environment variables here: https://snapcraft.io/docs/parts-environment-variables # information on parts environment variables here: https://snapcraft.io/docs/parts-environment-variables
override-build: | override-build: |
# ----- BUILD ZIP ----- # ----- BUILD ZIP -----
@ -225,6 +245,21 @@ parts:
# include this line to print all set variables # include this line to print all set variables
# sed -i '129 i set -o posix ; echo $(set) >&2 ; ls -l "${jdkhome}/bin/java"' "$AUTOPSY_LOCATION/platform/lib/nbexec" # sed -i '129 i set -o posix ; echo $(set) >&2 ; ls -l "${jdkhome}/bin/java"' "$AUTOPSY_LOCATION/platform/lib/nbexec"
# taken from https://github.com/ubuntu/libreoffice/blob/7.3/snapcraft.yaml, https://github.com/ubuntu/thunderbird/blob/stable/snapcraft.yaml
prime:
- -usr/lib/*/libgio*
- -usr/lib/*/libglib*
- -usr/lib/*/libgm*
- usr/lib/*/lib*
- -usr/lib/*/libgtk*
- -usr/lib/*/libgdk*
- -usr/lib/*/libcairo*
- -usr/lib/*/libpango*
- -usr/lib/*/libwayland*
- usr/lib/*/mesa/lib*
- usr/share/java/
- usr/sbin/*
# taken from https://github.com/ubuntu/thunderbird/blob/stable/snapcraft.yaml # taken from https://github.com/ubuntu/thunderbird/blob/stable/snapcraft.yaml
# Find files provided by the base and platform snap and ensure they aren't # Find files provided by the base and platform snap and ensure they aren't
# duplicated in this snap # duplicated in this snap
@ -236,8 +271,8 @@ parts:
override-prime: | override-prime: |
set -eux set -eux
for snap in "core22" "gnome-42-2204"; do for snap in "core22" "gnome-42-2204"; do
cd "/snap/$snap/current" && find . -type f,l -exec rm -f "$CRAFT_PRIME/{}" \; cd "/snap/$snap/current" && find . -type f,l -exec rm -f "$SNAPCRAFT_PRIME/{}" \;
done done
# taken from https://github.com/ubuntu/libreoffice/blob/7.3/snapcraft.yaml # taken from https://github.com/ubuntu/libreoffice/blob/7.3/snapcraft.yaml
rm -rf $SNAPCRAFT_PRIME/usr/lib/*/lib{gtk,gdk,cairo,pango,wayland}* rm -rf $SNAPCRAFT_PRIME/usr/lib/*/lib{gtk,gdk,cairo,pango,wayland}*