Fix macOS distribution bundles

This commit is contained in:
2026-08-26 12:36:05 -05:00
parent 596614e0d3
commit d6104bd45b
3 changed files with 50 additions and 19 deletions
+29 -8
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
#
# install-galaxy.sh — Download and install Galaxy.app on macOS.
# install-galaxy.sh — Download, sign, and install Galaxy.app on macOS.
#
# Usage:
# curl -fsSL https://mng-web-sharing.mini-games.tv/wst-data/ryan-share/galaxy/install-galaxy.sh | bash
@@ -13,6 +13,7 @@ set -euo pipefail
DOWNLOAD_URL="https://mng-web-sharing.mini-games.tv/wst-data/ryan-share/galaxy/Galaxy.zip"
APP_NAME="Galaxy.app"
PROCESS_NAME="galaxy-oss"
INSTALL_DIR="/Applications"
# ---------- helpers ----------
@@ -44,14 +45,21 @@ if [[ ! -d "$TMP_DIR/$APP_NAME" ]]; then
fail "$APP_NAME not found after extraction."
fi
# ---------- 3. Clear quarantine ----------
info "Removing the macOS quarantine attribute..."
/usr/bin/xattr -dr com.apple.quarantine "$TMP_DIR/$APP_NAME" 2>/dev/null || true
# ---------- 3. Clear quarantine & ad-hoc sign ----------
info "Clearing quarantine attributes..."
/usr/bin/xattr -cr "$TMP_DIR/$APP_NAME" || fail "Failed to clear quarantine attributes."
info "Applying an ad-hoc code signature..."
/usr/bin/codesign --force --deep --sign - "$TMP_DIR/$APP_NAME" || fail "Code signing failed."
info "Verifying the code signature..."
/usr/bin/codesign --verify --deep --strict --verbose=2 "$TMP_DIR/$APP_NAME" ||
fail "Code signature verification failed."
# ---------- 4. Kill, remove, install, launch ----------
info "Stopping any running Galaxy processes..."
pkill -x "Galaxy" 2>/dev/null && sleep 1 || true
pkill -9 -x "Galaxy" 2>/dev/null || true
pkill -x "$PROCESS_NAME" 2>/dev/null && sleep 1 || true
pkill -9 -x "$PROCESS_NAME" 2>/dev/null || true
INSTALLED_APP="$INSTALL_DIR/$APP_NAME"
STAGED_APP="$INSTALL_DIR/.$APP_NAME.new"
@@ -60,6 +68,9 @@ info "Staging $APP_NAME in $INSTALL_DIR..."
rm -rf "$STAGED_APP"
cp -R "$TMP_DIR/$APP_NAME" "$STAGED_APP" || fail "Failed to copy $APP_NAME to $INSTALL_DIR."
/usr/bin/codesign --verify --deep --strict --verbose=2 "$STAGED_APP" ||
fail "Installed application signature verification failed."
if [[ -d "$INSTALLED_APP" ]]; then
info "Removing existing $INSTALLED_APP..."
rm -rf "$INSTALLED_APP"
@@ -69,6 +80,16 @@ info "Installing $APP_NAME to $INSTALL_DIR..."
mv "$STAGED_APP" "$INSTALLED_APP" || fail "Failed to install $APP_NAME."
info "Launching Galaxy..."
open "$INSTALLED_APP"
/usr/bin/open "$INSTALLED_APP" || fail "macOS failed to launch Galaxy."
info "Done! Galaxy is running."
for _ in {1..50}; do
if pgrep -x "$PROCESS_NAME" >/dev/null; then
sleep 2
pgrep -x "$PROCESS_NAME" >/dev/null || fail "Galaxy exited immediately after launch."
info "Done! Galaxy is running."
exit 0
fi
sleep 0.1
done
fail "Galaxy did not start. Run $INSTALLED_APP/Contents/MacOS/$PROCESS_NAME to see the launch error."