From 7750d226f4a8c831b150c29aad46258c86a292c5 Mon Sep 17 00:00:00 2001 From: Maxim Slipenko Date: Sun, 21 Jan 2024 12:41:50 +0300 Subject: [PATCH] wip --- Dockerfile | 5 +++-- autorepacked/main.py | 10 +++++---- autorepacked/providers/rustdesk/__init__.py | 6 +++++- .../providers/singularityapp/__init__.py | 2 +- .../providers/trezor_suite/__init__.py | 5 ++++- .../providers/ultimaker_cura/__init__.py | 21 +++++++++++++++++++ 6 files changed, 40 insertions(+), 9 deletions(-) create mode 100644 autorepacked/providers/ultimaker_cura/__init__.py diff --git a/Dockerfile b/Dockerfile index 9a7a38d..c0a5aad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,8 +4,9 @@ RUN apt-get update && apt-get install -y \ wget \ apt-repo-tools \ alien \ - pip && \ - wget -O- https://eepm.ru/epm.sh | bash /dev/stdin ei + pip \ + epm +# wget -O- https://eepm.ru/epm.sh | bash /dev/stdin ei COPY requirements.txt . RUN pip --no-cache-dir install -r requirements.txt diff --git a/autorepacked/main.py b/autorepacked/main.py index 4d5553b..529c944 100644 --- a/autorepacked/main.py +++ b/autorepacked/main.py @@ -21,10 +21,11 @@ def create_repo(config: Config): ]) +def update_cache(): + utils.epm(['update']) + def update_epm(): - utils.epm([ - 'ei' - ]) + utils.epm(['ei']) @asynccontextmanager @@ -33,8 +34,8 @@ async def lifespan(app: FastAPI): yield -app = FastAPI(lifespan=lifespan) config = Config() +app = FastAPI(lifespan=lifespan, root_path=config.get('root_path')) update_task_started = False @@ -56,6 +57,7 @@ def update(): update_task_started = False return + update_cache() update_epm() providers_path = os.path.join(os.getcwd(), 'autorepacked/providers') diff --git a/autorepacked/providers/rustdesk/__init__.py b/autorepacked/providers/rustdesk/__init__.py index 3d7e0ae..31a62df 100644 --- a/autorepacked/providers/rustdesk/__init__.py +++ b/autorepacked/providers/rustdesk/__init__.py @@ -7,7 +7,11 @@ class RustdeskProvider(GithubReleasesProvider): _repo = 'rustdesk/rustdesk' def _get_release_filename(self): - return f'rustdesk-{self.get_version()}-x86_64.deb' + return f'rustdesk-{self.get_version()}.deb' + + def get_version(self): + # pin version due to error in start + return '1.1.9' def get_provider(config): diff --git a/autorepacked/providers/singularityapp/__init__.py b/autorepacked/providers/singularityapp/__init__.py index fa85cdd..371ba45 100644 --- a/autorepacked/providers/singularityapp/__init__.py +++ b/autorepacked/providers/singularityapp/__init__.py @@ -9,4 +9,4 @@ class SingularityApp(SnapProvider): def get_provider(config): - return SingularityApp(config) \ No newline at end of file + return SingularityApp(config) diff --git a/autorepacked/providers/trezor_suite/__init__.py b/autorepacked/providers/trezor_suite/__init__.py index 4027bd1..86d2c26 100644 --- a/autorepacked/providers/trezor_suite/__init__.py +++ b/autorepacked/providers/trezor_suite/__init__.py @@ -2,7 +2,7 @@ from autorepacked.common_providers.github_releases_provider import GithubRelease class TrezorSuiteProvider(GithubReleasesProvider): - _name = 'Trezor-Suite' + _name = 'trezor-suite' _repo = 'trezor/trezor-suite' @@ -12,6 +12,9 @@ class TrezorSuiteProvider(GithubReleasesProvider): def _get_release_filename(self): return f'Trezor-Suite-{self.get_version()}-linux-x86_64.AppImage' + def get_download_name(self): + return f"trezor-suite-{self.get_version()}-linux-x86_64.AppImage" + def get_provider(config): return TrezorSuiteProvider(config) diff --git a/autorepacked/providers/ultimaker_cura/__init__.py b/autorepacked/providers/ultimaker_cura/__init__.py new file mode 100644 index 0000000..8a29674 --- /dev/null +++ b/autorepacked/providers/ultimaker_cura/__init__.py @@ -0,0 +1,21 @@ +from autorepacked.common_providers.github_releases_provider import GithubReleasesProvider + + +class UltimakerCuraProvider(GithubReleasesProvider): + _name = 'ultimaker-cura' + + _repo = 'Ultimaker/Cura' + + def _get_release_filename(self): + return f'UltiMaker-Cura-{self.get_version()}-linux.AppImage' + + def get_download_name(self): + return f"ultimaker-cura-{self.get_version()}-linux-x86_64.AppImage" + + def get_version(self): + # pin version due to error in start + return '5.4.0' + + +def get_provider(config): + return UltimakerCuraProvider(config)