diff --git a/config.example.toml b/config.example.toml index 07d96ae2..72576727 100644 --- a/config.example.toml +++ b/config.example.toml @@ -167,6 +167,8 @@ # Extra Home Manager arguments # home_manager_arguments = ["--flake", "file"] +# subcommand to use for apt variants != nala (dist-upgrade (default) or upgrade) +# apt_command = "dist-upgrade" [git] # How many repos to pull at max in parallel diff --git a/src/config.rs b/src/config.rs index f96e4b9d..338f4e11 100644 --- a/src/config.rs +++ b/src/config.rs @@ -313,6 +313,7 @@ pub struct Linux { nix_env_arguments: Option, #[merge(strategy = crate::utils::merge_strategies::string_append_opt)] + apt_command: Option, apt_arguments: Option, enable_tlmgr: Option, @@ -1228,6 +1229,15 @@ impl Config { .unwrap_or("") } + /// apt command: upgrade or dist-upgrade + pub fn apt_command(&self) -> &str { + self.config_file + .linux + .as_ref() + .and_then(|linux| linux.apt_command.as_deref()) + .unwrap_or("dist-upgrade") + } + /// Extra apt arguments pub fn apt_arguments(&self) -> Option<&str> { self.config_file diff --git a/src/steps/os/linux.rs b/src/steps/os/linux.rs index 6e8b2bd8..fd7a6255 100644 --- a/src/steps/os/linux.rs +++ b/src/steps/os/linux.rs @@ -518,7 +518,8 @@ fn upgrade_debian(ctx: &ExecutionContext) -> Result<()> { if is_nala { command.arg("upgrade"); } else { - command.arg("dist-upgrade"); + let apt_command = ctx.config().apt_command(); + command.arg(apt_command); }; if ctx.config().yes(Step::System) { command.arg("-y");