Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion rust/agama-cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub enum ConfigCommands {

/// Validate a profile using JSON Schema
///
/// Schema is available at /usr/share/agama-cli/profile.schema.json
/// Schema is available at /usr/share/agama/schema/profile.schema.json
/// Note: validation is always done as part of all other "agama config" commands.
Validate {
/// JSON file, URL or path or `-` for standard input
Expand Down
7 changes: 5 additions & 2 deletions rust/agama-lib/src/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ use url::Url;
pub mod http_client;
pub use http_client::ProfileHTTPClient;

pub const DEFAULT_SCHEMA_DIR: &str = "/usr/share/agama-cli";
pub const DEFAULT_SCHEMA_DIR: &str = "/usr/share/agama/schema";
pub const DEFAULT_JSONNET_DIR: &str = "/usr/share/agama/jsonnet";

/// Downloads and converts autoyast profile.
pub struct AutoyastProfileImporter {
Expand Down Expand Up @@ -231,7 +232,9 @@ impl ProfileEvaluator {
.output()
.context("Failed to run lshw")?;
let helpers = fs::read_to_string("share/agama.libsonnet")
.or_else(|_| fs::read_to_string("/usr/share/agama-cli/agama.libsonnet"))
.or_else(|_| {
fs::read_to_string(PathBuf::from(DEFAULT_JSONNET_DIR).join("agama.libsonnet"))
})
.context("Failed to read agama.libsonnet")?;
let mut file = fs::File::create(path)?;
file.write_all(b"{\n")?;
Expand Down
4 changes: 2 additions & 2 deletions rust/agama-utils/src/licenses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ impl Registry {

impl Default for Registry {
fn default() -> Self {
let relative_path = PathBuf::from("share/eula");
let relative_path = PathBuf::from("test/share/eula");
let path = if relative_path.exists() {
relative_path
} else {
Expand All @@ -222,7 +222,7 @@ mod test {
use std::path::Path;

fn build_registry() -> Registry {
let mut repo = Registry::new(Path::new("../share/eula"));
let mut repo = Registry::new(Path::new("../test/share/eula"));
repo.read().unwrap();
repo
}
Expand Down
14 changes: 7 additions & 7 deletions rust/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,20 @@ install -D -t "${DESTDIR}${bindir}" "${SRCDIR}/target/${RUST_TARGET}/agama-web-s

install6 -D -p "${SRCDIR}"/share/agama.pam "${DESTDIR}${pamvendordir}"/agama

install6 -D -t "${DESTDIR}${datadir}"/agama-cli "${SRCDIR}"/agama-lib/share/iscsi.schema.json
install6 -D -t "${DESTDIR}${datadir}"/agama-cli "${SRCDIR}"/agama-lib/share/profile.schema.json
install6 -D -t "${DESTDIR}${datadir}"/agama-cli "${SRCDIR}"/agama-lib/share/storage.schema.json
install6 -D -t "${DESTDIR}${datadir}"/agama-cli "${SRCDIR}"/agama-lib/share/storage.model.schema.json
install6 -D -t "${DESTDIR}${datadir}"/agama-cli "${SRCDIR}"/share/agama.libsonnet
install6 -D -t "${DESTDIR}${datadir}"/agama/schema "${SRCDIR}"/agama-lib/share/iscsi.schema.json
install6 -D -t "${DESTDIR}${datadir}"/agama/schema "${SRCDIR}"/agama-lib/share/profile.schema.json
install6 -D -t "${DESTDIR}${datadir}"/agama/schema "${SRCDIR}"/agama-lib/share/storage.schema.json
install6 -D -t "${DESTDIR}${datadir}"/agama/schema "${SRCDIR}"/agama-lib/share/storage.model.schema.json
install6 -D -t "${DESTDIR}${datadir}"/agama/jsonnet "${SRCDIR}"/share/agama.libsonnet

install -D -t "${DESTDIR}${libexecdir}" "${SRCDIR}"/share/agama-scripts.sh

install6 -D -t "${DESTDIR}${unitdir}" "${SRCDIR}"/share/agama-autoinstall.service
install6 -D -t "${DESTDIR}${unitdir}" "${SRCDIR}"/share/agama-scripts.service
install6 -D -t "${DESTDIR}${unitdir}" "${SRCDIR}"/share/agama-web-server.service

# instal licenses
install6 -D -t "${DESTDIR}${datadir}"/agama/eula/license.final "${SRCDIR}"/share/eula/license.final/*
# create the licenses directory
install -d -m 0755 "${DESTDIR}${datadir}"/agama/eula

# install manpages
install6 -D -t "${DESTDIR}${mandir}"/man1 "${SRCDIR}"/out/man/*
Expand Down
30 changes: 24 additions & 6 deletions rust/package/agama.spec
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ BuildRequires: python-langtable-data
Requires: python-langtable-data
# dependency on the YaST part of Agama
Requires: agama-yast
Requires: agama-common

%description
Agama is a service-based Linux installer. It is composed of an HTTP-based API,
Expand All @@ -84,13 +85,26 @@ Url: https://github.com/agama-project/agama
Agama is a service-based Linux installer. This package contains the
auto-installation service.

%package -n agama-common
# This will be set by osc services, that will run after this.
Version: 0
Release: 0
Summary: Common files for Agama server and CLI.
License: GPL-2.0-only
Url: https://github.com/agama-project/agama

%description -n agama-common
Files that are needed by the Agama server and the command-line interface, like
the JSON schemas or the Jsonnet libraries.

%package -n agama-cli
# This will be set by osc services, that will run after this.
Version: 0
Release: 0
Summary: Agama command-line interface
License: GPL-2.0-only
Url: https://github.com/agama-project/agama
Requires: agama-common

%description -n agama-cli
Command line program to interact with the Agama installer.
Expand Down Expand Up @@ -223,19 +237,23 @@ echo $PATH
%{_bindir}/agama-web-server
%{_pam_vendordir}/agama
%{_unitdir}/agama-web-server.service
%dir %{_datadir}/agama/eula

%files -n agama-common
%dir %{_datadir}/agama/jsonnet
%{_datadir}/agama/jsonnet/agama.libsonnet
%dir %{_datadir}/agama/schema
%{_datadir}/agama/schema/iscsi.schema.json
%{_datadir}/agama/schema/profile.schema.json
%{_datadir}/agama/schema/storage.schema.json
%{_datadir}/agama/schema/storage.model.schema.json

%files -n agama-autoinstall
%{_bindir}/agama-autoinstall
%{_unitdir}/agama-autoinstall.service

%files -n agama-cli
%{_bindir}/agama
%dir %{_datadir}/agama-cli
%{_datadir}/agama-cli/agama.libsonnet
%{_datadir}/agama-cli/iscsi.schema.json
%{_datadir}/agama-cli/profile.schema.json
%{_datadir}/agama-cli/storage.schema.json
%{_datadir}/agama-cli/storage.model.schema.json
%{_mandir}/man1/agama*1%{?ext_man}

%files -n agama-cli-bash-completion
Expand Down
Loading
Loading