From 3ad086a021a42e87843e56abe718a0059cce8ab7 Mon Sep 17 00:00:00 2001 From: Marius Meisenzahl Date: Wed, 25 Sep 2024 12:15:30 +0000 Subject: [PATCH] Merge main --- common/DBusStructures.vala | 45 +++++++++++++++++++++++++++++++++ daemon/Daemon.vala | 15 ++++++++--- src/Views/PartitioningView.vala | 6 ++--- src/Views/ProgressView.vala | 4 +-- 4 files changed, 61 insertions(+), 9 deletions(-) diff --git a/common/DBusStructures.vala b/common/DBusStructures.vala index ece02c669..9c6cafd23 100644 --- a/common/DBusStructures.vala +++ b/common/DBusStructures.vala @@ -97,6 +97,7 @@ public struct InstallerDaemon.InstallConfig { string lang; bool modify_boot_order; bool install_drivers; + uint8 flags; } [Flags] @@ -139,3 +140,47 @@ public struct InstallerDaemon.LuksCredentials { string pv; string password; } + +public enum InstallerDaemon.LogLevel { + TRACE, + DEBUG, + INFO, + WARN, + ERROR; +} + +public struct InstallerDaemon.Error { + Step step; + int err; +} + +public enum InstallerDaemon.Step { + BACKUP, + INIT, + PARTITION, + EXTRACT, + CONFIGURE, + BOOTLOADER; +} + +public struct InstallerDaemon.Status { + Step step; + int percent; +} + +public struct InstallerDaemon.PartitionUsage { + /** + * None = 0; Some(usage) = 1; + */ + public uint8 tag; + /** + * The size, in sectors, that a partition is used. + */ + public uint64 value; +} + +public enum InstallerDaemon.PartitionTable { + NONE, + GPT, + MSDOS; +} diff --git a/daemon/Daemon.vala b/daemon/Daemon.vala index 0ccc1f7db..5e605728d 100644 --- a/daemon/Daemon.vala +++ b/daemon/Daemon.vala @@ -72,7 +72,7 @@ public class InstallerDaemon.Daemon : GLib.Object { filesystem = to_common_fs (part.get_file_system ()), start_sector = part.get_start_sector (), end_sector = part.get_end_sector (), - sectors_used = part.sectors_used (disk.get_sector_size ()), + sectors_used = to_common_usage (part.sectors_used (disk.get_sector_size ())), current_lvm_volume_group = lvm_vg }; } @@ -106,7 +106,7 @@ public class InstallerDaemon.Daemon : GLib.Object { filesystem = to_common_fs (part.get_file_system ()), start_sector = part.get_start_sector (), end_sector = part.get_end_sector (), - sectors_used = part.sectors_used (disk.get_sector_size ()), + sectors_used = to_common_usage (part.sectors_used (disk.get_sector_size ())), current_lvm_volume_group = lvm_vg }; } @@ -152,7 +152,7 @@ public class InstallerDaemon.Daemon : GLib.Object { filesystem = to_common_fs (part.get_file_system ()), start_sector = part.get_start_sector (), end_sector = part.get_end_sector (), - sectors_used = part.sectors_used (disk.get_sector_size ()), + sectors_used = to_common_usage (part.sectors_used (disk.get_sector_size ())), current_lvm_volume_group = lvm_vg }; } @@ -220,7 +220,7 @@ public class InstallerDaemon.Daemon : GLib.Object { var demo_mode_file = GLib.File.new_for_path ("/var/lib/lightdm/demo-mode"); try { demo_mode_file.create (GLib.FileCreateFlags.NONE); - } catch (Error e) { + } catch (GLib.Error e) { if (!(e is GLib.IOError.EXISTS)) { throw e; } @@ -547,6 +547,13 @@ public class InstallerDaemon.Daemon : GLib.Object { } } + private InstallerDaemon.PartitionUsage to_common_usage (Distinst.PartitionUsage usage) { + return InstallerDaemon.PartitionUsage () { + tag = usage.tag, + value = usage.value + }; + } + private Distinst.FileSystem to_distinst_fs (InstallerDaemon.FileSystem fs) { switch (fs) { case BTRFS: diff --git a/src/Views/PartitioningView.vala b/src/Views/PartitioningView.vala index d6f52bf17..d751b4751 100644 --- a/src/Views/PartitioningView.vala +++ b/src/Views/PartitioningView.vala @@ -238,7 +238,7 @@ public class Installer.PartitioningView : AbstractInstallerView { switch (bootloader) { case MSDOS: break; - case Distinst.PartitionTable.GPT: + case InstallerDaemon.PartitionTable.GPT: break; } @@ -344,7 +344,7 @@ public class Installer.PartitioningView : AbstractInstallerView { InstallerDaemon.Partition[] partitions = {}; - var usage_1 = Distinst.PartitionUsage () { + var usage_1 = InstallerDaemon.PartitionUsage () { tag = 1, value = 30312 }; @@ -358,7 +358,7 @@ public class Installer.PartitioningView : AbstractInstallerView { current_lvm_volume_group = "" }; - var usage_2 = Distinst.PartitionUsage () { + var usage_2 = InstallerDaemon.PartitionUsage () { tag = 0, value = 0 }; diff --git a/src/Views/ProgressView.vala b/src/Views/ProgressView.vala index a2a86a94e..3c7450574 100644 --- a/src/Views/ProgressView.vala +++ b/src/Views/ProgressView.vala @@ -196,11 +196,11 @@ public class ProgressView : Adw.NavigationPage { } } - private void fake_status (Distinst.Step step) { + private void fake_status (InstallerDaemon.Step step) { unowned var log_helper = LogHelper.get_default (); for (var percent = 0; percent <= 100; percent++) { log_helper.log_func (INFO, "I'm faking it!"); - Distinst.Status status = Distinst.Status () { + InstallerDaemon.Status status = InstallerDaemon.Status () { step = step, percent = percent };