mirror of
https://github.com/Faraphel/Atlas-Install.git
synced 2025-07-02 02:38:30 +02:00
added linux only check for sudo usage and write / execution permissions for the installer folder itself
This commit is contained in:
parent
48f7236755
commit
4a19aff206
5 changed files with 20 additions and 4 deletions
|
@ -115,6 +115,8 @@
|
|||
"CONVERTING_TO_RIIVOLUTION": "Converting to Riivolution patch",
|
||||
"PATCHS": "patchs",
|
||||
"PRE-PATCHS": "pre-patchs",
|
||||
"CALCULATING_HASH_FOR": "Calculating hash for"
|
||||
"CALCULATING_HASH_FOR": "Calculating hash for",
|
||||
"WARNING_NOT_ROOT": "The application require root permission. You should start the application with 'sudo'. Continue anyway ?",
|
||||
"WARNING_INSTALLER_PERMISSION": "The application need writing and execution permissions to its own files. You can use 'sudo chmod 777 -R <installer-path>' to fix that. Continue anyway ?"
|
||||
}
|
||||
}
|
|
@ -116,6 +116,8 @@
|
|||
"CONVERTING_TO_RIIVOLUTION": "Conversion en patch Riivolution",
|
||||
"PATCHS": "patchs",
|
||||
"PRE-PATCHS": "pre-patchs",
|
||||
"CALCULATING_HASH_FOR": "Calcule du hash pour"
|
||||
"CALCULATING_HASH_FOR": "Calcule du hash pour",
|
||||
"WARNING_NOT_ROOT": "Cette application nécessite les permissions root. Vous devriez lancer l'application avec 'sudo'. Continuer quand même ?",
|
||||
"WARNING_INSTALLER_PERMISSION": "Cette application nécessite les permissions d'écriture et d'exécution sur ses propres fichiers. Vous pouvez utiliser 'sudo chmod 777 -R <installer-path>' pour corriger cela. Continuer quand même ?"
|
||||
}
|
||||
}
|
|
@ -4,6 +4,8 @@ __author__ = 'Faraphel'
|
|||
|
||||
|
||||
# external links
|
||||
import os
|
||||
|
||||
discord_url = "https://discord.gg/HEYW5v8ZCd"
|
||||
github_wiki_url = "https://github.com/Faraphel/MKWF-Install/wiki/help"
|
||||
readthedocs_url = "https://mkwf-install.readthedocs.io/"
|
||||
|
@ -17,6 +19,7 @@ Go: int = 1_000 * Mo
|
|||
minimum_space_available: int = 15*Go
|
||||
file_block_size: int = 128*Ko
|
||||
|
||||
system = "win64" if os.name == "nt" else "lin64"
|
||||
|
||||
# global type hint
|
||||
TemplateSafeEval: str
|
||||
|
|
|
@ -379,6 +379,16 @@ class ButtonInstall(ttk.Button):
|
|||
if not messagebox.askokcancel(_("WARNING"), _("WARNING_LOW_SPACE_CONTINUE")):
|
||||
return
|
||||
|
||||
if system == "lin64": # if linux
|
||||
if os.getuid() != 0: # if the user is not root
|
||||
if not messagebox.askokcancel(_("WARNING"), _("WARNING_NOT_ROOT")):
|
||||
return
|
||||
|
||||
if not os.access("./", os.W_OK | os.X_OK):
|
||||
# check if writing (for the /.cache/) and execution (for /tools/) are allowed
|
||||
if not messagebox.askokcancel(_("WARNING"), _("WARNING_INSTALLER_PERMISSION")):
|
||||
return
|
||||
|
||||
game = Game(source_path)
|
||||
output_type = Extension[self.root.options.extension.get()]
|
||||
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
import subprocess
|
||||
from pathlib import Path
|
||||
import os
|
||||
from typing import Callable
|
||||
|
||||
from source import system
|
||||
from source.translation import translate as _
|
||||
|
||||
|
||||
tools_dir: Path = Path("./tools/")
|
||||
system = "win64" if os.name == "nt" else "lin64"
|
||||
|
||||
subprocess_kwargs = {"creationflags": subprocess.CREATE_NO_WINDOW} if system == "win64" else {}
|
||||
# creationflags are Windows specific. Linux don't show any subprocess window per default.
|
||||
|
|
Loading…
Reference in a new issue