Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add support for Anaconda backend #738

Draft
wants to merge 19 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
d43e49a
DBusStructures: Add new file system enum and partition usage struct
meisenzahl Nov 9, 2023
ff2b6d0
DBusStructures: Add to_string method to FileSystem enum
meisenzahl Nov 9, 2023
5853498
Update file system types to use InstallerDaemon
meisenzahl Nov 9, 2023
8c137fe
Daemon: Convert file system and partition usage to common format
meisenzahl Nov 9, 2023
3e041ce
Add PartitionTable enum and update
meisenzahl Nov 9, 2023
3a2ed8d
Add new enums and struct for InstallerDaemon and update flags in Daem…
meisenzahl Nov 9, 2023
c1e4fa9
Refactor to_common_usage_bootloader method in Daemon class
meisenzahl Nov 9, 2023
7cdde6a
Add InstallerDaemon.LogLevel and InstallerDaemon.Error to InstallerDa…
meisenzahl Nov 9, 2023
08a0147
Utils: Remove distinst specific code
meisenzahl Nov 9, 2023
dd09a4b
Refactor file common/DBusStructures.vala to handle FileSystem.NONE ca…
meisenzahl Nov 9, 2023
82c20cd
Remove distinst_dep from gui_dependencies
meisenzahl Nov 9, 2023
2d382d2
Add support for Distinst installer backend in
meisenzahl Nov 9, 2023
400d567
Satisfy linter
meisenzahl Nov 9, 2023
bd4c3e8
Add AnacondaBackend for installer backend option
meisenzahl Nov 9, 2023
f7b989f
GitHub CI: Build anaconda backend
meisenzahl Nov 9, 2023
a27bda7
DBusStructures: Refactor to unowned reference
meisenzahl Nov 11, 2023
6be9230
Merge branch 'prepare-backends' into anaconda-backend
meisenzahl Nov 11, 2023
c2ddbc4
Merge branch 'main' into anaconda-backend
meisenzahl Oct 7, 2024
94135fa
ProgressView: Output config
meisenzahl Oct 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ jobs:
run: |
meson build
ninja -C build
- name: Build (Anaconda Backend)
run: |
meson configure -Dinstaller_backend=anaconda build
ninja -C build

lint:
runs-on: ubuntu-latest
Expand Down
111 changes: 102 additions & 9 deletions common/DBusStructures.vala
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,106 @@ public struct InstallerDaemon.Disk {
Partition[] partitions;
}

public enum InstallerDaemon.FileSystem {
NONE,
BTRFS,
EXT2,
EXT3,
EXT4,
F2FS,
FAT16,
FAT32,
NTFS,
SWAP,
XFS,
LVM,
LUKS;

public string to_string () {
meisenzahl marked this conversation as resolved.
Show resolved Hide resolved
switch (this) {
case BTRFS:
return "btrfs";
case EXT2:
return "ext2";
case EXT3:
return "ext3";
case EXT4:
return "ext4";
case F2FS:
return "f2fs";
case FAT16:
return "fat16";
case FAT32:
return "fat32";
case NTFS:
return "ntfs";
case SWAP:
return "swap";
case XFS:
return "xfs";
case LVM:
return "lvm";
case LUKS:
return "luks";
case NONE:
default:
return "none";
}
}
}

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;
}

public enum InstallerDaemon.Step {
BACKUP,
INIT,
PARTITION,
EXTRACT,
CONFIGURE,
BOOTLOADER;
}

public struct InstallerDaemon.Status {
Step step;
int percent;
}

public enum InstallerDaemon.LogLevel {
TRACE,
DEBUG,
INFO,
WARN,
ERROR;
}

public struct InstallerDaemon.Error {
Step step;
int err;
}

public struct InstallerDaemon.Partition {
string device_path;

Distinst.FileSystem filesystem;
FileSystem filesystem;

uint64 start_sector;
uint64 end_sector;
Distinst.PartitionUsage sectors_used;
PartitionUsage sectors_used;
string? current_lvm_volume_group;
}

Expand All @@ -47,7 +139,8 @@ public struct InstallerDaemon.InstallConfig {
string keyboard_layout;
string keyboard_variant;
string lang;
uint8 flags;
bool modify_boot_order;
bool install_drivers;
}

[Flags]
Expand All @@ -62,18 +155,18 @@ public struct InstallerDaemon.Mount {
string parent_disk;
string mount_point;
uint64 sectors;
Distinst.FileSystem filesystem;
FileSystem filesystem;
MountFlags flags;

public bool is_valid_boot_mount () {
return filesystem == Distinst.FileSystem.FAT16
|| filesystem == Distinst.FileSystem.FAT32;
return filesystem == FileSystem.FAT16
|| filesystem == FileSystem.FAT32;
}

public bool is_valid_root_mount () {
return filesystem != Distinst.FileSystem.FAT16
&& filesystem != Distinst.FileSystem.FAT32
&& filesystem != Distinst.FileSystem.NTFS;
return filesystem != FileSystem.FAT16
&& filesystem != FileSystem.FAT32
&& filesystem != FileSystem.NTFS;
}

public bool is_lvm () {
Expand Down
47 changes: 47 additions & 0 deletions daemon/AnacondaBackend.vala
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright 2023 elementary, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

[DBus (name = "io.elementary.InstallerDaemon")]
public class InstallerDaemon.AnacondaBackend : GLib.Object {
public signal void on_log_message (InstallerDaemon.LogLevel level, string message);
public signal void on_status (InstallerDaemon.Status status);
public signal void on_error (InstallerDaemon.Error error);

public InstallerDaemon.PartitionTable bootloader_detect () throws GLib.Error {
return InstallerDaemon.PartitionTable.NONE;
}

public DiskInfo get_disks (bool get_partitions = false) throws GLib.Error {
return DiskInfo ();
}

public int decrypt_partition (string path, string pv, string password) throws GLib.Error {
return 0;
}

public Disk get_logical_device (string pv) throws GLib.Error {
return Disk ();
}

public void install_with_default_disk_layout (InstallConfig config, string disk, bool encrypt, string encryption_password) throws GLib.Error {}

public void install_with_custom_disk_layout (InstallConfig config, Mount[] disk_config, LuksCredentials[] credentials) throws GLib.Error {}

public void set_demo_mode_locale (string locale) throws GLib.Error {}

public void trigger_demo_mode () throws GLib.Error {}
}
Loading
Loading