Merge branch 'issue-1528' into calamares

- don't blank out the text in the progress bar if the job provides no
  message -- just leave the last message shown. FIXES #1527
  (There's no point in having more than one copy of those initcpio*
  modules, so just use the prettyName()).
- when a job starts, look for status, then description, then name so
  that **something** is shown as text in the progress bar.
- give *shellprocess* the possibility to change its own labels
  through translations in the config file. #FIXES #1528
main
Adriaan de Groot 4 years ago
commit 5895f3fb71

@ -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) #

@ -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
{

@ -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;
}

@ -191,7 +191,10 @@ void
ExecutionViewStep::updateFromJobQueue( qreal percent, const QString& message )
{
m_progressBar->setValue( int( percent * m_progressBar->maximum() ) );
if ( !message.isEmpty() )
{
m_label->setText( message );
}
}
void

@ -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 >(); )

@ -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 )

@ -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)
# 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"

Loading…
Cancel
Save