updated homebrew formula

This commit is contained in:
Greg DiCristofaro 2022-10-19 12:47:26 -04:00
parent 0625220b07
commit f5b4b2c714
4 changed files with 82 additions and 202 deletions

View File

@ -1,31 +0,0 @@
cask "autopsy" do
version "4.19.3"
# sha256 "a33aca4dd6686b1dba790b224c9e686d7e08c86e6074379194f3bde478d883ed"
url "https://github.com/sleuthkit/autopsy/releases/download/autopsy-4.19.2/autopsy-4.19.2.zip"
appcast "https://github.com/sleuthkit/autopsy/releases.atom"
name "autopsy"
desc "Minimal installer for conda specific to conda-forge"
homepage "https://github.com/conda-forge/miniforge"
auto_updates true
conflicts_with cask: "miniconda"
container type: :naked
installer script: {
executable: "Miniforge3-#{version}-MacOSX-x86_64.sh",
args: ["-b", "-p", "#{caskroom_path}/base"],
}
binary "#{caskroom_path}/base/condabin/conda"
uninstall delete: "#{caskroom_path}/base"
zap trash: [
"~/.condarc",
"~/.conda",
]
caveats <<~EOS
Please run the following to setup your shell:
conda init "$(basename "${SHELL}")"
EOS
end

View File

@ -1,113 +0,0 @@
# Documentation: https://docs.brew.sh/Formula-Cookbook
# https://rubydoc.brew.sh/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. "
homepage "http://www.sleuthkit.org/autopsy/"
url "https://github.com/sleuthkit/autopsy/releases/download/autopsy-4.19.2/autopsy-4.19.2.zip"
sha256 "b1ca770df47f09512276fee16c184644cdd9a2591edfdb622a3177896f299893"
license "Apache-2.0"
depends_on "afflib"
depends_on "libewf"
#depends_on "libpq"
depends_on "testdisk"
# TODO is this right?
depends_on "gstreamer"
depends_on "libheif"
depends_on "libtool" => :build
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "zip" => :build
depends_on "gnu-tar" => :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
# TODO could create separate for build and run
on_linux do
depends_on "sqlite"
on_arm do
resource "liberica_jvm" do
url "https://download.bell-sw.com/java/8u345+1/bellsoft-jre8u345+1-linux-aarch64-full.tar.gz"
#TODO sha256 "1795bd85fb05348c32dc3e915bc8aeaa7efeeaf849676f8be88b3c9aaf3799dd"
end
end
on_intel do
resource "liberica_jvm" do
url "https://download.bell-sw.com/java/8u345+1/bellsoft-jre8u345+1-linux-amd64-full.tar.gz"
#sha256 "70899945312ee630190b8c4f9dc1124af91fec14987e890074bda40126ec186e"
end
end
end
on_macos do
uses_from_macos "sqlite"
on_arm do
resource "liberica_jvm" do
url "https://download.bell-sw.com/java/8u345+1/bellsoft-jre8u345+1-macos-aarch64-full.tar.gz"
#TODO sha256 "58a99eadac9834db01ea96bcd2e47795ace073ecae4783055a1979f099e65d9f"
end
end
on_intel do
resource "liberica_jvm" do
url "https://download.bell-sw.com/java/8u345+1/bellsoft-jre8u345+1-macos-amd64-full.tar.gz"
#TODO sha256 "74348b0f7549056da898a83d3d582588cb12718bcf28c3ccbd1850877eb4c7ec"
end
end
end
def install
ENV.deparallelize
install_dir = File.join(prefix, "install")
# ----- SETUP JVM -----
jvm_bin_path = File.join(install_dir, "liberica_jvm")
system "mkdir", "-p", jvm_bin_path
resource("liberica_jvm").stage(jvm_bin_path)
ENV["JAVA_HOME"] = jvm_bin_path
ENV["ANT_FOUND"] = Formula["ant"].opt_bin/"ant"
# ----- SETUP TSK -----
sleuthkit_bin_path = File.join(install_dir, "sleuthkit")
system "mkdir", "-p", sleuthkit_bin_path
resource("sleuthkit").stage(sleuthkit_bin_path)
cd sleuthkit_bin_path do
ENV.append_to_cflags "-DNDEBUG"
system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}"
system "make"
system "make", "install"
end
# ----- RUN UNIX SETUP SCRIPT -----
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
ENV["TSK_JAVA_LIB_PATH"] = File.join(prefix, "share", "java")
java_path = "#{jvm_bin_path}/bin/java"
system unix_setup_script, "-j", "#{java_path}"
system "ln", "-s", File.join(autopsy_install_dir, "bin", "autopsy"), File.join(bin, "autopsy")
# TODO do we need env variables before execution? (i.e. LD PATH)
end
test do
system "#{bin}/autopsy", "--help"
end
end

View File

@ -1,80 +1,104 @@
# Documentation: https://docs.brew.sh/Formula-Cookbook
# https://rubydoc.brew.sh/Formula
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
# Can be run locally with `brew install --build-from-source --verbose --debug <path_to_this_file>`
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. "
homepage "http://www.sleuthkit.org/autopsy/"
url "https://github.com/sleuthkit/autopsy/archive/refs/tags/autopsy-4.19.3.tar.gz"
# sha256 "SHA_HERE"
url "https://github.com/sleuthkit/autopsy/releases/download/autopsy-4.19.2/autopsy-4.19.2.zip"
sha256 "b1ca770df47f09512276fee16c184644cdd9a2591edfdb622a3177896f299893"
license "Apache-2.0"
depends_on "postgresql@14"
depends_on "afflib"
depends_on "libewf"
depends_on "testdisk"
depends_on "sleuthkit"
# TODO is this right?
depen# ds_on "gstreamer"
depends_on "gstreamer"
depends_on "libheif"
depends_on "libtool" => :build
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "zip" => :build
depends_on "tar" => :build
depends_on "gnu-tar" => :build
depends_on "ant" => :build
resource "sleuthkit" do
url "https://github.com/sleuthkit/sleuthkit/releases/download/sleuthkit-4.11.1/sleuthkit-4.11.1.tar.gz"
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
end
# sha256 calculated using curl <url> | sha256sum
# TODO could create separate for build and run
on_linux do
depends_on "sqlite"
on_intel do
resource "liberica_jvm" do
url "https://download.bell-sw.com/java/8u345+1/bellsoft-jdk8u345+1-linux-amd64-full.tar.gz"
sha256 "70899945312ee630190b8c4f9dc1124af91fec14987e890074bda40126ec186e"
end
end
end
on_macos do
uses_from_macos "sqlite"
on_arm do
resource "liberica_jvm" do
url "https://download.bell-sw.com/java/8u345+1/bellsoft-jdk8u345+1-macos-aarch64-full.tar.gz"
sha256 "d5d6fe21ece5d6c29bdf96ba1dada4ba1f71569eb5233be3434c2aa7a4aeb3e7"
end
end
on_intel do
resource "liberica_jvm" do
url "https://download.bell-sw.com/java/8u345+1/bellsoft-jdk8u345+1-macos-amd64-full.tar.gz"
sha256 "426fd1f299a31d3895b5d38fb24040d599faa36886528ec10863b2cd470bb4b6"
end
end
end
conflicts_with "ffind", because: "both install a `ffind` executable"
conflicts_with "sleuthkit", because: "both install sleuthkit items"
def install
ENV.deparallelize
# ----- 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
install_dir = File.join(prefix, "install")
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
# ----- SETUP JVM -----
java_home_path = File.join(install_dir, "liberica_jvm")
system "mkdir", "-p", java_home_path
resource("liberica_jvm").stage(java_home_path)
ENV["JAVA_HOME"] = java_home_path
ENV["PATH"] = "#{java_home_path}/bin:#{ENV["PATH"]}"
ENV["ANT_FOUND"] = Formula["ant"].opt_bin/"ant"
# 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 = `pwd`
java_path = `#{jvm_bin_path}/bin/java`
netbeans_plat_ver = `grep "netbeans-plat-version=" "$AUTOPSY_SRC_PATH/nbproject/platform.properties" | cut -d'=' -f2`
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"] = java_path
ENV["TSK_HOME"]= `brew --prefix sleuthkit`
system "ant", "-Dnbplatform.active.dir=\"#{autopsy_platform_path}\"", "-Dnbplatform.default.harness.dir=\"#{autopsy_harness_path}\"", "build", "build-zip"
# ----- SETUP EXTRACT DIRECTORY -----
autopsy_zip = `find #{autopsy_src_path}/dist -maxdepth 1 -name "autopsy-*.*.*.zip"`
system "unzip", autopsy_zip, "-d", File.join(autopsy_src_path, "dist")
autopsy_install_dir = `find #{File.join(autopsy_src_path, "dist")} -maxdepth 1 -type d -name "autopsy-*.*.*"`
# ----- SETUP TSK -----
sleuthkit_bin_path = File.join(install_dir, "sleuthkit")
system "mkdir", "-p", sleuthkit_bin_path
resource("sleuthkit").stage(sleuthkit_bin_path)
cd sleuthkit_bin_path do
system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}"
system "make"
system "make", "install"
end
# ----- 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 "cp", "-a", "#{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
base_sleuthkit_path = `brew --prefix sleuthkit`
ENV["TSK_JAVA_LIB_PATH"] = File.join(base_sleuthkit_path, "share", "java")
system "bash", "-c", "cd \"#{autopsy_install_dir}\" && ./unix_setup.sh -j \"#{java_path}\""
ENV["TSK_JAVA_LIB_PATH"] = File.join(prefix, "share", "java")
system unix_setup_script, "-j", "#{java_home_path}"
# TODO do we need to symlink binary?
# TODO do we need env variables before execution?
system "ln", "-s", File.join(autopsy_install_path, "bin", "autopsy"), File.join(bin, "autopsy")
end
test do

View File

@ -83,7 +83,7 @@ elif [ -n $TSK_JAVA_LIB_PATH ] && [ -f "$TSK_JAVA_LIB_PATH/sleuthkit-$TSK_VERSIO
sleuthkit_jar_filepath=$TSK_JAVA_LIB_PATH/sleuthkit-$TSK_VERSION.jar
echo "found in $(dirname $sleuthkit_jar_filepath)"
else
echo "ERROR: sleuthkit-$TSK_VERSION.jar not found in /usr/share/java/, /usr/local/share/java/, or the environment variable: 'TSK_JAVA_LIB_PATH'."
echo "ERROR: sleuthkit-$TSK_VERSION.jar not found in /usr/share/java/, /usr/local/share/java/, or the environment variable: 'TSK_JAVA_LIB_PATH': \"$TSK_JAVA_LIB_PATH\"."
echo "Please install the Sleuth Kit Java bindings file."
echo "See https://github.com/sleuthkit/sleuthkit/releases."
exit 1