Cleanup repo + harden offline install and watchdog
Repo hygiene: - Remove dead scripts (.wait-for-display, .display-keepalive, .keep-screen-alive) - Remove stale backup/scratch (install.sh.bak, New.txt, stale .pyc) - Stop tracking machine-specific/generated state (config/app_config.json, playlists/server_playlist.json, src/player_auth.json, generated launchers) - Prune duplicate wheel versions (one per package) - Reorganize working_files -> dev/, dev/tests/, documentation/dev-notes/, scripts/ - Extend .gitignore; fix no-op rules in repo/.gitignore Offline install (install.sh): - Non-fatal system-dep step; per-package apt retry; .deb bundle install - Skip pip self-upgrade offline; guard online fallbacks behind connectivity probe - Dependency-free fetch_url (curl/wget/urllib); --no-reboot flag - Fix corrupted literal backslash-bang escapes (shebangs, test -f, banner) - Idempotent cron install (no more stacked @reboot lines) Autostart / watchdog: - start.sh: single-instance flock lock (.player_watchdog.lock) acquired only after a display is confirmed, preventing parallel watchdogs - Set XDG_RUNTIME_DIR when missing; exit early if headless - run_player.sh: activate .venv; stop_player.sh: clear lock file
This commit is contained in:
Executable
+126
@@ -0,0 +1,126 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Download DEB Packages Script for Offline Installation
|
||||
# This script downloads all system .deb packages required for offline installation
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
SYSTEM_DIR="$PROJECT_ROOT/repo/system-packages"
|
||||
DEB_DIR="$SYSTEM_DIR/debs"
|
||||
|
||||
echo "=========================================="
|
||||
echo "Downloading DEB Packages for Offline Install"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
|
||||
# Create debs directory
|
||||
mkdir -p "$DEB_DIR"
|
||||
|
||||
# Check if running on Debian/Ubuntu/Raspberry Pi OS
|
||||
if ! command -v apt-get &> /dev/null; then
|
||||
echo "Error: This script requires apt-get (Debian/Ubuntu/Raspberry Pi OS)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Reading package list from: $SYSTEM_DIR/apt-packages.txt"
|
||||
echo ""
|
||||
|
||||
# Update package cache
|
||||
echo "Updating package cache..."
|
||||
sudo apt update
|
||||
|
||||
# Read packages from file
|
||||
PACKAGES=$(grep -v '^#' "$SYSTEM_DIR/apt-packages.txt" | grep -v '^$' | tr '\n' ' ')
|
||||
|
||||
echo "Packages to download:"
|
||||
echo "$PACKAGES"
|
||||
echo ""
|
||||
|
||||
# Download packages and dependencies
|
||||
echo "Downloading packages with dependencies..."
|
||||
cd "$DEB_DIR"
|
||||
|
||||
# Use apt-get download to get .deb files
|
||||
for pkg in $PACKAGES; do
|
||||
echo "Downloading: $pkg"
|
||||
apt-get download "$pkg" 2>/dev/null || echo " Warning: Could not download $pkg"
|
||||
done
|
||||
|
||||
# Download dependencies
|
||||
echo ""
|
||||
echo "Downloading dependencies..."
|
||||
sudo apt-get install --download-only --reinstall -y $PACKAGES
|
||||
|
||||
# Copy downloaded debs from apt cache
|
||||
echo ""
|
||||
echo "Copying packages from apt cache..."
|
||||
sudo cp /var/cache/apt/archives/*.deb "$DEB_DIR/" 2>/dev/null || true
|
||||
|
||||
# Remove duplicate packages
|
||||
echo ""
|
||||
echo "Removing duplicates..."
|
||||
cd "$DEB_DIR"
|
||||
for file in *.deb; do
|
||||
[ -f "$file" ] || continue
|
||||
basename="${file%%_*}"
|
||||
count=$(ls -1 "${basename}"_*.deb 2>/dev/null | wc -l)
|
||||
if [ "$count" -gt 1 ]; then
|
||||
# Keep only the latest version
|
||||
ls -t "${basename}"_*.deb | tail -n +2 | xargs rm -f
|
||||
fi
|
||||
done
|
||||
|
||||
# Create installation order file
|
||||
echo ""
|
||||
echo "Creating installation order..."
|
||||
cat > "$DEB_DIR/install-order.txt" << 'EOF'
|
||||
# Install packages in this order to resolve dependencies
|
||||
|
||||
# 1. Base tools and libraries
|
||||
python3-pip_*.deb
|
||||
python3-setuptools_*.deb
|
||||
python3-dev_*.deb
|
||||
zlib1g-dev_*.deb
|
||||
|
||||
# 2. SDL2 libraries
|
||||
libsdl2-dev_*.deb
|
||||
libsdl2-image-dev_*.deb
|
||||
libsdl2-mixer-dev_*.deb
|
||||
libsdl2-ttf-dev_*.deb
|
||||
|
||||
# 3. Multimedia libraries
|
||||
libportmidi-dev_*.deb
|
||||
libswscale-dev_*.deb
|
||||
libavformat-dev_*.deb
|
||||
libavcodec-dev_*.deb
|
||||
libavcodec-extra_*.deb
|
||||
|
||||
# 4. FFmpeg and codecs
|
||||
ffmpeg_*.deb
|
||||
libx264-dev_*.deb
|
||||
|
||||
# 5. GStreamer
|
||||
gstreamer1.0-plugins-base_*.deb
|
||||
gstreamer1.0-plugins-good_*.deb
|
||||
gstreamer1.0-plugins-bad_*.deb
|
||||
gstreamer1.0-alsa_*.deb
|
||||
|
||||
# 6. Network tools
|
||||
wget_*.deb
|
||||
curl_*.deb
|
||||
EOF
|
||||
|
||||
# Summary
|
||||
echo ""
|
||||
echo "=========================================="
|
||||
echo "DEB Download Complete!"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
echo "Downloaded .deb files: $(ls -1 *.deb 2>/dev/null | wc -l)"
|
||||
echo "Location: $DEB_DIR"
|
||||
echo ""
|
||||
echo "To install offline, copy the repo folder and run:"
|
||||
echo " bash install.sh --offline"
|
||||
echo ""
|
||||
Executable
+73
@@ -0,0 +1,73 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Download Offline Packages Script for Kivy Signage Player
|
||||
# This script downloads all necessary Python packages and documents system packages
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
REPO_DIR="$PROJECT_ROOT/repo"
|
||||
WHEELS_DIR="$REPO_DIR/python-wheels"
|
||||
SYSTEM_DIR="$REPO_DIR/system-packages"
|
||||
|
||||
echo "=========================================="
|
||||
echo "Downloading Offline Packages"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
|
||||
# Check if repo directory exists
|
||||
if [ ! -d "$REPO_DIR" ]; then
|
||||
echo "Error: repo directory not found!"
|
||||
echo "Creating directories..."
|
||||
mkdir -p "$WHEELS_DIR"
|
||||
mkdir -p "$SYSTEM_DIR"
|
||||
fi
|
||||
|
||||
# Download Python packages
|
||||
echo "Step 1: Downloading Python wheels..."
|
||||
echo "--------------------"
|
||||
cd "$PROJECT_ROOT"
|
||||
|
||||
# Check if pip is installed
|
||||
if ! command -v pip3 &> /dev/null; then
|
||||
echo "Error: pip3 is not installed. Please install it first:"
|
||||
echo " sudo apt install python3-pip"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Download all Python packages and their dependencies
|
||||
echo "Downloading packages from requirements.txt..."
|
||||
pip3 download -r requirements.txt -d "$WHEELS_DIR" --platform linux_armv7l --only-binary=:all: || \
|
||||
pip3 download -r requirements.txt -d "$WHEELS_DIR" || true
|
||||
|
||||
# Also download for general Linux platforms as fallback
|
||||
echo "Downloading cross-platform packages..."
|
||||
pip3 download -r requirements.txt -d "$WHEELS_DIR" || true
|
||||
|
||||
echo ""
|
||||
echo "Python wheels downloaded to: $WHEELS_DIR"
|
||||
echo "Total wheel files: $(ls -1 "$WHEELS_DIR"/*.whl 2>/dev/null | wc -l)"
|
||||
|
||||
# List system packages
|
||||
echo ""
|
||||
echo "Step 2: System packages information"
|
||||
echo "--------------------"
|
||||
echo "System packages are listed in: $SYSTEM_DIR/apt-packages.txt"
|
||||
echo ""
|
||||
echo "To download .deb files for offline installation, run:"
|
||||
echo " bash download_deb_packages.sh"
|
||||
echo ""
|
||||
|
||||
# Summary
|
||||
echo "=========================================="
|
||||
echo "Download Complete!"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
echo "Offline packages ready in: $REPO_DIR"
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo "1. Copy the entire 'repo' folder to your offline system"
|
||||
echo "2. Run: bash install.sh"
|
||||
echo " (The installer will automatically detect and use offline packages)"
|
||||
echo ""
|
||||
Reference in New Issue
Block a user