#!/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."