Module Function Reference
Reference guide for functions available in Lunar module scripts
This page provides a comprehensive reference for functions available when writing Lunar Linux modules.
Status: This documentation is currently under development. Content is being migrated and expanded.
Overview
Lunar modules can use a variety of built-in functions provided by the Lunar package management system. These functions handle common tasks like downloading sources, applying patches, installing files, and managing dependencies.
Common Module Functions
Source Management
Functions for handling source code downloads and extraction:
download_source- Download source tarballsunpack_source- Extract downloaded archivesverify_source- Verify checksums and signatures
Build Functions
Functions used during the build process:
default_build- Standard configure/make/make install sequencedefault_config- Run ./configure with common optionsdefault_make- Run make with appropriate flagsdefault_install- Run make install
File Management
Functions for file and directory operations:
install_file- Install files to specific locationsinstall_dir- Create directory structuresmake_link- Create symbolic linkssafe_remove- Safely remove files
Dependency Management
Functions for handling module dependencies:
depends- Declare required dependenciesoptional_depends- Declare optional dependenciesconflicts- Specify conflicting modules
Configuration
Functions for module configuration:
query- Ask user questions during installationset_option- Set module-specific optionsget_option- Retrieve module options
Module Script Structure
A typical Lunar module consists of several scripts:
DETAILS- Module metadata (name, version, sources)DEPENDS- Dependency declarationsCONFIGURE- Configuration questionsBUILD- Build instructionsPRE_BUILD- Pre-build setupPOST_INSTALL- Post-installation tasks
Writing Custom Functions
Modules can define custom functions for complex build processes. These functions have access to the full Lunar function library.
Further Documentation
For detailed information on writing modules, see:
Contributing
This reference is incomplete. Contributions are welcome! If you have experience with Lunar module development, please help expand this documentation.
Source Code
The actual function implementations can be found in the Lunar source code:
/var/lib/lunar/functions- Core functions/var/lib/lunar/plugins- Plugin functions
You can examine these files directly for the most up-to-date function definitions and usage examples.