Files
pilot/gnome-pilot-extension/install.sh
2026-01-10 20:24:11 +01:00

114 lines
3.4 KiB
Bash
Executable File

#!/bin/bash
# install.sh - Script d'installation automatique de l'extension Pilot Control
set -e
EXTENSION_UUID="pilot-control@gnome-shell-extensions"
EXTENSION_DIR="$HOME/.local/share/gnome-shell/extensions/$EXTENSION_UUID"
SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo "================================================"
echo " Pilot Control - GNOME Shell Extension"
echo " Installation Script"
echo "================================================"
echo ""
# Vérifier que GNOME Shell est installé
if ! command -v gnome-shell &> /dev/null; then
echo "❌ Error: GNOME Shell is not installed"
exit 1
fi
# Vérifier la version de GNOME Shell
GNOME_VERSION=$(gnome-shell --version | grep -oP '\d+' | head -1)
if [ "$GNOME_VERSION" -lt 45 ]; then
echo "⚠️ Warning: This extension requires GNOME Shell 45 or higher"
echo " Current version: $GNOME_VERSION"
read -p " Continue anyway? (y/N) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit 1
fi
fi
echo "📋 Installation details:"
echo " Source: $SOURCE_DIR"
echo " Target: $EXTENSION_DIR"
echo ""
# Créer le répertoire de destination
echo "📁 Creating extension directory..."
mkdir -p "$EXTENSION_DIR"
# Copier les fichiers
echo "📦 Copying extension files..."
cp -v "$SOURCE_DIR/metadata.json" "$EXTENSION_DIR/"
cp -v "$SOURCE_DIR/extension.js" "$EXTENSION_DIR/"
cp -v "$SOURCE_DIR/prefs.js" "$EXTENSION_DIR/"
cp -v "$SOURCE_DIR/yamlConfig.js" "$EXTENSION_DIR/"
cp -v "$SOURCE_DIR/serviceManager.js" "$EXTENSION_DIR/"
cp -v "$SOURCE_DIR/stylesheet.css" "$EXTENSION_DIR/"
# Copier le répertoire UI
echo "📦 Copying UI files..."
mkdir -p "$EXTENSION_DIR/ui"
cp -v "$SOURCE_DIR/ui/"*.js "$EXTENSION_DIR/ui/"
# Vérifier l'installation
echo ""
if [ -f "$EXTENSION_DIR/metadata.json" ]; then
echo "✅ Extension installed successfully!"
echo ""
echo "📍 Installation location:"
echo " $EXTENSION_DIR"
echo ""
# Détecter le type de session
SESSION_TYPE="${XDG_SESSION_TYPE:-unknown}"
echo "🔄 Next steps:"
echo ""
echo "1. Restart GNOME Shell:"
if [ "$SESSION_TYPE" = "x11" ]; then
echo " • Press Alt+F2"
echo " • Type 'r' and press Enter"
else
echo " • Log out and log back in (Wayland session)"
fi
echo ""
echo "2. Enable the extension:"
echo " gnome-extensions enable $EXTENSION_UUID"
echo ""
echo " Or use the GNOME Extensions app"
echo ""
# Proposer d'activer l'extension immédiatement
read -p "🚀 Would you like to enable the extension now? (y/N) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
if gnome-extensions enable "$EXTENSION_UUID" 2>/dev/null; then
echo "✅ Extension enabled!"
echo ""
if [ "$SESSION_TYPE" = "x11" ]; then
echo "⚠️ You still need to restart GNOME Shell (Alt+F2, 'r')"
else
echo "⚠️ You need to log out and log back in for changes to take effect"
fi
else
echo "⚠️ Could not enable extension automatically"
echo " Please enable it manually using GNOME Extensions app"
fi
fi
echo ""
echo "📖 For more information, see:"
echo " $SOURCE_DIR/README.md"
else
echo "❌ Installation failed - metadata.json not found"
exit 1
fi
echo ""
echo "================================================"