rootfs module (need better spec) #10
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Module Overview
The rootfs module provides comprehensive root filesystem building capabilities for , supporting multiple Linux distributions and customizing them for cloud deployments. This module handles the complex process of creating bootable root filesystems from scratch, including package management, service configuration, and cloud-init integration for first-boot customization.
The module is designed to create minimal, secure, and cloud-optimized root filesystems that can be deployed across various cloud providers and virtualization platforms. It integrates with cloud-init to enable dynamic configuration at boot time, allowing instances to customize themselves based on user data, metadata, and other cloud-specific information.
Functionality
Module API
RootFS Building
RootFSBuilder::new(distro: LinuxDistro) -> Self- Create a new root filesystem builder for the specified distributioncreate_base_rootfs(distro: LinuxDistro, arch: Architecture) -> Result<RootFSBuilder, RootFSError>- Initialize a base root filesystembootstrap_packages(&mut self, packages: Vec<&str>) -> Result<(), RootFSError>- Bootstrap essential packages for the distributioninstall_package(&mut self, package: &str) -> &mut Self- Install a specific package in the root filesystemadd_file(&mut self, path: &Path, content: &[u8]) -> &mut Self- Add a file with specified content to the filesystemset_hostname(&mut self, hostname: &str) -> &mut Self- Set the system hostname for the root filesystemconfigure_systemd(&mut self, services: Vec<SystemdService>) -> &mut Self- Configure systemd services and unitssetup_networking(&mut self, config: NetworkConfig) -> &mut Self- Configure network interfaces and settingsinstall_cloud_init(&mut self, version: &str) -> Result<(), RootFSError>- Install cloud-init package and dependenciesbuild(&self, format: FileSystemFormat) -> Result<PathBuf, RootFSError>- Build the final root filesystem imageCloud-Init Config
CloudInitBuilder::new() -> Self- Create a new cloud-init configuration builderset_ssh_keys(&mut self, keys: Vec<String>) -> &mut Self- Configure SSH keys for user accessconfigure_user(&mut self, user: UserConfig) -> &mut Self- Set up user accounts and permissionsadd_script(&mut self, script: CloudInitScript) -> &mut Self- Add initialization scripts to run at bootset_network_config(&mut self, config: NetworkConfig) -> &mut Self- Configure network settings for cloud-initbuild(&self) -> Result<CloudInitConfig, CloudInitError>- Build the cloud-init configurationwrite_user_data(&self, path: &Path) -> Result<(), CloudInitError>- Write user-data configuration to filewrite_meta_data(&self, path: &Path) -> Result<(), CloudInitError>- Write meta-data configuration to filegenerate_iso(&self, path: &Path) -> Result<(), CloudInitError>- Generate cloud-init ISO image for attachmentremarks
rootfs moduleto rootfs module (need better spec)