Implement minimal OS and Bootloader installation logic
This commit is contained in:
@@ -16,20 +16,46 @@ def main():
|
||||
"--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:
|
||||
from .backend.disk import auto_partition_disk
|
||||
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 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']}")
|
||||
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"Partitioning failed: {e}", file=sys.stderr)
|
||||
print(f"Installation failed: {e}", file=sys.stderr)
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
return 1
|
||||
|
||||
import gi
|
||||
|
||||
Reference in New Issue
Block a user