From 40382d2a120324930e0b7ba4ea4655b89b721084 Mon Sep 17 00:00:00 2001 From: Edward Groves Date: Sat, 18 Jul 2026 12:38:55 -0400 Subject: [PATCH] Feat: Added homebrew casks for both Macos and Linux --- Casks/lce-emerald-launcher-experimental.rb | 18 +++++ Casks/lce-emerald-launcher.rb | 18 +++++ Formula/lce-emerald-launcher.rb | 19 +++++ scripts/fix-macos-quarantine.sh | 12 ++-- scripts/update-homebrew.py | 81 ++++++++++++++++++++++ 5 files changed, 142 insertions(+), 6 deletions(-) create mode 100644 Casks/lce-emerald-launcher-experimental.rb create mode 100644 Casks/lce-emerald-launcher.rb create mode 100644 Formula/lce-emerald-launcher.rb create mode 100644 scripts/update-homebrew.py diff --git a/Casks/lce-emerald-launcher-experimental.rb b/Casks/lce-emerald-launcher-experimental.rb new file mode 100644 index 0000000..4023171 --- /dev/null +++ b/Casks/lce-emerald-launcher-experimental.rb @@ -0,0 +1,18 @@ +cask "lce-emerald-launcher-experimental" do + version "1.5.1-experimental" + sha256 intel: "7826e105f283f22cb5784b7e0dd3c90b8fc493a636ca11333a4b867f3e1a9891", + arm: "e1c392213e0d34546f55971a1e381b942d2c896671576a18ab1db4ff1d4270b9" + + url "https://github.com/LCE-Hub/LCE-Emerald-Launcher-cask/releases/download/experimental/LCE.Emerald.Launcher_#{version.to_s.split("-").first}_#{arch}.dmg" + name "LCE Emerald Launcher Experimental" + desc "Minecraft Legacy Console Edition Launcher (Experimental)" + homepage "https://github.com/HuntedRaven7/LCE-Emerald-Launcher-cask" + + app "LCE Emerald Launcher/LCE Emerald Launcher.app" + + zap trash: [ + "~/Library/Application Support/com.emerald.legacy", + "~/Library/Preferences/com.emerald.legacy.plist", + "~/Library/Saved Application State/com.emerald.legacy.savedState", + ] +end diff --git a/Casks/lce-emerald-launcher.rb b/Casks/lce-emerald-launcher.rb new file mode 100644 index 0000000..f1d7c0f --- /dev/null +++ b/Casks/lce-emerald-launcher.rb @@ -0,0 +1,18 @@ +cask "lce-emerald-launcher" do + version "1.5.1" + sha256 intel: "7826e105f283f22cb5784b7e0dd3c90b8fc493a636ca11333a4b867f3e1a9891", + arm: "e1c392213e0d34546f55971a1e381b942d2c896671576a18ab1db4ff1d4270b9" + + url "https://github.com/LCE-Hub/LCE-Emerald-Launcher-cask/releases/download/v#{version}/LCE.Emerald.Launcher_#{version}_#{arch}.dmg" + name "LCE Emerald Launcher" + desc "Minecraft Legacy Console Edition Launcher" + homepage "https://github.com/HuntedRaven7/LCE-Emerald-Launcher-cask" + + app "LCE Emerald Launcher/LCE Emerald Launcher.app" + + zap trash: [ + "~/Library/Application Support/com.emerald.legacy", + "~/Library/Preferences/com.emerald.legacy.plist", + "~/Library/Saved Application State/com.emerald.legacy.savedState", + ] +end diff --git a/Formula/lce-emerald-launcher.rb b/Formula/lce-emerald-launcher.rb new file mode 100644 index 0000000..8e626af --- /dev/null +++ b/Formula/lce-emerald-launcher.rb @@ -0,0 +1,19 @@ +class LceEmeraldLauncher < Formula + desc "Minecraft Legacy Console Edition Launcher" + homepage "https://github.com/HuntedRaven7/LCE-Emerald-Launcher-cask" + url "https://github.com/HuntedRaven7/LCE-Emerald-Launcher-cask/releases/download/v#{version}/LCE.Emerald.Launcher_#{version}_amd64.AppImage" + sha256 "541271f927249fdfc4ada03b72110cdacaef388ed33b7d75724545145b8c412f" + version "1.5.0" + license "GPL-3.0-only" + + depends_on :linux + + def install + # Rename and install the AppImage + bin.install "LCE.Emerald.Launcher_#{version}_amd64.AppImage" => "lce-emerald-launcher" + end + + test do + assert_predicate bin/"lce-emerald-launcher", :exist? + end +end diff --git a/scripts/fix-macos-quarantine.sh b/scripts/fix-macos-quarantine.sh index dccf22d..52d2617 100755 --- a/scripts/fix-macos-quarantine.sh +++ b/scripts/fix-macos-quarantine.sh @@ -9,13 +9,13 @@ APP_PATH="$1" BUNDLE_ID="com.emerald.legacy" if [ -z "$APP_PATH" ]; then - echo "Usage: $0 " - exit 1 + echo "Usage: $0 " + exit 1 fi if [ ! -d "$APP_PATH" ]; then - echo "Error: App bundle not found at $APP_PATH" - exit 1 + echo "Error: App bundle not found at $APP_PATH" + exit 1 fi echo "Fixing macOS quarantine for: $APP_PATH" @@ -25,8 +25,8 @@ xattr -cr "$APP_PATH" # Add basic code signing (ad-hoc signature) codesign --force --deep --sign - "$APP_PATH" 2>/dev/null || { - echo "Warning: Code signing failed, but quarantine removal should work" + echo "Warning: Code signing failed, but quarantine removal should work" } -echo "✅ macOS quarantine fix completed" +echo "macOS quarantine fix completed" echo "The app should now launch without 'damaged' error" diff --git a/scripts/update-homebrew.py b/scripts/update-homebrew.py new file mode 100644 index 0000000..c66fe97 --- /dev/null +++ b/scripts/update-homebrew.py @@ -0,0 +1,81 @@ +import argparse +import re +import os + +def update_stable(version, intel_hash, arm_hash, linux_hash): + cask_path = "Casks/lce-emerald-launcher.rb" + formula_path = "Formula/lce-emerald-launcher.rb" + + # Update Cask + if os.path.exists(cask_path): + with open(cask_path, 'r') as f: + content = f.read() + + # Replace version + content = re.sub(r'^\s*version\s+"[^"]+"', f' version "{version}"', content, flags=re.MULTILINE) + # Replace sha256 block + content = re.sub(r'sha256\s+intel:\s+"[a-f0-9]+",\r?\n\s+arm:\s+"[a-f0-9]+"', + f'sha256 intel: "{intel_hash}",\n arm: "{arm_hash}"', + content) + + with open(cask_path, 'w') as f: + f.write(content) + print(f"Updated {cask_path}") + else: + print(f"Error: {cask_path} not found") + + # Update Formula + if os.path.exists(formula_path): + with open(formula_path, 'r') as f: + content = f.read() + + # Replace version + content = re.sub(r'^\s*version\s+"[^"]+"', f' version "{version}"', content, flags=re.MULTILINE) + # Replace sha256 + content = re.sub(r'^\s*sha256\s+"[a-f0-9]+"', f' sha256 "{linux_hash}"', content, flags=re.MULTILINE) + + with open(formula_path, 'w') as f: + f.write(content) + print(f"Updated {formula_path}") + else: + print(f"Error: {formula_path} not found") + +def update_experimental(version, intel_hash, arm_hash): + cask_path = "Casks/lce-emerald-launcher-experimental.rb" + + if os.path.exists(cask_path): + with open(cask_path, 'r') as f: + content = f.read() + + # Replace version + content = re.sub(r'^\s*version\s+"[^"]+"', f' version "{version}"', content, flags=re.MULTILINE) + # Replace sha256 block + content = re.sub(r'sha256\s+intel:\s+"[a-f0-9]+",\r?\n\s+arm:\s+"[a-f0-9]+"', + f'sha256 intel: "{intel_hash}",\n arm: "{arm_hash}"', + content) + + with open(cask_path, 'w') as f: + f.write(content) + print(f"Updated {cask_path}") + else: + print(f"Error: {cask_path} not found") + +def main(): + parser = argparse.ArgumentParser(description="Update Homebrew Formula/Cask files") + parser.add_argument("--type", choices=["stable", "experimental"], required=True) + parser.add_argument("--version", required=True) + parser.add_argument("--intel-hash", required=True) + parser.add_argument("--arm-hash", required=True) + parser.add_argument("--linux-hash") + + args = parser.parse_args() + + if args.type == "stable": + if not args.linux_hash: + raise ValueError("--linux-hash is required for stable update") + update_stable(args.version, args.intel_hash, args.arm_hash, args.linux_hash) + elif args.type == "experimental": + update_experimental(args.version, args.intel_hash, args.arm_hash) + +if __name__ == "__main__": + main()