create installer

This commit is contained in:
2025-09-10 15:43:14 +03:00
parent 26a9db889f
commit b6e6190d6c
41 changed files with 308 additions and 0 deletions

190
install_offline.sh Executable file
View File

@@ -0,0 +1,190 @@
#!/bin/bash
# Offline Installation Script for Tkinter Player
# Auto-detects architecture and uses appropriate local libraries ONLY
set -e
echo "==================================="
echo " TKINTER PLAYER OFFLINE INSTALLER"
echo "==================================="
echo ""
# Detect system architecture
ARCH=$(uname -m)
echo "🔍 Detected architecture: $ARCH"
# Determine which library folder to use based on architecture
if [ "$ARCH" = "armv7l" ]; then
LIBS_FOLDER="req_libraries_32bit"
ARCH_DESC="32-bit ARM (armv7l)"
echo "📦 32-bit ARM system detected"
elif [ "$ARCH" = "aarch64" ]; then
LIBS_FOLDER="req_libraries"
ARCH_DESC="64-bit ARM (aarch64)"
echo "📦 64-bit ARM system detected"
else
echo "⚠️ Unknown architecture: $ARCH"
echo " Defaulting to 64-bit libraries..."
LIBS_FOLDER="req_libraries"
ARCH_DESC="Unknown ($ARCH) - using 64-bit fallback"
fi
echo "<EFBFBD> Selected library folder: $LIBS_FOLDER"
echo "🏗️ Architecture: $ARCH_DESC"
echo ""
# Check if the selected library folder exists
if [ ! -d "$LIBS_FOLDER" ]; then
echo "❌ ERROR: Required library folder not found!"
echo " Missing folder: $LIBS_FOLDER"
echo ""
if [ "$ARCH" = "armv7l" ]; then
echo "💡 For 32-bit ARM systems:"
echo " 1. Run: ./download_32bit_libs.sh"
echo " 2. Make sure req_libraries_32bit/ folder exists"
else
echo "💡 For 64-bit ARM systems:"
echo " 1. Make sure req_libraries/ folder exists"
echo " 2. Run: pip download -r requirements.txt -d req_libraries/"
fi
echo ""
exit 1
fi
# Verify we have wheel files in the selected folder
WHEEL_COUNT=$(ls $LIBS_FOLDER/*.whl 2>/dev/null | wc -l)
if [ "$WHEEL_COUNT" -eq 0 ]; then
echo "❌ ERROR: No wheel files found in $LIBS_FOLDER/"
echo " Please download the appropriate libraries first."
exit 1
fi
echo "✅ Found $WHEEL_COUNT wheel files in $LIBS_FOLDER/"
# Check Python and pip
if ! command -v python3 &> /dev/null; then
echo "❌ Error: Python 3 is not installed!"
exit 1
fi
PIP_CMD="pip3"
if ! command -v pip3 &> /dev/null; then
PIP_CMD="pip"
fi
echo "<22><> Environment check:"
echo " Python: $(python3 --version)"
echo " Architecture: $ARCH_DESC"
# Count wheel files
WHEEL_COUNT=$(ls $LIBS_FOLDER/*.whl 2>/dev/null | wc -l)
echo " Wheel files: $WHEEL_COUNT in $LIBS_FOLDER/"
# Show architecture-specific packages for verification
echo ""
echo "🔍 Architecture-specific packages detected:"
if ls $LIBS_FOLDER/bcrypt*.whl >/dev/null 2>&1; then
BCRYPT_FILE=$(basename $(ls $LIBS_FOLDER/bcrypt*.whl | head -1))
echo " 🔐 BCRYPT: $BCRYPT_FILE"
# Show if it's 32-bit or 64-bit specific
if [[ "$BCRYPT_FILE" == *"armv7l"* ]]; then
echo " → 32-bit ARM wheel ✅"
elif [[ "$BCRYPT_FILE" == *"aarch64"* ]]; then
echo " → 64-bit ARM wheel ✅"
fi
fi
if ls $LIBS_FOLDER/pillow*.whl >/dev/null 2>&1; then
PILLOW_FILE=$(basename $(ls $LIBS_FOLDER/pillow*.whl | head -1))
echo " 🖼️ PILLOW: $PILLOW_FILE"
if [[ "$PILLOW_FILE" == *"armv7l"* ]]; then
echo " → 32-bit ARM wheel ✅"
elif [[ "$PILLOW_FILE" == *"aarch64"* ]]; then
echo " → 64-bit ARM wheel ✅"
fi
fi
if ls $LIBS_FOLDER/psutil*.whl >/dev/null 2>&1; then
PSUTIL_FILE=$(basename $(ls $LIBS_FOLDER/psutil*.whl | head -1))
echo " 📊 PSUTIL: $PSUTIL_FILE"
if [[ "$PSUTIL_FILE" == *"armv7l"* ]]; then
echo " → 32-bit ARM wheel ✅"
elif [[ "$PSUTIL_FILE" == *"aarch64"* ]]; then
echo " → 64-bit ARM wheel ✅"
fi
fi
echo ""
# Ask for confirmation
read -p "🚀 Ready to install? (y/N): " -n 1 -r
echo ""
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "❌ Installation cancelled."
exit 1
fi
# Create and activate virtual environment
if [ ! -d ".venv" ]; then
echo "📁 Creating virtual environment..."
python3 -m venv .venv
fi
echo "🔄 Activating virtual environment..."
source .venv/bin/activate
pip install --upgrade pip
# Install packages COMPLETELY OFFLINE
echo ""
echo "📦 Installing packages from $LIBS_FOLDER/ (OFFLINE ONLY)..."
echo "============================================================"
echo "🚫 Internet access: DISABLED for this installation"
echo "📁 Source: Local wheel files only"
echo ""
# Force completely offline installation - no internet access allowed
echo "🔧 Installing architecture-specific wheels..."
pip install --no-index --no-deps --find-links $LIBS_FOLDER/ $LIBS_FOLDER/*.whl
echo ""
echo "🔍 Verifying architecture-specific installation..."
# Test key imports to verify correct architecture packages were installed
python3 -c "
import sys
print(f'✅ Python version: {sys.version}')
print(f'✅ Platform: {sys.platform}')
try:
import requests
print('✅ requests - Network library installed')
except ImportError as e:
print(f'❌ requests failed: {e}')
try:
import bcrypt
print('✅ bcrypt - Encryption library installed')
except ImportError as e:
print(f'❌ bcrypt failed: {e}')
try:
import vlc
print('✅ python-vlc - Media library installed')
except ImportError as e:
print(f'❌ python-vlc failed: {e}')
try:
import PIL
print('✅ Pillow - Image library installed')
except ImportError as e:
print(f'❌ Pillow failed: {e}')
try:
import psutil
print('✅ psutil - System library installed')
except ImportError as e:
print(f'❌ psutil failed: {e}')
"
echo ""
echo "✅ Installation completed!"
echo ""
echo "Next steps:"
echo "1. source .venv/bin/activate"
echo "2. ./run_app.sh"