Skip to content

Commit

Permalink
v3.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
xtexx committed Dec 15, 2024
1 parent 97cc4f9 commit 98174fb
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 45 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ciel-rs"
version = "3.5.2"
version = "3.6.0"
description = "An nspawn container manager"
license = "MIT"
authors = ["liushuyu <[email protected]>"]
Expand Down
2 changes: 0 additions & 2 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ pub fn build_cli() -> Command {
.alias("sh")
.arg(instance_arg.clone().help("Instance to be used"))
.arg(Arg::new("COMMANDS").required(false).num_args(1..))
.args(instance_configs.iter().cloned())
.about("Start an interactive shell"),
)
.subcommand(
Expand Down Expand Up @@ -226,7 +225,6 @@ pub fn build_cli() -> Command {
.arg(Arg::new("CONTINUE").conflicts_with("SELECT").short('c').long("resume").alias("continue").num_args(1).help("Continue from a Ciel checkpoint"))
.arg(Arg::new("SELECT").num_args(0..=1).long("stage-select").help("Select the starting point for a build"))
.arg(Arg::new("PACKAGES").conflicts_with("CONTINUE").num_args(1..))
.args(instance_configs.iter().cloned())
.about("Build the packages using the specified instance"),
)
.subcommand(
Expand Down
42 changes: 1 addition & 41 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ mod network;
mod overlayfs;
mod repo;

use actions::{inspect_container, patch_instance_config, rollback_container};
use anyhow::{anyhow, bail, Context, Result};
use clap::ArgMatches;
use config::{InstanceConfig, WorkspaceConfig};
use config::WorkspaceConfig;
use console::{style, user_attended};
use dotenvy::dotenv;
use libc::exit;
use std::process;
use std::{path::Path, process::Command};

Expand Down Expand Up @@ -268,20 +266,6 @@ fn main() -> Result<()> {
}
("shell", args) => {
let instance = get_instance_option(args)?;
let config_ref = InstanceConfig::get(&instance)?;
let mut config = config_ref.read().unwrap().clone();
patch_instance_config(&instance, args, &mut config)?;

let container = inspect_container(&instance)?;
let ephermal_config = config != InstanceConfig::load_mounted(&instance)?;
let need_rollback = container.mounted && ephermal_config;
if need_rollback {
rollback_container(&instance)?;
}
if ephermal_config {
*config_ref.write().unwrap() = config;
}

if let Some(cmd) = args.get_many::<String>("COMMANDS") {
let command = cmd
.into_iter()
Expand Down Expand Up @@ -317,30 +301,12 @@ fn main() -> Result<()> {
}
("build", args) => {
let instance = get_instance_option(args)?;
let config_ref = InstanceConfig::get(&instance)?;
let mut config = config_ref.read().unwrap().clone();
patch_instance_config(&instance, args, &mut config)?;

let container = inspect_container(&instance)?;
let ephermal_config = config != InstanceConfig::load_mounted(&instance)?;
let need_rollback = container.mounted && ephermal_config;
if need_rollback {
rollback_container(&instance)?;
}
if ephermal_config {
*config_ref.write().unwrap() = config;
}

let settings = BuildSettings {
offline: args.get_flag("OFFLINE"),
stage2: args.get_flag("STAGE2"),
};
let mut state = None;
if let Some(cont) = args.get_one::<String>("CONTINUE") {
if container.started {
error!("The current instance has not been started. Cannot continue.");
process::exit(1);
}
state = Some(actions::load_build_checkpoint(cont)?);
let empty: Vec<&str> = Vec::new();
let status = actions::package_build(&instance, empty.into_iter(), state, settings)?;
Expand All @@ -353,12 +319,6 @@ fn main() -> Result<()> {
process::exit(1);
}
let packages = packages.unwrap();

if need_rollback {
warn!("The current instance configuration differs from the mounted one. Rolling back.");
actions::rollback_container(&instance)?;
}

if args.contains_id("SELECT") {
let start_package = args.get_one::<String>("SELECT");
let status =
Expand Down

0 comments on commit 98174fb

Please sign in to comment.