mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-09 12:04:15 +02:00
[appimage] new config file
This commit is contained in:
@@ -14,9 +14,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
### Improvements
|
### Improvements
|
||||||
- AppImage:
|
- AppImage:
|
||||||
- cleaning the downloaded database files when **--reset** is passed as parameter
|
- cleaning the downloaded database files when **--reset** is passed as parameter
|
||||||
|
- environment variables **BAUH_APPIMAGE_DB_UPDATER** and **BAUH_APPIMAGE_DB_UPDATER_TIME** dropped in favor of the new configuration file located at **~/.config/bauh/appimage.yml**
|
||||||
- AUR:
|
- AUR:
|
||||||
- The AUR indexer daemon is not running every 20 minutes anymore. It will only run during the boot, and will generate the optimized index
|
- The AUR indexer daemon is not running every 20 minutes anymore. It will only run during the boot, and will generate the optimized index
|
||||||
at **/tmp/bauh/arch/aur.txt**. This new behavior does not harm the current experience, and reduces memory usage. More information about this behavior in [README](https://github.com/vinifmor/bauh/blob/master/README.md).
|
at **/tmp/bauh/arch/aur.txt**. This new behavior does not harm the current experience, and reduces memory usage. More information about this behavior in [README](https://github.com/vinifmor/bauh/blob/master/README.md).
|
||||||
|
- Environment variable **BAUH_ARCH_AUR_INDEX_UPDATER** dropped in favor of the behavior described above.
|
||||||
|
- Environment variables **BAUH_ARCH_OPTIMIZE** and **BAUH_ARCH_CHECK_SUBDEPS** dropped in favor of the new configuration file located at **~/.config/bauh/arch.yml**
|
||||||
- Minor memory improvements
|
- Minor memory improvements
|
||||||
### Fixes
|
### Fixes
|
||||||
- AUR:
|
- AUR:
|
||||||
|
|||||||
31
README.md
31
README.md
@@ -104,21 +104,28 @@ If bauh is not starting properly after changing its style, execute `bauh --reset
|
|||||||
#### AppImage ( appimage )
|
#### AppImage ( appimage )
|
||||||
- The user is able to search, install, uninstall, downgrade, launch and retrieve the applications history
|
- The user is able to search, install, uninstall, downgrade, launch and retrieve the applications history
|
||||||
- Supported sources: [AppImageHub](https://appimage.github.io) ( **applications with no releases published to GitHub are currently not available** )
|
- Supported sources: [AppImageHub](https://appimage.github.io) ( **applications with no releases published to GitHub are currently not available** )
|
||||||
- Faster downloads if **aria2c** is installed. Same behavior described in the **AUR support** section.
|
|
||||||
- Installed applications are store at **~/.local/share/bauh/appimage/installed**
|
- Installed applications are store at **~/.local/share/bauh/appimage/installed**
|
||||||
- Desktop entries ( menu shortcuts ) of the installed applications are stored at **~/.local/share/applications**
|
- Desktop entries ( menu shortcuts ) of the installed applications are stored at **~/.local/share/applications**
|
||||||
- Downloaded database files are stored at **~/.local/share/bauh/appimage** as **apps.db** and **releases.db**
|
- Downloaded database files are stored at **~/.local/share/bauh/appimage** as **apps.db** and **releases.db**
|
||||||
- Databases updater daemon running every 20 minutes ( the interval in SECONDS can be changed with the environment variable **BAUH_APPIMAGE_DB_UPDATER_TIME** ). It can be disabled via the environment variable **BAUH_APPIMAGE_DB_UPDATER=0**.
|
- Databases are always updated when bauh starts
|
||||||
|
- Databases updater daemon running every 20 minutes ( it can be customized via the configuration file described below )
|
||||||
|
- Crashes may happen during an AppImage installation if **AppImageLauncher** is installed. It is advisable to uninstall it and reboot the system before trying to install an application.
|
||||||
- All supported application names can be found at: https://github.com/vinifmor/bauh-files/blob/master/appimage/apps.txt
|
- All supported application names can be found at: https://github.com/vinifmor/bauh-files/blob/master/appimage/apps.txt
|
||||||
|
- The configuration file is located at **~/.config/bauh/appimage.yml** and it allows the following customizations:
|
||||||
Obs: There are some crashes when **AppImageLauncher** is installed. It is advisable to uninstall it and reboot the system before trying to install an AppImage application.
|
```
|
||||||
|
db_updater:
|
||||||
|
enabled: true # if 'false': disables the daemon database updater ( bauh will not be able to see if there are updates for your already installed AppImages )
|
||||||
|
interval: 1200 # the databases update interval in SECONDS ( 1200 == 20 minutes )
|
||||||
|
```
|
||||||
|
- Required dependencies
|
||||||
|
- Arch-based systems: **sqlite**, **wget** ( or **aria2** for faster multi-threaded downloads )
|
||||||
|
- Debian-based systems: **sqlite3**, **wget** ( or **aria2** for faster multi-threaded downloads )
|
||||||
|
- **aria2 will only be used if the multi-threaded download settings are enabled**
|
||||||
|
|
||||||
#### AUR ( arch )
|
#### AUR ( arch )
|
||||||
- Only available for Arch-based systems
|
- Only available for Arch-based systems
|
||||||
- The user is able to search, install, uninstall, downgrade, launch and retrieve the packages history
|
- The user is able to search, install, uninstall, downgrade, launch and retrieve packages history
|
||||||
- It handles conflicts, and missing / optional packages installations ( including from your distro mirrors )
|
- It handles conflicts, and missing / optional packages installations ( including from your distro mirrors )
|
||||||
- If [**aria2**](https://github.com/aria2/aria2) is installed on your system and multi-threaded downloads are enabled ( see **BAUH_DOWNLOAD_MULTITHREAD** ), the source packages
|
|
||||||
will be pre-downloaded faster ( it does **NOT** modify your **pacman** settings ).
|
|
||||||
- Automatically makes simple package compilation improvements:
|
- Automatically makes simple package compilation improvements:
|
||||||
|
|
||||||
a) if **MAKEFLAGS** is not set in **/etc/makepkg.conf**,
|
a) if **MAKEFLAGS** is not set in **/etc/makepkg.conf**,
|
||||||
@@ -132,15 +139,15 @@ will be pre-downloaded faster ( it does **NOT** modify your **pacman** settings
|
|||||||
- If some of your installed packages are not categorized, send an e-mail to **bauh4linux@gmail.com** informing their names and categories in the following format: ```name=category1[,category2,category3,...]```
|
- If some of your installed packages are not categorized, send an e-mail to **bauh4linux@gmail.com** informing their names and categories in the following format: ```name=category1[,category2,category3,...]```
|
||||||
- The configuration file is located at **~/.config/bauh/arch.yml** and it allows the following customizations:
|
- The configuration file is located at **~/.config/bauh/arch.yml** and it allows the following customizations:
|
||||||
```
|
```
|
||||||
optimize: true # if false: disables the auto-compilation improvements
|
optimize: true # if 'false': disables the auto-compilation improvements
|
||||||
transitive_checking: true # if false: the dependency checking process will be faster, but the application will ask for a confirmation every time a not installed dependency is detected.
|
transitive_checking: true # if 'false': the dependency checking process will be faster, but the application will ask for a confirmation every time a not installed dependency is detected.
|
||||||
```
|
```
|
||||||
- Required dependencies:
|
- Required dependencies:
|
||||||
- **pacman**
|
- **pacman**
|
||||||
- **wget**
|
- **wget**
|
||||||
- Optional dependencies:
|
- Optional dependencies:
|
||||||
- **git**: allows to retrieve packages release history and downgrading
|
- **git**: allows to retrieve packages release history and downgrading
|
||||||
- **aria2**: provides faster and multi-threaded downloads
|
- **aria2**: provides faster, multi-threaded downloads for required source files ( if the param )
|
||||||
|
|
||||||
#### Web Applications ( web )
|
#### Web Applications ( web )
|
||||||
- It allows the installation of native Web applications by typing an address / URL in the search bar.
|
- It allows the installation of native Web applications by typing an address / URL in the search bar.
|
||||||
@@ -165,8 +172,8 @@ environment:
|
|||||||
system: false # set it to 'true' if you want to use the nativefier version globally installed on your system
|
system: false # set it to 'true' if you want to use the nativefier version globally installed on your system
|
||||||
```
|
```
|
||||||
- Required dependencies:
|
- Required dependencies:
|
||||||
- Arch systems: **python-lxml**, **python-beautifulsoup4**
|
- Arch-based systems: **python-lxml**, **python-beautifulsoup4**
|
||||||
- Debian systems ( using pip ): **beautifulsoup4**, **lxml**
|
- Debian-based systems ( using pip ): **beautifulsoup4**, **lxml**
|
||||||
|
|
||||||
### General settings
|
### General settings
|
||||||
You can change some application settings via environment variables or arguments (type ```bauh --help``` to get more information).
|
You can change some application settings via environment variables or arguments (type ```bauh --help``` to get more information).
|
||||||
|
|||||||
12
bauh/gems/appimage/config.py
Normal file
12
bauh/gems/appimage/config.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
from bauh.api.constants import CONFIG_PATH
|
||||||
|
from bauh.commons.config import read_config as read
|
||||||
|
|
||||||
|
|
||||||
|
def read_config(update_file: bool = False) -> dict:
|
||||||
|
default = {
|
||||||
|
'db_updater': {
|
||||||
|
'interval': 60 * 20,
|
||||||
|
'enabled': True
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return read('{}/appimage.yml'.format(CONFIG_PATH), default, update_file=update_file)
|
||||||
@@ -8,7 +8,7 @@ import subprocess
|
|||||||
import traceback
|
import traceback
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from threading import Lock
|
from threading import Lock, Thread
|
||||||
from typing import Set, Type, List
|
from typing import Set, Type, List
|
||||||
|
|
||||||
from colorama import Fore
|
from colorama import Fore
|
||||||
@@ -23,6 +23,7 @@ from bauh.api.constants import HOME_PATH
|
|||||||
from bauh.commons.html import bold
|
from bauh.commons.html import bold
|
||||||
from bauh.commons.system import SystemProcess, new_subprocess, ProcessHandler, run_cmd, SimpleProcess
|
from bauh.commons.system import SystemProcess, new_subprocess, ProcessHandler, run_cmd, SimpleProcess
|
||||||
from bauh.gems.appimage import query, INSTALLATION_PATH, suggestions, LOCAL_PATH
|
from bauh.gems.appimage import query, INSTALLATION_PATH, suggestions, LOCAL_PATH
|
||||||
|
from bauh.gems.appimage.config import read_config
|
||||||
from bauh.gems.appimage.model import AppImage
|
from bauh.gems.appimage.model import AppImage
|
||||||
from bauh.gems.appimage.worker import DatabaseUpdater
|
from bauh.gems.appimage.worker import DatabaseUpdater
|
||||||
|
|
||||||
@@ -48,7 +49,6 @@ class AppImageManager(SoftwareManager):
|
|||||||
self.logger = context.logger
|
self.logger = context.logger
|
||||||
self.file_downloader = context.file_downloader
|
self.file_downloader = context.file_downloader
|
||||||
self.db_locks = {DB_APPS_PATH: Lock(), DB_RELEASES_PATH: Lock()}
|
self.db_locks = {DB_APPS_PATH: Lock(), DB_RELEASES_PATH: Lock()}
|
||||||
self.dbs_updater = DatabaseUpdater(http_client=context.http_client, logger=context.logger, db_locks=self.db_locks)
|
|
||||||
|
|
||||||
def _get_db_connection(self, db_path: str) -> sqlite3.Connection:
|
def _get_db_connection(self, db_path: str) -> sqlite3.Connection:
|
||||||
if os.path.exists(db_path):
|
if os.path.exists(db_path):
|
||||||
@@ -387,8 +387,19 @@ class AppImageManager(SoftwareManager):
|
|||||||
def requires_root(self, action: str, pkg: AppImage):
|
def requires_root(self, action: str, pkg: AppImage):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def _start_updater(self):
|
||||||
|
local_config = read_config(update_file=True)
|
||||||
|
interval = local_config['db_updater']['interval'] or 20 * 60
|
||||||
|
|
||||||
|
updater = DatabaseUpdater(http_client=self.context.http_client, logger=self.context.logger,
|
||||||
|
db_locks=self.db_locks, interval=interval)
|
||||||
|
if local_config['db_updater']['enabled']:
|
||||||
|
updater.start()
|
||||||
|
else:
|
||||||
|
updater.download_databases() # only once
|
||||||
|
|
||||||
def prepare(self):
|
def prepare(self):
|
||||||
self.dbs_updater.start()
|
Thread(target=self._start_updater()).start()
|
||||||
|
|
||||||
def list_updates(self, internet_available: bool) -> List[PackageUpdate]:
|
def list_updates(self, internet_available: bool) -> List[PackageUpdate]:
|
||||||
res = self.read_installed(disk_loader=None, internet_available=internet_available)
|
res = self.read_installed(disk_loader=None, internet_available=internet_available)
|
||||||
|
|||||||
@@ -15,19 +15,24 @@ from bauh.gems.appimage import LOCAL_PATH
|
|||||||
|
|
||||||
|
|
||||||
class DatabaseUpdater(Thread):
|
class DatabaseUpdater(Thread):
|
||||||
|
|
||||||
URL_DB = 'https://raw.githubusercontent.com/vinifmor/bauh-files/master/appimage/dbs.tar.gz'
|
URL_DB = 'https://raw.githubusercontent.com/vinifmor/bauh-files/master/appimage/dbs.tar.gz'
|
||||||
COMPRESS_FILE_PATH = LOCAL_PATH + '/db.tar.gz'
|
COMPRESS_FILE_PATH = LOCAL_PATH + '/db.tar.gz'
|
||||||
|
|
||||||
def __init__(self, http_client: HttpClient, logger: logging.Logger, db_locks: dict):
|
def __init__(self, http_client: HttpClient, logger: logging.Logger, db_locks: dict, interval: int):
|
||||||
super(DatabaseUpdater, self).__init__(daemon=True)
|
super(DatabaseUpdater, self).__init__(daemon=True)
|
||||||
self.http_client = http_client
|
self.http_client = http_client
|
||||||
self.logger = logger
|
self.logger = logger
|
||||||
self.enabled = bool(int(os.getenv('BAUH_APPIMAGE_DB_UPDATER', 1)))
|
|
||||||
self.db_locks = db_locks
|
self.db_locks = db_locks
|
||||||
self.sleep = int(os.getenv('BAUH_APPIMAGE_DB_UPDATER_TIME', 60 * 20))
|
self.sleep = interval
|
||||||
|
|
||||||
|
def download_databases(self):
|
||||||
|
try:
|
||||||
|
if not internet.is_available(self.http_client, self.logger):
|
||||||
|
return
|
||||||
|
except requests.exceptions.ConnectionError:
|
||||||
|
self.logger.warning('The internet connection seems to be off.')
|
||||||
|
return
|
||||||
|
|
||||||
def _download_databases(self):
|
|
||||||
self.logger.info('Retrieving AppImage databases')
|
self.logger.info('Retrieving AppImage databases')
|
||||||
|
|
||||||
res = self.http_client.get(self.URL_DB)
|
res = self.http_client.get(self.URL_DB)
|
||||||
@@ -71,15 +76,7 @@ class DatabaseUpdater(Thread):
|
|||||||
self.logger.warning('Could not download the database file {}'.format(self.URL_DB))
|
self.logger.warning('Could not download the database file {}'.format(self.URL_DB))
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if self.enabled:
|
while True:
|
||||||
while True:
|
self.download_databases()
|
||||||
try:
|
self.logger.info('Sleeping')
|
||||||
if internet.is_available(self.http_client, self.logger):
|
time.sleep(self.sleep)
|
||||||
self._download_databases()
|
|
||||||
except requests.exceptions.ConnectionError:
|
|
||||||
self.logger.warning('The internet connection seems to be off.')
|
|
||||||
|
|
||||||
self.logger.info('Sleeping')
|
|
||||||
time.sleep(self.sleep)
|
|
||||||
else:
|
|
||||||
self.logger.warning('AppImage database updater disabled')
|
|
||||||
|
|||||||
Reference in New Issue
Block a user