[libcalamaresui] Read emergency setting from module.desc
- Read setting from the module descriptor - Document optional settings - Add EMERGENCY keyword to the CMake helper functions
This commit is contained in:
parent
2d7eea6d73
commit
def459a29d
@ -38,6 +38,7 @@
|
||||
# RESOURCES resource-file
|
||||
# [NO_INSTALL]
|
||||
# [SHARED_LIB]
|
||||
# [EMERGENCY]
|
||||
# )
|
||||
|
||||
include( CMakeParseArguments )
|
||||
@ -47,7 +48,7 @@ include( CMakeColors )
|
||||
function( calamares_add_plugin )
|
||||
# parse arguments ( name needs to be saved before passing ARGN into the macro )
|
||||
set( NAME ${ARGV0} )
|
||||
set( options NO_INSTALL SHARED_LIB )
|
||||
set( options NO_INSTALL SHARED_LIB EMERGENCY )
|
||||
set( oneValueArgs NAME TYPE EXPORT_MACRO RESOURCES )
|
||||
set( multiValueArgs SOURCES UI LINK_LIBRARIES LINK_PRIVATE_LIBRARIES COMPILE_DEFINITIONS )
|
||||
cmake_parse_arguments( PLUGIN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
|
||||
@ -132,6 +133,9 @@ function( calamares_add_plugin )
|
||||
set( _type ${PLUGIN_TYPE} )
|
||||
file( WRITE ${_file} "# AUTO-GENERATED metadata file\n# Syntax is YAML 1.2\n---\n" )
|
||||
file( APPEND ${_file} "type: \"${_type}\"\nname: \"${PLUGIN_NAME}\"\ninterface: \"qtplugin\"\nload: \"lib${target}.so\"\n" )
|
||||
if ( PLUGIN_EMERGENCY )
|
||||
file( APPEND ${_file} "emergency: true\n" )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${PLUGIN_DESC_FILE}
|
||||
|
@ -290,6 +290,12 @@ void
|
||||
Module::initFrom( const QVariantMap& moduleDescriptor )
|
||||
{
|
||||
m_name = moduleDescriptor.value( "name" ).toString();
|
||||
|
||||
auto em = QStringLiteral( "emergency" );
|
||||
if ( moduleDescriptor.contains( em ) )
|
||||
{
|
||||
m_emergency = moduleDescriptor[ em ].toBool();
|
||||
}
|
||||
}
|
||||
|
||||
} //ns
|
||||
|
@ -182,9 +182,11 @@ public:
|
||||
protected:
|
||||
explicit Module();
|
||||
virtual void initFrom( const QVariantMap& moduleDescriptor );
|
||||
bool m_loaded;
|
||||
QVariantMap m_configurationMap;
|
||||
|
||||
bool m_loaded = false;
|
||||
bool m_emergency = false;
|
||||
|
||||
private:
|
||||
void loadConfigurationFile( const QString& configFileName ); //throws YAML::Exception
|
||||
|
||||
@ -193,8 +195,6 @@ private:
|
||||
QString m_directory;
|
||||
QString m_instanceId;
|
||||
|
||||
bool m_emergency;
|
||||
|
||||
friend void ::operator>>( const QVariantMap& moduleDescriptor,
|
||||
Calamares::Module* m );
|
||||
};
|
||||
|
@ -43,15 +43,21 @@ module's name, type, interface and possibly other properties. The name
|
||||
of the module as defined in `module.desc` must be the same as the name
|
||||
of the module's directory.
|
||||
|
||||
Module descriptors must have the following keys:
|
||||
Module descriptors **must** have the following keys:
|
||||
- *name* (an identifier; must be the same as the directory name)
|
||||
- *type* ("job" or "view")
|
||||
- *interface* (see below for the different interfaces; generally we
|
||||
refer to the kinds of modules by their interface)
|
||||
|
||||
Module descriptors **may** have the following keys:
|
||||
- *required* **unimplemented** (a list of modules which are required for this module
|
||||
to operate properly)
|
||||
- *emergency* (a boolean value, set to true to mark the module
|
||||
as an emergency module)
|
||||
|
||||
## Module-specific configuration
|
||||
|
||||
A Calamares module *may* read a module configuration file,
|
||||
A Calamares module **may** read a module configuration file,
|
||||
named `<modulename>.conf`. If such a file is present in the
|
||||
module's directory, it is shipped as a *default* configuration file.
|
||||
The module configuration file, if it exists, is a YAML 1.2 document
|
||||
@ -125,3 +131,17 @@ while the module type must be "job" or "jobmodule".
|
||||
The key *command* should have a string as value, which is passed to the
|
||||
shell -- remember to quote it properly.
|
||||
|
||||
## Emergency Modules
|
||||
|
||||
Only C++ modules and job modules may be emergency modules. If, during an
|
||||
*exec* step in the sequence, a module fails, installation as a whole fails
|
||||
and the install is aborted. If there are emergency modules in the **same**
|
||||
exec block, those will be executed before the installation is aborted.
|
||||
Non-emergency modules are not executed.
|
||||
|
||||
If an emergency-module fails while processing emergency-modules for
|
||||
another failed module, that failure is ignored and emergency-module
|
||||
processing continues.
|
||||
|
||||
Use the EMERGENCY keyword in the CMake description of a C++ module
|
||||
to generate a suitable `module.desc`.
|
||||
|
Loading…
Reference in New Issue
Block a user