Created
April 20, 2026 19:30
-
-
Save sanity/7a930e9d8a4e82b9144b4698244c7cd0 to your computer and use it in GitHub Desktop.
Wrap freenet release binary in a minimal .app bundle for macOS menu bar testing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Wrap the built freenet binary in a minimal .app bundle so macOS will let it | |
| # register a menu bar icon. Run this from the freenet-core repo root after | |
| # `cargo build --release -p freenet` has produced target/release/freenet. | |
| # | |
| # Output: ./Freenet.app — launch with `open Freenet.app`. | |
| set -euo pipefail | |
| if [[ ! -x "target/release/freenet" ]]; then | |
| echo "target/release/freenet not found — run 'cargo build --release -p freenet' first" >&2 | |
| exit 1 | |
| fi | |
| rm -rf Freenet.app | |
| mkdir -p Freenet.app/Contents/MacOS Freenet.app/Contents/Resources | |
| cp target/release/freenet Freenet.app/Contents/MacOS/freenet-bin | |
| cat > Freenet.app/Contents/MacOS/Freenet <<'SH' | |
| #!/bin/bash | |
| DIR="$(cd "$(dirname "$0")" && pwd)" | |
| exec "$DIR/freenet-bin" service run-wrapper | |
| SH | |
| chmod +x Freenet.app/Contents/MacOS/Freenet | |
| cat > Freenet.app/Contents/Info.plist <<'PLIST' | |
| <?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>Freenet</string> | |
| <key>CFBundleDisplayName</key><string>Freenet</string> | |
| <key>CFBundleIdentifier</key><string>org.freenet.Freenet</string> | |
| <key>CFBundleVersion</key><string>0.0.1</string> | |
| <key>CFBundleShortVersionString</key><string>0.0.1</string> | |
| <key>CFBundlePackageType</key><string>APPL</string> | |
| <key>CFBundleExecutable</key><string>Freenet</string> | |
| <key>LSUIElement</key><true/> | |
| <key>LSMinimumSystemVersion</key><string>11.0</string> | |
| <key>NSPrincipalClass</key><string>NSApplication</string> | |
| <key>NSHighResolutionCapable</key><true/> | |
| </dict> | |
| </plist> | |
| PLIST | |
| echo "Created Freenet.app" | |
| echo "Launch with: open Freenet.app" | |
| echo "Inspect logs in Console.app (filter: Freenet or freenet-bin)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment