particle-os-tools/src/bootupd
2025-07-14 01:09:07 -07:00
..
scriptlets Initial commit: Particle-OS tools repository 2025-07-11 21:14:33 -07:00
test-scripts Big updates 2025-07-14 01:09:07 -07:00
CHANGELOG.md Initial commit: Particle-OS tools repository 2025-07-11 21:14:33 -07:00
compile.sh Initial commit: Particle-OS tools repository 2025-07-11 21:14:33 -07:00
README.md Initial commit: Particle-OS tools repository 2025-07-11 21:14:33 -07:00

Ubuntu uBlue bootupd-alternative Tool - Modular Structure

This directory contains the modular source code for the Ubuntu uBlue bootupd-alternative Tool, organized into logical scriptlets that are compiled into a single unified script.

📁 Directory Structure

src/bootupd/
├── compile.sh              # Compilation script (merges all scriptlets)
├── config/                 # Configuration files (JSON)
│   ├── bootupd-settings.json     # Main configuration
│   └── bootloader-config.json    # Bootloader-specific settings
├── scriptlets/             # Individual scriptlet files
│   ├── 00-header.sh        # Configuration, shared functions, initialization
│   ├── 01-dependencies.sh  # Dependency checking and validation
│   ├── 02-bootloader.sh    # Bootloader-specific operations
│   ├── 03-backup.sh        # Backup and restore functionality
│   ├── 04-entries.sh       # Boot entry management
│   ├── 05-devices.sh       # Device validation and information
│   ├── 06-status.sh        # Status and information display
│   └── 99-main.sh          # Main dispatch and help
├── README.md               # This file
└── CHANGELOG.md            # Version history and changes

🚀 Usage

Compiling the Unified Script

# Navigate to the bootupd directory
cd src/bootupd

# Run the compilation script
bash compile.sh

This will generate bootupd-alternative.sh in the project root directory.

Development Workflow

  1. Edit Individual Scriptlets: Modify the specific scriptlet files in scriptlets/
  2. Test Changes: Make your changes and test individual components
  3. Compile: Run bash compile.sh to merge all scriptlets
  4. Deploy: The unified bootupd-alternative.sh is ready for distribution

📋 Scriptlet Descriptions

Core Scriptlets (Implemented)

  • 00-header.sh: Shared utility functions, global cleanup, and system detection helpers
  • 01-dependencies.sh: Package dependency validation and bootloader detection
  • 02-bootloader.sh: Bootloader-specific operations (GRUB, UEFI, LILO, syslinux)
  • 03-backup.sh: Backup and restore functionality
  • 04-entries.sh: Boot entry management
  • 05-devices.sh: Device validation and information
  • 06-status.sh: Status and monitoring
  • 99-main.sh: Main command dispatch and help system

🔧 Benefits of This Structure

Modular Development

  • Each component can be developed and tested independently
  • Easy to locate and modify specific functionality
  • Clear separation of concerns

Unified Deployment

  • Single bootupd-alternative.sh file for end users
  • No complex dependency management
  • Professional distribution format

Maintainable Code

  • Logical organization by functionality
  • Easy to add new features
  • Clear documentation per component

Version Control Friendly

  • Small, focused files are easier to review
  • Clear commit history per feature
  • Reduced merge conflicts

🏗️ Architecture Overview

Core Components

  1. Multi-Bootloader Support: GRUB, UEFI, LILO, syslinux detection and management
  2. Backup and Restore: Comprehensive backup/restore functionality
  3. Device Validation: Robust device checking and information
  4. Error Handling: Comprehensive error handling and recovery

Bootloader Support

  1. GRUB: Traditional GRUB bootloader management
  2. UEFI: UEFI firmware and boot entry management
  3. LILO: Legacy LILO bootloader support
  4. syslinux: syslinux bootloader support

Integration Points

  • Ubuntu uBlue Config: Integrates with unified configuration system
  • ComposeFS Backend: Uses the modular composefs-alternative.sh
  • Bootloader Integration: Automatic boot entry management
  • Device Management: Comprehensive device validation and information

🚀 Quick Start

Basic Bootloader Management

# Install bootloader to device
sudo ./bootupd-alternative.sh install /dev/sda

# Update bootloader configuration
sudo ./bootupd-alternative.sh update

# Show bootloader status
sudo ./bootupd-alternative.sh status

Advanced Features (Planned)

# Create backup
sudo ./bootupd-alternative.sh backup before-update

# Restore backup
sudo ./bootupd-alternative.sh restore before-update

# Add custom boot entry
sudo ./bootupd-alternative.sh add-entry "Ubuntu Recovery" /boot/vmlinuz-5.15.0-rc1

# Set default boot entry
sudo ./bootupd-alternative.sh set-default "Ubuntu uBlue"

🔧 Configuration

The bootupd tool integrates with the Ubuntu uBlue configuration system:

# Configuration is automatically loaded from:
# /usr/local/etc/ublue-config.sh

# Key configuration variables:
BOOTUPD_DIR="/var/lib/ubuntu-ublue/bootupd"
BOOTLOADER_INTEGRATION_SCRIPT="/usr/local/bin/bootloader-integration.sh"
COMPOSEFS_SCRIPT="/usr/local/bin/composefs-alternative.sh"

🛠️ Development Guidelines

Adding New Scriptlets

  1. Create the scriptlet file in scriptlets/ with appropriate naming
  2. Add to compile.sh in the correct order
  3. Update this README with the new scriptlet description
  4. Test thoroughly before committing

Scriptlet Naming Convention

  • 00-header.sh: Core configuration and shared functions
  • 01-XX.sh: Dependencies and validation
  • 02-XX.sh: Core functionality
  • 03-XX.sh: Advanced features
  • 99-main.sh: Main dispatch (always last)

Error Handling

All scriptlets should:

  • Use the unified logging system (log_info, log_error, etc.)
  • Include proper error handling and cleanup
  • Validate inputs and device paths
  • Provide clear error messages

🎯 Future Enhancements

Phase 1: Core Stability (Current)

  • Modular architecture implementation
  • Build system development
  • Documentation and examples
  • Ubuntu uBlue integration
  • Multi-bootloader detection

Phase 2: Enhanced Features

  • Bootloader-specific operations
  • Backup and restore functionality
  • Boot entry management
  • Device validation and information
  • Status and monitoring

Phase 3: Advanced Functionality

  • Advanced bootloader features
  • Secure boot integration
  • Performance optimizations
  • Monitoring and analytics
  • Integration with container orchestration

Phase 4: Enterprise Features

  • Multi-node cluster support
  • Advanced security features
  • Integration with CI/CD systems
  • Automated backup and recovery
  • Performance analytics and reporting