Move actions into OS-specific

This commit is contained in:
Ana Hobden 2022-10-28 09:29:15 -07:00
parent d71827515a
commit a61045f5a8
37 changed files with 56 additions and 58 deletions

View file

@ -1,26 +0,0 @@
/*! Actions which do not only call other base plugins. */
mod configure_nix_daemon_service;
mod create_directory;
mod create_file;
mod create_group;
mod create_or_append_file;
mod create_user;
pub mod darwin;
mod fetch_nix;
mod move_unpacked_nix;
mod setup_default_profile;
mod start_systemd_unit;
mod systemd_sysext_merge;
pub use configure_nix_daemon_service::{ConfigureNixDaemonService, ConfigureNixDaemonServiceError};
pub use create_directory::{CreateDirectory, CreateDirectoryError};
pub use create_file::{CreateFile, CreateFileError};
pub use create_group::{CreateGroup, CreateGroupError};
pub use create_or_append_file::{CreateOrAppendFile, CreateOrAppendFileError};
pub use create_user::{CreateUser, CreateUserError};
pub use fetch_nix::{FetchNix, FetchNixError};
pub use move_unpacked_nix::{MoveUnpackedNix, MoveUnpackedNixError};
pub use setup_default_profile::{SetupDefaultProfile, SetupDefaultProfileError};
pub use start_systemd_unit::{StartSystemdUnit, StartSystemdUnitError};
pub use systemd_sysext_merge::{SystemdSysextMerge, SystemdSysextMergeError};

View file

@ -2,8 +2,11 @@ use reqwest::Url;
use crate::{ use crate::{
action::{ action::{
base::{ConfigureNixDaemonService, SetupDefaultProfile}, common::{
meta::{ConfigureShellProfile, PlaceChannelConfiguration, PlaceNixConfiguration}, ConfigureShellProfile, PlaceChannelConfiguration, PlaceNixConfiguration,
SetupDefaultProfile,
},
linux::ConfigureNixDaemonService,
Action, ActionDescription, ActionState, Action, ActionDescription, ActionState,
}, },
cli::arg::ChannelValue, cli::arg::ChannelValue,

View file

@ -2,7 +2,7 @@ use std::path::Path;
use tokio::task::{JoinError, JoinSet}; use tokio::task::{JoinError, JoinSet};
use crate::action::base::{CreateOrAppendFile, CreateOrAppendFileError}; use crate::action::common::{CreateOrAppendFile, CreateOrAppendFileError};
use crate::{ use crate::{
action::{Action, ActionDescription, ActionState}, action::{Action, ActionDescription, ActionState},
BoxableError, BoxableError,

View file

@ -1,4 +1,4 @@
use crate::action::base::{CreateDirectory, CreateDirectoryError}; use crate::action::common::{CreateDirectory, CreateDirectoryError};
use crate::action::{Action, ActionDescription, ActionState}; use crate::action::{Action, ActionDescription, ActionState};
const PATHS: &[&str] = &[ const PATHS: &[&str] = &[

View file

@ -4,7 +4,7 @@ use crate::CommonSettings;
use crate::{ use crate::{
action::{ action::{
base::{CreateGroup, CreateGroupError, CreateUser, CreateUserError}, common::{CreateGroup, CreateGroupError, CreateUser, CreateUserError},
Action, ActionDescription, ActionState, Action, ActionDescription, ActionState,
}, },
BoxableError, BoxableError,

View file

@ -2,19 +2,32 @@
mod configure_nix; mod configure_nix;
mod configure_shell_profile; mod configure_shell_profile;
mod create_directory;
mod create_file;
mod create_group;
mod create_nix_tree; mod create_nix_tree;
mod create_systemd_sysext; mod create_or_append_file;
mod create_user;
mod create_users_and_group; mod create_users_and_group;
pub mod darwin; mod fetch_nix;
mod move_unpacked_nix;
mod place_channel_configuration; mod place_channel_configuration;
mod place_nix_configuration; mod place_nix_configuration;
mod provision_nix; mod provision_nix;
mod setup_default_profile;
pub use configure_nix::ConfigureNix; pub use configure_nix::ConfigureNix;
pub use configure_shell_profile::ConfigureShellProfile; pub use configure_shell_profile::ConfigureShellProfile;
pub use create_directory::{CreateDirectory, CreateDirectoryError};
pub use create_file::{CreateFile, CreateFileError};
pub use create_group::{CreateGroup, CreateGroupError};
pub use create_nix_tree::{CreateNixTree, CreateNixTreeError}; pub use create_nix_tree::{CreateNixTree, CreateNixTreeError};
pub use create_systemd_sysext::{CreateSystemdSysext, CreateSystemdSysextError}; pub use create_or_append_file::{CreateOrAppendFile, CreateOrAppendFileError};
pub use create_user::{CreateUser, CreateUserError};
pub use create_users_and_group::{CreateUsersAndGroup, CreateUsersAndGroupError}; pub use create_users_and_group::{CreateUsersAndGroup, CreateUsersAndGroupError};
pub use fetch_nix::{FetchNix, FetchNixError};
pub use move_unpacked_nix::{MoveUnpackedNix, MoveUnpackedNixError};
pub use place_channel_configuration::{PlaceChannelConfiguration, PlaceChannelConfigurationError}; pub use place_channel_configuration::{PlaceChannelConfiguration, PlaceChannelConfigurationError};
pub use place_nix_configuration::{PlaceNixConfiguration, PlaceNixConfigurationError}; pub use place_nix_configuration::{PlaceNixConfiguration, PlaceNixConfigurationError};
pub use provision_nix::{ProvisionNix, ProvisionNixError}; pub use provision_nix::{ProvisionNix, ProvisionNixError};
pub use setup_default_profile::{SetupDefaultProfile, SetupDefaultProfileError};

View file

@ -5,7 +5,7 @@ use crate::{
BoxableError, BoxableError,
}; };
use crate::action::base::{CreateFile, CreateFileError}; use crate::action::common::{CreateFile, CreateFileError};
#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)] #[derive(Debug, serde::Deserialize, serde::Serialize, Clone)]
pub struct PlaceChannelConfiguration { pub struct PlaceChannelConfiguration {

View file

@ -1,6 +1,6 @@
use crate::action::{Action, ActionDescription, ActionState}; use crate::action::{Action, ActionDescription, ActionState};
use crate::action::base::{CreateDirectory, CreateDirectoryError, CreateFile, CreateFileError}; use crate::action::common::{CreateDirectory, CreateDirectoryError, CreateFile, CreateFileError};
const NIX_CONF_FOLDER: &str = "/etc/nix"; const NIX_CONF_FOLDER: &str = "/etc/nix";
const NIX_CONF: &str = "/etc/nix/nix.conf"; const NIX_CONF: &str = "/etc/nix/nix.conf";

View file

@ -2,7 +2,7 @@ use std::path::PathBuf;
use tokio::task::JoinError; use tokio::task::JoinError;
use crate::action::base::{ use crate::action::common::{
CreateDirectoryError, FetchNix, FetchNixError, MoveUnpackedNix, MoveUnpackedNixError, CreateDirectoryError, FetchNix, FetchNixError, MoveUnpackedNix, MoveUnpackedNixError,
}; };
use crate::CommonSettings; use crate::CommonSettings;

View file

@ -6,14 +6,12 @@ use tokio::process::Command;
use crate::{ use crate::{
action::{ action::{
base::{ common::{CreateFile, CreateFileError, CreateOrAppendFile, CreateOrAppendFileError},
darwin::{ darwin::{
BootstrapVolume, BootstrapVolumeError, CreateSyntheticObjects, BootstrapVolume, BootstrapVolumeError, CreateSyntheticObjects,
CreateSyntheticObjectsError, CreateVolume, CreateVolumeError, EnableOwnership, CreateSyntheticObjectsError, CreateVolume, CreateVolumeError, EnableOwnership,
EnableOwnershipError, EncryptVolume, EncryptVolumeError, UnmountVolume, EnableOwnershipError, EncryptVolume, EncryptVolumeError, UnmountVolume,
UnmountVolumeError, UnmountVolumeError,
},
CreateFile, CreateFileError, CreateOrAppendFile, CreateOrAppendFileError,
}, },
Action, ActionDescription, ActionState, Action, ActionDescription, ActionState,
}, },

View file

@ -1,4 +1,5 @@
mod bootstrap_volume; mod bootstrap_volume;
mod create_apfs_volume;
mod create_synthetic_objects; mod create_synthetic_objects;
mod create_volume; mod create_volume;
mod enable_ownership; mod enable_ownership;
@ -7,6 +8,7 @@ mod kickstart_launchctl_service;
mod unmount_volume; mod unmount_volume;
pub use bootstrap_volume::{BootstrapVolume, BootstrapVolumeError}; pub use bootstrap_volume::{BootstrapVolume, BootstrapVolumeError};
pub use create_apfs_volume::{CreateApfsVolume, CreateApfsVolumeError};
pub use create_synthetic_objects::{CreateSyntheticObjects, CreateSyntheticObjectsError}; pub use create_synthetic_objects::{CreateSyntheticObjects, CreateSyntheticObjectsError};
pub use create_volume::{CreateVolume, CreateVolumeError}; pub use create_volume::{CreateVolume, CreateVolumeError};
pub use enable_ownership::{EnableOwnership, EnableOwnershipError}; pub use enable_ownership::{EnableOwnership, EnableOwnershipError};

View file

@ -1,6 +1,6 @@
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use crate::action::base::{CreateDirectory, CreateDirectoryError, CreateFile, CreateFileError}; use crate::action::common::{CreateDirectory, CreateDirectoryError, CreateFile, CreateFileError};
use crate::{ use crate::{
action::{Action, ActionDescription, ActionState}, action::{Action, ActionDescription, ActionState},
BoxableError, BoxableError,

9
src/action/linux/mod.rs Normal file
View file

@ -0,0 +1,9 @@
mod configure_nix_daemon_service;
mod create_systemd_sysext;
mod start_systemd_unit;
mod systemd_sysext_merge;
pub use configure_nix_daemon_service::{ConfigureNixDaemonService, ConfigureNixDaemonServiceError};
pub use create_systemd_sysext::{CreateSystemdSysext, CreateSystemdSysextError};
pub use start_systemd_unit::{StartSystemdUnit, StartSystemdUnitError};
pub use systemd_sysext_merge::{SystemdSysextMerge, SystemdSysextMergeError};

View file

@ -1,2 +0,0 @@
mod create_apfs_volume;
pub use create_apfs_volume::{CreateApfsVolume, CreateApfsVolumeError};

View file

@ -1,5 +1,6 @@
pub mod base; pub mod common;
pub mod meta; pub mod darwin;
pub mod linux;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};

View file

@ -3,7 +3,7 @@ use std::path::PathBuf;
use crate::{ use crate::{
action::{Action, ActionDescription}, action::{Action, ActionDescription},
planner::Planner, planner::Planner,
BuiltinPlanner, HarmonicError, HarmonicError,
}; };
#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)] #[derive(Debug, serde::Deserialize, serde::Serialize, Clone)]

View file

@ -5,8 +5,8 @@ use tokio::process::Command;
use crate::{ use crate::{
action::{ action::{
base::darwin::KickstartLaunchctlService, common::{ConfigureNix, ProvisionNix},
meta::{darwin::CreateApfsVolume, ConfigureNix, ProvisionNix}, darwin::{CreateApfsVolume, KickstartLaunchctlService},
}, },
execute_command, execute_command,
os::darwin::DiskUtilOutput, os::darwin::DiskUtilOutput,

View file

@ -1,9 +1,9 @@
use crate::{ use crate::{
action::{ action::{
base::{CreateDirectory, StartSystemdUnit}, common::{ConfigureNix, CreateDirectory, ProvisionNix},
meta::{ConfigureNix, ProvisionNix}, linux::StartSystemdUnit,
}, },
planner::{BuiltinPlannerError, Planner}, planner::Planner,
BuiltinPlanner, CommonSettings, InstallPlan, BuiltinPlanner, CommonSettings, InstallPlan,
}; };

View file

@ -1,7 +1,7 @@
use crate::{ use crate::{
action::{ action::{
base::{CreateDirectory, StartSystemdUnit}, common::{CreateDirectory, ProvisionNix},
meta::{CreateSystemdSysext, ProvisionNix}, linux::{CreateSystemdSysext, StartSystemdUnit},
}, },
planner::Planner, planner::Planner,
BuiltinPlanner, CommonSettings, InstallPlan, BuiltinPlanner, CommonSettings, InstallPlan,