import argparse import sys import logging # Configure logging logging.basicConfig(level=logging.INFO) def main(): parser = argparse.ArgumentParser(description="Iridium OS Installer") parser.add_argument( "--mock", action="store_true", help="Run in mock mode (no actual changes to disk)", ) parser.add_argument( "--partition-disk", help="Automatically partition the specified disk (WARNING: DESTROYS DATA)", ) parser.add_argument( "--full-install", help="Run a full minimal installation on the specified disk (WARNING: DESTROYS DATA)", ) args = parser.parse_args() if args.partition_disk or args.full_install: from .backend.disk import auto_partition_disk, mount_partitions from .backend.os_install import install_minimal_os, configure_system target = args.partition_disk or args.full_install try: print(f"Starting installation on {target}...") print("Step 1: Partitioning...") parts = auto_partition_disk(target) if args.full_install: print("Step 2: Mounting...") mount_root = "/mnt" mount_partitions(parts, mount_root) print("Step 3: Installing OS (this may take a while)...") install_minimal_os(mount_root) print("Step 4: Configuring Bootloader...") configure_system(mount_root, parts) print("Installation complete! You can now reboot.") else: print("Partitioning successful!") print(f"EFI: {parts['efi']}") print(f"Swap: {parts['swap']}") print(f"Root: {parts['root']}") return 0 except Exception as e: print(f"Installation failed: {e}", file=sys.stderr) import traceback traceback.print_exc() return 1 import gi gi.require_version("Gtk", "4.0") gi.require_version("Adw", "1") from gi.repository import Adw, Gio from .ui.window import InstallerWindow class IridiumInstallerApp(Adw.Application): def __init__(self, mock_mode=False): super().__init__( application_id="org.iridium.Installer", flags=Gio.ApplicationFlags.FLAGS_NONE, ) self.mock_mode = mock_mode def do_activate(self): win = self.props.active_window if not win: win = InstallerWindow(application=self, mock_mode=self.mock_mode) win.present() app = IridiumInstallerApp(mock_mode=args.mock) return app.run(sys.argv) if __name__ == "__main__": sys.exit(main())