diff --git a/.github/workflows/ci-live.yml b/.github/workflows/ci-live.yml new file mode 100644 index 0000000000..044657aa1d --- /dev/null +++ b/.github/workflows/ci-live.yml @@ -0,0 +1,59 @@ +name: CI - ISO definition + +on: + push: + paths: + # NOTE: GitHub Actions do not allow using YAML references, the same path + # list is used below for the pull request event. Keep both lists in sync!! + + # this file as well + - .github/workflows/ci-live.yml + # any change in the service subfolder + - live/** + + pull_request: + paths: + # NOTE: GitHub Actions do not allow using YAML references, the same path + # list is used above for the push event. Keep both lists in sync!! + + # this file as well + - .github/workflows/ci-live.yml + # any change in the service subfolder + - live/** + + # allow running manually + workflow_dispatch: + +jobs: + ruby_tests: + runs-on: ubuntu-latest + env: + COVERAGE: 1 + + defaults: + run: + working-directory: ./live + + strategy: + fail-fast: false + matrix: + distro: [ "tumbleweed" ] + + container: + image: registry.opensuse.org/yast/head/containers_${{matrix.distro}}/yast-ruby + + steps: + + - name: Git Checkout + uses: actions/checkout@v4 + + - name: Configure and refresh repositories + # disable unused repositories to have faster refresh + run: zypper modifyrepo -d repo-non-oss repo-openh264 repo-update && zypper ref + + - name: Install Ruby development files + run: zypper --non-interactive install + make + + - name: Run the tests + run: make check diff --git a/autoinstallation/README.md b/autoinstallation/README.md index cf6e23ce7e..06f78e4251 100644 --- a/autoinstallation/README.md +++ b/autoinstallation/README.md @@ -32,8 +32,8 @@ repository to get an impression of how a profile looks like. ```json { - "l10n": { - "languages": ["en_US.UTF-8"] + "localization": { + "language": "en_US.UTF-8" }, "product": { "id": "Tumbleweed" diff --git a/autoinstallation/bin/agama-auto b/autoinstallation/bin/agama-auto index 5e1b4e76f5..01493a4fa5 100755 --- a/autoinstallation/bin/agama-auto +++ b/autoinstallation/bin/agama-auto @@ -4,23 +4,32 @@ set -ex # Temporarily skip the AutoYaST XML validation export YAST_SKIP_XML_VALIDATION=1 -if [ -z "$1" ] -then - url=$(awk -F 'agama.auto=' '{sub(/ .*$/, "", $2); print $2}' < /proc/cmdline) +if [ -z "$1" ]; then + url=$(grep 'agama.auto=' + +- gh#agama-project/agama#1970 + - Adapted agama-auto script to reboot by default once the + unattended installation is finished. + - Allow to modify the finish method through the 'agama.finish' + kernel cmdline argument. + ------------------------------------------------------------------- Fri Sep 20 11:27:29 UTC 2024 - Imobach Gonzalez Sosa diff --git a/doc/dbus/bus/org.opensuse.Agama.Manager1.bus.xml b/doc/dbus/bus/org.opensuse.Agama.Manager1.bus.xml index 93626ae74c..945966dedd 100644 --- a/doc/dbus/bus/org.opensuse.Agama.Manager1.bus.xml +++ b/doc/dbus/bus/org.opensuse.Agama.Manager1.bus.xml @@ -39,6 +39,8 @@ + + diff --git a/doc/dbus/bus/org.opensuse.Agama1.Manager.bus.xml b/doc/dbus/bus/org.opensuse.Agama1.Manager.bus.xml index 7127266bdc..060c3de4d2 100644 --- a/doc/dbus/bus/org.opensuse.Agama1.Manager.bus.xml +++ b/doc/dbus/bus/org.opensuse.Agama1.Manager.bus.xml @@ -39,6 +39,8 @@ + + diff --git a/doc/dbus/org.opensuse.Agama1.Manager.doc.xml b/doc/dbus/org.opensuse.Agama1.Manager.doc.xml index 02a8009499..13dd26b9a5 100644 --- a/doc/dbus/org.opensuse.Agama1.Manager.doc.xml +++ b/doc/dbus/org.opensuse.Agama1.Manager.doc.xml @@ -14,6 +14,27 @@ + + + - + - - - + + + + 11.0.0 @@ -30,22 +31,22 @@ openSUSE - + - + - + - + @@ -59,7 +60,7 @@ 3000 - + @@ -72,7 +73,7 @@ 1900 - + @@ -92,10 +93,10 @@ - + - + @@ -145,6 +146,7 @@ + @@ -163,10 +165,11 @@ + - + @@ -176,7 +179,7 @@ - + @@ -186,7 +189,7 @@ - + @@ -201,14 +204,14 @@ - + - + - + diff --git a/live/src/config.sh b/live/src/config.sh index d51b0ccf14..6204477498 100644 --- a/live/src/config.sh +++ b/live/src/config.sh @@ -44,6 +44,7 @@ systemctl enable agama-hostname.service systemctl enable agama-proxy-setup.service systemctl enable agama-certificate-issue.path systemctl enable agama-certificate-wait.service +systemctl enable agama-cmdline-process.service systemctl enable agama-welcome-issue.service systemctl enable agama-avahi-issue.service systemctl enable agama-url-issue.service @@ -57,6 +58,7 @@ systemctl enable live-password-random.service systemctl enable live-password-systemd.service systemctl enable live-root-shell.service systemctl enable checkmedia.service +systemctl enable qemu-guest-agent.service systemctl enable setup-systemd-proxy-env.path systemctl enable x11-autologin.service systemctl enable spice-vdagentd.service @@ -76,7 +78,8 @@ systemctl disable YaST2-Second-Stage.service ### setup dracut for live system arch=$(uname -m) # keep in sync with ISO Volume ID set in the fix_bootconfig script -label="Install-$kiwi_profiles-$arch" +profile=$(echo "$kiwi_profiles" | tr "_" "-") +label="Install-$profile-$arch" echo "Setting default live root: live:LABEL=$label" mkdir /etc/cmdline.d @@ -87,6 +90,15 @@ echo "root_disk=live:LABEL=$label" >>/etc/cmdline.d/10-liveroot.conf echo 'install_items+=" /etc/cmdline.d/10-liveroot.conf "' >/etc/dracut.conf.d/10-liveroot-file.conf echo 'add_dracutmodules+=" dracut-menu agama-cmdline "' >>/etc/dracut.conf.d/10-liveroot-file.conf +# add xhci-pci-renesas to initrd if available (workaround for bsc#1237235) +# FIXME: remove when the module is included in the default driver list in +# in /usr/lib/dracut/modules.d/90kernel-modules/module-setup.sh, see +# https://github.com/openSUSE/dracut/blob/7559201e7480a65b0da050263d96a1cd8f15f50d/modules.d/90kernel-modules/module-setup.sh#L42-L46 +if [ -f /lib/modules/*/kernel/drivers/usb/host/xhci-pci-renesas.ko* ]; then + echo "Adding xhci-pci-renesas driver to initrd..." + echo 'add_drivers+=" xhci-pci-renesas "' > /etc/dracut.conf.d/10-extra-drivers.conf +fi + if [ "${arch}" = "s390x" ]; then # workaround for custom bootloader setting touch /config.bootoptions @@ -167,6 +179,7 @@ rpm -e --nodeps alsa alsa-utils alsa-ucm-conf || true du -h -s /lib/modules /lib/firmware # remove the multimedia drivers +# set DEBUG=1 to print the deleted drivers /tmp/driver_cleanup.rb --delete # remove the script, not needed anymore rm /tmp/driver_cleanup.rb diff --git a/live/src/fix_bootconfig b/live/src/fix_bootconfig index 77ec7b6416..d901c6974a 100644 --- a/live/src/fix_bootconfig +++ b/live/src/fix_bootconfig @@ -55,8 +55,9 @@ for i in "\$@" ; do fi done +profile=$(echo "$kiwi_profiles" | tr "_" "-") # keep in sync with ISO Volume ID set in the config.sh script -volid="Install-$kiwi_profiles-$arch" +volid="Install-\$profile-$arch" [ -x $bootfix ] && $bootfix $dst rm -f $dst/fix_bootconfig.* $dst/.profile diff --git a/live/test/fixtures/expected/cmdline b/live/test/fixtures/expected/cmdline new file mode 100644 index 0000000000..d07b617330 --- /dev/null +++ b/live/test/fixtures/expected/cmdline @@ -0,0 +1 @@ + BOOT_IMAGE=/boot/vmlinuz splash=silent mitigations=auto quiet nosimplefb=1 \ No newline at end of file diff --git a/live/test/fixtures/expected/info_cmdline b/live/test/fixtures/expected/info_cmdline new file mode 100644 index 0000000000..ca2bb594ab --- /dev/null +++ b/live/test/fixtures/expected/info_cmdline @@ -0,0 +1,3 @@ +BOOT_IMAGE=/boot/vmlinuz splash=silent nosimplefb=1 +agama.install_url=ftp://test.com/repo +live.password=secret \ No newline at end of file diff --git a/live/test/fixtures/expected/info_cmdline.info b/live/test/fixtures/expected/info_cmdline.info new file mode 100644 index 0000000000..9de6db162f --- /dev/null +++ b/live/test/fixtures/expected/info_cmdline.info @@ -0,0 +1,2 @@ +agama.install_url=ftp://test.com/repo +live.password=secret \ No newline at end of file diff --git a/live/test/fixtures/source/cmdline b/live/test/fixtures/source/cmdline new file mode 100644 index 0000000000..d43325ea28 --- /dev/null +++ b/live/test/fixtures/source/cmdline @@ -0,0 +1 @@ +BOOT_IMAGE=/boot/vmlinuz splash=silent agama.auto=ftp://example.suse.cz/profile.json LIBSTORAGE_MULTIPATH=1 mitigations=auto Y2DEBUG=1 quiet nosimplefb=1 diff --git a/live/test/fixtures/source/info_cmdline b/live/test/fixtures/source/info_cmdline new file mode 100644 index 0000000000..32aeff0894 --- /dev/null +++ b/live/test/fixtures/source/info_cmdline @@ -0,0 +1 @@ +BOOT_IMAGE=/boot/vmlinuz splash=silent agama.info=https://pastebin.com/raw/krzAVL8S nosimplefb=1 diff --git a/live/test/info_cmdline_test.rb b/live/test/info_cmdline_test.rb new file mode 100755 index 0000000000..93c1672c0d --- /dev/null +++ b/live/test/info_cmdline_test.rb @@ -0,0 +1,51 @@ +#! /usr/bin/rspec +require "tmpdir" + +describe "info-cmdline-conf.sh" do + let(:script_path) { File.expand_path("../root/usr/bin/info-cmdline-conf.sh", __dir__, ) } + + context "There is no info parameter" do + let(:source_path) { File.expand_path("fixtures/source/cmdline", __dir__, ) } + let(:expected_path) { File.expand_path("fixtures/source/cmdline", __dir__, ) } + + + it "does nothing" do + Dir.mktmpdir do |tmpdir| + target_path = File.join(tmpdir, "cmdline") + FileUtils.cp(source_path, target_path) + info_path = File.join(tmpdir, "cmdline.info") + command = "#{script_path} #{target_path} #{info_path}" + cmd_result = system(command) + expect(cmd_result).to eq true + expected = File.read(expected_path) + result = File.read(target_path) + expect(result).to eq expected + expect(File.exists?(info_path)).to eq false + end + end + end + + context "There is info parameter" do + let(:source_path) { File.expand_path("fixtures/source/info_cmdline", __dir__, ) } + let(:expected_path) { File.expand_path("fixtures/expected/info_cmdline", __dir__, ) } + let(:expected_info_path) { File.expand_path("fixtures/expected/info_cmdline.info", __dir__, ) } + + it "removes info parameter and add its content" do + Dir.mktmpdir do |tmpdir| + target_path = File.join(tmpdir, "cmdline") + FileUtils.cp(source_path, target_path) + info_path = File.join(tmpdir, "cmdline.info") + command = "#{script_path} #{target_path} #{info_path}" + cmd_result = system(command) + expect(cmd_result).to eq true + expected = File.read(expected_path) + result = File.read(target_path) + expect(result).to eq expected + + expected_info = File.read(expected_info_path) + result_info = File.read(info_path) + expect(result_info).to eq expected_info + end + end + end +end diff --git a/live/test/kernel_cmdline_test.rb b/live/test/kernel_cmdline_test.rb new file mode 100755 index 0000000000..ce2c1e8258 --- /dev/null +++ b/live/test/kernel_cmdline_test.rb @@ -0,0 +1,19 @@ +#! /usr/bin/rspec +require "tmpdir" + +describe "kernel-cmdline-conf.sh" do + it "filters out any agama params" do + script_path = File.expand_path("../root/usr/bin/kernel-cmdline-conf.sh", __dir__, ) + source_path = File.expand_path("fixtures/source/cmdline", __dir__, ) + expected_path = File.expand_path("fixtures/expected/cmdline", __dir__, ) + tmpdir = Dir.mktmpdir do |tmpdir| + target_path = File.join(tmpdir, "cmdline") + command = "#{script_path} #{source_path} #{target_path}" + cmd_result = system(command) + expect(cmd_result).to eq true + expected = File.read(expected_path) + result = File.read(target_path) + expect(result).to eq expected + end + end +end diff --git a/products.d/agama-products.changes b/products.d/agama-products.changes index ff8fe5409e..33d6cb2e19 100644 --- a/products.d/agama-products.changes +++ b/products.d/agama-products.changes @@ -1,3 +1,17 @@ +------------------------------------------------------------------- +Wed Feb 19 14:16:28 UTC 2025 - Josef Reidinger + +- Add sudo-policy-wheel-auth-self package as mandatory for products + that do not do it automatic to allow just non-root user for + initial login (jsc#PM-2128) + +------------------------------------------------------------------- +Thu Feb 13 11:19:19 UTC 2025 - Lubos Kocman + +- Change the default lsm to SELinux in enforcing for both Leap and Tumblweed + keep AppArmor around as an option jsc#PED-12021 + https://news.opensuse.org/2025/02/13/tw-plans-to-adopt-selinux-as-default/ + ------------------------------------------------------------------- Fri Jan 24 06:45:45 UTC 2025 - Imobach Gonzalez Sosa diff --git a/products.d/leap_160.yaml b/products.d/leap_160.yaml index 64e01a5f0b..dfa87b0cd9 100644 --- a/products.d/leap_160.yaml +++ b/products.d/leap_160.yaml @@ -59,7 +59,7 @@ software: base_product: openSUSE security: - lsm: apparmor + lsm: selinux available_lsms: apparmor: patterns: diff --git a/products.d/sles_160.yaml b/products.d/sles_160.yaml index 90cbf55088..b7cee8e62c 100644 --- a/products.d/sles_160.yaml +++ b/products.d/sles_160.yaml @@ -74,6 +74,7 @@ software: - sles_minimal_sap mandatory_packages: - NetworkManager + - sudo-policy-wheel-auth-self # explicit wheel group policy to conform new auth model optional_packages: null base_product: SLES diff --git a/products.d/sles_sap_160.yaml b/products.d/sles_sap_160.yaml index 587a89b08d..53a4a4f937 100644 --- a/products.d/sles_sap_160.yaml +++ b/products.d/sles_sap_160.yaml @@ -44,6 +44,7 @@ software: - sles_sap_gui mandatory_packages: - NetworkManager + - sudo-policy-wheel-auth-self # explicit wheel group policy to conform new auth model optional_packages: null base_product: SLES_SAP diff --git a/products.d/slowroll.yaml b/products.d/slowroll.yaml index cd6cdee57e..421a8e271d 100644 --- a/products.d/slowroll.yaml +++ b/products.d/slowroll.yaml @@ -61,6 +61,7 @@ software: mandatory_packages: - NetworkManager - openSUSE-repos-Slowroll + - sudo-policy-wheel-auth-self # explicit wheel group policy to conform new auth model optional_packages: null base_product: openSUSE diff --git a/products.d/tumbleweed.yaml b/products.d/tumbleweed.yaml index 8287f0772e..13c76d47d3 100644 --- a/products.d/tumbleweed.yaml +++ b/products.d/tumbleweed.yaml @@ -112,11 +112,12 @@ software: mandatory_packages: - NetworkManager - openSUSE-repos-Tumbleweed + - sudo-policy-wheel-auth-self # explicit wheel group policy to conform new auth model optional_packages: null base_product: openSUSE security: - lsm: apparmor + lsm: selinux available_lsms: apparmor: patterns: @@ -124,7 +125,7 @@ security: selinux: patterns: - selinux - policy: permissive + policy: enforcing none: patterns: null diff --git a/rust/agama-cli/src/commands.rs b/rust/agama-cli/src/commands.rs index cd733132a4..175fe63962 100644 --- a/rust/agama-cli/src/commands.rs +++ b/rust/agama-cli/src/commands.rs @@ -23,6 +23,7 @@ use crate::config::ConfigCommands; use crate::logs::LogsCommands; use crate::profile::ProfileCommands; use crate::questions::QuestionsCommands; +use crate::FinishMethod; use clap::Subcommand; #[derive(Subcommand, Debug)] @@ -105,4 +106,15 @@ pub enum Commands { /// URL pointing to file for download url: String, }, + /// Finish the installation rebooting the system by default. + /// + /// This command finishes the installation by performing a set of tasks and rebooting the system by + /// default if the installation is completed successfully. + /// + /// Optionally an argument can be given for determining whether the system should be rebooted, + /// poweroff, halt or just stop at the of the installation. Values: [stop|reboot|poweroff|halt] + Finish { + #[clap(default_value = "reboot")] + method: Option, + }, } diff --git a/rust/agama-cli/src/error.rs b/rust/agama-cli/src/error.rs index b2afcb357a..cd79421bb5 100644 --- a/rust/agama-cli/src/error.rs +++ b/rust/agama-cli/src/error.rs @@ -27,6 +27,8 @@ pub enum CliError { Validation, #[error("Could not start the installation")] Installation, + #[error("The installation has not finished correctly")] + NotFinished, #[error("Could not read the password")] InteractivePassword(#[source] InquireError), #[error("Could not read the password from the standard input")] diff --git a/rust/agama-cli/src/lib.rs b/rust/agama-cli/src/lib.rs index 836a9b787e..dd5a43fddc 100644 --- a/rust/agama-cli/src/lib.rs +++ b/rust/agama-cli/src/lib.rs @@ -18,6 +18,7 @@ // To contact SUSE LLC about this file by physical or electronic mail, you may // find current contact information at www.suse.com. +use agama_lib::manager::FinishMethod; use clap::{Args, Parser}; mod auth; @@ -129,6 +130,25 @@ async fn install(manager: &ManagerClient<'_>, max_attempts: u8) -> anyhow::Resul Ok(()) } +/// Finish the instalation with the given method +/// +/// Before finishing, it makes sure that the manager is idle. +/// +/// * `manager`: the manager client. +async fn finish(manager: &ManagerClient<'_>, method: FinishMethod) -> anyhow::Result<()> { + if manager.is_busy().await { + println!("Agama's manager is busy. Waiting until it is ready..."); + } + + // Make sure that the manager is ready + manager.wait().await?; + if !manager.finish(method).await? { + eprintln!("Cannot finish the installation ({method})"); + return Err(CliError::NotFinished)?; + } + Ok(()) +} + async fn show_progress() -> Result<(), ServiceError> { // wait 1 second to give other task chance to start, so progress can display something tokio::time::sleep(Duration::from_secs(1)).await; @@ -211,6 +231,11 @@ pub async fn run_command(cli: Cli) -> Result<(), ServiceError> { let manager = build_manager().await?; install(&manager, 3).await? } + Commands::Finish { method } => { + let manager = build_manager().await?; + let method = method.unwrap_or_default(); + finish(&manager, method).await?; + } Commands::Questions(subcommand) => run_questions_cmd(client, subcommand).await?, Commands::Logs(subcommand) => run_logs_cmd(client, subcommand).await?, Commands::Download { url } => Transfer::get(&url, std::io::stdout())?, diff --git a/rust/agama-lib/share/examples/profile.jsonnet b/rust/agama-lib/share/examples/profile.jsonnet index 5b74cd82dc..88b3624885 100644 --- a/rust/agama-lib/share/examples/profile.jsonnet +++ b/rust/agama-lib/share/examples/profile.jsonnet @@ -37,7 +37,7 @@ local memory = agama.findByID(agama.lshw, 'memory').size; }, root: { password: 'nots3cr3t', - sshKey: '...', + sshPublicKey: '...', }, // look ma, there are comments! localization: { diff --git a/rust/agama-lib/share/profile.schema.json b/rust/agama-lib/share/profile.schema.json index ef9113b239..82c62a4f2b 100644 --- a/rust/agama-lib/share/profile.schema.json +++ b/rust/agama-lib/share/profile.schema.json @@ -20,6 +20,14 @@ "$ref": "#/$defs/preScript" } }, + "postPartitioning": { + "title": "Post-partitioning scripts", + "description": "User-defined scripts to run after the partitioning finishes", + "type": "array", + "items": { + "$ref": "#/$defs/postPartitioning" + } + }, "post": { "title": "Post-installation scripts", "description": "User-defined scripts to run after the installation finishes", @@ -492,6 +500,28 @@ "required": ["name"], "oneOf": [{ "required": ["body"] }, { "required": ["url"] }] }, + "postPartitioning": { + "title": "User-defined installation script that runs after the partitioning finishes", + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "description": "Script name, to be used as file name", + "type": "string" + }, + "body": { + "title": "Script content", + "description": "Script content, starting with the shebang", + "type": "string" + }, + "url": { + "title": "Script URL", + "description": "URL to fetch the script from" + } + }, + "required": ["name"], + "oneOf": [{ "required": ["body"] }, { "required": ["url"] }] + }, "postScript": { "title": "User-defined installation script that runs after the installation finishes", "type": "object", diff --git a/rust/agama-lib/src/manager.rs b/rust/agama-lib/src/manager.rs index 6eaf80bf43..7b9d995d18 100644 --- a/rust/agama-lib/src/manager.rs +++ b/rust/agama-lib/src/manager.rs @@ -85,6 +85,38 @@ impl TryFrom for InstallationPhase { } } +/// Finish method +#[derive( + Serialize, + Deserialize, + Debug, + PartialEq, + Eq, + Clone, + Copy, + strum::Display, + strum::EnumString, + utoipa::ToSchema, +)] +#[strum(serialize_all = "camelCase")] +#[serde(rename_all = "camelCase")] +pub enum FinishMethod { + // Halt the system + Halt, + // Reboots the system + Reboot, + // Do nothing at the end of the installation + Stop, + // Poweroff the system + Poweroff, +} + +impl Default for FinishMethod { + fn default() -> Self { + Self::Reboot + } +} + impl<'a> ManagerClient<'a> { pub async fn new(connection: Connection) -> zbus::Result> { Ok(Self { @@ -116,9 +148,13 @@ impl<'a> ManagerClient<'a> { Ok(self.manager_proxy.commit().await?) } - /// Executes the after installation tasks. - pub async fn finish(&self) -> Result<(), ServiceError> { - Ok(self.manager_proxy.finish().await?) + /// Executes the after installation tasks finishing with the method given or rebooting the + /// system by default. + pub async fn finish(&self, method: FinishMethod) -> Result { + Ok(self + .manager_proxy + .finish(&method.to_string().as_str()) + .await?) } /// Determines whether it is possible to start the installation. diff --git a/rust/agama-lib/src/product.rs b/rust/agama-lib/src/product.rs index f4f57f31bf..c1ba89cd83 100644 --- a/rust/agama-lib/src/product.rs +++ b/rust/agama-lib/src/product.rs @@ -26,7 +26,6 @@ pub mod proxies; mod settings; mod store; -pub use crate::software::model::RegistrationRequirement; pub use client::{Product, ProductClient}; pub use http_client::ProductHTTPClient; pub use settings::ProductSettings; diff --git a/rust/agama-lib/src/product/client.rs b/rust/agama-lib/src/product/client.rs index df58db028a..96abe8e417 100644 --- a/rust/agama-lib/src/product/client.rs +++ b/rust/agama-lib/src/product/client.rs @@ -18,12 +18,11 @@ // To contact SUSE LLC about this file by physical or electronic mail, you may // find current contact information at www.suse.com. -use std::collections::HashMap; - use crate::dbus::{get_optional_property, get_property}; use crate::error::ServiceError; use crate::software::proxies::SoftwareProductProxy; use serde::Serialize; +use std::collections::HashMap; use zbus::Connection; use super::proxies::RegistrationProxy; diff --git a/rust/agama-lib/src/product/proxies.rs b/rust/agama-lib/src/product/proxies.rs index 8207560c0d..23e37962d3 100644 --- a/rust/agama-lib/src/product/proxies.rs +++ b/rust/agama-lib/src/product/proxies.rs @@ -63,8 +63,4 @@ pub trait Registration { /// RegCode property #[zbus(property)] fn reg_code(&self) -> zbus::Result; - - /// Requirement property - #[zbus(property)] - fn requirement(&self) -> zbus::Result; } diff --git a/rust/agama-lib/src/product/store.rs b/rust/agama-lib/src/product/store.rs index c1a3f42297..e077ced587 100644 --- a/rust/agama-lib/src/product/store.rs +++ b/rust/agama-lib/src/product/store.rs @@ -121,8 +121,7 @@ mod test { .body( r#"{ "key": "", - "email": "", - "requirement": "NotRequired" + "email": "" }"#, ); }); diff --git a/rust/agama-lib/src/proxies/manager1.rs b/rust/agama-lib/src/proxies/manager1.rs index e311a77878..3ac0d73397 100644 --- a/rust/agama-lib/src/proxies/manager1.rs +++ b/rust/agama-lib/src/proxies/manager1.rs @@ -36,7 +36,7 @@ pub trait Manager1 { fn commit(&self) -> zbus::Result<()>; /// Finish method - fn finish(&self) -> zbus::Result<()>; + fn finish(&self, method: &str) -> zbus::Result; /// Probe method fn probe(&self) -> zbus::Result<()>; diff --git a/rust/agama-lib/src/scripts/model.rs b/rust/agama-lib/src/scripts/model.rs index 3ad9343712..80bc2d2569 100644 --- a/rust/agama-lib/src/scripts/model.rs +++ b/rust/agama-lib/src/scripts/model.rs @@ -39,6 +39,7 @@ use super::ScriptError; #[serde(rename_all = "camelCase")] pub enum ScriptsGroup { Pre, + PostPartitioning, Post, Init, } @@ -84,9 +85,10 @@ pub enum ScriptSource { /// /// There are different types of scripts that can run at different stages of the installation. #[derive(Clone, Debug, Serialize, Deserialize, utoipa::ToSchema)] -#[serde(tag = "type")] +#[serde(tag = "type", rename_all = "camelCase")] pub enum Script { Pre(PreScript), + PostPartitioning(PostPartitioningScript), Post(PostScript), Init(InitScript), } @@ -95,6 +97,7 @@ impl Script { fn base(&self) -> &BaseScript { match self { Script::Pre(inner) => &inner.base, + Script::PostPartitioning(inner) => &inner.base, Script::Post(inner) => &inner.base, Script::Init(inner) => &inner.base, } @@ -119,6 +122,7 @@ impl Script { pub fn group(&self) -> ScriptsGroup { match self { Script::Pre(_) => ScriptsGroup::Pre, + Script::PostPartitioning(_) => ScriptsGroup::PostPartitioning, Script::Post(_) => ScriptsGroup::Post, Script::Init(_) => ScriptsGroup::Init, } @@ -136,6 +140,7 @@ impl Script { .join(self.name()); let runner = match self { Script::Pre(inner) => &inner.runner(), + Script::PostPartitioning(inner) => &inner.runner(), Script::Post(inner) => &inner.runner(), Script::Init(inner) => &inner.runner(), }; @@ -183,6 +188,31 @@ impl TryFrom