| .. | ||
| scriptlets | ||
| test-scripts | ||
| CHANGELOG.md | ||
| compile.sh | ||
| README.md | ||
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
- Edit Individual Scriptlets: Modify the specific scriptlet files in
scriptlets/ - Test Changes: Make your changes and test individual components
- Compile: Run
bash compile.shto merge all scriptlets - Deploy: The unified
bootupd-alternative.shis 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.shfile 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
- Multi-Bootloader Support: GRUB, UEFI, LILO, syslinux detection and management
- Backup and Restore: Comprehensive backup/restore functionality
- Device Validation: Robust device checking and information
- Error Handling: Comprehensive error handling and recovery
Bootloader Support
- GRUB: Traditional GRUB bootloader management
- UEFI: UEFI firmware and boot entry management
- LILO: Legacy LILO bootloader support
- 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
- Create the scriptlet file in
scriptlets/with appropriate naming - Add to compile.sh in the correct order
- Update this README with the new scriptlet description
- 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
📚 Related Documentation
- ComposeFS Modular System: Backend filesystem layer
- BootC Modular System: Container-native boot system
- apt-layer Modular System: Package layer management
- Ubuntu uBlue Configuration: Unified configuration system
🎯 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