58 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
# Installation script for Chromebook Volume Buttons Driver
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo "=== Chromebook Volume Buttons Driver Installation ==="
echo ""
# Check if running as root
if [ "$EUID" -ne 0 ]; then
echo "Error: This script must be run with sudo privileges"
echo "Usage: sudo bash install.sh"
exit 1
fi
# Copy Python script to system location
echo "[1/5] Installing Python script to /usr/local/bin/..."
cp "${SCRIPT_DIR}/volume_buttons.py" /usr/local/bin/chromebook-volume-buttons
chmod +x /usr/local/bin/chromebook-volume-buttons
echo " Script installed successfully"
# Install systemd service
echo "[2/5] Installing systemd service..."
cp "${SCRIPT_DIR}/chromebook-volume-buttons.service" /etc/systemd/system/
echo " Service file installed"
# Reload systemd daemon
echo "[3/5] Reloading systemd daemon..."
systemctl daemon-reload
echo " Daemon reloaded"
# Enable service for auto-start
echo "[4/5] Enabling service for automatic startup..."
systemctl enable chromebook-volume-buttons.service
echo " Service enabled (will start on boot)"
# Start service immediately
echo "[5/5] Starting service..."
systemctl start chromebook-volume-buttons.service
systemctl restart chromebook-volume-buttons.service
echo " Service started"
echo ""
echo "=== Installation completed successfully ==="
echo ""
echo "Service status:"
systemctl status chromebook-volume-buttons.service --no-pager -l || true
echo ""
echo "Useful commands:"
echo " View live logs: sudo journalctl -u chromebook-volume-buttons.service -f"
echo " Stop service: sudo systemctl stop chromebook-volume-buttons.service"
echo " Restart service: sudo systemctl restart chromebook-volume-buttons.service"
echo " Disable service: sudo systemctl disable chromebook-volume-buttons.service"
echo " Check status: sudo systemctl status chromebook-volume-buttons.service"