#!/bin/bash
if [[ $# -lt 2 ]]; then
  echo "Usage: $0 <folder-name> <zip-path>"
  exit 1
fi

FN=$1
ZIP_PATH=$2
TARGET_DIR=$(dirname "$ZIP_PATH")

cd "$TARGET_DIR" || exit

echo "1. Unzipping $ZIP_PATH into $FN..."
unzip -o -q "$ZIP_PATH" -d "$FN"

echo "2. Stripping Gatekeeper Quarantine and setting permissions..."
chmod -R u+wrx "$FN"
xattr -rc "$FN"

echo "ffmpeg has been successfully installed and signed."