first commit of lxtools installer

This commit is contained in:
2025-06-08 13:36:22 +02:00
parent d91c231723
commit e523a78e8c
3 changed files with 278 additions and 30 deletions

View File

@ -3,7 +3,6 @@ import gettext
import locale
import tkinter as tk
from tkinter import messagebox, ttk
import shutil
import os
import socket
import subprocess
@ -17,7 +16,7 @@ from datetime import datetime
class LXToolsAppConfig:
VERSION = "1.1.3"
VERSION = "1.1.4"
APP_NAME = "Lunix Tools Installer"
WINDOW_WIDTH = 450
WINDOW_HEIGHT = 580
@ -80,7 +79,6 @@ class LXToolsAppConfig:
("fedora", "Fedora"),
("tumbleweed", "SUSE Tumbleweed"),
("leap", "SUSE Leap"),
("suse", "openSUSE"),
("arch", "Arch Linux"),
("ubuntu", "Ubuntu"),
("debian", "Debian"),
@ -97,9 +95,8 @@ class LXToolsAppConfig:
"Manjaro": ["pacman", "-S", "--noconfirm", "tk"],
"Garuda Linux": ["pacman", "-S", "--noconfirm", "tk"],
"EndeavourOS": ["pacman", "-S", "--noconfirm", "tk"],
"openSUSE": ["zypper", "install", "-y", "python3-tk"],
"SUSE Tumbleweed": ["zypper", "install", "-y", "python3-tk"],
"SUSE Leap": ["zypper", "install", "-y", "python3-tk"],
"SUSE Tumbleweed": ["zypper", "install", "-y", "python314-tk"],
"SUSE Leap": ["zypper", "install", "-y", "python312-tk"],
}
@staticmethod
@ -601,7 +598,7 @@ cd wirepy_install
echo "Downloading Wire-Py..."
wget -q "{LXToolsAppConfig.WIREPY_URL}" -O wirepy.zip
unzip -q wirepy.zip
WIREPY_DIR=$(find . -name "Wire-Py" -type d | head -1)
WIREPY_DIR=$(find . -name "wire-py" -type d | head -1)
echo "Downloading shared libraries..."
wget -q "{LXToolsAppConfig.SHARED_LIBS_URL}" -O shared.zip
@ -612,7 +609,7 @@ SHARED_DIR=$(find . -name "shared_libs" -type d | head -1)
echo "Installing Wire-Py executables..."
for file in wirepy.py start_wg.py ssl_encrypt.py ssl_decrypt.py match_found.py tunnel.py; do
if [ -f "$WIREPY_DIR/$file" ]; then
cp "$WIREPY_DIR/$file" /usr/local/bin/
cp -f "$WIREPY_DIR/$file" /usr/local/bin/
chmod 755 /usr/local/bin/$file
echo "Installed $file"
fi
@ -620,51 +617,67 @@ done
# Install config
if [ -f "$WIREPY_DIR/wp_app_config.py" ]; then
cp "$WIREPY_DIR/wp_app_config.py" /usr/lib/python3/dist-packages/shared_libs/
cp -f "$WIREPY_DIR/wp_app_config.py" /usr/lib/python3/dist-packages/shared_libs/
echo "Installed wp_app_config.py"
fi
# Install shared libraries
echo "Installing shared libraries..."
for file in common_tools.py file_and_dir_ensure.py gitea.py __init__.py logview_app_config.py logviewer.py; do
for file in common_tools.py file_and_dir_ensure.py gitea.py __init__.py logview_app_config.py; do
if [ -f "$SHARED_DIR/$file" ]; then
cp "$SHARED_DIR/$file" /usr/lib/python3/dist-packages/shared_libs/
cp -f "$SHARED_DIR/$file" /usr/lib/python3/dist-packages/shared_libs/
echo "Installed shared lib: $file"
fi
done
# Install LogViewer executable
if [ -f "$SHARED_DIR/logviewer.py" ]; then
cp -f "$SHARED_DIR/logviewer.py" /usr/lib/python3/dist-packages/shared_libs/
chmod 755 /usr/lib/python3/dist-packages/shared_libs/logviewer.py
echo "Installed logviewer.py (executable)"
fi
# Install icons
if [ -d "$WIREPY_DIR/lx-icons" ]; then
echo "Installing icons..."
cp -r "$WIREPY_DIR/lx-icons"/* /usr/share/icons/lx-icons/
cp -rf "$WIREPY_DIR/lx-icons"/* /usr/share/icons/lx-icons/
fi
# Install TK-Themes
if [ -d "$WIREPY_DIR/TK-Themes" ]; then
echo "Installing TK-Themes..."
cp -r "$WIREPY_DIR/TK-Themes"/* /usr/share/TK-Themes/
cp -rf "$WIREPY_DIR/TK-Themes"/* /usr/share/TK-Themes/
fi
# Install desktop file
if [ -f "$WIREPY_DIR/Wire-Py.desktop" ]; then
cp "$WIREPY_DIR/Wire-Py.desktop" /usr/share/applications/
cp -f "$WIREPY_DIR/Wire-Py.desktop" /usr/share/applications/
echo "Installed desktop file"
fi
# Install language files
if [ -d "$WIREPY_DIR/languages/de" ]; then
echo "Installing language files..."
cp "$WIREPY_DIR/languages/de"/*.mo /usr/share/locale/de/LC_MESSAGES/ 2>/dev/null || true
cp -f "$WIREPY_DIR/languages/de"/*.mo /usr/share/locale/de/LC_MESSAGES/ 2>/dev/null || true
fi
# Install policy file
if [ -f "$WIREPY_DIR/org.sslcrypt.policy" ]; then
cp "$WIREPY_DIR/org.sslcrypt.policy" /usr/share/polkit-1/actions/
cp -f "$WIREPY_DIR/org.sslcrypt.policy" /usr/share/polkit-1/actions/
echo "Installed policy file"
fi
# Create symlink
# Create symlink for Wirepy
ln -sf /usr/local/bin/wirepy.py /usr/local/bin/wirepy
# Create symlink for LogViewer
ln -sf /usr/lib/python3/dist-packages/shared_libs/logviewer.py /usr/local/bin/logviewer
echo "Created Wirepy and LogViewer symlink"
# Install language files if available
if [ -d "$SHARED_DIR/languages/de" ]; then
echo "Installing language files..."
cp "$SHARED_DIR/languages/de"/*.mo /usr/share/locale/de/LC_MESSAGES/ 2>/dev/null || true
fi
echo "Created symlink"
# Create SSL key if not exists
@ -716,13 +729,13 @@ if [ ! -d "/usr/share/TK-Themes" ] || [ -z "$(ls -A /usr/share/TK-Themes 2>/dev/
if [ -d "$WIREPY_DIR/TK-Themes" ]; then
echo "Installing TK-Themes..."
cp -r "$WIREPY_DIR/TK-Themes"/* /usr/share/TK-Themes/
cp -rf "$WIREPY_DIR/TK-Themes"/* /usr/share/TK-Themes/
fi
# Also install icons from Wire-Py if not present
if [ -d "$WIREPY_DIR/lx-icons" ] && [ ! -d "/usr/share/icons/lx-icons" ]; then
echo "Installing icons from Wire-Py..."
cp -r "$WIREPY_DIR/lx-icons"/* /usr/share/icons/lx-icons/
cp -rf "$WIREPY_DIR/lx-icons"/* /usr/share/icons/lx-icons/
fi
fi
@ -730,14 +743,14 @@ fi
echo "Installing shared libraries..."
for file in common_tools.py file_and_dir_ensure.py gitea.py __init__.py logview_app_config.py; do
if [ -f "$SHARED_DIR/$file" ]; then
cp "$SHARED_DIR/$file" /usr/lib/python3/dist-packages/shared_libs/
cp -f "$SHARED_DIR/$file" /usr/lib/python3/dist-packages/shared_libs/
echo "Installed shared lib: $file"
fi
done
# Install LogViewer executable
if [ -f "$SHARED_DIR/logviewer.py" ]; then
cp "$SHARED_DIR/logviewer.py" /usr/lib/python3/dist-packages/shared_libs/
cp -f "$SHARED_DIR/logviewer.py" /usr/lib/python3/dist-packages/shared_libs/
chmod 755 /usr/lib/python3/dist-packages/shared_libs/logviewer.py
echo "Installed logviewer.py (executable)"
fi
@ -1093,7 +1106,7 @@ class LXToolsGUI:
self.root.iconphoto(False, icon)
except:
pass
# self.root.minsize(LXToolsAppConfig.WINDOW_WIDTH, LXToolsAppConfig.WINDOW_HEIGHT)
self.root.minsize(LXToolsAppConfig.WINDOW_WIDTH, LXToolsAppConfig.WINDOW_HEIGHT)
ThemeManager.apply_light_theme(self.root)
# Create header
self._create_header()
@ -1155,7 +1168,7 @@ class LXToolsGUI:
tk.Label(
text_frame,
text=f"v{LXToolsAppConfig.VERSION} • Linux Application Installer",
text=f"v {LXToolsAppConfig.VERSION} • Linux Application Installer",
font=("Helvetica", 9),
fg="#bdc3c7",
bg="#2c3e50",
@ -1438,7 +1451,7 @@ class LXToolsGUI:
# Initial log message
self.log_message(
f"=== {LXToolsAppConfig.APP_NAME} v{LXToolsAppConfig.VERSION} ==="
f"=== {LXToolsAppConfig.APP_NAME} v {LXToolsAppConfig.VERSION} ==="
)
self.log_message(f"Working directory: {LXToolsAppConfig.WORK_DIR}")
self.log_message(f"Icons directory: {LXToolsAppConfig.ICONS_DIR}")
@ -1588,24 +1601,24 @@ class LXToolsGUI:
text=f"✅ Installed ({installed_version})", fg="green"
)
self.log_message(
f"{project_info['name']}: Installed v{installed_version}"
f"{project_info['name']}: Installed {installed_version}"
)
# Get latest version from API
try:
latest_version = self.app_manager.get_latest_version(project_key)
if latest_version != "Unknown":
if installed_version != latest_version:
if installed_version != f"v. {latest_version}":
version_label.config(
text=f"Latest: v {latest_version} (Update available)",
text=f"Latest: v. {latest_version} (Update available)",
fg="orange",
)
self.log_message(
f"{project_info['name']}: Update available v{latest_version}"
f"{project_info['name']}: Update available v. {latest_version}"
)
else:
version_label.config(
text=f"Latest: v {latest_version} (Up to date)",
text=f"Latest: v. {latest_version} (Up to date)",
fg="green",
)
self.log_message(f"{project_info['name']}: Up to date")
@ -1817,7 +1830,7 @@ def check_and_install_tkinter():
def main():
"""Main function to start the application"""
print(f"=== {LXToolsAppConfig.APP_NAME} v{LXToolsAppConfig.VERSION} ===")
print(f"=== {LXToolsAppConfig.APP_NAME} v {LXToolsAppConfig.VERSION} ===")
print(f"Working directory: {os.getcwd()}")
# Check and install tkinter if needed