Files
Kiwy-Signage/install.sh
Kivy Signage Player 4ce41b7ccc Add offline installation support with repo folder and updated dependencies
Features:
- Create repo/ folder structure for offline packages
  - python-wheels/ for Python packages (.whl files)
  - system-packages/ for APT packages and .deb files
- Add download_offline_packages.sh to populate Python wheels
- Add download_deb_packages.sh to download system .deb packages
- Update install.sh with smart online/offline detection
  - Auto-detects repo folder and uses offline packages
  - Falls back to online installation if repo is empty
  - Supports --offline flag for explicit offline mode
- Update requirements.txt with async dependencies:
  - aiohttp==3.9.1 for async HTTP client
  - asyncio==3.4.3 for async I/O framework
- Add OFFLINE_INSTALLATION.md with complete guide
- Add .gitignore to exclude downloaded packages from repo
- Document all system dependencies in apt-packages.txt

Downloaded packages:
- 18 Python wheels with all dependencies
- Total size: ~50 MB for Python packages
- Ready for offline deployment
2025-11-03 16:29:03 +02:00

117 lines
3.8 KiB
Bash

#!/bin/bash
# Kivy Signage Player Installation Script
# Supports both online and offline installation
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_DIR="$SCRIPT_DIR/repo"
WHEELS_DIR="$REPO_DIR/python-wheels"
SYSTEM_DIR="$REPO_DIR/system-packages"
DEB_DIR="$SYSTEM_DIR/debs"
# Check for offline mode
OFFLINE_MODE=false
if [ "$1" == "--offline" ] || [ "$1" == "-o" ]; then
OFFLINE_MODE=true
echo "=========================================="
echo "Offline Installation Mode"
echo "=========================================="
elif [ -d "$WHEELS_DIR" ] && [ "$(ls -A $WHEELS_DIR 2>/dev/null)" ]; then
echo "=========================================="
echo "Offline packages detected - Using repo folder"
echo "=========================================="
OFFLINE_MODE=true
else
echo "=========================================="
echo "Online Installation Mode"
echo "=========================================="
fi
echo ""
echo "Installing Kivy Signage Player dependencies..."
echo ""
# Install system dependencies
echo "Step 1: Installing system dependencies..."
echo "--------------------"
if [ "$OFFLINE_MODE" = true ] && [ -d "$DEB_DIR" ] && [ "$(ls -A $DEB_DIR/*.deb 2>/dev/null)" ]; then
# Offline: Install from local .deb files
echo "Installing from offline .deb packages..."
cd "$DEB_DIR"
# Install all .deb files with dependencies
sudo dpkg -i *.deb 2>/dev/null || true
# Fix any broken dependencies
sudo apt-get install -f -y || true
echo "System packages installed from offline repository"
else
# Online: Use apt-get
echo "Updating package lists..."
sudo apt update
echo "Installing system packages..."
# Read packages from file if available, otherwise use default list
if [ -f "$SYSTEM_DIR/apt-packages.txt" ]; then
PACKAGES=$(grep -v '^#' "$SYSTEM_DIR/apt-packages.txt" | grep -v '^$' | tr '\n' ' ')
sudo apt install -y $PACKAGES
else
# Default package list
sudo apt install -y python3-pip python3-setuptools python3-dev
sudo apt install -y libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev
sudo apt install -y libportmidi-dev libswscale-dev libavformat-dev libavcodec-dev
sudo apt install -y zlib1g-dev ffmpeg libavcodec-extra
sudo apt install -y gstreamer1.0-plugins-base gstreamer1.0-plugins-good
fi
echo "System packages installed successfully"
fi
echo ""
# Install Python dependencies
echo "Step 2: Installing Python dependencies..."
echo "--------------------"
if [ "$OFFLINE_MODE" = true ] && [ -d "$WHEELS_DIR" ] && [ "$(ls -A $WHEELS_DIR/*.whl 2>/dev/null)" ]; then
# Offline: Install from local wheels
echo "Installing from offline Python wheels..."
echo "Wheel files found: $(ls -1 $WHEELS_DIR/*.whl 2>/dev/null | wc -l)"
pip3 install --no-index --find-links="$WHEELS_DIR" -r requirements.txt
echo "Python packages installed from offline repository"
else
# Online: Use pip from PyPI
echo "Installing from PyPI..."
pip3 install -r requirements.txt
echo "Python packages installed successfully"
fi
echo ""
echo "=========================================="
echo "Installation completed successfully!"
echo "=========================================="
echo ""
echo "To run the signage player:"
echo " cd src && python3 main.py"
echo ""
echo "Or use the run script:"
echo " bash run_player.sh"
echo ""
# Check if config exists
if [ ! -d "$SCRIPT_DIR/config" ] || [ ! "$(ls -A $SCRIPT_DIR/config)" ]; then
echo "Note: No configuration found."
echo "Please configure the player before running:"
echo " 1. Copy config/app_config.txt.example to config/app_config.txt"
echo " 2. Edit the configuration file with your server details"
echo ""
fi