work towards homebrew

This commit is contained in:
Greg DiCristofaro 2022-10-18 21:04:39 -04:00
parent c6b2aed017
commit 0d0c2ab812
2 changed files with 62 additions and 72 deletions

View File

@ -3,115 +3,110 @@
class Autopsy < Formula class Autopsy < Formula
desc "Autopsy® is a digital forensics platform and graphical interface to The Sleuth Kit® and other digital forensics tools. It can be used by law enforcement, military, and corporate examiners to investigate what happened on a computer. You can even use it to recover photos from your camera's memory card. " desc "Autopsy® is a digital forensics platform and graphical interface to The Sleuth Kit® and other digital forensics tools. It can be used by law enforcement, military, and corporate examiners to investigate what happened on a computer. You can even use it to recover photos from your camera's memory card. "
homepage "http://www.sleuthkit.org/autopsy/" homepage "http://www.sleuthkit.org/autopsy/"
url "https://github.com/sleuthkit/autopsy/archive/refs/tags/autopsy-4.19.3.tar.gz" url "https://github.com/sleuthkit/autopsy/releases/download/autopsy-4.19.2/autopsy-4.19.2.zip"
sha256 "67299005603af0cadc98c420ce5088187010b71eabcbb6db7a4e5bce325734c5" sha256 "b1ca770df47f09512276fee16c184644cdd9a2591edfdb622a3177896f299893"
license "Apache-2.0" license "Apache-2.0"
depends_on "postgresql@14" depends_on "afflib"
depends_on "libewf"
#depends_on "libpq"
depends_on "testdisk" depends_on "testdisk"
depends_on "sleuthkit"
# TODO is this right? # TODO is this right?
depends_on "gstreamer" depends_on "gstreamer"
depends_on "libheif" depends_on "libheif"
depends_on "libtool" => :build
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "zip" => :build depends_on "zip" => :build
depends_on "gnu-tar" => :build depends_on "gnu-tar" => :build
depends_on "ant" => :build depends_on "ant" => :build
resource "sleuthkit" do
url "https://github.com/sleuthkit/sleuthkit/releases/download/sleuthkit-4.11.0/sleuthkit-4.11.0.tar.gz"
#TODO sha256 "1795bd85fb05348c32dc3e915bc8aeaa7efeeaf849676f8be88b3c9aaf3799dd"
end
# sha256 calculated using curl <url> | sha256sum # sha256 calculated using curl <url> | sha256sum
# TODO could create separate for build and run
on_linux do on_linux do
depends_on "sqlite"
on_arm do on_arm do
resource "liberica_jvm" do resource "liberica_jvm" do
url "https://download.bell-sw.com/java/8u345+1/bellsoft-jdk8u345+1-linux-aarch64.tar.gz" url "https://download.bell-sw.com/java/8u345+1/bellsoft-jre8u345+1-linux-aarch64-full.tar.gz"
sha256 "1795bd85fb05348c32dc3e915bc8aeaa7efeeaf849676f8be88b3c9aaf3799dd" #TODO sha256 "1795bd85fb05348c32dc3e915bc8aeaa7efeeaf849676f8be88b3c9aaf3799dd"
end end
end end
on_intel do on_intel do
resource "liberica_jvm" do resource "liberica_jvm" do
url "https://download.bell-sw.com/java/8u345+1/bellsoft-jdk8u345+1-linux-amd64.tar.gz" url "https://download.bell-sw.com/java/8u345+1/bellsoft-jre8u345+1-linux-amd64-full.tar.gz"
sha256 "0d82ad4821b55d276d25486132f708f4cc747e242a9ce256fdf1c7f21979a94c" #sha256 "70899945312ee630190b8c4f9dc1124af91fec14987e890074bda40126ec186e"
end end
end end
end end
on_macos do on_macos do
uses_from_macos "sqlite"
on_arm do on_arm do
resource "liberica_jvm" do resource "liberica_jvm" do
url "https://download.bell-sw.com/java/8u345+1/bellsoft-jdk8u345+1-macos-aarch64.tar.gz" url "https://download.bell-sw.com/java/8u345+1/bellsoft-jre8u345+1-macos-aarch64-full.tar.gz"
sha256 "58a99eadac9834db01ea96bcd2e47795ace073ecae4783055a1979f099e65d9f" #TODO sha256 "58a99eadac9834db01ea96bcd2e47795ace073ecae4783055a1979f099e65d9f"
end end
end end
on_intel do on_intel do
resource "liberica_jvm" do resource "liberica_jvm" do
url "https://download.bell-sw.com/java/8u345+1/bellsoft-jdk8u345+1-macos-amd64.tar.gz" url "https://download.bell-sw.com/java/8u345+1/bellsoft-jre8u345+1-macos-amd64-full.tar.gz"
sha256 "74348b0f7549056da898a83d3d582588cb12718bcf28c3ccbd1850877eb4c7ec" #TODO sha256 "74348b0f7549056da898a83d3d582588cb12718bcf28c3ccbd1850877eb4c7ec"
end end
end end
end end
def install def install
ENV.deparallelize ENV.deparallelize
jvm_bin_path = File.join(bin, "liberica_jvm") install_dir = File.join(prefix, "install")
# ----- SETUP JVM -----
jvm_bin_path = File.join(install_dir, "liberica_jvm")
system "mkdir", "-p", jvm_bin_path system "mkdir", "-p", jvm_bin_path
resource("liberica_jvm").stage(jvm_bin_path) resource("liberica_jvm").stage(jvm_bin_path)
# ----- GET ADDITIONAL DEPENDENCIES -----
# TODO may be a better way to handle this
# system "brew", "tap", "bell-sw/liberica"
# system "brew", "install", "--cask", "liberica-jdk8-full"
# jvm_tar_name = "bellsoft-jdk8u345+1-macos-amd64.tar.gz"
# jvm_tmp_path = "#{prefix}/#{jvm_tar_name}"
# jvm_bin_path = "#{prefix}/liberica_jvm"
# system "curl", "-k", "-o", jvm_tmp_path, "https://download.bell-sw.com/java/8u345+1/#{jvm_tar_name}"
# system "mkdir", "-p", jvm_bin_path
# system "tar", "-xf", "#{prefix}/#{jvm_tar_name}", "-C", jvm_bin_path
# # TODO do we need any permissions?
# system "rm", jvm_tmp_path
# jvm_pkg_name = "bellsoft-jdk8u345+1-macos-amd64.pkg"
# jvm_tmp_path = "#{prefix}/#{jvm_pkg_name}"
# jvm_bin_path = "#{prefix}/liberica_jvm"
# system "curl", "-k", "-o", jvm_tmp_path, "https://download.bell-sw.com/java/8u345+1/bellsoft-jdk8u345+1-macos-amd64.pkg"
# system "mkdir", "-p", jvm_bin_path
# system "installer", "-pkg", jvm_tmp_path, "-target", jvm_bin_path
# system "rm", jvm_tmp_path
# # TODO may be a better way to handle this
# gstreamer_tmp_path = "#{prefix}/gstreamer-1.0-1.20.3-universal.pkg"
# gstreamer_bin_path = File.join(prefix, "gstreamer", "bin")
# system "curl", "-k", "-o", gstreamer_tmp_path, "https://gstreamer.freedesktop.org/data/pkg/osx/1.20.3/gstreamer-1.0-1.20.3-universal.pkg"
# system "mkdir", "-p", gstreamer_bin_path
# system "installer", "-pkg", gstreamer_tmp_path, "-target", gstreamer_bin_path
# system "rm", gstreamer_tmp_path
# ----- BUILD ZIP -----
autopsy_src_path = "."
java_path = "#{jvm_bin_path}/bin/java"
# system "chmod", "a+x", java_path
platform_properties_file = File.join(autopsy_src_path, "nbproject", "platform.properties")
netbeans_plat_ver = `grep "netbeans-plat-version=" "#{platform_properties_file}" | cut -d'=' -f2`.strip()
autopsy_platform_path = File.join(autopsy_src_path, "netbeans-plat", netbeans_plat_ver)
autopsy_harness_path = File.join(autopsy_platform_path, "harness")
ENV["JAVA_HOME"] = jvm_bin_path ENV["JAVA_HOME"] = jvm_bin_path
ENV["TSK_HOME"]= `sh -c "brew --prefix sleuthkit"` ENV["ANT_FOUND"] = Formula["ant"].opt_bin/"ant"
system "ant", "-Dnbplatform.active.dir=\"#{autopsy_platform_path}\"", "-Dnbplatform.default.harness.dir=\"#{autopsy_harness_path}\"", "build", "build-zip"
# ----- SETUP EXTRACT DIRECTORY ----- # ----- SETUP TSK -----
autopsy_zip = `find #{autopsy_src_path}/dist -maxdepth 1 -name "autopsy-*.*.*.zip"` sleuthkit_bin_path = File.join(install_dir, "sleuthkit")
system "unzip", autopsy_zip, "-d", File.join(autopsy_src_path, "dist") system "mkdir", "-p", sleuthkit_bin_path
autopsy_install_dir = `find #{File.join(autopsy_src_path, "dist")} -maxdepth 1 -type d -name "autopsy-*.*.*"` resource("sleuthkit").stage(sleuthkit_bin_path)
cd sleuthkit_bin_path do
ENV.append_to_cflags "-DNDEBUG"
system "./bootstrap"
system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}"
system "make"
system "make", "install"
end
ENV["TSK_HOME"]= sleuthkit_bin_path
# ----- RUN UNIX SETUP SCRIPT ----- # ----- RUN UNIX SETUP SCRIPT -----
unix_setup_script = File.join(autopsy_install_dir, "unix_setup.sh") autopsy_tmp_path = `find $(pwd) -maxdepth 1 -type d -name "autopsy-*.*.*"`.strip()
autopsy_install_path = File.join(install_dir, "autopsy")
system "mv", autopsy_tmp_path, autopsy_install_path
unix_setup_script = File.join(autopsy_install_path, "unix_setup.sh")
# TODO remove for the future
system "rm", unix_setup_script
system "curl", "-o", unix_setup_script, "https://raw.githubusercontent.com/gdicristofaro/autopsy/8425_linuxMacBuild/unix_setup.sh"
system "chmod", "u+x", unix_setup_script system "chmod", "u+x", unix_setup_script
base_sleuthkit_path = `brew --prefix sleuthkit` ENV["TSK_JAVA_LIB_PATH"] = File.join(prefix, "share", "java")
ENV["TSK_JAVA_LIB_PATH"] = File.join(base_sleuthkit_path, "share", "java") java_path = "#{jvm_bin_path}/bin/java"
system "bash", "-c", "cd \"#{autopsy_install_dir}\" && ./unix_setup.sh -j \"#{java_path}\"" system unix_setup_script, "-j", "#{java_path}"
# TODO do we need to symlink binary? system "ln", "-s", File.join(autopsy_install_dir, "bin", "autopsy"), File.join(bin, "autopsy")
# TODO do we need env variables before execution?
# TODO do we need env variables before execution? (i.e. LD PATH)
end end
test do test do

View File

@ -41,13 +41,8 @@ pushd $SCRIPTPATH
# Verify PhotoRec was installed # Verify PhotoRec was installed
echo -n "Checking for PhotoRec..." echo -n "Checking for PhotoRec..."
photorec_filepath=/usr/bin/photorec if ! command -v photorec &> /dev/null
photorec_osx_filepath=/usr/local/bin/photorec then
if [ -f "$photorec_filepath" ]; then
echo "found in $(dirname $photorec_filepath)"
elif [ -f "$photorec_osx_filepath" ]; then
echo "found in $(dirname $photorec_osx_filepath)"
else
echo "ERROR: PhotoRec not found, please install the testdisk package." echo "ERROR: PhotoRec not found, please install the testdisk package."
exit 1 exit 1
fi fi