mirror of
https://github.com/Murmele/Gittyup.git
synced 2024-08-15 21:50:29 +03:00
Merge pull request #435 from Murmele/flatpakUninstall
Flatpak uninstall
This commit is contained in:
commit
627f73d9fd
@ -5,7 +5,7 @@ project(Gittyup)
|
|||||||
set(GITTYUP_NAME "Gittyup")
|
set(GITTYUP_NAME "Gittyup")
|
||||||
set(GITTYUP_VERSION_MAJOR 1)
|
set(GITTYUP_VERSION_MAJOR 1)
|
||||||
set(GITTYUP_VERSION_MINOR 2)
|
set(GITTYUP_VERSION_MINOR 2)
|
||||||
set(GITTYUP_VERSION_PATCH 1)
|
set(GITTYUP_VERSION_PATCH 2)
|
||||||
set(GITTYUP_VERSION
|
set(GITTYUP_VERSION
|
||||||
"${GITTYUP_VERSION_MAJOR}.${GITTYUP_VERSION_MINOR}.${GITTYUP_VERSION_PATCH}"
|
"${GITTYUP_VERSION_MAJOR}.${GITTYUP_VERSION_MINOR}.${GITTYUP_VERSION_PATCH}"
|
||||||
)
|
)
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
### v1.2.2 - 2023-01-22
|
||||||
|
|
||||||
|
Bug fix release
|
||||||
|
|
||||||
|
#### Changed
|
||||||
|
|
||||||
|
* Fix flatpak install process
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
### v1.2.1 - 2023-01-22
|
### v1.2.1 - 2023-01-22
|
||||||
|
|
||||||
Bug fix release
|
Bug fix release
|
||||||
|
@ -271,9 +271,36 @@ Updater *Updater::instance() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FLATPAK) || defined(DEBUG_FLATPAK)
|
#if defined(FLATPAK) || defined(DEBUG_FLATPAK)
|
||||||
|
bool Updater::uninstallGittyup(bool system) {
|
||||||
|
QString bash = git::Command::bashPath();
|
||||||
|
QString loc = system ? "--system" : "--user";
|
||||||
|
|
||||||
|
QStringList args;
|
||||||
|
args.append("-c");
|
||||||
|
args.append(QString("flatpak-spawn --host flatpak remove -y %1 "
|
||||||
|
"com.github.Murmele.Gittyup")
|
||||||
|
.arg(loc));
|
||||||
|
auto *p = new QProcess(this);
|
||||||
|
|
||||||
|
p->start(bash, args);
|
||||||
|
if (!p->waitForFinished()) {
|
||||||
|
const QString es = p->errorString();
|
||||||
|
qDebug() << "Uninstalling Gittyup failed: " + es;
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
qDebug() << "Uninstall: " + p->readAll();
|
||||||
|
}
|
||||||
|
p->deleteLater();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool Updater::install(const DownloadRef &download, QString &error) {
|
bool Updater::install(const DownloadRef &download, QString &error) {
|
||||||
QString path = download->file()->fileName();
|
QString path = download->file()->fileName();
|
||||||
|
|
||||||
|
// Ignore return value
|
||||||
|
uninstallGittyup(true);
|
||||||
|
uninstallGittyup(false);
|
||||||
|
|
||||||
QDir dir(QCoreApplication::applicationDirPath());
|
QDir dir(QCoreApplication::applicationDirPath());
|
||||||
QStringList args;
|
QStringList args;
|
||||||
args.append("-c");
|
args.append("-c");
|
||||||
@ -294,6 +321,7 @@ bool Updater::install(const DownloadRef &download, QString &error) {
|
|||||||
} else {
|
} else {
|
||||||
qDebug() << "Successfully installed bundle: " + p->readAll();
|
qDebug() << "Successfully installed bundle: " + p->readAll();
|
||||||
}
|
}
|
||||||
|
p->deleteLater();
|
||||||
|
|
||||||
auto relauncher_cmd = dir.filePath("relauncher");
|
auto relauncher_cmd = dir.filePath("relauncher");
|
||||||
qDebug() << "Relauncher command: " << relauncher_cmd;
|
qDebug() << "Relauncher command: " << relauncher_cmd;
|
||||||
|
@ -62,6 +62,10 @@ private:
|
|||||||
|
|
||||||
bool install(const DownloadRef &download, QString &error);
|
bool install(const DownloadRef &download, QString &error);
|
||||||
|
|
||||||
|
#if defined(FLATPAK) || defined(DEBUG_FLATPAK)
|
||||||
|
bool uninstallGittyup(bool system);
|
||||||
|
#endif
|
||||||
|
|
||||||
QNetworkAccessManager mMgr;
|
QNetworkAccessManager mMgr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user