diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 359b907fb..fb8a85feb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/daemon/AnacondaBackend.vala b/daemon/AnacondaBackend.vala new file mode 100644 index 000000000..9aac110bc --- /dev/null +++ b/daemon/AnacondaBackend.vala @@ -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 . + */ + +[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 {} +} diff --git a/daemon/Daemon.vala b/daemon/Daemon.vala index 0fd716099..cfd3b3452 100644 --- a/daemon/Daemon.vala +++ b/daemon/Daemon.vala @@ -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); diff --git a/daemon/meson.build b/daemon/meson.build index f4a07ee25..0c787778a 100644 --- a/daemon/meson.build +++ b/daemon/meson.build @@ -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 diff --git a/meson.build b/meson.build index 85c73b6b3..199947615 100644 --- a/meson.build +++ b/meson.build @@ -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 diff --git a/meson_options.txt b/meson_options.txt index 9f76e1d3b..1a1604457 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -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') diff --git a/src/Views/ProgressView.vala b/src/Views/ProgressView.vala index 3c7450574..ae55b434e 100644 --- a/src/Views/ProgressView.vala +++ b/src/Views/ProgressView.vala @@ -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 (null, () => { fake_status (InstallerDaemon.Step.PARTITION);