Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow to configure the apt upgrade method on debian #749

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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: 2 additions & 0 deletions config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@
nix_env_arguments: Option<String>,

#[merge(strategy = crate::utils::merge_strategies::string_append_opt)]
apt_command: Option<String>,
apt_arguments: Option<String>,

enable_tlmgr: Option<bool>,
Expand Down Expand Up @@ -1228,6 +1229,15 @@
.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")
}

Check warning on line 1240 in src/config.rs

View check run for this annotation

Codecov / codecov/patch

src/config.rs#L1232-L1240

Added lines #L1232 - L1240 were not covered by tests
/// Extra apt arguments
pub fn apt_arguments(&self) -> Option<&str> {
self.config_file
Expand Down
3 changes: 2 additions & 1 deletion src/steps/os/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,8 @@
if is_nala {
command.arg("upgrade");
} else {
command.arg("dist-upgrade");
let apt_command = ctx.config().apt_command();
command.arg(apt_command);

Check warning on line 522 in src/steps/os/linux.rs

View check run for this annotation

Codecov / codecov/patch

src/steps/os/linux.rs#L521-L522

Added lines #L521 - L522 were not covered by tests
};
if ctx.config().yes(Step::System) {
command.arg("-y");
Expand Down
Loading