From be983e16cd45a97098386f406247a8c2e2f9c182 Mon Sep 17 00:00:00 2001
From: Greg DiCristofaro <gregd@basistech.com>
Date: Wed, 2 Aug 2023 07:53:23 -0400
Subject: [PATCH] updates to snap package

---
 snap/snapcraft.yaml | 94 +++++++++++++++++++++++++++++----------------
 1 file changed, 60 insertions(+), 34 deletions(-)

diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
index 6baf79aa21..90cd4a23da 100644
--- a/snap/snapcraft.yaml
+++ b/snap/snapcraft.yaml
@@ -44,11 +44,15 @@ plugs:
   system-files-hugepages:
     interface: system-files
     read: [/sys/kernel/mm/hugepages]
+  # TODO may not be necessary but may provide ability for online/offline help
   browser-sandbox:
     interface: browser-support
     allow-sandbox: true
 
+
 slots:
+  # TODO may not be necessary
+  # taken from thunderbird snap: https://github.com/ubuntu/thunderbird/blob/stable/snapcraft.yaml
   dbus-daemon:
     interface: dbus
     bus: session
@@ -143,20 +147,6 @@ parts:
       - libewf-dev
       - libvhdi-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:
     after: [sleuthkit]
     # information on packages here: https://snapcraft.io/docs/package-repositories
@@ -168,14 +158,18 @@ parts:
       - ant
       - doxygen
     stage-packages:
-      - libde265-dev
+      # lib heif reqs
       - libheif-dev
+      - libde265-dev
+      # pg reqs
       - libpq-dev
       - testdisk
+      # TODO these may not be necessary
       - freeglut3
       - libpsm-infinipath1
       - libpsm-infinipath1-dev
       - libglu1-mesa
+      # libgstreamer reqs
       - libgstreamer1.0-dev
       - libgstreamer-plugins-base1.0-dev
       - libgstreamer-plugins-bad1.0-dev
@@ -197,6 +191,55 @@ parts:
       - perl
       # needed by solr to determine locally running ports
       - lsof
+      # TODO may be needed by openjfx
+      # taken from https://github.com/jgneff/openjfx/blob/edge/snap/snapcraft.yaml
+      - libatk1.0-0
+      - libatk-bridge2.0-0
+      - libatspi2.0-0
+      - libcairo2
+      - libcairo-gobject2
+      - libdatrie1
+      - libepoxy0
+      - libfontconfig1
+      - libfreetype6
+      - libgdk-pixbuf2.0-0
+      - libgl1
+      - libglvnd0
+      - libglx0
+      - libgraphite2-3
+      - libgtk2.0-0
+      - libgtk-3-0
+      - libharfbuzz0b
+      - libpango-1.0-0
+      - libpangocairo-1.0-0
+      - libpangoft2-1.0-0
+      - libpixman-1-0
+      - libpng16-16
+      - libthai0
+      - libwayland-client0
+      - libwayland-cursor0
+      - libwayland-egl1
+      - libx11-6
+      - libxau6
+      - libxcb1
+      - libxcb-render0
+      - libxcb-shm0
+      - libxcomposite1
+      - libxcursor1
+      - libxdamage1
+      - libxdmcp6
+      - libxext6
+      - libxfixes3
+      - libxi6
+      - libxinerama1
+      - libxkbcommon0
+      - libxrandr2
+      - libxrender1
+      - libxtst6
+      # Gtk-Message: 16:12:52.145: Failed to load module "canberra-gtk-module"
+      - libcanberra-gtk3-module
+      # Gtk-Message: 10:57:54.572: Failed to load module "pk-gtk-module"
+      - packagekit-gtk3-module
     plugin: nil
     # source: https://github.com/sleuthkit/autopsy.git
     source: https://github.com/gdicristofaro/autopsy.git
@@ -237,28 +280,14 @@ parts:
       cat <<EOF > $AUTOPSY_LOCATION/bin/autopsywrapper.sh
       #!/bin/bash
       mkdir -p \$HOME/tmp
+      # include this line to print all set variables
+      # set -o posix ; echo $(set) >&2 ; ls -l "${jdkhome}/bin/java"
       echo Starting Autopsy...
       \$SNAP/autopsy/bin/autopsy
       EOF
 
       chmod 755 $AUTOPSY_LOCATION/bin/autopsywrapper.sh
 
-      # 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"
-    # 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
   # Find files provided by the base and platform snap and ensure they aren't
@@ -273,6 +302,3 @@ parts:
       for snap in "core22" "gnome-42-2204"; do
         cd "/snap/$snap/current" && find . -type f,l -exec rm -f "$SNAPCRAFT_PRIME/{}" \;
       done
-
-      # taken from https://github.com/ubuntu/libreoffice/blob/7.3/snapcraft.yaml
-      rm -rf $SNAPCRAFT_PRIME/usr/lib/*/lib{gtk,gdk,cairo,pango,wayland}*
-- 
GitLab