1. Overview
The LinuxDistro module provides Linux distribution identification for BastionGuard Backup. It loads distribution metadata from os-release or lsb-release files and exposes normalized identifiers, descriptions, release values, and display names.
The implementation is written in Vala and uses GLib/GIO together with the application utility namespaces required by the file.
2. Dependencies and Integration
The module imports:
TeeJee.LoggingTeeJee.FileSystemTeeJee.ProcessHelper
Key runtime integrations include:
- GIO/GLib streams – filesystem and process I/O
3. Declared Types
3.1 LinuxDistro
public class LinuxDistro : GLib.Object
This class encapsulates the state and operations described by this source file.
4. State, Properties, Constants, and Signals
Public and protected state
public string dist_id– Runtime state used by the module.public string description– Runtime state used by the module.public string release– Runtime state used by the module.public string codename– Runtime state used by the module.public string dist_type– Runtime state used by the module.
5. Public API and Operational Methods
5.1 LinuxDistro()
public LinuxDistro()
Initializes the object state, allocates required collections or widgets, and applies constructor parameters.
5.2 full_name()
public string full_name()
Implements the full name operation for this module.
5.3 get_dist_info()
public static LinuxDistro get_dist_info(string root_path)
Detects distribution metadata below the supplied root path by reading os-release and lsb-release data with fallbacks.
6. Internal Helpers
6.1 read_info_file()
private static LinuxDistro? read_info_file(string file_path)
Reads and parses info file into the module data model.
7. Filesystem Paths and Resource Locations
The source references the following absolute or template paths:
/etc/lsb-release
/etc/os-release
Some values are templates completed at runtime with application names, process IDs, device identifiers, or file names.
8. Operational Flow
- Read or discover source data and normalize it into the module data model.
9. Error Handling and Diagnostics
- GLib and filesystem exceptions are caught locally in the operations that can fail.
- Boolean, nullable, or empty-string return values communicate recoverable failures to callers.
10. Runtime and Security Considerations
- Linux-specific paths: the module depends on Linux virtual filesystems or privileged system directories.
- Shared state: static caches and global switches are shared by all callers and are not automatically thread-isolated.
11. Licensing
The source is distributed under the GNU General Public License version 2 or any later version.
The source header identifies:
Copyright 2012-2018 Tony George <teejeetech@gmail.com>
