┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexander Lohnau <[email protected]>2020-04-21 18:44:48 +0200
committerAlexander Lohnau <[email protected]>2020-04-21 21:29:06 +0200
commit5bbdf66fce8d01c73ce87a5175234c7f60a2c9cb (patch)
tree6e9cb240d7c8674681a8522287d97149dd215115 /src
parent76f9d9a5f5c6b2a26d4e7e927a39f52ebf88960c (diff)
Dolphin Service Installer: Run uninstall scripts, rename methods
Summary: Now scripts starting with `uninstall` are being executed. Addtionally the `runInstallerScriptOnce` method has been renamed, because it is used to run the install/uninstall scripts. Same for `runInstallerScript`. Depends on D28801 Test Plan: Compile, run tests. Try to uninstall a dolphin service which has a uninstall.sh script. Reviewers: #dolphin, ngraham, nicolasfella, elvisangelaccio Reviewed By: #dolphin, elvisangelaccio Subscribers: cfeck, kfm-devel Tags: #dolphin Differential Revision: https://phabricator.kde.org/D28836
Diffstat (limited to 'src')
-rw-r--r--src/settings/services/servicemenuinstaller/servicemenuinstaller.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/settings/services/servicemenuinstaller/servicemenuinstaller.cpp b/src/settings/services/servicemenuinstaller/servicemenuinstaller.cpp
index 1c4ea4cff..06f34c6b9 100644
--- a/src/settings/services/servicemenuinstaller/servicemenuinstaller.cpp
+++ b/src/settings/services/servicemenuinstaller/servicemenuinstaller.cpp
@@ -126,7 +126,7 @@ QString findRecursive(const QString &dir, const QString &basename)
return QString();
}
-bool runInstallerScriptOnce(const QString &path, const QStringList &args)
+bool runScriptOnce(const QString &path, const QStringList &args)
{
QProcess process;
process.setWorkingDirectory(QFileInfo(path).absolutePath());
@@ -152,7 +152,7 @@ bool runInstallerScriptOnce(const QString &path, const QStringList &args)
// If hasArgVariants is true, run "path".
// If hasArgVariants is false, run "path argVariants[i]" until successful.
-bool runInstallerScript(const QString &path, bool hasArgVariants, const QStringList &argVariants, QString &errorText)
+bool runScriptVariants(const QString &path, bool hasArgVariants, const QStringList &argVariants, QString &errorText)
{
QFile file(path);
if (!file.setPermissions(QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner)) {
@@ -163,11 +163,11 @@ bool runInstallerScript(const QString &path, bool hasArgVariants, const QStringL
qInfo() << "[servicemenuinstaller]: Trying to run installer/uninstaller" << path;
if (hasArgVariants) {
for (const auto &arg : argVariants) {
- if (runInstallerScriptOnce(path, {arg})) {
+ if (runScriptOnce(path, {arg})) {
return true;
}
}
- } else if (runInstallerScriptOnce(path, {})) {
+ } else if (runScriptOnce(path, {})) {
return true;
}
@@ -232,7 +232,7 @@ bool cmdInstall(const QString &archive, QString &errorText)
}
if (!installItPath.isEmpty()) {
- return runInstallerScript(installItPath, false, QStringList{}, errorText);
+ return runScriptVariants(installItPath, false, QStringList{}, errorText);
}
// If "install-it" is missing, try "install"
@@ -247,7 +247,7 @@ bool cmdInstall(const QString &archive, QString &errorText)
}
if (!installerPath.isEmpty()) {
- return runInstallerScript(installerPath, true, {"--local", "--local-install", "--install"}, errorText);
+ return runScriptVariants(installerPath, true, {"--local", "--local-install", "--install"}, errorText);
}
fail(i18n("Failed to find an installation script in %1", dir));
@@ -272,7 +272,7 @@ bool cmdUninstall(const QString &archive, QString &errorText)
// Try "deinstall" first
QString deinstallPath;
- const QStringList basenames1 = {"deinstall.sh", "deinstall"};
+ const QStringList basenames1 = {"uninstall.sh", "uninstal", "deinstall.sh", "deinstall"};
for (const auto &basename : basenames1) {
const auto path = findRecursive(dir, basename);
if (!path.isEmpty()) {
@@ -282,7 +282,7 @@ bool cmdUninstall(const QString &archive, QString &errorText)
}
if (!deinstallPath.isEmpty()) {
- const bool ok = runInstallerScript(deinstallPath, false, {}, errorText);
+ const bool ok = runScriptVariants(deinstallPath, false, {}, errorText);
if (!ok) {
return ok;
}
@@ -300,8 +300,8 @@ bool cmdUninstall(const QString &archive, QString &errorText)
}
if (!installerPath.isEmpty()) {
- const bool ok = runInstallerScript(installerPath, true,
- {"--remove", "--delete", "--uninstall", "--deinstall"}, errorText);
+ const bool ok = runScriptVariants(installerPath, true,
+ {"--remove", "--delete", "--uninstall", "--deinstall"}, errorText);
if (!ok) {
return ok;
}