Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions mycloud-desktop/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# myCloud Desktop Post-Image Configuration

Scripts for re-establishing myCloud Desktop configuration after restoring from a disk image or cloning a Mac.

## Usage

Run the post-image script after restoring a Mac from a disk image:

```bash
bash "/Applications/myCloud Desktop/macosx/myCloud Desktop-post-image.sh"
```

Or deploy from this repository:

```bash
sudo cp post-image.sh "/Applications/myCloud Desktop/macosx/myCloud Desktop-post-image.sh"
bash "/Applications/myCloud Desktop/macosx/myCloud Desktop-post-image.sh"
```

## What It Does

1. **Launch Agent** — Reloads the launchd agent for auto-start on login
2. **Login Item** — Ensures myCloud Desktop is registered as a login item
3. **Finder Extension** — Re-registers the Finder extension with `pluginkit`
4. **Permissions** — Fixes executable permissions on key binaries

## Enabling the Finder Extension

The script registers the extension, but it must be enabled manually:

### Via System Settings
1. Open **System Settings**
2. Go to **Privacy & Security** → **Extensions** → **Added Extensions**
3. Find **myCloud Desktop** and enable the Finder extension

### Via Command Line
```bash
pluginkit -e use -i ch.swisscom.mycloud.desktop.client.mac.finder
```

## Verification

Check if the extension is registered:
```bash
pluginkit -m | grep mycloud
```

A `-` prefix means disabled, `+` means enabled.
51 changes: 51 additions & 0 deletions mycloud-desktop/post-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env bash
# Post-image configuration script for myCloud Desktop
# Run this after restoring from a disk image to re-establish app configuration

APP_DIR="/Applications/myCloud Desktop"
APP_NAME="myCloud Desktop"
LAUNCH_AGENT_PLIST="$HOME/Library/LaunchAgents/com.install4j.6427-8897-8914-3516.myCloud Desktop.app.plist"
FINDER_EXT="$APP_DIR/myCloud Desktop.app/Contents/PlugIns/finderExtension.appex"

echo "=== myCloud Desktop Post-Image Configuration ==="

# Ensure LaunchAgents directory exists
mkdir -p "$HOME/Library/LaunchAgents"

# Re-register launch agent if plist exists but isn't loaded
if [ -f "$LAUNCH_AGENT_PLIST" ]; then
echo "Loading launch agent..."
launchctl unload "$LAUNCH_AGENT_PLIST" 2>/dev/null || true
launchctl load "$LAUNCH_AGENT_PLIST"
echo "Launch agent loaded."
else
echo "Warning: Launch agent plist not found at $LAUNCH_AGENT_PLIST"
fi

# Re-add to login items if not already present
echo "Ensuring login item is registered..."
osascript -e "tell application \"System Events\"
if not (exists login item \"$APP_NAME\") then
make login item at end with properties {path:\"$APP_DIR/$APP_NAME.app\", hidden:false, name:\"$APP_NAME\"}
end if
end tell" 2>/dev/null || echo "Note: Could not add login item (may require permission)"

# Verify and register Finder extension
if [ -d "$FINDER_EXT" ]; then
echo "Finder extension found."
# Re-register the extension with the system
pluginkit -a "$FINDER_EXT" 2>/dev/null && echo "Finder extension registered." || echo "Note: Could not register Finder extension automatically."
echo "Tip: Enable it in System Settings > Privacy & Security > Extensions > Finder Extensions"
else
echo "Warning: Finder extension not found at $FINDER_EXT"
fi

# Fix permissions if needed
if [ -w "$APP_DIR" ]; then
echo "Fixing executable permissions..."
chmod +x "$APP_DIR/myCloud Desktop.app/Contents/MacOS/JavaApplicationStub" 2>/dev/null || true
chmod +x "$APP_DIR/app/restarter.sh" 2>/dev/null || true
fi

echo "=== Post-image configuration complete ==="
exit 0