Files
ElyOffice/scripts/inert-lo.sh
T

18 lines
897 B
Bash
Executable File

#!/usr/bin/env bash
# The built LibreOffice bundle holds libraries, nothing to register.
set -euo pipefail
app=${1:?usage: scripts/inert-lo.sh path/to/LibreOffice.app}
plist=$app/Contents/Info.plist
[ -f "$plist" ] || { echo "inert-lo.sh: no $plist" >&2; exit 1; }
lsregister=/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister
for key in CFBundleDocumentTypes CFBundleURLTypes UTExportedTypeDeclarations UTImportedTypeDeclarations; do
if /usr/libexec/PlistBuddy -c "Print :$key" "$plist" >/dev/null 2>&1; then
/usr/libexec/PlistBuddy -c "Delete :$key" "$plist"
fi
done
rm -rf "$app/Contents/PlugIns" "$app/Contents/Library/Spotlight"
"$lsregister" -u "$app"
# Spotlight would find the bundle and register it again.
touch "$(cd "$app/../../.." && pwd)/.metadata_never_index"
echo "inert-lo.sh: $app claims no files and is unregistered"