Skip to content

Commit

Permalink
Merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
meisenzahl committed Sep 25, 2024
1 parent c69236b commit 3ad086a
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 9 deletions.
45 changes: 45 additions & 0 deletions common/DBusStructures.vala
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public struct InstallerDaemon.InstallConfig {
string lang;
bool modify_boot_order;
bool install_drivers;
uint8 flags;
}

[Flags]
Expand Down Expand Up @@ -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;
}
15 changes: 11 additions & 4 deletions daemon/Daemon.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
}
Expand Down Expand Up @@ -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
};
}
Expand Down Expand Up @@ -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
};
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions src/Views/PartitioningView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public class Installer.PartitioningView : AbstractInstallerView {
switch (bootloader) {
case MSDOS:
break;
case Distinst.PartitionTable.GPT:
case InstallerDaemon.PartitionTable.GPT:
break;
}

Expand Down Expand Up @@ -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
};
Expand All @@ -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
};
Expand Down
4 changes: 2 additions & 2 deletions src/Views/ProgressView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down

0 comments on commit 3ad086a

Please sign in to comment.