diff --git a/CHANGES b/CHANGES index 5092fd6cb..a96284bb2 100644 --- a/CHANGES +++ b/CHANGES @@ -20,6 +20,8 @@ This release contains contributions from (alphabetically by first name): a particular kind of partition table. (thanks Gaƫl) - The *partition* module is a little more resilient to variations in btrfs notation from os-prober. + - The *shellprocess* module now supports having a different progress + message (other than "Shell Processes Job") through the config file. # 3.2.31 (2020-10-06) # diff --git a/src/libcalamares/JobQueue.cpp b/src/libcalamares/JobQueue.cpp index 526cd70bf..1637f0719 100644 --- a/src/libcalamares/JobQueue.cpp +++ b/src/libcalamares/JobQueue.cpp @@ -177,6 +177,18 @@ private: const auto& jobitem = m_runningJobs->at( m_jobIndex ); progress = ( jobitem.cumulative + jobitem.weight * percentage ) / m_overallQueueWeight; message = jobitem.job->prettyStatusMessage(); + // In progress reports at the start of a job (e.g. when the queue + // starts the job, or if the job itself reports 0.0) be more + // accepting in what gets reported: jobs with no status fall + // back to description and name, whichever is non-empty. + if ( percentage == 0.0 && message.isEmpty() ) + { + message = jobitem.job->prettyDescription(); + if ( message.isEmpty() ) + { + message = jobitem.job->prettyName(); + } + } } else { diff --git a/src/libcalamares/utils/CalamaresUtilsSystem.cpp b/src/libcalamares/utils/CalamaresUtilsSystem.cpp index 8be7a16f9..dad6e5b12 100644 --- a/src/libcalamares/utils/CalamaresUtilsSystem.cpp +++ b/src/libcalamares/utils/CalamaresUtilsSystem.cpp @@ -127,7 +127,7 @@ System::runCommand( System::RunLocation location, if ( ( location == System::RunLocation::RunInTarget ) && ( !gs || !gs->contains( "rootMountPoint" ) ) ) { - cWarning() << "No rootMountPoint in global storage"; + cWarning() << "No rootMountPoint in global storage, while RunInTarget is specified"; return ProcessResult::Code::NoWorkingDirectory; } diff --git a/src/libcalamaresui/viewpages/ExecutionViewStep.cpp b/src/libcalamaresui/viewpages/ExecutionViewStep.cpp index fe90e1ec3..e3498c62d 100644 --- a/src/libcalamaresui/viewpages/ExecutionViewStep.cpp +++ b/src/libcalamaresui/viewpages/ExecutionViewStep.cpp @@ -191,7 +191,10 @@ void ExecutionViewStep::updateFromJobQueue( qreal percent, const QString& message ) { m_progressBar->setValue( int( percent * m_progressBar->maximum() ) ); - m_label->setText( message ); + if ( !message.isEmpty() ) + { + m_label->setText( message ); + } } void diff --git a/src/modules/shellprocess/ShellProcessJob.cpp b/src/modules/shellprocess/ShellProcessJob.cpp index ab00a0bdd..6e3db62aa 100644 --- a/src/modules/shellprocess/ShellProcessJob.cpp +++ b/src/modules/shellprocess/ShellProcessJob.cpp @@ -34,6 +34,10 @@ ShellProcessJob::~ShellProcessJob() {} QString ShellProcessJob::prettyName() const { + if ( m_name ) + { + return m_name->get(); + } return tr( "Shell Processes Job" ); } @@ -75,6 +79,16 @@ ShellProcessJob::setConfigurationMap( const QVariantMap& configurationMap ) { cWarning() << "No script given for ShellProcessJob" << moduleInstanceKey(); } + + bool labels_ok = false; + auto labels = CalamaresUtils::getSubMap( configurationMap, "i18n", labels_ok ); + if ( labels_ok ) + { + if ( labels.contains( "name" ) ) + { + m_name = std::make_unique< CalamaresUtils::Locale::TranslatedString >( labels, "name" ); + } + } } CALAMARES_PLUGIN_FACTORY_DEFINITION( ShellProcessJobFactory, registerPlugin< ShellProcessJob >(); ) diff --git a/src/modules/shellprocess/ShellProcessJob.h b/src/modules/shellprocess/ShellProcessJob.h index 468aded59..a931d1e1a 100644 --- a/src/modules/shellprocess/ShellProcessJob.h +++ b/src/modules/shellprocess/ShellProcessJob.h @@ -13,6 +13,7 @@ #include "CppJob.h" #include "DllMacro.h" +#include "locale/TranslatableConfiguration.h" #include "utils/CommandList.h" #include "utils/PluginFactory.h" @@ -37,6 +38,7 @@ public: private: std::unique_ptr< CalamaresUtils::CommandList > m_commands; + std::unique_ptr< CalamaresUtils::Locale::TranslatedString > m_name; }; CALAMARES_PLUGIN_FACTORY_DECLARATION( ShellProcessJobFactory ) diff --git a/src/modules/shellprocess/shellprocess.conf b/src/modules/shellprocess/shellprocess.conf index 00d88851f..5d8a12d26 100644 --- a/src/modules/shellprocess/shellprocess.conf +++ b/src/modules/shellprocess/shellprocess.conf @@ -24,16 +24,56 @@ # # The value of *script* may be: # - a single string; this is one command that is executed. -# - a list of strings; these are executed one at a time, by +# - a single object (this is not useful). +# - a list of items; these are executed one at a time, by # separate shells (/bin/sh -c is invoked for each command). -# - an object, specifying a key *command* and (optionally) -# a key *timeout* to set the timeout for this specific -# command differently from the global setting. +# Each list item may be: +# - a single string; this is one command that is executed. +# - a single object, specifying a key *command* and (optionally) +# a key *timeout* to set the timeout for this specific +# command differently from the global setting. +# +# Using a single object is not useful because the same effect can +# be obtained with a single string and a global timeout, but when +# there are multiple commands to execute, one of them might have +# a different timeout than the others. +# +# To change the description of the job, set the *name* entries in *i18n*. --- dontChroot: false timeout: 10 + +# Script may be a single string (because false returns an error exit +# code, this will trigger a failure in the installation): +# +# script: "/usr/bin/false" + +# Script may be a list of strings (because false returns an error exit +# code, **but** the command starts with a "-", the error exit is +# ignored and installation continues): +# +# script: +# - "-/usr/bin/false" +# - "/bin/ls" +# - "/usr/bin/true" + +# Script may be a lit of items (if the touch command fails, it is +# ignored; the slowloris command has a different timeout from the +# other commands in the list): script: - "-touch @@ROOT@@/tmp/thingy" - - "/usr/bin/false" + - "/usr/bin/true" - command: "/usr/local/bin/slowloris" timeout: 3600 + +# You can change the description of the job (as it is displayed in the +# progress bar during installation) by defining an *i18n* key, which +# has a *name* field and optionally, translations as *name[lang]*. +# +# Without a translation here, the default name from the source code +# is used, "Shell Processes Job". +# +# i18n: +# name: "Shell process" +# name[nl]: "Schelpenpad" +# name[en_GB]: "Just a moment"