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 all 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 @@ -31,6 +31,10 @@ jobs:
meson setup build
ninja -C build install
ninja -C build test
- name: Build (Anaconda Backend)
run: |
meson configure -Dinstaller_backend=anaconda build
ninja -C build

lint:
runs-on: ubuntu-latest
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 {}
}
2 changes: 2 additions & 0 deletions daemon/Daemon.vala
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ private void on_bus_acquired (GLib.DBusConnection connection, string name) {
try {
#if DISTINST_BACKEND
connection.register_object ("/io/elementary/InstallerDaemon", new InstallerDaemon.DistinstBackend ());
#elif ANACONDA_BACKEND
connection.register_object ("/io/elementary/InstallerDaemon", new InstallerDaemon.AnacondaBackend ());
#endif
} catch (GLib.Error e) {
critical ("Unable to register the object: %s", e.message);
Expand Down
3 changes: 3 additions & 0 deletions daemon/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ if installer_backend == 'distinst'
vala_files += ['DistinstBackend.vala']
daemon_dependencies += [distinst_dep]
args += '--define=DISTINST_BACKEND'
elif installer_backend == 'anaconda'
vala_files += ['AnacondaBackend.vala']
args += '--define=ANACONDA_BACKEND'
else
error('No supported installer backend provided')
endif
Expand Down
1 change: 1 addition & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ systemd_dep = dependency('systemd')
installer_backend = get_option('installer_backend')
if installer_backend == 'distinst'
distinst_dep = dependency('distinst')
elif installer_backend == 'anaconda'
else
error('No supported installer backend provided')
endif
Expand Down
2 changes: 1 addition & 1 deletion meson_options.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
option('supported_languages', type : 'string', value : 'aa;ab;ae;af;ak;am;an;ar;as;ast;av;ay;az;ba;be;bg;bh;bi;bm;bn;bo;br;bs;ca;ce;ch;ckb;co;cr;cs;cu;cv;cy;da;de;de_CH;de_DE;dv;dz;ee;el;en;en_US;en_AU;en_CA;en_GB;eo;es;et;eu;fa;ff;fi;fj;fo;fr;fr_BE;fr_CA;fr_FR;fy;ga;gd;gl;gn;gu;gv;ha;he;hi;ho;hr;ht;hu;hy;hz;ia;id;ie;ig;ii;ik;io;is;it;iu;ja;jv;ka;kab;kg;ki;kj;kk;kl;km;kn;ko;kr;ks;ku;kv;kw;ky;la;lb;lg;li;ln;lo;lt;lu;lv;mg;mh;mi;mk;ml;mn;mo;mr;ms;mt;my;na;nb;nd;ne;ng;nl;nn;nr;nv;ny;oc;oj;om;or;os;pa;pi;pl;ps;pt;pt_PT;pt_BR;qu;rm;rn;ro;ru;rue;rw;sa;sc;sd;se;sg;si;sk;sl;sm;sma;sn;so;sq;sr;ss;st;su;sv;sw;szl;ta;te;tg;th;ti;tk;tl;tn;to;tr;ts;tt;tw;ty;udm;ug;uk;ur;uz;ve;vi;vo;wa;wo;xh;yi;yo;za;zh;zh_CN;zh_HK;zh_TW;zu', description : 'The list of supported languages')
option('preferred_languages', type : 'string', value : 'en;zh;es;fr;pt;ru;de', description : 'A prioritized list of languages')
option('installer_backend', type : 'combo', choices : ['distinst'], value : 'distinst')
option('installer_backend', type : 'combo', choices : ['distinst', 'anaconda'], value : 'anaconda')
29 changes: 29 additions & 0 deletions src/Views/ProgressView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,35 @@ public class ProgressView : Adw.NavigationPage {
}

public void start_installation () {
unowned Configuration current_config = Configuration.get_default ();

stdout.printf ("###################################\n");
stdout.printf ("lang: %s\n", current_config.lang);
stdout.printf ("country: %s\n", current_config.country);
stdout.printf ("keyboard_layout: %s\n", current_config.keyboard_layout);
stdout.printf ("keyboard_variant: %s\n", current_config.keyboard_variant);
stdout.printf ("encryption_password: %s\n", current_config.encryption_password);
stdout.printf ("disk: %s\n", current_config.disk);
stdout.printf ("mounts:\n");
foreach (var mount in current_config.mounts) {
stdout.printf ("- partition_path: %s\n", mount.partition_path);
stdout.printf (" parent_disk: %s\n", mount.parent_disk);
stdout.printf (" mount_point: %s\n", mount.mount_point);
stdout.printf (" sectors: %llu\n", mount.sectors);
stdout.printf (" filesystem: %s\n", mount.filesystem.to_string ());
stdout.printf (" flags: %u\n", mount.flags);
}
stdout.printf ("luks:\n");
foreach (var luks in current_config.luks) {
if (luks != null) {
stdout.printf ("- device: %s\n", luks.device);
stdout.printf (" pv: %s\n", luks.pv);
stdout.printf (" password: %s\n", luks.password);
}
}
stdout.printf ("install_drivers: %s\n", current_config.install_drivers ? "true" : "false");
stdout.printf ("###################################\n");

if (Installer.App.test_mode) {
new Thread<void*> (null, () => {
fake_status (InstallerDaemon.Step.PARTITION);
Expand Down