62 lines
1.8 KiB
Python
62 lines
1.8 KiB
Python
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)",
|
|
)
|
|
args = parser.parse_args()
|
|
|
|
if args.partition_disk:
|
|
from .backend.disk import auto_partition_disk
|
|
try:
|
|
print(f"Starting partitioning on {args.partition_disk}...")
|
|
result = auto_partition_disk(args.partition_disk)
|
|
print("Partitioning successful!")
|
|
print(f"EFI: {result['efi']}")
|
|
print(f"Swap: {result['swap']}")
|
|
print(f"Root: {result['root']}")
|
|
return 0
|
|
except Exception as e:
|
|
print(f"Partitioning failed: {e}", file=sys.stderr)
|
|
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())
|