Add Fleet-managed app: Little Snitch for macOS (#36338)
- Add input manifest for little-snitch - Generate output files - Add description to apps.json
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "Little Snitch",
|
||||
"slug": "little-snitch/darwin",
|
||||
"unique_identifier": "at.obdev.LittleSnitch",
|
||||
"token": "little-snitch",
|
||||
"installer_format": "dmg",
|
||||
"default_categories": ["Developer tools"]
|
||||
}
|
||||
@@ -428,6 +428,13 @@
|
||||
"unique_identifier": "com.linear",
|
||||
"description": "Linear is an app to manage software development and track bugs."
|
||||
},
|
||||
{
|
||||
"name": "Little Snitch",
|
||||
"slug": "little-snitch/darwin",
|
||||
"platform": "darwin",
|
||||
"unique_identifier": "at.obdev.LittleSnitch",
|
||||
"description": "Little Snitch is a network monitor and application firewall that provides real-time visibility and control over network connections for macOS."
|
||||
},
|
||||
{
|
||||
"name": "Logi Options+",
|
||||
"slug": "logi-options+/darwin",
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"version": "6.3.3",
|
||||
"queries": {
|
||||
"exists": "SELECT 1 FROM apps WHERE bundle_identifier = 'at.obdev.LittleSnitch';"
|
||||
},
|
||||
"installer_url": "https://www.obdev.at/downloads/littlesnitch/LittleSnitch-6.3.3.dmg",
|
||||
"install_script_ref": "8f85249a",
|
||||
"uninstall_script_ref": "6d6725ce",
|
||||
"sha256": "9180c2ee2f69259d920255258930783aa7c9cc1ffbbb128920df2f51a9955265",
|
||||
"default_categories": [
|
||||
"Security"
|
||||
]
|
||||
}
|
||||
],
|
||||
"refs": {
|
||||
"6d6725ce": "#!/bin/sh\n\n# variables\nAPPDIR=\"/Applications/\"\nLOGGED_IN_USER=$(scutil <<< \"show State:/Users/ConsoleUser\" | awk '/Name :/ { print $3 }')\n# functions\n\ntrash() {\n local logged_in_user=\"$1\"\n local target_file=\"$2\"\n local timestamp=\"$(date +%Y-%m-%d-%s)\"\n local rand=\"$(jot -r 1 0 99999)\"\n\n # replace ~ with /Users/$logged_in_user\n if [[ \"$target_file\" == ~* ]]; then\n target_file=\"/Users/$logged_in_user${target_file:1}\"\n fi\n\n local trash=\"/Users/$logged_in_user/.Trash\"\n local file_name=\"$(basename \"${target_file}\")\"\n\n if [[ -e \"$target_file\" ]]; then\n echo \"removing $target_file.\"\n mv -f \"$target_file\" \"$trash/${file_name}_${timestamp}_${rand}\"\n else\n echo \"$target_file doesn't exist.\"\n fi\n}\n\nsudo rm -rf \"$APPDIR/Little Snitch.app\"\nsudo rmdir '/Library/Application Support/Objective Development'\ntrash $LOGGED_IN_USER '/Library/Application Support/Objective Development/Little Snitch'\ntrash $LOGGED_IN_USER '/Library/Caches/at.obdev.LittleSnitchConfiguration'\ntrash $LOGGED_IN_USER '/Library/Extensions/LittleSnitch.kext'\ntrash $LOGGED_IN_USER '/Library/Little Snitch'\ntrash $LOGGED_IN_USER '/Library/Logs/LittleSnitchDaemon.log'\ntrash $LOGGED_IN_USER '/Library/StagedExtensions/Library/Extensions/LittleSnitch.kext'\ntrash $LOGGED_IN_USER '~/Library/Application Support/Little Snitch'\ntrash $LOGGED_IN_USER '~/Library/Caches/at.obdev.LittleSnitchAgent'\ntrash $LOGGED_IN_USER '~/Library/Caches/at.obdev.LittleSnitchConfiguration'\ntrash $LOGGED_IN_USER '~/Library/Caches/at.obdev.LittleSnitchHelper'\ntrash $LOGGED_IN_USER '~/Library/Caches/at.obdev.LittleSnitchSoftwareUpdate'\ntrash $LOGGED_IN_USER '~/Library/Caches/com.apple.helpd/Generated/at.obdev.LittleSnitchConfiguration.help*'\ntrash $LOGGED_IN_USER '~/Library/Caches/com.apple.helpd/SDMHelpData/Other/English/HelpSDMIndexFile/at.obdev.LittleSnitchConfiguration.help*'\ntrash $LOGGED_IN_USER '~/Library/Logs/Little Snitch Agent.log'\ntrash $LOGGED_IN_USER '~/Library/Logs/Little Snitch Helper.log'\ntrash $LOGGED_IN_USER '~/Library/Logs/Little Snitch Installer.log'\ntrash $LOGGED_IN_USER '~/Library/Logs/Little Snitch Network Monitor.log'\ntrash $LOGGED_IN_USER '~/Library/Preferences/at.obdev.LittleSnitchAgent.plist'\ntrash $LOGGED_IN_USER '~/Library/Preferences/at.obdev.LittleSnitchConfiguration.plist'\ntrash $LOGGED_IN_USER '~/Library/Preferences/at.obdev.LittleSnitchInstaller.plist'\ntrash $LOGGED_IN_USER '~/Library/Preferences/at.obdev.LittleSnitchNetworkMonitor.plist'\ntrash $LOGGED_IN_USER '~/Library/Preferences/at.obdev.LittleSnitchSoftwareUpdate.plist'\ntrash $LOGGED_IN_USER '~/Library/Saved Application State/at.obdev.LittleSnitchInstaller.savedState'\ntrash $LOGGED_IN_USER '~/Library/WebKit/at.obdev.LittleSnitchConfiguration'\n",
|
||||
"8f85249a": "#!/bin/sh\n\n# variables\nAPPDIR=\"/Applications/\"\nTMPDIR=$(dirname \"$(realpath $INSTALLER_PATH)\")\n# functions\n\nquit_application() {\n local bundle_id=\"$1\"\n local timeout_duration=10\n\n # check if the application is running\n if ! osascript -e \"application id \\\"$bundle_id\\\" is running\" 2>/dev/null; then\n return\n fi\n\n local console_user\n console_user=$(stat -f \"%Su\" /dev/console)\n if [[ $EUID -eq 0 && \"$console_user\" == \"root\" ]]; then\n echo \"Not logged into a non-root GUI; skipping quitting application ID '$bundle_id'.\"\n return\n fi\n\n echo \"Quitting application '$bundle_id'...\"\n\n # try to quit the application within the timeout period\n local quit_success=false\n SECONDS=0\n while (( SECONDS < timeout_duration )); do\n if osascript -e \"tell application id \\\"$bundle_id\\\" to quit\" >/dev/null 2>&1; then\n if ! pgrep -f \"$bundle_id\" >/dev/null 2>&1; then\n echo \"Application '$bundle_id' quit successfully.\"\n quit_success=true\n break\n fi\n fi\n sleep 1\n done\n\n if [[ \"$quit_success\" = false ]]; then\n echo \"Application '$bundle_id' did not quit.\"\n fi\n}\n\n\n# extract contents\nMOUNT_POINT=$(mktemp -d /tmp/dmg_mount_XXXXXX)\nhdiutil attach -plist -nobrowse -readonly -mountpoint \"$MOUNT_POINT\" \"$INSTALLER_PATH\"\nsudo cp -R \"$MOUNT_POINT\"/* \"$TMPDIR\"\nhdiutil detach \"$MOUNT_POINT\"\n# copy to the applications folder\nquit_application 'at.obdev.LittleSnitch'\nif [ -d \"$APPDIR/Little Snitch.app\" ]; then\n\tsudo mv \"$APPDIR/Little Snitch.app\" \"$TMPDIR/Little Snitch.app.bkp\"\nfi\nsudo cp -R \"$TMPDIR/Little Snitch.app\" \"$APPDIR\"\n"
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -53,24 +53,90 @@ fi
|
||||
|
||||
# Extract CFBundleIconFile from Info.plist
|
||||
ICON_FILE=$(defaults read "$INFO_PLIST" CFBundleIconFile 2>/dev/null || plutil -extract CFBundleIconFile raw "$INFO_PLIST" 2>/dev/null || echo "")
|
||||
|
||||
# If CFBundleIconFile not found, try modern approach with CFBundleIconName (Asset Catalog)
|
||||
if [[ -z "$ICON_FILE" ]]; then
|
||||
echo "Error: CFBundleIconFile not found in Info.plist"
|
||||
exit 1
|
||||
fi
|
||||
ICON_NAME=$(defaults read "$INFO_PLIST" CFBundleIconName 2>/dev/null || plutil -extract CFBundleIconName raw "$INFO_PLIST" 2>/dev/null || echo "")
|
||||
|
||||
# Handle case where extension might or might not be included
|
||||
if [[ "$ICON_FILE" != *.icns ]]; then
|
||||
ICON_FILE="${ICON_FILE}.icns"
|
||||
fi
|
||||
if [[ -n "$ICON_NAME" ]]; then
|
||||
echo "CFBundleIconFile not found, but CFBundleIconName found: $ICON_NAME"
|
||||
echo "Extracting icon from Asset Catalog using macOS Workspace API..."
|
||||
|
||||
# Find the exact icon file in Resources folder
|
||||
ICNS_PATH="$APP_PATH/Contents/Resources/$ICON_FILE"
|
||||
if [[ ! -f "$ICNS_PATH" ]]; then
|
||||
echo "Error: Icon file '$ICON_FILE' not found in $APP_PATH/Contents/Resources"
|
||||
exit 1
|
||||
fi
|
||||
# Create temporary directory for extraction
|
||||
TMP_EXTRACT_DIR=$(mktemp -d)
|
||||
EXTRACTED_ICON="$TMP_EXTRACT_DIR/app-icon.png"
|
||||
|
||||
echo "Using icon file: $ICON_FILE"
|
||||
# Use osascript to extract icon via NSWorkspace
|
||||
osascript <<EOF
|
||||
use framework "Foundation"
|
||||
use framework "AppKit"
|
||||
|
||||
set appPath to "$APP_PATH"
|
||||
set outputPath to "$EXTRACTED_ICON"
|
||||
|
||||
set workspace to current application's NSWorkspace's sharedWorkspace()
|
||||
set appIcon to workspace's iconForFile:appPath
|
||||
|
||||
set imageData to appIcon's TIFFRepresentation()
|
||||
set imageRep to (current application's NSBitmapImageRep's imageRepWithData:imageData)
|
||||
set pngData to (imageRep's representationUsingType:(current application's NSPNGFileType) |properties|:(missing value))
|
||||
|
||||
pngData's writeToFile:outputPath atomically:true
|
||||
EOF
|
||||
|
||||
if [[ ! -f "$EXTRACTED_ICON" ]]; then
|
||||
echo "Error: Failed to extract icon from Asset Catalog"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create a temporary icns file from the extracted PNG for compatibility with rest of script
|
||||
TMP_ICNS="$TMP_EXTRACT_DIR/app-icon.icns"
|
||||
|
||||
# Create iconset directory
|
||||
ICONSET_DIR="$TMP_EXTRACT_DIR/AppIcon.iconset"
|
||||
mkdir -p "$ICONSET_DIR"
|
||||
|
||||
# Generate multiple sizes for iconset
|
||||
sips -z 16 16 "$EXTRACTED_ICON" --out "$ICONSET_DIR/icon_16x16.png" > /dev/null 2>&1
|
||||
sips -z 32 32 "$EXTRACTED_ICON" --out "$ICONSET_DIR/icon_16x16@2x.png" > /dev/null 2>&1
|
||||
sips -z 32 32 "$EXTRACTED_ICON" --out "$ICONSET_DIR/icon_32x32.png" > /dev/null 2>&1
|
||||
sips -z 64 64 "$EXTRACTED_ICON" --out "$ICONSET_DIR/icon_32x32@2x.png" > /dev/null 2>&1
|
||||
sips -z 128 128 "$EXTRACTED_ICON" --out "$ICONSET_DIR/icon_128x128.png" > /dev/null 2>&1
|
||||
sips -z 256 256 "$EXTRACTED_ICON" --out "$ICONSET_DIR/icon_128x128@2x.png" > /dev/null 2>&1
|
||||
sips -z 256 256 "$EXTRACTED_ICON" --out "$ICONSET_DIR/icon_256x256.png" > /dev/null 2>&1
|
||||
sips -z 512 512 "$EXTRACTED_ICON" --out "$ICONSET_DIR/icon_256x256@2x.png" > /dev/null 2>&1
|
||||
sips -z 512 512 "$EXTRACTED_ICON" --out "$ICONSET_DIR/icon_512x512.png" > /dev/null 2>&1
|
||||
sips -z 1024 1024 "$EXTRACTED_ICON" --out "$ICONSET_DIR/icon_512x512@2x.png" > /dev/null 2>&1
|
||||
|
||||
# Create icns from iconset
|
||||
iconutil -c icns "$ICONSET_DIR" -o "$TMP_ICNS"
|
||||
|
||||
if [[ ! -f "$TMP_ICNS" ]]; then
|
||||
echo "Error: Failed to create icns file from extracted icon"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ICNS_PATH="$TMP_ICNS"
|
||||
echo "Successfully extracted icon from Asset Catalog"
|
||||
else
|
||||
echo "Error: Neither CFBundleIconFile nor CFBundleIconName found in Info.plist"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# Handle case where extension might or might not be included
|
||||
if [[ "$ICON_FILE" != *.icns ]]; then
|
||||
ICON_FILE="${ICON_FILE}.icns"
|
||||
fi
|
||||
|
||||
# Find the exact icon file in Resources folder
|
||||
ICNS_PATH="$APP_PATH/Contents/Resources/$ICON_FILE"
|
||||
if [[ ! -f "$ICNS_PATH" ]]; then
|
||||
echo "Error: Icon file '$ICON_FILE' not found in $APP_PATH/Contents/Resources"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Using icon file: $ICON_FILE"
|
||||
fi
|
||||
|
||||
# Extract iconset
|
||||
TMP_DIR=$(mktemp -d)
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
Reference in New Issue
Block a user