calamares/src/modules
Adriaan de Groot 32a1c84935 [locale] Document the settings in locale.conf
- The geoipUrl is weird, because it is not a complete URL.
   Document that, and what kind of data is expected.

FIXES #920
2018-03-29 16:50:02 -04:00
..
bootloader [bootloader] use generic file names instead of grub 2017-10-23 12:53:34 -04:00
displaymanager [modules] displaymanager: try to fix regression introduced with c8fd11b 2017-09-21 13:08:13 -04:00
dracut Fixed pep8 whining in module dracut 2017-03-21 12:33:26 +01:00
dracutlukscfg Licensing: add self 2017-09-19 15:57:25 +02:00
dummycpp Licensing: add self 2017-09-19 15:57:25 +02:00
dummyprocess Add option to run process jobmodules in chroot. 2014-08-12 14:26:10 +02:00
dummypython Python-i18n: implement gettext functions in libcalamares.utils 2017-08-16 10:53:11 +02:00
dummypythonqt [dummypythonqt] Automatic merge of Transifex translations 2017-09-07 05:45:03 -04:00
finished finished: fix configuration file syntax 2017-10-12 07:05:28 -07:00
fstab Simplify dict() construction for fstab-lines 2017-09-13 06:13:28 -04:00
grubcfg Swap + LUKS configuration. 2017-09-07 03:43:42 -04:00
hwclock [hwclock] Be more lenient. 2017-12-13 06:27:04 -05:00
initcpio Use target_env calls in Python modules. 2015-09-15 16:48:41 +02:00
initcpiocfg PEP8 whining 2017-08-31 04:51:34 -04:00
initramfs Remove whitespace 2017-08-06 12:20:26 -04:00
initramfscfg Missing import; thanks to crazy on IRC 2017-10-04 05:32:23 -04:00
interactiveterminal CMake: look for ECM at top-level, add to search path if found. 2017-12-03 12:48:23 -05:00
keyboard Licensing: add self 2017-09-19 15:57:25 +02:00
license Clang: reduce warnings about overriden destructors 2017-09-20 09:11:18 -04:00
locale [locale] Document the settings in locale.conf 2018-03-29 16:50:02 -04:00
localecfg Fix localecfg to work with new locale module. 2016-08-10 12:11:48 +02:00
luksbootkeyfile Python-style: actually add the new copyright headers 2017-06-04 15:01:25 +02:00
luksopenswaphookcfg Fixed pep8 whininig in module luksopenswaphookcfg 2017-06-02 22:16:25 +02:00
machineid Python-i18n: adjust for changed API 2017-08-18 14:19:50 -04:00
mount Fix unknown partition-type Fat32 at mount and in fstab 2017-07-03 17:20:02 +02:00
netinstall [netinstall] Special-case the root node. 2017-11-24 07:52:52 -05:00
networkcfg Fixed pep8 whining in module networkcfg 2017-06-04 13:31:08 +02:00
packages [packages] Fix previous. 2017-12-02 06:14:17 -05:00
partition CMake: look for ECM at top-level, add to search path if found. 2017-12-03 12:48:23 -05:00
plasmalnf [plasmalnf] Simplify showAll handling 2018-03-29 10:09:45 -04:00
plymouthcfg Fixed pep8 whining in module plymouthcfg 2017-03-21 12:44:05 +01:00
removeuser RemoveUser: fix bad PEP8-ing 2017-07-12 07:07:53 -04:00
services Fixed pep8 whining in module services 2017-06-06 18:26:29 +02:00
summary Clang: reduce warnings about overriden destructors 2017-09-20 09:11:18 -04:00
umount Configs: fix trivial spelling error 2017-06-02 15:43:07 +02:00
unpackfs Update unpackfs.conf examples and documentation 2017-08-23 06:57:11 -04:00
users CMake: look for ECM at top-level, add to search path if found. 2017-12-03 12:48:23 -05:00
webview Licensing: add self 2017-09-19 15:57:25 +02:00
welcome [welcome] Improve error reporting from requirements checker 2017-12-04 10:47:26 -05:00
CMakeLists.txt CMake: explain which modules are skipped 2017-12-24 16:14:58 -05: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 Testing: add test to check the shipped config-files for correctness. 2017-10-12 12:55:07 -03:00
testmodule.py Testing: set more locale-globals in testing-script. 2017-08-29 05:51:29 -04: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.