add gpg public_key ipmort
This commit is contained in:
157
manager.py
157
manager.py
@ -11,7 +11,28 @@ import sys
|
||||
import shutil
|
||||
import subprocess
|
||||
import stat
|
||||
from network import GiteaUpdate
|
||||
from network import GiteaUpdater
|
||||
|
||||
|
||||
class Locale:
|
||||
APP_NAME = "lxtoolsinstaller"
|
||||
# Locale settings
|
||||
LOCALE_DIR = "./locale/"
|
||||
|
||||
@staticmethod
|
||||
def setup_translations() -> gettext.gettext:
|
||||
"""Initialize translations and set the translation function"""
|
||||
try:
|
||||
locale.bindtextdomain(Locale.APP_NAME, Locale.LOCALE_DIR)
|
||||
gettext.bindtextdomain(Locale.APP_NAME, Locale.LOCALE_DIR)
|
||||
gettext.textdomain(Locale.APP_NAME)
|
||||
except:
|
||||
pass
|
||||
return gettext.gettext
|
||||
|
||||
|
||||
# Initialize translations
|
||||
_ = Locale.setup_translations()
|
||||
|
||||
|
||||
class Detector:
|
||||
@ -107,14 +128,16 @@ class Detector:
|
||||
arch = ["Arch Linux", "Manjaro", "EndeavourOS", "ArcoLinux", "Garuda Linux"]
|
||||
if os_system in deb:
|
||||
result = subprocess.run(
|
||||
["apt", "list", "--installed", "|", "grep", "polkit"],
|
||||
["apt list --installed | grep polkit"],
|
||||
capture_output=True,
|
||||
shell=True,
|
||||
text=True,
|
||||
check=False,
|
||||
)
|
||||
if result.returncode == 0:
|
||||
return True
|
||||
else:
|
||||
print(f"STDERR: {result.stderr}")
|
||||
return False
|
||||
|
||||
elif os_system in arch:
|
||||
@ -127,30 +150,35 @@ class Detector:
|
||||
if result.returncode == 0:
|
||||
return True
|
||||
else:
|
||||
print(f"STDERR: {result.stderr}")
|
||||
return False
|
||||
|
||||
elif os_system == "Fedora":
|
||||
result = subprocess.run(
|
||||
["dnf", "list", "--installed", "|", "grep", "polkit"],
|
||||
["systemctl --type=service | grep polkit"],
|
||||
capture_output=True,
|
||||
shell=True,
|
||||
text=True,
|
||||
check=False,
|
||||
)
|
||||
if result.returncode == 0:
|
||||
return True
|
||||
else:
|
||||
print(f"STDERR: {result.stderr}")
|
||||
return False
|
||||
|
||||
elif os_system == "SUSE Tumbleweed" or os_system == "SUSE Leap":
|
||||
result = subprocess.run(
|
||||
["zypper", "search", "--installed-only", "|", "grep", "polkit"],
|
||||
["zypper search --installed-only | grep pkexec"],
|
||||
capture_output=True,
|
||||
shell=True,
|
||||
text=True,
|
||||
check=False,
|
||||
)
|
||||
if result.returncode == 0:
|
||||
return True
|
||||
else:
|
||||
print(f"STDERR: {result.stderr}")
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
@ -161,14 +189,17 @@ class Detector:
|
||||
arch = ["Arch Linux", "Manjaro", "EndeavourOS", "ArcoLinux", "Garuda Linux"]
|
||||
if os_system in deb:
|
||||
result = subprocess.run(
|
||||
["apt", "list", "--installed", "|", "grep", "network-manager"],
|
||||
["apt list --installed | grep network-manager"],
|
||||
capture_output=True,
|
||||
shell=True,
|
||||
text=True,
|
||||
check=False,
|
||||
)
|
||||
|
||||
if result.returncode == 0:
|
||||
return True
|
||||
else:
|
||||
print(f"STDERR: {result.stderr}")
|
||||
return False
|
||||
|
||||
elif os_system in arch:
|
||||
@ -178,33 +209,40 @@ class Detector:
|
||||
text=True,
|
||||
check=False,
|
||||
)
|
||||
|
||||
if result.returncode == 0:
|
||||
return True
|
||||
else:
|
||||
print(f"STDERR: {result.stderr}")
|
||||
return False
|
||||
|
||||
elif os_system == "Fedora":
|
||||
|
||||
result = subprocess.run(
|
||||
["dnf", "list", "--installed", "|", "grep", "NetworkManager"],
|
||||
["which NetworkManager"],
|
||||
capture_output=True,
|
||||
shell=True,
|
||||
text=True,
|
||||
check=False,
|
||||
check=True,
|
||||
)
|
||||
if result.returncode == 0:
|
||||
return True
|
||||
else:
|
||||
print(f"STDERR: {result.stderr}")
|
||||
return False
|
||||
|
||||
elif os_system == "SUSE Tumbleweed" or os_system == "SUSE Leap":
|
||||
result = subprocess.run(
|
||||
["zypper", "search", "--installed-only", "|", "grep", "networkmanager"],
|
||||
["zypper search --installed-only | grep NetworkManager"],
|
||||
capture_output=True,
|
||||
shell=True,
|
||||
text=True,
|
||||
check=False,
|
||||
check=True,
|
||||
)
|
||||
if result.returncode == 0:
|
||||
return True
|
||||
else:
|
||||
print(f"STDERR: {result.stderr}")
|
||||
return False
|
||||
|
||||
|
||||
@ -322,6 +360,10 @@ class Image:
|
||||
"./lx-icons/48/log.png",
|
||||
"/usr/share/icons/lx-icons/48/log.png",
|
||||
],
|
||||
"header_image": [
|
||||
"./lx-icons/32/lxtools_key.png",
|
||||
"/usr/share/icons/lx-icons/32/lxtools_key.png",
|
||||
],
|
||||
}
|
||||
|
||||
# Get paths to try
|
||||
@ -430,7 +472,7 @@ class AppManager:
|
||||
if not project_info:
|
||||
return "Unknown"
|
||||
|
||||
return GiteaUpdate.api_down(project_info["api_url"])
|
||||
return GiteaUpdater.get_latest_version_from_api(project_info["api_url"])
|
||||
|
||||
def check_other_apps_installed(self, exclude_key) -> bool:
|
||||
"""Check if other apps are still installed"""
|
||||
@ -658,24 +700,8 @@ class LXToolsAppConfig:
|
||||
os.path.dirname(os.path.abspath(__file__)), "certs", "cacert.pem"
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def setup_translations() -> gettext.gettext:
|
||||
"""Initialize translations and set the translation function"""
|
||||
try:
|
||||
locale.bindtextdomain(
|
||||
LXToolsAppConfig.APP_NAME, LXToolsAppConfig.LOCALE_DIR
|
||||
)
|
||||
gettext.bindtextdomain(
|
||||
LXToolsAppConfig.APP_NAME, LXToolsAppConfig.LOCALE_DIR
|
||||
)
|
||||
gettext.textdomain(LXToolsAppConfig.APP_NAME)
|
||||
except:
|
||||
pass
|
||||
return gettext.gettext
|
||||
|
||||
VERSION = "1.1.7"
|
||||
APP_NAME = "lxtoolsinstaller"
|
||||
WINDOW_WIDTH = 450
|
||||
VERSION = "1.1.8"
|
||||
WINDOW_WIDTH = 460
|
||||
WINDOW_HEIGHT = 580
|
||||
# Working directory
|
||||
WORK_DIR = os.getcwd()
|
||||
@ -683,9 +709,6 @@ class LXToolsAppConfig:
|
||||
THEMES_DIR = os.path.join(WORK_DIR, "TK-Themes")
|
||||
TEMP_DIR = "/tmp/lxtools"
|
||||
|
||||
# Locale settings
|
||||
LOCALE_DIR = "./locale/"
|
||||
|
||||
# Download URLs
|
||||
WIREPY_URL = "https://git.ilunix.de/punix/Wire-Py/archive/main.zip"
|
||||
SHARED_LIBS_URL = "https://git.ilunix.de/punix/shared_libs/archive/main.zip"
|
||||
@ -696,11 +719,20 @@ class LXToolsAppConfig:
|
||||
"https://git.ilunix.de/api/v1/repos/punix/shared_libs/releases"
|
||||
)
|
||||
|
||||
# GPG required
|
||||
EXPECTED_FINGERPRINT = "743745087C6414E00F1EF84D4CCF06B6CE2A4C7F"
|
||||
KEY_URL_OPENPGP = (
|
||||
f"https://keys.openpgp.org/vks/v1/by-fingerprint/{EXPECTED_FINGERPRINT}"
|
||||
)
|
||||
KEY_URL_GITILUNIX = (
|
||||
"https://git.ilunix.de/punix/lxtools_installer/raw/branch/main/public_key.asc"
|
||||
)
|
||||
|
||||
# Project configurations
|
||||
PROJECTS = {
|
||||
"wirepy": {
|
||||
"name": "Wire-Py",
|
||||
"description": "WireGuard VPN Manager with GUI",
|
||||
"description": _("WireGuard VPN Manager with GUI"),
|
||||
"download_url": WIREPY_URL,
|
||||
"api_url": WIREPY_API_URL,
|
||||
"icon_key": "icon_vpn",
|
||||
@ -713,7 +745,7 @@ class LXToolsAppConfig:
|
||||
},
|
||||
"logviewer": {
|
||||
"name": "LogViewer",
|
||||
"description": "System Log Viewer with GUI",
|
||||
"description": _("System Log Viewer with GUI"),
|
||||
"download_url": SHARED_LIBS_URL,
|
||||
"api_url": SHARED_LIBS_API_URL,
|
||||
"icon_key": "icon_log",
|
||||
@ -772,8 +804,6 @@ class LXToolsAppConfig:
|
||||
|
||||
|
||||
LXToolsAppConfig.extract_data_files()
|
||||
# Initialize translations
|
||||
_ = LXToolsAppConfig.setup_translations()
|
||||
|
||||
|
||||
class LocaleStrings:
|
||||
@ -817,14 +847,16 @@ class LocaleStrings:
|
||||
"python_check": _("Python not installed"),
|
||||
"polkit_check": _("Please install Polkit!"),
|
||||
"networkmanager_check": _("Please install Networkmanager!"),
|
||||
"polkit_check_log": _("Polkit check: "),
|
||||
"networkmanager_check_log": _("Networkmanager check: "),
|
||||
}
|
||||
|
||||
# MSGC = Strings on Cards
|
||||
MSGC = {
|
||||
"checking": _("Checking..."),
|
||||
"version_check": _("Version: Checking..."),
|
||||
"latest": _("Latest: "),
|
||||
"update_available": _("Update available "),
|
||||
"update_on": _("Update on "),
|
||||
"available_lower": _("available"),
|
||||
"up_to_date": _("Up to date"),
|
||||
"latest_unknown": _("Latest unknown"),
|
||||
"could_not_check": _("Could not check latest version"),
|
||||
@ -873,7 +905,7 @@ class LocaleStrings:
|
||||
|
||||
# MSGP = Others print strings
|
||||
MSGP = {
|
||||
"tk_install": _("Installing tkinter for )"),
|
||||
"tk_install": _("Installing tkinter for "),
|
||||
"command_string": _("Command: "),
|
||||
"tk_success": _("TKinter installation completed successfully!"),
|
||||
"tk_failed": _("TKinter installation failed: "),
|
||||
@ -888,3 +920,52 @@ class LocaleStrings:
|
||||
"final_result": _(" Final result: "),
|
||||
"get_version_error": _("Error getting version for "),
|
||||
}
|
||||
|
||||
# MSGG = String on AppImageMessagDialogs and Strings
|
||||
MSGA = {
|
||||
"gitea_gpg_error": _("Error verifying signature: "),
|
||||
"not_gpg_found": _("Could not find GPG signature: "),
|
||||
"SHA256_File_not_found": _("SHA256-File not found: "),
|
||||
"SHA256_File_not_found1": _("Would you like to continue?"),
|
||||
"SHA256_hash mismatch": _("SHA256 hash mismatch. File might be corrupted!"),
|
||||
"Failed_retrieving": _("Failed to retrieve version from Gitea API"),
|
||||
"Error_retrieving": _("Error retrieving latest version: "),
|
||||
"gpg_verify_success": _("GPG verification successful. Signature is valid."),
|
||||
"error_gpg_check": _("Error GPG check: "),
|
||||
"error_gpg_download": _("Error downloading or verifying AppImage: "),
|
||||
"error_repo": _("Error accessing Gitea repository: "),
|
||||
"error": _("Error: "),
|
||||
"appimage_renamed": _("The AppImage renamed..."),
|
||||
"appimage_rename_error": _("Error renaming the AppImage: "),
|
||||
"appimage_executable_error": _("Error making the AppImage executable: "),
|
||||
"appimage_executable_success": _("The AppImage has been made executable"),
|
||||
"appimage_not_exist": _("Error: The AppImage file does not exist."),
|
||||
}
|
||||
|
||||
MSGGPG = {
|
||||
"gpg_missing": _(
|
||||
"Warning: 'gpg' is not installed. Please install it to verify the AppImage signature."
|
||||
),
|
||||
"url_not_reachable": _("URL not reachable: "),
|
||||
"corrupted_file": _(
|
||||
"No fingerprint found in the key. File might be corrupted or empty."
|
||||
),
|
||||
"mismatch": _("Fingerprint mismatch: Expected "),
|
||||
"but_got": _("but got: "),
|
||||
"failed_import": _("Failed to import public key: "),
|
||||
"fingerprint_extract": _("GPG fingerprint extraction failed: "),
|
||||
"error_import_key": _("Error importing GPG key from "),
|
||||
"error_updating_trust_level": _("Error updating trust level: "),
|
||||
"error_executing_script": _("Error executing script to update trust level: "),
|
||||
"keyserver_reachable": _(
|
||||
"OpenPGP keyserver is reachable. Proceeding with download."
|
||||
),
|
||||
"keyserver_unreachable": _(
|
||||
"OpenPGP keyserver unreachable. Skipping this source."
|
||||
),
|
||||
"all_keys_valid": _(
|
||||
"All keys have valid fingerprints matching the expected value."
|
||||
),
|
||||
"set_trust_level": _("Trust level 5 successfully applied to key "),
|
||||
"not_all_keys_are_valid": _("Not all keys are valid."),
|
||||
}
|
||||
|
Reference in New Issue
Block a user