calamares/src/modules
2018-05-22 11:37:24 -04:00
..
bootloader [bootloader] print() does not log 2018-01-30 11:26:29 +01:00
contextualprocess [contextualprocess] Warnings-- by dropping destructor 2018-03-06 16:24:12 +01:00
displaymanager Documentation: change http links to GitHub to https 2017-12-20 08:39:09 -05:00
dracut Documentation: change http links to GitHub to https 2017-12-20 08:39:09 -05:00
dracutlukscfg Documentation: change http links to GitHub to https 2017-12-20 08:39:09 -05:00
dummycpp [dummycpp] more verbose debug log 2018-01-24 16:19:22 +01:00
dummyprocess Add option to run process jobmodules in chroot. 2014-08-12 14:26:10 +02:00
dummypython Documentation: change http links to GitHub to https 2017-12-20 08:39:09 -05:00
dummypythonqt i18n: [dummypythonqt] Automatic merge of Transifex translations 2018-05-22 11:37:24 -04:00
finished [finished] Remove useless debugging 2018-02-19 16:55:34 -05:00
fstab Documentation: change http links to GitHub to https 2017-12-20 08:39:09 -05:00
grubcfg Documentation: change http links to GitHub to https 2017-12-20 08:39:09 -05:00
hwclock Documentation: change http links to GitHub to https 2017-12-20 08:39:09 -05:00
initcpio Documentation: change http links to GitHub to https 2017-12-20 08:39:09 -05:00
initcpiocfg Merge branch 'kpmcore-3.2' 2018-01-02 13:25:11 +01:00
initramfs Documentation: change http links to GitHub to https 2017-12-20 08:39:09 -05:00
initramfscfg Documentation: change http links to GitHub to https 2017-12-20 08:39:09 -05:00
interactiveterminal [interactiveterminal] Document config 2018-02-07 12:03:13 +01:00
keyboard [keyboard] Warnings-- for nullptr 2018-03-06 16:23:44 +01:00
license [license] Warnings-- by making the one default case explicit 2018-03-06 16:23:29 +01:00
locale [locale] Check all XML TimeZone elements if needed 2018-05-07 05:18:35 -04:00
localecfg the first character must be a comment 2018-03-03 14:30:08 +01:00
luksbootkeyfile Documentation: change http links to GitHub to https 2017-12-20 08:39:09 -05:00
luksopenswaphookcfg Documentation: change http links to GitHub to https 2017-12-20 08:39:09 -05:00
machineid Documentation: change http links to GitHub to https 2017-12-20 08:39:09 -05:00
mount Documentation: change http links to GitHub to https 2017-12-20 08:39:09 -05:00
netinstall Merge pull request #958 from bill-auger/patch-2 2018-05-22 12:08:01 +02:00
networkcfg Documentation: change http links to GitHub to https 2017-12-20 08:39:09 -05:00
openrcdmcryptcfg Documentation: change http links to GitHub to https 2017-12-20 08:39:09 -05:00
packages Merge branch '3.1.x-stable' 2018-04-04 11:10:34 -04:00
partition [partition] Check for available partition type before creating 2018-05-16 10:56:06 -04:00
plasmalnf [plasmalnf] Continue fighting with layout 2018-04-13 08:44:02 -04:00
plymouthcfg Documentation: change http links to GitHub to https 2017-12-20 08:39:09 -05:00
removeuser Documentation: change http links to GitHub to https 2017-12-20 08:39:09 -05:00
services Documentation: change http links to GitHub to https 2017-12-20 08:39:09 -05:00
shellprocess [shellprocess] ECM has already been searched-for 2018-02-19 07:03:43 -05:00
summary Documentation: change http links to GitHub to https 2017-12-20 08:39:09 -05:00
tracking [tracking] Reduce compile warnings 2018-03-06 16:11:50 +01:00
umount [umount] Make a pretty_name() 2018-02-20 04:49:51 -05:00
unpackfs finally !must! never fail unhandled 2017-12-26 22:25:40 +01:00
users Update CreateUserJob.cpp 2018-05-17 12:52:09 +02:00
webview Documentation: change http links to GitHub to https 2017-12-20 08:39:09 -05:00
welcome [welcome] Fix display of unsupported locales 2018-05-14 06:28:57 -04:00
CMakeLists.txt CMake: build modules alphabetically 2018-01-24 14:13:13 +01:00
globalStorage.yaml Consistency: calamares_main ==> run; global_storage => globalStorage 2014-07-25 16:46:12 +02:00
README.md Modules: minor cleanup + docs 2017-08-09 05:45:09 +09:00
test_conf.cpp Documentation: change http links to GitHub to https 2017-12-20 08:39:09 -05:00
testmodule.py Documentation: change http links to GitHub to https 2017-12-20 08:39:09 -05:00

Calamares modules

Calamares modules are plugins that provide features like installer pages, batch jobs, etc. An installer page (visible to the user) is called a "view", while other modules are "jobs".

Each Calamares module lives in its own directory.

All modules are installed in $DESTDIR/lib/calamares/modules.

Module types

There are two types of Calamares module:

  • viewmodule, for user-visible modules. These may be in C++, or PythonQt.
  • jobmodule, for not-user-visible modules. These may be done in C++, Python, or as external processes.

Module interfaces

There are three (four) interfaces for Calamares modules:

  • qtplugin,
  • python (jobmodules only),
  • pythonqt (optional),
  • process (jobmodules only).

Module directory

Each Calamares module lives in its own directory. The contents of the directory depend on the interface and type of the module.

Module descriptor

A Calamares module must have a module descriptor file, named module.desc. For C++ (qtplugin) modules using CMake as a build- system and using the calamares_add_plugin() function -- this is the recommended way to create such modules -- the module descriptor file is optional, since it can be generated by the build system. For other module interfaces, the module descriptor file is required.

The module descriptor file must be placed in the module's directory. The module descriptor file is a YAML 1.2 document which defines the 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:

  • 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-specific configuration

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 which contains a YAML map of anything.

All default module configuration files are installed in $DESTDIR/share/calamares/modules but can be overridden by files with the same name placed manually (or by the packager) in /etc/calamares/modules.

C++ modules

Currently the recommended way to write a module which exposes one or more installer pages (viewmodule) is through a C++ and Qt plugin. Viewmodules must implement Calamares::ViewStep. They can also implement Calamares::Job to provide jobs.

To add a Qt plugin module, put it in a subdirectory and make sure it has a CMakeLists.txt with a calamares_add_plugin call. It will be picked up automatically by our CMake magic. The module.desc file is optional.

Python modules

Modules may use one of the python interfaces, which may be present in a Calamares installation (but also may not be). These modules must have a module.desc file. The Python script must implement one or more of the Python interfaces for Calamares -- either the python jobmodule interface, or the experimental pythonqt job- and viewmodule interfaces.

To add a Python or process jobmodule, put it in a subdirectory and make sure it has a module.desc. It will be picked up automatically by our CMake magic. For all kinds of Python jobs, the key script must be set to the name of the main python file for the job. This is almost universally "main.py".

CMakeLists.txt is not used for Python and process jobmodules.

Calamares offers a Python API for module developers, the core Calamares functionality is exposed as libcalamares.job for job data, libcalamares.globalstorage for shared data and libcalamares.utils for generic utility functions. Documentation is inline.

All code in Python job modules must obey PEP8, the only exception are libcalamares.globalstorage keys, which should always be camelCaseWithLowerCaseInitial to match the C++ identifier convention.

For testing and debugging we provide the testmodule.py script which fakes a limited Calamares Python environment for running a single jobmodule.

Python Jobmodule

A Python jobmodule is a Python program which imports libcalamares and has a function run() as entry point. The function run() must return None if everything went well, or a tuple (str,str) with an error message and description if something went wrong.

PythonQt Jobmodule

A PythonQt jobmodule implements the experimental Job interface by defining a subclass of something.

PythonQt Viewmodule

A PythonQt viewmodule implements the experimental View interface by defining a subclass of something.

Process jobmodules

A process jobmodule runs a (single) command. The interface is "process", 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.