Skip to content

A free, open-source alternative to Burp Suite: an intercepting proxy and web app security testing suite with Repeater, Intruder, Collaborator and a built-in OWASP ZAP scanner. Linux, AGPL-3.0.

2.5 KB
Raw Blame
#!/usr/bin/env bash
# Install the Open Suite launcher icon and menu entry for the current user.
#
# This is the piece that makes the icon work regardless of the user's theme.
# The icon is installed into the hicolor icon theme, which every desktop falls
# back to last, and the menu entry refers to it by the name "opensuite" rather
# than borrowing a theme icon that would look different on every machine.
#
# No root needed: everything goes under ~/.local/share. Pass --system to install
# for all users instead (needs sudo).
set -euo pipefail
DIR="$(cd "$(dirname "$0")" && pwd)"
TMP="$(mktemp -d)"
trap 'rm -rf "$TMP"' EXIT

SCOPE="user"
[ "${1:-}" = "--system" ] && SCOPE="system"

if [ "$SCOPE" = "system" ]; then
    ICONROOT="/usr/share/icons/hicolor"
    APPDIR="/usr/share/applications"
else
    ICONROOT="$HOME/.local/share/icons/hicolor"
    APPDIR="$HOME/.local/share/applications"
fi

echo "Installing Open Suite desktop entry ($SCOPE scope)..."

# Scalable source, for themes and desktops that prefer SVG.
mkdir -p "$ICONROOT/scalable/apps"
cp "$DIR/icon/opensuite.svg" "$ICONROOT/scalable/apps/opensuite.svg"

# Raster sizes, rendered from the app itself so no SVG tool is required.
if [ -f "$DIR/dist/opensuite.jar" ]; then
    java -cp "$DIR/dist/opensuite.jar" opensuite.ui.AppIcon "$TMP" >/dev/null
    for size in 16 24 32 48 64 128 256; do
        mkdir -p "$ICONROOT/${size}x${size}/apps"
        cp "$TMP/opensuite_${size}.png" "$ICONROOT/${size}x${size}/apps/opensuite.png"
    done
else
    echo "  note: dist/opensuite.jar not found, installed the SVG only (run ./build.sh for PNG sizes)"
fi

# Menu entry, with Exec pointing at this checkout's launcher. Any Exec line
# from an earlier install is dropped first, so re-running the script (or
# moving the checkout) replaces it instead of appending duplicates.
mkdir -p "$APPDIR"
sed "/^Exec=/d; \$aExec=$DIR/run.sh" "$DIR/icon/opensuite.desktop" \
    > "$APPDIR/opensuite.desktop"
chmod +x "$APPDIR/opensuite.desktop" 2>/dev/null || true

# Refresh the caches so the entry appears without a logout.
command -v gtk-update-icon-cache >/dev/null 2>&1 && \
    gtk-update-icon-cache -f -t "$ICONROOT" >/dev/null 2>&1 || true
command -v update-desktop-database >/dev/null 2>&1 && \
    update-desktop-database "$APPDIR" >/dev/null 2>&1 || true

echo "Installed:"
echo "  icon  -> $ICONROOT/{scalable,*x*}/apps/opensuite.*"
echo "  entry -> $APPDIR/opensuite.desktop"
echo "Open Suite should now appear in your application menu with its own icon."