-
Notifications
You must be signed in to change notification settings - Fork 659
Add scripts for Mac Bundle #7987
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
845fa5a
a756a04
8b9f675
451fa4f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,116 @@ | ||||||||||||||||||||||||
| #! /usr/bin/env bash | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # | ||||||||||||||||||||||||
| # macos-bundle.sh v1.0 | ||||||||||||||||||||||||
| # | ||||||||||||||||||||||||
| # Create a "bundle" for the Autopsy 4 application. | ||||||||||||||||||||||||
| # | ||||||||||||||||||||||||
| # 2025.11.02.- Eduardo René Rodríguez Ávila, creation. | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # | ||||||||||||||||||||||||
| # Application name and path | ||||||||||||||||||||||||
| # | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| echo "Creating app bundle..." | ||||||||||||||||||||||||
| APP="$HOME/Applications/Autopsy.app" | ||||||||||||||||||||||||
| mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources/app" | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # | ||||||||||||||||||||||||
| # Info.plist | ||||||||||||||||||||||||
| # | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| echo "Creating Info.plist..." | ||||||||||||||||||||||||
| cat > "$APP/Contents/Info.plist" << EOT | ||||||||||||||||||||||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||||||||||||||||||||||
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||||||||||||||||||||||||
| <plist version="1.0"> | ||||||||||||||||||||||||
| <dict> | ||||||||||||||||||||||||
| <key>CFBundleName</key><string>Autopsy</string> | ||||||||||||||||||||||||
| <key>CFBundleDisplayName</key><string>Autopsy</string> | ||||||||||||||||||||||||
| <key>CFBundleIdentifier</key><string>mx.example.autopsy</string> | ||||||||||||||||||||||||
| <key>CFBundleExecutable</key><string>autopsy-launcher</string> | ||||||||||||||||||||||||
| <key>CFBundleIconFile</key><string>autopsy.icns</string> | ||||||||||||||||||||||||
| <key>LSMinimumSystemVersion</key><string>13.0</string> | ||||||||||||||||||||||||
| <key>NSHighResolutionCapable</key><true/> | ||||||||||||||||||||||||
| </dict> | ||||||||||||||||||||||||
| </plist> | ||||||||||||||||||||||||
| EOT | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # | ||||||||||||||||||||||||
| # Launcher | ||||||||||||||||||||||||
| # | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| echo "Creating launcher script..." | ||||||||||||||||||||||||
| cat > "$APP/Contents/MacOS/autopsy-launcher" << EOT | ||||||||||||||||||||||||
| #! /usr/bin/env bash | ||||||||||||||||||||||||
| set -euo pipefail | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # Resolve bundle paths | ||||||||||||||||||||||||
| BUNDLE_DIR="\$(cd "\$(dirname "\$0")/.." && pwd)" | ||||||||||||||||||||||||
| RESOURCES="\$BUNDLE_DIR/Resources" | ||||||||||||||||||||||||
| APP_ROOT="\$RESOURCES/app" | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # Prefer a JDK 17 if present; fall back to default | ||||||||||||||||||||||||
| if [ -z "${JAVA_HOME:-}" ]; then | ||||||||||||||||||||||||
| if /usr/libexec/java_home -v 17 >/dev/null 2>&1; then | ||||||||||||||||||||||||
| export JAVA_HOME="$("/usr/libexec/java_home" -v 17)" | ||||||||||||||||||||||||
| else | ||||||||||||||||||||||||
| export JAVA_HOME="$("/usr/libexec/java_home" 2>/dev/null || true)" | ||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||
| [ -n "${JAVA_HOME:-}" ] && export PATH="\$JAVA_HOME/bin:\$PATH" | ||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # Start from the app's root so relative paths work | ||||||||||||||||||||||||
| cd "\$APP_ROOT" | ||||||||||||||||||||||||
| exec "\$APP_ROOT/bin/autopsy" | ||||||||||||||||||||||||
| EOT | ||||||||||||||||||||||||
|
Comment on lines
+53
to
+66
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n -C3 'jdkhome|--jdkhome|JAVA_HOME' \
macos-bundle.sh \
netbeans-plat/15/harness/launchers/app.sh \
unix_setup.sh
rg -n '^[[:space:]]*#?[[:space:]]*jdkhome=' etc/autopsy.conf || trueRepository: sleuthkit/autopsy Length of output: 3799 🏁 Script executed: cat -n macos-bundle.sh | sed -n '1,90p'Repository: sleuthkit/autopsy Length of output: 3120 🏁 Script executed: # Check the full context of how jdkhome is handled in app.sh
cat -n netbeans-plat/15/harness/launchers/app.sh | sed -n '80,110p'Repository: sleuthkit/autopsy Length of output: 873 🏁 Script executed: # Search for any nbexec or java launcher documentation
fd -type f \( -name "*.md" -o -name "*.txt" -o -name "README*" \) | head -20Repository: sleuthkit/autopsy Length of output: 231 🏁 Script executed: # Check if there's a default autopsy.conf to see typical jdkhome entries
fd -type f -name "autopsy.conf*"Repository: sleuthkit/autopsy Length of output: 231 🏁 Script executed: # Search for autopsy.conf files
find . -name "*autopsy.conf*" -type f 2>/dev/null | head -20Repository: sleuthkit/autopsy Length of output: 97 🏁 Script executed: # Check what bin/autopsy actually is
cat -n bin/autopsy | head -30Repository: sleuthkit/autopsy Length of output: 104 🏁 Script executed: # Search for any netbeans nbexec documentation or comments about --jdkhome
rg -A2 -B2 'jdkhome' netbeans-plat/15/harness/launchers/ --type shRepository: sleuthkit/autopsy Length of output: 1386 🏁 Script executed: # Check the default autopsy.conf
cat installer_autopsy/etc/autopsy.confRepository: sleuthkit/autopsy Length of output: 3517 🏁 Script executed: # Search for where bin/autopsy gets created - it's likely from netbeans-plat
find . -path "*/bin/*" -type f | grep -E "(autopsy|launcher)" | head -20Repository: sleuthkit/autopsy Length of output: 229 🏁 Script executed: # Check if app.sh actually uses JAVA_HOME or only jdkhome
rg -n 'JAVA_HOME|jdkhome' netbeans-plat/15/harness/launchers/app.sh | head -20Repository: sleuthkit/autopsy Length of output: 328 🏁 Script executed: # Verify the rsync command at lines 76-77
cat -n macos-bundle.sh | sed -n '73,80p'Repository: sleuthkit/autopsy Length of output: 312 🏁 Script executed: # Check if there's a template or mechanism to customize jdkhome in macos-bundle.sh
rg -n 'jdkhome|autopsy.conf' macos-bundle.shRepository: sleuthkit/autopsy Length of output: 43 Remove stale The launcher carefully selects This mirrors the pattern in Proposed fix rsync -a --delete --exclude=".git" --exclude="target" \
"$SRC/${autopsy,bin,etc}" "$APP/Contents/Resources/app/"
+
+# Prevent stale jdkhome from overriding launcher JAVA_HOME selection
+CONF="$APP/Contents/Resources/app/etc/autopsy.conf"
+if [ -f "$CONF" ]; then
+ awk '!/^[[:space:]]*jdkhome=/' "$CONF" > "$CONF.tmp"
+ mv "$CONF.tmp" "$CONF"
+fi🤖 Prompt for AI Agents |
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| chmod u+x "$APP/Contents/MacOS/autopsy-launcher" | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # | ||||||||||||||||||||||||
| # Autopsy is copied | ||||||||||||||||||||||||
| # | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| echo "Copyng application..." | ||||||||||||||||||||||||
| SRC="$PWD" # Change if necessary | ||||||||||||||||||||||||
| rsync -a --delete --exclude=".git" --exclude="target" \ | ||||||||||||||||||||||||
| "$SRC/${autopsy,bin,etc}" "$APP/Contents/Resources/app/" | ||||||||||||||||||||||||
|
Comment on lines
+74
to
+77
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n '\$\{autopsy,bin,etc\}' macos-bundle.sh
bash -lc 'unset autopsy; SRC=/tmp/src; printf "current=[%s]\n" "$SRC/${autopsy,bin,etc}"'
bash -lc 'SRC=/tmp/src; printf "expected=[%s]\n" "$SRC"/{autopsy,bin,etc}'Repository: sleuthkit/autopsy Length of output: 433 Fix invalid Bash expansion in the Line 77 uses Proposed fix-echo "Copyng application..."
+echo "Copying application..."
SRC="$PWD" # Change if necessary
-rsync -a --delete --exclude=".git" --exclude="target" \
- "$SRC/${autopsy,bin,etc}" "$APP/Contents/Resources/app/"
+for d in autopsy bin etc; do
+ [ -d "$SRC/$d" ] || { echo "Missing required directory: $SRC/$d" >&2; exit 1; }
+done
+rsync -a --delete --exclude=".git" --exclude="target" \
+ "$SRC/autopsy/" "$SRC/bin/" "$SRC/etc/" "$APP/Contents/Resources/app/"📝 Committable suggestion
Suggested change
🧰 Tools🪛 Shellcheck (0.11.0)[warning] 77-77: autopsy is referenced but not assigned. (SC2154) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # | ||||||||||||||||||||||||
| # Icon set | ||||||||||||||||||||||||
| # | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| echo "Creating icon set..." | ||||||||||||||||||||||||
| mkdir -p tmp/autopsy.iconset | ||||||||||||||||||||||||
| ( | ||||||||||||||||||||||||
| sips -z 16 16 autopsy.png --out tmp/autopsy.iconset/icon_16x16.png | ||||||||||||||||||||||||
| sips -z 32 32 autopsy.png --out tmp/autopsy.iconset/icon_16x16@2x.png | ||||||||||||||||||||||||
| sips -z 32 32 autopsy.png --out tmp/autopsy.iconset/icon_32x32.png | ||||||||||||||||||||||||
| sips -z 64 64 autopsy.png --out tmp/autopsy.iconset/icon_32x32@2x.png | ||||||||||||||||||||||||
| sips -z 128 128 autopsy.png --out tmp/autopsy.iconset/icon_128x128.png | ||||||||||||||||||||||||
| sips -z 256 256 autopsy.png --out tmp/autopsy.iconset/icon_128x128@2x.png | ||||||||||||||||||||||||
| sips -z 256 256 autopsy.png --out tmp/autopsy.iconset/icon_256x256.png | ||||||||||||||||||||||||
| sips -z 512 512 autopsy.png --out tmp/autopsy.iconset/icon_256x256@2x.png | ||||||||||||||||||||||||
| sips -z 512 512 autopsy.png --out tmp/autopsy.iconset/icon_512x512.png | ||||||||||||||||||||||||
| ) > /dev/null 2>&1 | ||||||||||||||||||||||||
| cp autopsy.png tmp/autopsy.iconset/icon_512x512@2x.png | ||||||||||||||||||||||||
| iconutil -c icns tmp/autopsy.iconset -o "$APP/Contents/Resources/autopsy.icns" | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # | ||||||||||||||||||||||||
| # Sign | ||||||||||||||||||||||||
| # | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| echo -n "Signing application..." | ||||||||||||||||||||||||
| codesign -s - --force --deep "$APP" | ||||||||||||||||||||||||
| xattr -dr com.apple.quarantine "$APP" | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # | ||||||||||||||||||||||||
| # Final instrucctions | ||||||||||||||||||||||||
| # | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| echo "" | ||||||||||||||||||||||||
| echo "First time could be necessary to launch from terminal with:" | ||||||||||||||||||||||||
| echo "" | ||||||||||||||||||||||||
| echo "\$ open $APP" | ||||||||||||||||||||||||
| echo "" | ||||||||||||||||||||||||
| echo "after that it will appear in Spotlight" | ||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: sleuthkit/autopsy
Length of output: 874
🏁 Script executed:
head -50 macos-bundle.sh | cat -nRepository: sleuthkit/autopsy
Length of output: 1664
🏁 Script executed:
Repository: sleuthkit/autopsy
Length of output: 1106
Top-level script lacks strict mode, and the icon block suppresses all tool output.
The macos-bundle.sh script has no
set -euo pipefailat the top level, allowing silent failures. The icon generation block (lines 83–98) silently suppresses all output with> /dev/null 2>&1and has no checks for required dependencies (autopsy.png,sips,iconutil). A missing source file or unavailable tool will produce a broken bundle without any error indication.Proposed fix
For lines 83–98:
📝 Committable suggestion
🤖 Prompt for AI Agents