[appimage] fix: uninstalling the application when download fails (dowgrading)

This commit is contained in:
Vinicius Moreira
2021-11-19 17:22:14 -03:00
parent 65df7654f9
commit 93362878e3
2 changed files with 12 additions and 6 deletions

View File

@@ -12,7 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- AppImage
- displaying updates without the associated download URL for some applications [#207](https://github.com/vinifmor/bauh/issues/207)
- uninstalling the application when an update download fails [#207](https://github.com/vinifmor/bauh/issues/207)
- uninstalling the application when an update/downgrade download fails [#207](https://github.com/vinifmor/bauh/issues/207)
- Flatpak
- not displaying update components not associated with installed packages

View File

@@ -333,12 +333,18 @@ class AppImageManager(SoftwareManager):
type_=MessageType.ERROR)
return False
else:
old_release = versions.history[versions.pkg_status_idx + 1]
pkg.version = old_release['0_version']
pkg.latest_version = pkg.version
pkg.url_download = old_release['2_url_download']
download_data = self._download(pkg=pkg, watcher=watcher)
if not download_data:
return False
if self.uninstall(pkg, root_password, watcher).success:
old_release = versions.history[versions.pkg_status_idx + 1]
pkg.version = old_release['0_version']
pkg.latest_version = pkg.version
pkg.url_download = old_release['2_url_download']
if self.install(pkg, root_password, None, watcher).success:
if self._install(pkg=pkg, watcher=watcher, pre_downloaded_file=download_data).success:
self.cache_to_disk(pkg, None, False)
return True
else: