#!/bin/bash version='2.8.8' changelog="\n--fix Icons by Oktus" TMPPATH=/tmp/LinuxsatPanel-install FILEPATH=/tmp/LinuxsatPanel-main.tar.gz echo "Starting LinuxsatPanel installation..." if [ ! -d /usr/lib64 ]; then PLUGINPATH=/usr/lib/enigma2/python/Plugins/Extensions/LinuxsatPanel else PLUGINPATH=/usr/lib64/enigma2/python/Plugins/Extensions/LinuxsatPanel fi cleanup() { echo "Cleaning up temporary files..." [ -d "$TMPPATH" ] && rm -rf "$TMPPATH" [ -f "$FILEPATH" ] && rm -f "$FILEPATH" [ -d "/tmp/LinuxsatPanel-main" ] && rm -rf "/tmp/LinuxsatPanel-main" } detect_os() { if [ -f /var/lib/dpkg/status ]; then OSTYPE="DreamOs" STATUS="/var/lib/dpkg/status" elif [ -f /etc/opkg/opkg.conf ] || [ -f /var/lib/opkg/status ]; then OSTYPE="OE" STATUS="/var/lib/opkg/status" else OSTYPE="Unknown" STATUS="" fi echo "Detected OS type: $OSTYPE" } detect_os cleanup mkdir -p "$TMPPATH" if ! command -v wget >/dev/null 2>&1; then echo "Installing wget..." case "$OSTYPE" in "DreamOs") apt-get update && apt-get install -y wget || { echo "Failed to install wget"; exit 1; } ;; "OE") opkg update && opkg install wget || { echo "Failed to install wget"; exit 1; } ;; *) echo "Unsupported OS type. Cannot install wget." exit 1 ;; esac fi if python --version 2>&1 | grep -q '^Python 3\.'; then echo "Python3 image detected" Packagerequests="python3-requests" else echo "Python2 image detected" Packagerequests="python-requests" fi install_pkg() { local pkg=$1 if [ -z "$STATUS" ] || ! grep -qs "Package: $pkg" "$STATUS" 2>/dev/null; then echo "Installing $pkg..." case "$OSTYPE" in "DreamOs") apt-get update && apt-get install -y "$pkg" || { echo "Could not install $pkg, continuing anyway..."; } ;; "OE") opkg update && opkg install "$pkg" || { echo "Could not install $pkg, continuing anyway..."; } ;; *) echo "Cannot install $pkg on unknown OS type, continuing..." ;; esac else echo "$pkg already installed" fi } install_pkg "$Packagerequests" echo "Downloading LinuxsatPanel..." wget --no-check-certificate 'https://github.com/Belfagor2005/LinuxsatPanel/archive/refs/heads/main.tar.gz' -O "$FILEPATH" if [ $? -ne 0 ]; then echo "Failed to download LinuxsatPanel package!" cleanup exit 1 fi echo "Extracting package..." tar -xzf "$FILEPATH" -C "$TMPPATH" if [ $? -ne 0 ]; then echo "Failed to extract LinuxsatPanel package!" cleanup exit 1 fi echo "Installing plugin files..." mkdir -p "$PLUGINPATH" if [ -d "$TMPPATH/LinuxsatPanel-main/usr/lib/enigma2/python/Plugins/Extensions/LinuxsatPanel" ]; then cp -r "$TMPPATH/LinuxsatPanel-main/usr/lib/enigma2/python/Plugins/Extensions/LinuxsatPanel"/* "$PLUGINPATH/" 2>/dev/null echo "Copied from standard plugin directory" elif [ -d "$TMPPATH/LinuxsatPanel-main/usr/lib64/enigma2/python/Plugins/Extensions/LinuxsatPanel" ]; then cp -r "$TMPPATH/LinuxsatPanel-main/usr/lib64/enigma2/python/Plugins/Extensions/LinuxsatPanel"/* "$PLUGINPATH/" 2>/dev/null echo "Copied from lib64 plugin directory" elif [ -d "$TMPPATH/LinuxsatPanel-main/usr" ]; then cp -r "$TMPPATH/LinuxsatPanel-main/usr"/* /usr/ 2>/dev/null echo "Copied entire usr structure" else echo "Could not find plugin files in extracted archive" echo "Available directories in tmp:" find "$TMPPATH" -type d | head -10 cleanup exit 1 fi sync echo "Verifying installation..." if [ -d "$PLUGINPATH" ] && [ -n "$(ls -A "$PLUGINPATH" 2>/dev/null)" ]; then echo "Plugin directory found and not empty: $PLUGINPATH" echo "Contents:" ls -la "$PLUGINPATH/" | head -10 else echo "Plugin installation failed or directory is empty!" cleanup exit 1 fi cleanup sync FILE="/etc/image-version" box_type=$(head -n 1 /etc/hostname 2>/dev/null || echo "Unknown") distro_value=$(grep '^distro=' "$FILE" 2>/dev/null | awk -F '=' '{print $2}') distro_version=$(grep '^version=' "$FILE" 2>/dev/null | awk -F '=' '{print $2}') python_vers=$(python --version 2>&1) cat </dev/null 2>&1; then systemctl restart enigma2 elif command -v init >/dev/null 2>&1; then init 4 && sleep 2 && init 3 else killall -9 enigma2 fi exit 0