Add GUI progress bar and improve systemd-boot installation reliability
This commit is contained in:
@@ -284,7 +284,8 @@ def configure_system(mount_root, partition_info, user_info=None, disk_device=Non
|
||||
f.write("bls\n")
|
||||
|
||||
# Initialize systemd-boot
|
||||
run_command(["chroot", mount_root, "bootctl", "install", "--path=/boot"])
|
||||
# We use --force to overwrite any existing entries and ensure it's the primary bootloader
|
||||
run_command(["chroot", mount_root, "bootctl", "install", "--path=/boot", "--force"])
|
||||
|
||||
# Sync kernels and generate BLS entries
|
||||
# Since we rsync'd, kernels are in /lib/modules and /boot
|
||||
|
||||
@@ -182,6 +182,13 @@ class InstallerWindow(Adw.ApplicationWindow):
|
||||
spinner.start()
|
||||
|
||||
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=12)
|
||||
|
||||
self.progress_bar = Gtk.ProgressBar()
|
||||
self.progress_bar.set_show_text(True)
|
||||
self.progress_bar.set_margin_start(24)
|
||||
self.progress_bar.set_margin_end(24)
|
||||
box.append(self.progress_bar)
|
||||
|
||||
box.append(spinner)
|
||||
|
||||
# Log view
|
||||
@@ -226,6 +233,31 @@ class InstallerWindow(Adw.ApplicationWindow):
|
||||
mark = self.log_buffer.create_mark("end", end_iter, False)
|
||||
self.log_view.scroll_to_mark(mark, 0.0, True, 0.0, 1.0)
|
||||
|
||||
# Update progress bar based on keywords or rsync progress
|
||||
msg_lower = msg.lower()
|
||||
if "step 1:" in msg_lower:
|
||||
self.progress_bar.set_fraction(0.1)
|
||||
self.progress_bar.set_text("Partitioning...")
|
||||
elif "step 2:" in msg_lower:
|
||||
self.progress_bar.set_fraction(0.2)
|
||||
self.progress_bar.set_text("Mounting...")
|
||||
elif "step 3:" in msg_lower:
|
||||
self.progress_bar.set_fraction(0.3)
|
||||
self.progress_bar.set_text("Installing OS...")
|
||||
elif "step 4:" in msg_lower:
|
||||
self.progress_bar.set_fraction(0.9)
|
||||
self.progress_bar.set_text("Configuring Bootloader...")
|
||||
elif "%" in msg and "to-check" in msg:
|
||||
# Parse rsync progress (e.g., "1,234,567 80% 10.00MB/s 0:00:05")
|
||||
import re
|
||||
match = re.search(r"(\d+)%", msg)
|
||||
if match:
|
||||
percentage = int(match.group(1))
|
||||
# Map 0-100% of rsync to 0.3-0.8 of total progress
|
||||
fraction = 0.3 + (percentage / 100.0) * 0.5
|
||||
self.progress_bar.set_fraction(fraction)
|
||||
self.progress_bar.set_text(f"Syncing files... {percentage}%")
|
||||
|
||||
def show_finish_page(self, message, success=True):
|
||||
if self.log_handler:
|
||||
logging.getLogger().removeHandler(self.log_handler)
|
||||
|
||||
Reference in New Issue
Block a user