autopsy-flatpak/snap/snapcraft.yaml
2023-07-17 10:47:44 -04:00

231 lines
7.6 KiB
YAML

name: autopsy
base: core22
version: 4.20.0
summary: A graphical interface to The Sleuth Kit and other digital forensics tools. # 79 char long summary
description: Autopsy is a graphical interface to The Sleuth Kit and other open source digital forensics tools.
source-code: https://github.com/sleuthkit/autopsy/
website: https://www.autopsy.com/
license: Apache-2.0
grade: stable # must be 'stable' to release into candidate/stable channels
confinement: strict # or classic # use 'strict' once you have the right plugs and slots
architectures: [amd64]
compression: lzo
icon: snap/gui/autopsy.png
plugs:
system-files-autopsy:
interface: system-files
read: [/dev]
# does not appear necessary as writing to home directory gets written to $SNAP_USER_DATA: https://snapcraft.io/docs/environment-variables
#layout:
# $SNAP_REAL_HOME/.icesoft:
# bind: $SNAP_DATA/.icesoft
# $SNAP_REAL_HOME/.java:
# bind: $SNAP_DATA/.java
# $SNAP_REAL_HOME/.openjfx:
# bind: $SNAP_DATA/.openjfx
# /$SNAP_USER_DATA/tmp:
# bind: $SNAP_DATA/tmp
# /$SNAP_USER_DATA/.autopsy:
# bind: $SNAP_DATA/appdata
# /$SNAP_USER_DATA/.cache/autopsy:
# bind: $SNAP_DATA/cache
apps:
autopsy:
environment:
jdkhome: $SNAP/usr/lib/jvm/java-17-openjdk-amd64
SOLR_JAVA_HOME: $SNAP/usr/lib/jvm/java-17-openjdk-amd64
# provide means for java gstreamer to find gstreamer libs with jna.library.path
# set user home to new home value to avoid issues writing cache files to hom
jreflags: $jreflags '-Duser.home=$HOME' '-Djava.io.tmpdir=$HOME/tmp' '-Djna.library.path=$SNAP/usr/lib/x86_64-linux-gnu:$SNAP/usr/local/lib'
# to load libtsk.so
LD_LIBRARY_PATH: $SNAP/usr/local/lib:$LD_LIBRARY_PATH
# make sure path is set up to ensure things like photorec are found
PATH: $SNAP/usr/bin:$SNAP/usr/local/bin:$PATH
# gstreamer scans for plugins (i.e. app integration plugins). this tells gstreamer where to look for the scanner and libraries
GST_PLUGIN_SYSTEM_PATH: $SNAP/usr/lib/x86_64-linux-gnu/gstreamer-1.0
GST_PLUGIN_SCANNER: $SNAP/usr/lib/x86_64-linux-gnu/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner
SOLR_LOGS_DIR: $HOME/.autopsy/dev/solr/logs
SOLR_PID_DIR: $HOME/.autopsy/dev/solr/logs
SOLR_DATA_HOME: $HOME/solr
command: autopsy/bin/autopsywrapper.sh
# More info here: https://snapcraft.io/docs/gnome-extension
extensions: [ gnome ]
common-id: org.sleuthkit.autopsy
plugs:
# taken from https://snapcraft.io/docs/supported-interfaces
# can be debugged with snappy debug: https://snapcraft.io/docs/debug-snaps#heading--snappy-debug
- audio-playback
- avahi-observe
- block-devices
- cifs-mount
- daemon-notify
- desktop
- desktop-launch
# - desktop-legacy
- dm-crypt
- firewall-control
- fuse-support
- hardware-observe
- home
- kernel-crypto-api
- log-observe
# may be necessary for solr
- microstack-support
- modem-manager
- mount-control
- mount-observe
- network
- network-bind
- network-control
- network-manager
- network-manager-observe
- network-observe
- network-setup-observe
- network-status
- opengl
- optical-drive
# may be necessary for solr
- ppp
- pulseaudio
- raw-input
- raw-usb
- removable-media
- sd-control
- system-files-autopsy
- system-observe
- system-trace
- udisks2
# - unity7
- unity8
- wayland
- x11
parts:
sleuthkit:
plugin: autotools
source: https://github.com/sleuthkit/sleuthkit.git
source-branch: develop
#source-tag: sleuthkit-4.12.0
build-environment: [JAVA_HOME: /usr/lib/jvm/java-17-openjdk-amd64]
# may be necessary for classic snaps: https://snapcraft.io/docs/linters-classic#heading--issues-auto
# build-attributes:
# - enable-patchelf
build-packages:
- build-essential
- autoconf
- libtool
- automake
- zip
- openjdk-17-jdk
- openjdk-17-jre
- ant
- ant-contrib
- ant-optional
- libpq-dev
- testdisk
- libafflib-dev
- libewf-dev
- libvhdi-dev
- libvmdk-dev
stage-packages:
- libpq-dev
- testdisk
- libafflib-dev
- libewf-dev
- libvhdi-dev
- libvmdk-dev
autopsy:
after: [sleuthkit]
# may be necessary for classic snaps: https://snapcraft.io/docs/linters-classic#heading--issues-auto
# build-attributes:
# - enable-patchelf
build-packages:
- zip
- unzip
- openjdk-17-jdk
- openjdk-17-jre
- ant
- doxygen
stage-packages:
- libde265-dev
- libheif-dev
- libpq-dev
- testdisk
- freeglut3
- libpsm-infinipath1
- libpsm-infinipath1-dev
- libglu1-mesa
- libgstreamer1.0-dev
- libgstreamer-plugins-base1.0-dev
- libgstreamer-plugins-bad1.0-dev
- libgstreamer1.0-0
- gstreamer1.0-plugins-base
- gstreamer1.0-plugins-good
- gstreamer1.0-plugins-bad
- gstreamer1.0-plugins-ugly
- gstreamer1.0-libav
- gstreamer1.0-tools
- gstreamer1.0-x
- gstreamer1.0-alsa
- gstreamer1.0-gl
- gstreamer1.0-gtk3
- gstreamer1.0-qt5
- gstreamer1.0-pulseaudio
- openjdk-17-jre
- openjdk-17-jdk
- perl
# possibly needed by solr
- lsof
plugin: nil
# source: https://github.com/sleuthkit/autopsy.git
source: https://github.com/gdicristofaro/autopsy.git
# source-branch: develop
source-branch: 8425-snap
build-environment:
- JAVA_HOME: /usr/lib/jvm/java-17-openjdk-amd64
- TSK_JAVA_LIB_PATH: $SNAPCRAFT_STAGE/usr/local/share/java
override-build: |
# ----- BUILD ZIP -----
AUTOPSY_SRC_PATH=$(pwd)
NETBEANS_PLAT_VER=$(grep "netbeans-plat-version=" "$AUTOPSY_SRC_PATH/nbproject/platform.properties" | cut -d'=' -f2)
AUTOPSY_PLATFORM_PATH="$AUTOPSY_SRC_PATH/netbeans-plat/$NETBEANS_PLAT_VER"
AUTOPSY_HARNESS_PATH="$AUTOPSY_PLATFORM_PATH/harness"
export TSK_HOME="$HOME/parts/sleuthkit/build"
ant -Dnbplatform.active.dir="$AUTOPSY_PLATFORM_PATH" -Dnbplatform.default.harness.dir="$AUTOPSY_HARNESS_PATH" build build-zip
# ----- SETUP EXTRACT DIRECTORY -----
AUTOPSY_LOCATION="$SNAPCRAFT_PART_INSTALL/autopsy"
mkdir -p $AUTOPSY_LOCATION
AUTOPSY_ZIP=$(find ./dist -maxdepth 1 -name "autopsy-*.*.*.zip")
AUTOPSY_ZIP_TMP_LOC=./dist/autopsy_tmp_zip_loc
mkdir -p $AUTOPSY_ZIP_TMP_LOC
unzip $AUTOPSY_ZIP -d $AUTOPSY_ZIP_TMP_LOC
AUTOPSY_EXTRACTED_TMP_LOC=$(find $AUTOPSY_ZIP_TMP_LOC -maxdepth 1 -name "autopsy-*.*.*")
cp -r $AUTOPSY_EXTRACTED_TMP_LOC/* $AUTOPSY_LOCATION
# ----- RUN UNIX SETUP SCRIPT -----
UNIX_SETUP_SCRIPT="$AUTOPSY_LOCATION/unix_setup.sh"
chmod +x $UNIX_SETUP_SCRIPT
$UNIX_SETUP_SCRIPT
# snaps run applications with different permissions. This ensures applications can run.
chmod 755 "$AUTOPSY_LOCATION/bin/autopsy"
# wrapper to setup temp dir if not exists; also could be easily modified for debugging purposes with snap try: https://snapcraft.io/docs/snap-try
cat <<EOF > $AUTOPSY_LOCATION/bin/autopsywrapper.sh
#!/bin/bash
mkdir -p \$HOME/tmp
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"