diff --git a/CHANGELOG.md b/CHANGELOG.md index 6efdf815..3c3ec8fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - checking architecture dependencies (x86_64, i686) - architecture dependencies are displayed on the info window as well - optimizations to speed up zst packages building + - showing a warning messaging when trying to install / update a package with the root user - UI: - **Settings** available as a tray action as well - minor improvements diff --git a/bauh/gems/arch/controller.py b/bauh/gems/arch/controller.py index d9cb372b..de3abb1d 100644 --- a/bauh/gems/arch/controller.py +++ b/bauh/gems/arch/controller.py @@ -21,6 +21,7 @@ from bauh.api.abstract.model import PackageUpdate, PackageHistory, SoftwarePacka from bauh.api.abstract.view import MessageType, FormComponent, InputOption, SingleSelectComponent, SelectViewType, \ ViewComponent, PanelComponent from bauh.api.constants import TEMP_DIR +from bauh.commons import user from bauh.commons.category import CategoriesDownloader from bauh.commons.config import save_config from bauh.commons.html import bold @@ -262,6 +263,12 @@ class ArchManager(SoftwareManager): shutil.rmtree(pkg.get_disk_cache_path()) def update(self, pkg: ArchPackage, root_password: str, watcher: ProcessWatcher) -> bool: + if user.is_root() and pkg.mirror == 'aur': + watcher.show_message(title=self.i18n['arch.install.aur.root_error.title'], + body=self.i18n['arch.install.aur.root_error.body'], + type_=MessageType.ERROR) + return False + self.local_config = read_config() try: return self.install(pkg=pkg, root_password=root_password, watcher=watcher, skip_optdeps=True) @@ -893,6 +900,12 @@ class ArchManager(SoftwareManager): ArchCompilationOptimizer(self.context.logger).optimize() def install(self, pkg: ArchPackage, root_password: str, watcher: ProcessWatcher, skip_optdeps: bool = False) -> bool: + if user.is_root() and pkg.mirror == 'aur': + watcher.show_message(title=self.i18n['arch.install.aur.root_error.title'], + body=self.i18n['arch.install.aur.root_error.body'], + type_=MessageType.ERROR) + return False + clean_config = False if not self.local_config: diff --git a/bauh/gems/arch/resources/locale/ca b/bauh/gems/arch/resources/locale/ca index 6ca50944..888e03c3 100644 --- a/bauh/gems/arch/resources/locale/ca +++ b/bauh/gems/arch/resources/locale/ca @@ -112,4 +112,6 @@ arch.sync_databases.substatus.error=It was not possible to synchronize the packa arch.config.sync_dbs=Synchronize packages databases arch.config.sync_dbs.tip=Synchronizes the package databases once a day ( or after a device reboot ) before the first package installation, upgrade or downgrade. This option help to prevent errors during these operations. arch.config.simple_dep_check=Verificació de dependències simples -arch.config.simple_dep_check.tip=Si només s'hauria d'utilitzar la verificació de dependència proporcionada per pacman abans d'instal·lar un paquet (més ràpid, però no sempre exacte). Si està desactivat, es farà una comprovació més completa (més lenta, però més precisa) \ No newline at end of file +arch.config.simple_dep_check.tip=Si només s'hauria d'utilitzar la verificació de dependència proporcionada per pacman abans d'instal·lar un paquet (més ràpid, però no sempre exacte). Si està desactivat, es farà una comprovació més completa (més lenta, però més precisa) +arch.install.aur.root_error.title=No es permet l’acció +arch.install.aur.root_error.body=La instal·lació o actualització de paquets com a root no està permesa \ No newline at end of file diff --git a/bauh/gems/arch/resources/locale/de b/bauh/gems/arch/resources/locale/de index 4b377f9c..de46390c 100644 --- a/bauh/gems/arch/resources/locale/de +++ b/bauh/gems/arch/resources/locale/de @@ -112,4 +112,6 @@ arch.sync_databases.substatus.error=It was not possible to synchronize the packa arch.config.sync_dbs=Synchronize packages databases arch.config.sync_dbs.tip=Synchronizes the package databases once a day ( or after a device reboot ) before the first package installation, upgrade or downgrade. This option help to prevent errors during these operations. arch.config.simple_dep_check=Simple dependencies checking -arch.config.simple_dep_check.tip=If only the dependency checking provided by pacman should be used before installing a package ( faster, but not always accurate ). If disabled, a more complete checking will be performed ( slower, but more accurate ) \ No newline at end of file +arch.config.simple_dep_check.tip=If only the dependency checking provided by pacman should be used before installing a package ( faster, but not always accurate ). If disabled, a more complete checking will be performed ( slower, but more accurate ) +arch.install.aur.root_error.title=Action not allowed +arch.install.aur.root_error.body=Installing or updating packages as root is not allowed \ No newline at end of file diff --git a/bauh/gems/arch/resources/locale/en b/bauh/gems/arch/resources/locale/en index 744a0ba2..33bf886e 100644 --- a/bauh/gems/arch/resources/locale/en +++ b/bauh/gems/arch/resources/locale/en @@ -112,4 +112,6 @@ arch.sync_databases.substatus.error=It was not possible to synchronize the packa arch.config.sync_dbs=Synchronize packages databases arch.config.sync_dbs.tip=Synchronizes the package databases once a day ( or after a device reboot ) before the first package installation, upgrade or downgrade. This option help to prevent errors during these operations. arch.config.simple_dep_check=Simple dependencies checking -arch.config.simple_dep_check.tip=If only the dependency checking provided by pacman should be used before installing a package ( faster, but not always accurate ). If disabled, a more complete checking will be performed ( slower, but more accurate ) \ No newline at end of file +arch.config.simple_dep_check.tip=If only the dependency checking provided by pacman should be used before installing a package ( faster, but not always accurate ). If disabled, a more complete checking will be performed ( slower, but more accurate ) +arch.install.aur.root_error.title=Action not allowed +arch.install.aur.root_error.body=Installing or updating packages as root is not allowed \ No newline at end of file diff --git a/bauh/gems/arch/resources/locale/es b/bauh/gems/arch/resources/locale/es index 0ed21a13..8170a67a 100644 --- a/bauh/gems/arch/resources/locale/es +++ b/bauh/gems/arch/resources/locale/es @@ -112,4 +112,6 @@ arch.sync_databases.substatus.error=No fue posible sincronizar la base de paquet arch.config.sync_dbs=Sincronizar las bases de paquetes arch.config.sync_dbs.tip=Sincroniza las bases de paquetes una vez al día ( o cada reinicialización del dispositivo ) antes de la primera instalación, actualización o reversión de un paquete. Esta opción ayuda a prevenir errores durante estas operaciones. arch.config.simple_dep_check=Verificación de dependencias simples -arch.config.simple_dep_check.tip=Si solo se usara la verificación de dependencia provista por pacman antes de instalar un paquete (más rápido, pero no siempre exacto). Si está deshabilitado, se realizará una verificación más completa (más lenta, pero más precisa) \ No newline at end of file +arch.config.simple_dep_check.tip=Si solo se usara la verificación de dependencia provista por pacman antes de instalar un paquete (más rápido, pero no siempre exacto). Si está deshabilitado, se realizará una verificación más completa (más lenta, pero más precisa) +arch.install.aur.root_error.title=Acción no permitida +arch.install.aur.root_error.body=Instalar o actualizar paquetes como root no es permitido \ No newline at end of file diff --git a/bauh/gems/arch/resources/locale/it b/bauh/gems/arch/resources/locale/it index a6314c23..33491c07 100644 --- a/bauh/gems/arch/resources/locale/it +++ b/bauh/gems/arch/resources/locale/it @@ -80,4 +80,6 @@ arch.sync_databases.substatus.error=It was not possible to synchronize the packa arch.config.sync_dbs=Synchronize packages databases arch.config.sync_dbs.tip=Synchronizes the package databases once a day ( or after a device reboot ) before the first package installation, upgrade or downgrade. This option help to prevent errors during these operations. arch.config.simple_dep_check=Verifica delle dipendenze semplice -arch.config.simple_dep_check.tip=Se è necessario utilizzare solo la verifica della dipendenza fornita da pacman prima di installare un pacchetto (più veloce, ma non sempre accurato). Se disabilitato, verrà eseguito un controllo più completo (più lento, ma più accurato) \ No newline at end of file +arch.config.simple_dep_check.tip=Se è necessario utilizzare solo la verifica della dipendenza fornita da pacman prima di installare un pacchetto (più veloce, ma non sempre accurato). Se disabilitato, verrà eseguito un controllo più completo (più lento, ma più accurato) +arch.install.aur.root_error.title=Azione non consentita +arch.install.aur.root_error.body=L'installazione o l'aggiornamento di pacchetti come root non è consentito \ No newline at end of file diff --git a/bauh/gems/arch/resources/locale/pt b/bauh/gems/arch/resources/locale/pt index d2302470..cf45d2b0 100644 --- a/bauh/gems/arch/resources/locale/pt +++ b/bauh/gems/arch/resources/locale/pt @@ -113,3 +113,5 @@ arch.config.sync_dbs=Sincronizar bases de pacotes arch.config.sync_dbs.tip=Sincroniza as bases de pacotes uma vez ao dia ( ou a cada reinicialização do dispositivo ) antes da primeira instalação, atualização ou reversão de um pacote. Essa opção ajuda a evitar erros durante essa operações. arch.config.simple_dep_check=Verificação de dependências simples arch.config.simple_dep_check.tip=Se somente a verificação de dependências provida pelo pacman deve ser usada antes de instalar um pacote ( mais rápida, porém nem sempre precisa ). Se desativada, uma verificação mais completa será realizada ( mais lenta, porém mais precisa ) +arch.install.aur.root_error.title=Ação não permitida +arch.install.aur.root_error.body=Não é permitido instalar ou atualizar pacotes como usuário root \ No newline at end of file