diff --git a/fix_mac.sh b/fix_mac.sh new file mode 100755 index 0000000..7e9ec1d --- /dev/null +++ b/fix_mac.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +APP_PATH="/Applications/draugnorak.app" + +echo "Fixing Draugnorak at: $APP_PATH" + +############################################## +# 1. Remove Quarantine Attribute +############################################## +echo "Removing quarantine flag..." +xattr -dr com.apple.quarantine "$APP_PATH" 2>/dev/null + +############################################## +# 2. Ensure Executable Permissions +############################################## +echo "Ensuring executable permission..." +chmod +x "$APP_PATH/Contents/MacOS/"* 2>/dev/null + +############################################## +# 3. Detect Main Executable & Patch Info.plist +############################################## +EXECUTABLE=$(ls "$APP_PATH/Contents/MacOS/" | head -n 1) + +echo "Patching Info.plist..." +/usr/libexec/PlistBuddy -c "Set :CFBundleExecutable $EXECUTABLE" "$APP_PATH/Contents/Info.plist" 2>/dev/null +/usr/libexec/PlistBuddy -c "Set :CFBundlePackageType APPL" "$APP_PATH/Contents/Info.plist" 2>/dev/null +/usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier com.draugnorak.$EXECUTABLE" "$APP_PATH/Contents/Info.plist" 2>/dev/null + +############################################## +# 4. Ad-Hoc Code Re-sign +############################################## +echo "Re-signing bundle (ad-hoc)..." +sudo codesign --force --deep --sign - "$APP_PATH" + +############################################## +# 5. Refresh Launch Services +############################################## +echo "Refreshing LaunchServices database..." +/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -f "$APP_PATH" + +echo "Done!" +echo "Try launching Draugnorak normally." \ No newline at end of file