summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbill-auger <mr.j.spam.me@gmail.com>2018-05-20 04:36:38 -0400
committerbill-auger <mr.j.spam.me@gmail.com>2018-05-27 06:26:01 -0400
commit70777b8a02f90c884ce71bdbbe2bedac8f8324d8 (patch)
tree3a447a56f2a28f83689b8a06abdb216d164cab52
parentce19db09f8d9aefc84e3d1de4db511c9ee3b2c29 (diff)
implement package selection
-rw-r--r--src/libcalamares/GlobalStorage.cpp7
-rw-r--r--src/libcalamares/GlobalStorage.h7
-rw-r--r--src/libcalamares/PacstrapCppJob.cpp6
-rw-r--r--src/libcalamares/PacstrapCppJob.h8
-rw-r--r--src/modules/netinstall/NetInstallPage.cpp1
-rw-r--r--src/modules/netinstall/NetInstallViewStep.cpp51
-rw-r--r--src/modules/netinstall/netinstall.conf31
-rw-r--r--src/modules/welcome/checker/RequirementsChecker.cpp8
8 files changed, 108 insertions, 11 deletions
diff --git a/src/libcalamares/GlobalStorage.cpp b/src/libcalamares/GlobalStorage.cpp
index 7a160d7f8..d5bc4ed08 100644
--- a/src/libcalamares/GlobalStorage.cpp
+++ b/src/libcalamares/GlobalStorage.cpp
@@ -176,6 +176,13 @@ const QString GS::INIT_NAME_KEY = "init-name";
const QString GS::DESKTOPS_KEY = "desktops";
const QString GS::DE_ICON_KEY = "de-icon";
const QString GS::DE_NAME_KEY = "de-name";
+const QString GS::PACKAGE_GROUPS_KEY = "package-groups";
+const QString GS::PACKAGES_KEY = "packageOperations";
+const QString GS::PACKAGES_CRITICAL_KEY = "install";
+const QString GS::PACKAGES_NONCRITICAL_KEY = "try_install";
+const QString GS::PACKAGE_PRE_KEY = "pre-script";
+const QString GS::PACKAGE_KEY = "package";
+const QString GS::PACKAGE_POST_KEY = "post-script";
const QString GS::LOCALE_KEY = "localeConf";
const QString GS::LANG_KEY = "LANG";
const QString GS::ROOT_MOUNTPOINT_KEY = "rootMountPoint";
diff --git a/src/libcalamares/GlobalStorage.h b/src/libcalamares/GlobalStorage.h
index 3a877f41c..a8039caad 100644
--- a/src/libcalamares/GlobalStorage.h
+++ b/src/libcalamares/GlobalStorage.h
@@ -113,6 +113,13 @@ public:
static const QString DESKTOPS_KEY;
static const QString DE_ICON_KEY;
static const QString DE_NAME_KEY;
+ static const QString PACKAGE_GROUPS_KEY;
+ static const QString PACKAGES_KEY;
+ static const QString PACKAGES_CRITICAL_KEY;
+ static const QString PACKAGES_NONCRITICAL_KEY;
+ static const QString PACKAGE_PRE_KEY;
+ static const QString PACKAGE_KEY;
+ static const QString PACKAGE_POST_KEY;
static const QString LOCALE_KEY;
static const QString LANG_KEY;
static const QString ROOT_MOUNTPOINT_KEY;
diff --git a/src/libcalamares/PacstrapCppJob.cpp b/src/libcalamares/PacstrapCppJob.cpp
index a1d877838..cc5b62824 100644
--- a/src/libcalamares/PacstrapCppJob.cpp
+++ b/src/libcalamares/PacstrapCppJob.cpp
@@ -30,13 +30,13 @@
const QString PacstrapCppJob::BOOTLODER_PACKAGES_KEY = "bootloader" ;
const QString PacstrapCppJob::KERNEL_PACKAGES_KEY = "kernel" ;
const QString PacstrapCppJob::UTILITIES_PACKAGES_KEY = "utilities" ;
-const QString PacstrapCppJob::OPENRC_PACKAGES_KEY = "openrc" ;
-const QString PacstrapCppJob::SYSTEMD_PACKAGES_KEY = "systemd" ;
const QString PacstrapCppJob::APPLICATIONS_PACKAGES_KEY = "applications" ;
const QString PacstrapCppJob::MULTIMEDIA_PACKAGES_KEY = "multimedia" ;
const QString PacstrapCppJob::NETWORK_PACKAGES_KEY = "network" ;
const QString PacstrapCppJob::LOOKANDFEEL_PACKAGES_KEY = "look-and-feel" ;
const QString PacstrapCppJob::XSERVER_PACKAGES_KEY = "x-server" ;
+const QString PacstrapCppJob::OPENRC_PACKAGES_KEY = "openrc" ;
+const QString PacstrapCppJob::SYSTEMD_PACKAGES_KEY = "systemd" ;
const QString PacstrapCppJob::LXDE_PACKAGES_KEY = "lxde" ;
const QString PacstrapCppJob::MATE_PACKAGES_KEY = "mate" ;
@@ -63,6 +63,8 @@ const QSTRINGMAP PacstrapCppJob::LANGUAGE_PACKS = { {"eo" , "iceweasel
{"pt_BR.UTF-8" , "iceweasel-l10n-pt-br" } ,
{"pl_PL.UTF-8" , "icedove-l10n-pl" } ,
{"pl_PL.UTF-8" , "iceweasel-l10n-pl" } } ;
+const QString PacstrapCppJob::PREINST_ERROR_MSG = "Error running pre-install script:\n%1" ;
+const QString PacstrapCppJob::POSTINST_ERROR_MSG = "Error running post-install script:\n%1" ;
/* PacstrapCppJob private class constants */
diff --git a/src/libcalamares/PacstrapCppJob.h b/src/libcalamares/PacstrapCppJob.h
index 828a5aa6f..61eb9edc8 100644
--- a/src/libcalamares/PacstrapCppJob.h
+++ b/src/libcalamares/PacstrapCppJob.h
@@ -47,8 +47,6 @@ public:
QString prettyStatusMessage() const override ;
Calamares::JobResult exec () override ;
- static const QString DESKTOP_PACKAGES_KEY ;
-
protected:
@@ -95,13 +93,13 @@ public:
static const QString BOOTLODER_PACKAGES_KEY ;
static const QString KERNEL_PACKAGES_KEY ;
static const QString UTILITIES_PACKAGES_KEY ;
- static const QString OPENRC_PACKAGES_KEY ;
- static const QString SYSTEMD_PACKAGES_KEY ;
static const QString APPLICATIONS_PACKAGES_KEY ;
static const QString MULTIMEDIA_PACKAGES_KEY ;
static const QString NETWORK_PACKAGES_KEY ;
static const QString LOOKANDFEEL_PACKAGES_KEY ;
static const QString XSERVER_PACKAGES_KEY ;
+ static const QString OPENRC_PACKAGES_KEY ;
+ static const QString SYSTEMD_PACKAGES_KEY ;
static const QString LXDE_PACKAGES_KEY ;
static const QString MATE_PACKAGES_KEY ;
@@ -116,6 +114,8 @@ protected:
static const qreal BASE_JOB_WEIGHT ;
static const qreal GUI_JOB_WEIGHT ;
static const QSTRINGMAP LANGUAGE_PACKS ;
+ static const QString PREINST_ERROR_MSG ;
+ static const QString POSTINST_ERROR_MSG ;
private:
diff --git a/src/modules/netinstall/NetInstallPage.cpp b/src/modules/netinstall/NetInstallPage.cpp
index 04dad5dea..c0cc23e3b 100644
--- a/src/modules/netinstall/NetInstallPage.cpp
+++ b/src/modules/netinstall/NetInstallPage.cpp
@@ -70,6 +70,7 @@ NetInstallPage::NetInstallPage( QWidget* parent )
ui->netinstallCheckbox->setText( tr( NETINSTALL_CHECK_TEXT ) );
ui->netinstallCheckbox->setChecked( false ); // deferred to onActivate();
ui->netinstallCheckbox->setEnabled( false ); // deferred to onActivate();
+ ui->groupswidget->setHeaderHidden(true);
}
bool
diff --git a/src/modules/netinstall/NetInstallViewStep.cpp b/src/modules/netinstall/NetInstallViewStep.cpp
index 92ebba4d9..4d9bb9b95 100644
--- a/src/modules/netinstall/NetInstallViewStep.cpp
+++ b/src/modules/netinstall/NetInstallViewStep.cpp
@@ -24,6 +24,8 @@
#include "GlobalStorage.h"
#include "utils/Logger.h"
+#include <QVariantList>
+
#include "NetInstallPage.h"
CALAMARES_PLUGIN_FACTORY_DEFINITION( NetInstallViewStepFactory, registerPlugin<NetInstallViewStep>(); )
@@ -196,6 +198,55 @@ NetInstallViewStep::setConfigurationMap( const QVariantMap& configurationMap )
if ( configurationMap.contains( "groupsUrl" ) &&
configurationMap.value( "groupsUrl" ).type() == QVariant::String )
{
+cDebug() << "NetInstallViewStep::setConfigurationMap() groupsUrl=" << configurationMap.value( "groupsUrl" ).toString();
+
+ // load package groups from netinstall.conf localStorage
+ if ( configurationMap.contains( GS::PACKAGE_GROUPS_KEY ) &&
+ configurationMap.value( GS::PACKAGE_GROUPS_KEY ).type() == QVariant::List &&
+ configurationMap.value( "groupsUrl" ).toString() == PACKAGE_GROUPS_FILE )
+ {
+ // convert local storage packages lists to YAML
+ QVariantList package_groups = configurationMap.value( GS::PACKAGE_GROUPS_KEY ).toList();
+ YAML::Emitter package_groups_yaml;
+ package_groups_yaml.SetOutputCharset(YAML::EscapeNonAscii);
+ package_groups_yaml << YAML::BeginSeq;
+ for ( int groups_n = 0; groups_n < package_groups.length(); ++groups_n )
+ {
+ QVariantMap package_group = package_groups.value(groups_n).toMap();
+ std::string group_name = package_group["name"].toString().toStdString();
+ std::string group_desc = package_group["description"].toString().toStdString();
+ std::string group_critical = package_group["critical"].toString().toStdString();
+ QStringList group_packages = package_group.value( "packages" ).toStringList();
+ std::vector< std::string > packages;
+ foreach ( const QString& package , group_packages )
+ packages.push_back( package.toStdString() );
+
+cDebug() << "NetInstallViewStep::setConfigurationMap() package_group[name]=" << QString::fromStdString(group_name);
+cDebug() << "NetInstallViewStep::setConfigurationMap() package_group[description]=" << QString::fromStdString(group_desc);
+cDebug() << "NetInstallViewStep::setConfigurationMap() package_group[critical]=" << QString::fromStdString(group_critical);
+cDebug() << "NetInstallViewStep::setConfigurationMap() package_group[packages]=" << group_packages;
+
+ package_groups_yaml << YAML::BeginMap;
+ package_groups_yaml << YAML::Key << "name" << YAML::Value << group_name;
+ package_groups_yaml << YAML::Key << "description" << YAML::Value << group_desc;
+ package_groups_yaml << YAML::Key << "critical" << YAML::Value << group_critical;
+ package_groups_yaml << YAML::Key << "packages" << YAML::Value << packages;
+ package_groups_yaml << YAML::EndMap;
+ }
+ package_groups_yaml << YAML::EndSeq;
+
+// DBG << "NetInstallViewStep::setConfigurationMap() err=" << QString(package_groups_yaml.GetLastError());
+
+ QFile package_groups_file( QString( PACKAGE_GROUPS_FILE ).remove(0, 7) );
+ if (package_groups_file.open( QIODevice::WriteOnly | QIODevice::Text ))
+ {
+ QTextStream out( &package_groups_file );
+ out << package_groups_yaml.c_str(); // TODO:
+ }
+ cDebug() << "wrote package groups from netinstall.conf to" << PACKAGE_GROUPS_FILE;
+ }
+ else cDebug() << "no package groups defined in netinstall.conf - trying 'groupsUrl'";
+
Calamares::JobQueue::instance()->globalStorage()->insert(
"groupsUrl", configurationMap.value( "groupsUrl" ).toString() );
m_widget->loadGroupList();
diff --git a/src/modules/netinstall/netinstall.conf b/src/modules/netinstall/netinstall.conf
index a640bb212..484c4b359 100644
--- a/src/modules/netinstall/netinstall.conf
+++ b/src/modules/netinstall/netinstall.conf
@@ -1,7 +1,9 @@
---
# This is the URL that is retrieved to get the netinstall groups-and-packages
# data (which should be in the format described in netinstall.yaml).
-# groupsUrl: http://chakraos.org/netinstall.php
+# groupsUrl: http://example.org/netinstall.php
+# or it can be a locally installed file (add netinstall.yaml to ./CMakeLists.txt)
+groupsUrl: file:///usr/share/calamares/netinstall.yaml
# If the installation can proceed without netinstall (e.g. the Live CD
# can create a working installed system, but netinstall is preferred
@@ -27,3 +29,30 @@ desktops:
mate:
de-icon: /usr/share/calamares/branding/parabola/parabolaicon.png
de-name: Mate Desktop Environment
+
+
+# Package groups can be defined here rather than in a separate YAML file
+# if 'groupsUrl' is set exactly to NetInstallViewStep::PACKAGE_GROUPS_FILE.
+package-groups:
+ - name: "Audio Production"
+ description: "Applications for Audio Production"
+ selected: false
+ packages:
+ - ardour
+ - pro-audio
+ - name: "Development"
+ description: "Applications for software development"
+ selected: false
+ packages:
+ - base-devel
+ - name: "Graphics"
+ description: "Applications to work with graphics"
+ selected: false
+ packages:
+ - gimp
+ - imagemagick
+ - name: "Video Production"
+ description: "Applications for Video Production"
+ selected: false
+ packages:
+ - kdenlive
diff --git a/src/modules/welcome/checker/RequirementsChecker.cpp b/src/modules/welcome/checker/RequirementsChecker.cpp
index 653ba1ae7..80133d048 100644
--- a/src/modules/welcome/checker/RequirementsChecker.cpp
+++ b/src/modules/welcome/checker/RequirementsChecker.cpp
@@ -297,13 +297,13 @@ RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap )
}
Calamares::GlobalStorage* globalStorage = Calamares::JobQueue::instance()->globalStorage();
- bool has_isorepo = QDir("/isorepo").exists("isorepo.db.tar.gz");
+ bool has_isorepo = QDir( "/isorepo" ).exists( "isorepo.db.tar.gz" );
globalStorage->insert( GS::HAS_ISOREPO_KEY, has_isorepo );
if ( has_isorepo )
- m_entriesToRequire.removeAll("internet") ;
+ m_entriesToRequire.removeAll( "internet" ) ;
else
- m_entriesToRequire.append("internet") ;
- m_entriesToCheck.append("internet") ;
+ m_entriesToRequire.append( "internet" ) ;
+ m_entriesToCheck.append( "internet" ) ;
m_entriesToCheck.removeDuplicates() ;
m_entriesToRequire.removeDuplicates() ;
}