diff options
author | bill-auger <mr.j.spam.me@gmail.com> | 2018-05-20 04:38:08 -0400 |
---|---|---|
committer | bill-auger <mr.j.spam.me@gmail.com> | 2018-05-20 04:45:33 -0400 |
commit | 91ae5e9f3f234b98269ce23c223bfd1dbf747f75 (patch) | |
tree | 1ff534f20e8171699f3f1e448e7a2a1da72a7745 | |
parent | a506dbf51ac4db350510680b63b54dc75d2c9249 (diff) |
stash - pacstrap extra packgaesv3.1.9-parabola8
-rw-r--r-- | src/modules/pacstrap-extra/pacstrap-extra.cpp | 99 | ||||
-rw-r--r-- | src/modules/pacstrap-extra/pacstrap-extra.h | 51 |
2 files changed, 150 insertions, 0 deletions
diff --git a/src/modules/pacstrap-extra/pacstrap-extra.cpp b/src/modules/pacstrap-extra/pacstrap-extra.cpp new file mode 100644 index 000000000..8d4218ff3 --- /dev/null +++ b/src/modules/pacstrap-extra/pacstrap-extra.cpp @@ -0,0 +1,99 @@ +/* === This file is part of Calamares - <http://github.com/calamares> === + * + * Copyright 2017-2018 bill-auger <bill-auger@programmer.net> + * + * Calamares is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Calamares is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Calamares. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <QProcess> + +#include "pacstrap-extra.h" + + +/* PacstrapExtraJob public instance methods */ + +PacstrapExtraJob::PacstrapExtraJob(QObject* parent) : PacstrapCppJob(GUI_JOB_NAME , + GUI_STATUS_MSG , + GUI_JOB_WEIGHT , + parent ) {} + + +/* PacstrapExtraJob protected getters/setters */ + +QVariantList PacstrapExtraJob::getPackagesOps() +{ + QVariantList packages_data = this->globalStorage->value(GS::PACKAGES_KEY).toList() ; + + foreach (const QVariant& packages_map , packages_data) + if (packages_map.contains(GS::PACKAGES_NONCRITICAL_KEY)) + return packages_map.value(GS::PACKAGES_NONCRITICAL_KEY).toList() ; +} + +QVariantList PacstrapExtraJob::getPreScripts() +{ + QStringList preinstall_scripts ; + + foreach (const QVariant& package_ops , getPackagesOps()) + preinstall_scripts.append(package_ops.value(PACKAGE_PRE_KEY)) ; + + return preinstall_scripts ; +} + +QString PacstrapExtraJob::getPackageList() +{ + QStringList extra_packages ; + + foreach (const QVariant& package_ops , getPackagesOps()) + extra_packages.append(package_ops.value(PACKAGE_KEY)) ; + +DEBUG_TRACE_EXTRAPACKAGES + + return extra_packages.join(" ") ; +} + +QVariantList PacstrapExtraJob::getPostScripts() +{ + QStringList postinstall_scripts ; + + foreach (const QVariant& package_ops , getPackagesOps()) + postinstall_scripts.append(package_ops.value(PACKAGE_POST_KEY)) ; + + return postinstall_scripts ; +} + + +/* PacstrapExtraJob protected instance methods */ + +QString PacstrapExtraJob::chrootExecPreInstall() +{ +printf("[PACSTRAP-EXTRA]: chrootExecPreInstall nScripts=%s\n" , getPreScripts().size) ; + + foreach (const QVariant& preinstall_script , getPreScripts()) + if (!!execStatus(preinstall_script)) return PREINST_ERROR_MSG.arg(preinstall_script) ; + + return QString("") ; +} + +QString PacstrapExtraJob::chrootExecPostInstall() +{ +printf("[PACSTRAP-EXTRA]: chrootExecPostInstall nScripts=%s\n" , getPostScripts().size) ; + + foreach (const QVariant& postinstall_script , getPostScripts()) + if (!!execStatus(postinstall_script)) return PREINST_ERROR_MSG.arg(postinstall_script) ; + + return QString("") ; +} + + +CALAMARES_PLUGIN_FACTORY_DEFINITION(PacstrapExtraJobFactory , registerPlugin<PacstrapExtraJob>() ;) diff --git a/src/modules/pacstrap-extra/pacstrap-extra.h b/src/modules/pacstrap-extra/pacstrap-extra.h new file mode 100644 index 000000000..28858adb0 --- /dev/null +++ b/src/modules/pacstrap-extra/pacstrap-extra.h @@ -0,0 +1,51 @@ +/* === This file is part of Calamares - <http://github.com/calamares> === + * + * Copyright 2017-2018 bill-auger <bill-auger@programmer.net> + * + * Calamares is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Calamares is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Calamares. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef PACSTRAP_EXTRA_H +#define PACSTRAP_EXTRA_H + +#include <PacstrapCppJob.h> +#include <PluginDllMacro.h> +#include <utils/PluginFactory.h> + + +class PLUGINDLLEXPORT PacstrapExtraJob : public PacstrapCppJob +{ + Q_OBJECT + + +public: + + explicit PacstrapExtraJob(QObject* parent = nullptr) ; + + +protected: + + QVariantList getPackagesOps () override ; + QVariantList getPreScripts () override ; + QString getPackageList () override ; + QVariantList getPostScripts () override ; + QString getPackageList () override ; + QString chrootExecPreInstall () override ; + QString chrootExecPostInstall() override ; +} ; + + +CALAMARES_PLUGIN_FACTORY_DECLARATION(PacstrapExtraJobFactory) + +#endif // PACSTRAP_EXTRA_H |