build(packaging): set up multi-platform packaging and CI/CD

- Add GitHub Actions workflows for CI and releases
- Create icon generation script and SVG source
- Configure electron-builder for macOS, Windows, Linux
- Add macOS entitlements for code signing
- Add Linux post-install/remove scripts
- Enhance package.json with publishing scripts
- Add artifact naming convention
This commit is contained in:
Haze
2026-02-05 23:39:55 +08:00
Unverified
parent e02cf05baf
commit bad94e7e76
12 changed files with 815 additions and 4 deletions

122
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,122 @@
# ClawX CI Workflow
# Runs on pull requests and pushes to main
name: CI
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run linter
run: pnpm run lint
typecheck:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run typecheck
run: pnpm run typecheck
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run tests
run: pnpm run test
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm run build:vite
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

145
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,145 @@
# ClawX Release Workflow
# Builds and publishes releases for macOS, Windows, and Linux
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 1.0.0)'
required: true
permissions:
contents: write
jobs:
release:
strategy:
matrix:
include:
- os: macos-latest
platform: mac
- os: windows-latest
platform: win
- os: ubuntu-latest
platform: linux
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build Vite
run: pnpm run build:vite
# macOS specific steps
- name: Build macOS
if: matrix.platform == 'mac'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# For code signing (optional)
# CSC_LINK: ${{ secrets.MAC_CERTS }}
# CSC_KEY_PASSWORD: ${{ secrets.MAC_CERTS_PASSWORD }}
# For notarization (optional)
# APPLE_ID: ${{ secrets.APPLE_ID }}
# APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
# APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: pnpm run package:mac
# Windows specific steps
- name: Build Windows
if: matrix.platform == 'win'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# For code signing (optional)
# CSC_LINK: ${{ secrets.WIN_CERTS }}
# CSC_KEY_PASSWORD: ${{ secrets.WIN_CERTS_PASSWORD }}
run: pnpm run package:win
# Linux specific steps
- name: Build Linux
if: matrix.platform == 'linux'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: pnpm run package:linux
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: release-${{ matrix.platform }}
path: |
release/*.dmg
release/*.zip
release/*.exe
release/*.AppImage
release/*.deb
release/*.yml
release/*.yaml
retention-days: 7
publish:
needs: release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: release-artifacts
- name: List artifacts
run: ls -la release-artifacts/
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
release-artifacts/**/*.dmg
release-artifacts/**/*.zip
release-artifacts/**/*.exe
release-artifacts/**/*.AppImage
release-artifacts/**/*.deb
release-artifacts/**/*.yml
release-artifacts/**/*.yaml
draft: false
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }}
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -0,0 +1,185 @@
# Commit 7: Packaging and Distribution
## Summary
Set up comprehensive packaging and distribution infrastructure including CI/CD workflows, multi-platform build configuration, icon generation, and macOS code signing support.
## Changes
### GitHub Actions Workflows
#### `.github/workflows/ci.yml` (New)
Continuous Integration workflow for PRs and main branch:
- **lint**: ESLint validation
- **typecheck**: TypeScript type checking
- **test**: Unit test execution
- **build**: Multi-platform build verification (macOS, Windows, Linux)
#### `.github/workflows/release.yml` (New)
Release workflow triggered by version tags:
- Matrix builds for all platforms
- Artifact collection and upload
- GitHub Release creation with auto-generated notes
- Pre-release detection for alpha/beta versions
### Build Configuration
#### `electron-builder.yml`
Enhanced configuration:
- Artifact naming with version, OS, and arch
- ASAR packaging with native module unpacking
- macOS: Universal binary, notarization ready, extended info
- Windows: NSIS installer with customization
- Linux: AppImage, DEB, RPM targets with dependencies
New features:
- `artifactName` template for consistent naming
- `asarUnpack` for native modules
- macOS `extendInfo` for privacy permissions
- DMG background and icon configuration
- Linux desktop entry with keywords
#### `package.json`
New scripts:
- `icons`: Generate icons from SVG source
- `clean`: Remove build artifacts
- `package:mac:universal`: Build universal macOS binary
- `publish`: Build and publish to GitHub
- `publish:mac/win/linux`: Platform-specific publishing
- `release`: Full release workflow
### Icon Generation
#### `resources/icons/icon.svg` (New)
Vector source icon:
- Gradient background (#6366f1 to #8b5cf6)
- White claw symbol with "X" accent
- 200px corner radius on 1024px canvas
#### `scripts/generate-icons.sh` (New)
Icon generation script:
- Generates PNG at multiple sizes (16-1024px)
- Creates macOS `.icns` via iconutil
- Creates Windows `.ico` via ImageMagick
- Creates Linux PNG set
#### `resources/icons/README.md` (New)
Documentation for icon requirements and generation.
### macOS Signing
#### `entitlements.mac.plist` (New)
macOS entitlements for:
- Unsigned executable memory (V8)
- JIT compilation
- Library validation disable
- Network client access
- Child process spawning (Gateway)
- File access permissions
### Linux Packaging
#### `scripts/linux/after-install.sh` (New)
Post-installation script:
- Update desktop database
- Update icon cache
- Create CLI symlink
#### `scripts/linux/after-remove.sh` (New)
Post-removal script:
- Remove CLI symlink
- Update databases
## Technical Details
### Build Matrix
| Platform | Target | Architecture | Format |
|----------|--------|--------------|--------|
| macOS | dmg, zip | universal | Intel + Apple Silicon |
| Windows | nsis | x64, arm64 | .exe installer |
| Linux | AppImage | x64, arm64 | Portable |
| Linux | deb | x64, arm64 | Debian package |
| Linux | rpm | x64 | Red Hat package |
### Artifact Naming Convention
```
${productName}-${version}-${os}-${arch}.${ext}
Example: ClawX-1.0.0-mac-universal.dmg
```
### Code Signing (Optional)
**macOS:**
```yaml
env:
CSC_LINK: ${{ secrets.MAC_CERTS }}
CSC_KEY_PASSWORD: ${{ secrets.MAC_CERTS_PASSWORD }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
```
**Windows:**
```yaml
env:
CSC_LINK: ${{ secrets.WIN_CERTS }}
CSC_KEY_PASSWORD: ${{ secrets.WIN_CERTS_PASSWORD }}
```
### Release Process
1. Update version in `package.json`
2. Commit and push changes
3. Create and push version tag: `git tag v1.0.0 && git push --tags`
4. GitHub Actions builds all platforms
5. Artifacts uploaded to GitHub Release
6. Users receive update notification via electron-updater
### CI Pipeline
```
Push/PR to main
|
v
┌────────────────┐
│ lint │
│ typecheck │──> Parallel
│ test │
│ build │
└────────────────┘
|
v
All Pass?
|
┌───┴───┐
No Yes
| |
v v
Fail Merge OK
```
### Release Pipeline
```
Push tag v*
|
v
┌─────────────────────────────┐
│ Build (Matrix) │
│ ┌─────┬──────┬──────────┐ │
│ │ mac │ win │ linux │ │
│ └─────┴──────┴──────────┘ │
└─────────────────────────────┘
|
v
Upload Artifacts
|
v
Create GitHub Release
|
v
Auto-update available
```
## Version
v0.1.0-alpha (incremental)

View File

@@ -12,6 +12,7 @@
* [commit_4] Provider configuration - Secure API key storage, provider management UI
* [commit_5] Channel connection flows - Multi-channel support with QR/token connection UI
* [commit_6] Auto-update functionality - electron-updater integration with UI
* [commit_7] Packaging and distribution - CI/CD, multi-platform builds, icon generation
### Plan:
1. ~~Initialize project structure~~
@@ -20,7 +21,10 @@
4. ~~Add Provider configuration (API Key management)~~
5. ~~Implement Channel connection flows~~
6. ~~Add auto-update functionality~~
7. Packaging and distribution setup
7. ~~Packaging and distribution setup~~
8. Chat interface
9. Skills browser/enable page
10. Cron tasks management
## Version Milestones

View File

@@ -2,6 +2,7 @@ appId: app.clawx.desktop
productName: ClawX
copyright: Copyright © 2026 ClawX
compression: maximum
artifactName: ${productName}-${version}-${os}-${arch}.${ext}
directories:
output: release
@@ -17,13 +18,21 @@ extraResources:
to: resources/
filter:
- "**/*"
- "!icons/*.md"
- "!icons/*.svg"
asar: true
asarUnpack:
- "**/*.node"
# Auto-update configuration
publish:
- provider: github
owner: clawx
repo: clawx
releaseType: release
# macOS Configuration
mac:
category: public.app-category.productivity
icon: resources/icons/icon.icns
@@ -39,8 +48,15 @@ mac:
gatekeeperAssess: false
entitlements: entitlements.mac.plist
entitlementsInherit: entitlements.mac.plist
notarize: false # Set to true when you have Apple credentials
extendInfo:
NSMicrophoneUsageDescription: ClawX requires microphone access for voice features
NSCameraUsageDescription: ClawX requires camera access for video features
dmg:
background: resources/dmg-background.png
icon: resources/icons/icon.icns
iconSize: 100
contents:
- type: file
x: 130
@@ -50,6 +66,7 @@ dmg:
x: 410
y: 220
# Windows Configuration
win:
icon: resources/icons/icon.ico
target:
@@ -58,15 +75,25 @@ win:
- x64
- arm64
publisherName: ClawX Inc.
# For code signing, uncomment and configure:
# certificateFile: path/to/certificate.pfx
# certificatePassword: ${env.WIN_CSC_KEY_PASSWORD}
nsis:
oneClick: false
perMachine: false
allowToChangeInstallationDirectory: true
deleteAppDataOnUninstall: false
differentialPackage: true
createDesktopShortcut: true
createStartMenuShortcut: true
shortcutName: ClawX
uninstallDisplayName: ClawX
license: LICENSE
installerIcon: resources/icons/icon.ico
uninstallerIcon: resources/icons/icon.ico
# Linux Configuration
linux:
icon: resources/icons
target:
@@ -77,5 +104,36 @@ linux:
- target: deb
arch:
- x64
- arm64
- target: rpm
arch:
- x64
category: Utility
maintainer: ClawX Team
maintainer: ClawX Team <team@clawx.app>
vendor: ClawX
synopsis: AI Assistant powered by OpenClaw
description: |
ClawX is a graphical AI assistant application that integrates with
OpenClaw Gateway to provide intelligent automation and assistance
across multiple messaging platforms.
desktop:
Name: ClawX
Comment: AI Assistant powered by OpenClaw
Categories: Utility;Network;
Keywords: ai;assistant;automation;chat;
appImage:
license: LICENSE
deb:
depends:
- libgtk-3-0
- libnotify4
- libnss3
- libxss1
- libxtst6
- xdg-utils
- libatspi2.0-0
- libuuid1
afterInstall: scripts/linux/after-install.sh
afterRemove: scripts/linux/after-remove.sh

33
entitlements.mac.plist Normal file
View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- Required for Electron apps -->
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<!-- Allow JIT compilation for V8 -->
<key>com.apple.security.cs.allow-jit</key>
<true/>
<!-- Required for Hardened Runtime -->
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<!-- Network access for WebSocket/HTTP -->
<key>com.apple.security.network.client</key>
<true/>
<!-- Allow spawning child processes (for Gateway) -->
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
<!-- File access for user data -->
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
<!-- Downloads folder access -->
<key>com.apple.security.files.downloads.read-write</key>
<true/>
</dict>
</plist>

View File

@@ -12,7 +12,7 @@
"scripts": {
"dev": "vite",
"dev:electron": "electron .",
"build": "tsc && vite build && electron-builder",
"build": "pnpm run build:vite && pnpm run package",
"build:vite": "vite build",
"build:electron": "tsc -p tsconfig.node.json",
"preview": "vite preview",
@@ -23,11 +23,19 @@
"test:watch": "vitest",
"test:coverage": "vitest run --coverage",
"test:e2e": "playwright test",
"icons": "bash scripts/generate-icons.sh",
"clean": "rm -rf dist dist-electron release",
"package": "electron-builder",
"package:mac": "electron-builder --mac",
"package:mac:universal": "electron-builder --mac --universal",
"package:win": "electron-builder --win",
"package:linux": "electron-builder --linux",
"package:all": "electron-builder -mwl"
"package:all": "electron-builder -mwl",
"publish": "electron-builder --publish always",
"publish:mac": "electron-builder --mac --publish always",
"publish:win": "electron-builder --win --publish always",
"publish:linux": "electron-builder --linux --publish always",
"release": "pnpm run build:vite && pnpm run publish"
},
"dependencies": {
"electron-store": "^10.0.0",

68
resources/icons/README.md Normal file
View File

@@ -0,0 +1,68 @@
# ClawX Application Icons
This directory contains the application icons for all supported platforms.
## Required Files
| File | Platform | Description |
|------|----------|-------------|
| `icon.svg` | Source | Vector source for all icons |
| `icon.icns` | macOS | Apple Icon Image format |
| `icon.ico` | Windows | Windows ICO format |
| `icon.png` | All | 512x512 PNG fallback |
| `16x16.png` - `512x512.png` | Linux | PNG set for Linux |
## Generating Icons
### Using the Script
```bash
# Make the script executable
chmod +x scripts/generate-icons.sh
# Run icon generation
./scripts/generate-icons.sh
```
### Prerequisites
**macOS:**
```bash
brew install imagemagick librsvg
```
**Linux:**
```bash
apt install imagemagick librsvg2-bin
```
**Windows:**
Install ImageMagick from https://imagemagick.org/
### Manual Generation
If you prefer to generate icons manually:
1. **macOS (.icns)**
- Create a `.iconset` folder with properly named PNGs
- Run: `iconutil -c icns -o icon.icns ClawX.iconset`
2. **Windows (.ico)**
- Use ImageMagick: `convert icon_16.png icon_32.png icon_64.png icon_128.png icon_256.png icon.ico`
3. **Linux (PNGs)**
- Generate PNGs at: 16, 32, 48, 64, 128, 256, 512 pixels
## Design Guidelines
- **Background**: Gradient from #6366f1 to #8b5cf6 (Indigo to Violet)
- **Corner Radius**: ~20% of width (200px on 1024px canvas)
- **Foreground**: White claw symbol with "X" accent
- **Safe Area**: Keep 10% margin from edges
## Updating the Icon
1. Edit `icon.svg` with your vector editor (Figma, Illustrator, Inkscape)
2. Run `./scripts/generate-icons.sh`
3. Verify generated icons look correct
4. Commit all generated files

35
resources/icons/icon.svg Normal file
View File

@@ -0,0 +1,35 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">
<defs>
<linearGradient id="bgGrad" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" style="stop-color:#6366f1;stop-opacity:1" />
<stop offset="100%" style="stop-color:#8b5cf6;stop-opacity:1" />
</linearGradient>
<linearGradient id="clawGrad" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" style="stop-color:#ffffff;stop-opacity:1" />
<stop offset="100%" style="stop-color:#e0e7ff;stop-opacity:1" />
</linearGradient>
</defs>
<!-- Background -->
<rect x="0" y="0" width="1024" height="1024" rx="200" fill="url(#bgGrad)"/>
<!-- Claw shape -->
<g transform="translate(512, 512)" fill="url(#clawGrad)">
<!-- Center circle -->
<circle cx="0" cy="0" r="100"/>
<!-- Claw fingers -->
<path d="M -50 -80 Q -80 -200 -150 -280 Q -180 -320 -150 -350 Q -120 -380 -80 -350 Q -20 -300 40 -150 Z" />
<path d="M 50 -80 Q 80 -200 150 -280 Q 180 -320 150 -350 Q 120 -380 80 -350 Q 20 -300 -40 -150 Z" />
<path d="M -100 20 Q -220 0 -320 -40 Q -370 -60 -390 -20 Q -410 20 -370 50 Q -300 100 -150 80 Z" />
<path d="M 100 20 Q 220 0 320 -40 Q 370 -60 390 -20 Q 410 20 370 50 Q 300 100 150 80 Z" />
<path d="M 0 120 Q 0 250 0 350 Q 0 400 40 420 Q 80 400 80 350 L 80 250 Q 60 150 0 120 Z" />
<path d="M 0 120 Q 0 250 0 350 Q 0 400 -40 420 Q -80 400 -80 350 L -80 250 Q -60 150 0 120 Z" />
</g>
<!-- X mark -->
<g transform="translate(750, 750)" fill="#ffffff" opacity="0.9">
<rect x="-60" y="-15" width="120" height="30" rx="15" transform="rotate(45)"/>
<rect x="-60" y="-15" width="120" height="30" rx="15" transform="rotate(-45)"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

111
scripts/generate-icons.sh Normal file
View File

@@ -0,0 +1,111 @@
#!/bin/bash
# Icon Generation Script
# Generates app icons for macOS, Windows, and Linux from SVG source
#
# Prerequisites:
# - macOS: brew install imagemagick librsvg
# - Linux: apt install imagemagick librsvg2-bin
# - Windows: Install ImageMagick
#
# Usage: ./scripts/generate-icons.sh
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
ICONS_DIR="$PROJECT_DIR/resources/icons"
SVG_SOURCE="$ICONS_DIR/icon.svg"
echo "🎨 Generating ClawX icons..."
# Check if SVG source exists
if [ ! -f "$SVG_SOURCE" ]; then
echo "❌ SVG source not found: $SVG_SOURCE"
exit 1
fi
# Check for required tools
if ! command -v convert &> /dev/null; then
echo "❌ ImageMagick not found. Please install it:"
echo " macOS: brew install imagemagick"
echo " Linux: apt install imagemagick"
exit 1
fi
if ! command -v rsvg-convert &> /dev/null; then
echo "❌ rsvg-convert not found. Please install it:"
echo " macOS: brew install librsvg"
echo " Linux: apt install librsvg2-bin"
exit 1
fi
# Create temp directory
TEMP_DIR=$(mktemp -d)
trap "rm -rf $TEMP_DIR" EXIT
echo "📁 Using temp directory: $TEMP_DIR"
# Generate PNG files at various sizes
SIZES=(16 32 64 128 256 512 1024)
for SIZE in "${SIZES[@]}"; do
echo " Generating ${SIZE}x${SIZE} PNG..."
rsvg-convert -w $SIZE -h $SIZE "$SVG_SOURCE" -o "$TEMP_DIR/icon_${SIZE}.png"
done
# ============ macOS (.icns) ============
echo "🍎 Generating macOS .icns..."
ICONSET_DIR="$TEMP_DIR/ClawX.iconset"
mkdir -p "$ICONSET_DIR"
# macOS iconset requires specific file names
cp "$TEMP_DIR/icon_16.png" "$ICONSET_DIR/icon_16x16.png"
cp "$TEMP_DIR/icon_32.png" "$ICONSET_DIR/icon_16x16@2x.png"
cp "$TEMP_DIR/icon_32.png" "$ICONSET_DIR/icon_32x32.png"
cp "$TEMP_DIR/icon_64.png" "$ICONSET_DIR/icon_32x32@2x.png"
cp "$TEMP_DIR/icon_128.png" "$ICONSET_DIR/icon_128x128.png"
cp "$TEMP_DIR/icon_256.png" "$ICONSET_DIR/icon_128x128@2x.png"
cp "$TEMP_DIR/icon_256.png" "$ICONSET_DIR/icon_256x256.png"
cp "$TEMP_DIR/icon_512.png" "$ICONSET_DIR/icon_256x256@2x.png"
cp "$TEMP_DIR/icon_512.png" "$ICONSET_DIR/icon_512x512.png"
cp "$TEMP_DIR/icon_1024.png" "$ICONSET_DIR/icon_512x512@2x.png"
if command -v iconutil &> /dev/null; then
iconutil -c icns -o "$ICONS_DIR/icon.icns" "$ICONSET_DIR"
echo " ✅ Created icon.icns"
else
echo " ⚠️ iconutil not found (macOS only). Skipping .icns generation."
fi
# ============ Windows (.ico) ============
echo "🪟 Generating Windows .ico..."
# Windows ICO typically includes 16, 32, 48, 64, 128, 256
convert "$TEMP_DIR/icon_16.png" \
"$TEMP_DIR/icon_32.png" \
"$TEMP_DIR/icon_64.png" \
"$TEMP_DIR/icon_128.png" \
"$TEMP_DIR/icon_256.png" \
"$ICONS_DIR/icon.ico"
echo " ✅ Created icon.ico"
# ============ Linux (PNG set) ============
echo "🐧 Generating Linux PNG icons..."
LINUX_SIZES=(16 32 48 64 128 256 512)
for SIZE in "${LINUX_SIZES[@]}"; do
cp "$TEMP_DIR/icon_${SIZE}.png" "$ICONS_DIR/${SIZE}x${SIZE}.png" 2>/dev/null || \
rsvg-convert -w $SIZE -h $SIZE "$SVG_SOURCE" -o "$ICONS_DIR/${SIZE}x${SIZE}.png"
done
echo " ✅ Created Linux PNG icons"
# ============ Copy main icon ============
cp "$TEMP_DIR/icon_512.png" "$ICONS_DIR/icon.png"
echo " ✅ Created icon.png (512x512)"
echo ""
echo "✅ Icon generation complete!"
echo " Generated files in: $ICONS_DIR"
ls -la "$ICONS_DIR"

View File

@@ -0,0 +1,22 @@
#!/bin/bash
# Post-installation script for ClawX on Linux
set -e
# Update desktop database
if command -v update-desktop-database &> /dev/null; then
update-desktop-database -q /usr/share/applications || true
fi
# Update icon cache
if command -v gtk-update-icon-cache &> /dev/null; then
gtk-update-icon-cache -q /usr/share/icons/hicolor || true
fi
# Create symbolic link for CLI access (optional)
if [ -x /opt/ClawX/clawx ]; then
ln -sf /opt/ClawX/clawx /usr/local/bin/clawx 2>/dev/null || true
fi
echo "ClawX has been installed successfully."

View File

@@ -0,0 +1,20 @@
#!/bin/bash
# Post-removal script for ClawX on Linux
set -e
# Remove symbolic link
rm -f /usr/local/bin/clawx 2>/dev/null || true
# Update desktop database
if command -v update-desktop-database &> /dev/null; then
update-desktop-database -q /usr/share/applications || true
fi
# Update icon cache
if command -v gtk-update-icon-cache &> /dev/null; then
gtk-update-icon-cache -q /usr/share/icons/hicolor || true
fi
echo "ClawX has been removed."