Fix system updates for Nobara (#661)
* Fix system updates for Nobara * fmt * Add os-release test for Nobara * Make requested changes * cargo fmt
This commit is contained in:
@@ -39,6 +39,7 @@ pub enum Distribution {
|
||||
Exherbo,
|
||||
NixOS,
|
||||
KDENeon,
|
||||
Nobara,
|
||||
}
|
||||
|
||||
impl Distribution {
|
||||
@@ -53,7 +54,7 @@ impl Distribution {
|
||||
Some("alpine") => Distribution::Alpine,
|
||||
Some("centos") | Some("rhel") | Some("ol") => Distribution::CentOS,
|
||||
Some("clear-linux-os") => Distribution::ClearLinux,
|
||||
Some("fedora") | Some("nobara") => {
|
||||
Some("fedora") => {
|
||||
return if let Some(variant) = variant {
|
||||
if variant.contains(&"Silverblue")
|
||||
|| variant.contains(&"Kinoite")
|
||||
@@ -69,6 +70,7 @@ impl Distribution {
|
||||
};
|
||||
}
|
||||
|
||||
Some("nobara") => Distribution::Nobara,
|
||||
Some("void") => Distribution::Void,
|
||||
Some("debian") | Some("pureos") | Some("Deepin") => Distribution::Debian,
|
||||
Some("arch") | Some("manjaro-arm") | Some("garuda") | Some("artix") => Distribution::Arch,
|
||||
@@ -152,6 +154,7 @@ impl Distribution {
|
||||
Distribution::Bedrock => update_bedrock(ctx),
|
||||
Distribution::OpenMandriva => upgrade_openmandriva(ctx),
|
||||
Distribution::PCLinuxOS => upgrade_pclinuxos(ctx),
|
||||
Distribution::Nobara => upgrade_nobara(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,6 +232,40 @@ fn upgrade_redhat(ctx: &ExecutionContext) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn upgrade_nobara(ctx: &ExecutionContext) -> Result<()> {
|
||||
let sudo = require_option(ctx.sudo().as_ref(), REQUIRE_SUDO.to_string())?;
|
||||
let pkg_manager = require("dnf")?;
|
||||
|
||||
let mut update_command = ctx.run_type().execute(sudo);
|
||||
update_command.arg(&pkg_manager);
|
||||
|
||||
if ctx.config().yes(Step::System) {
|
||||
update_command.arg("-y");
|
||||
}
|
||||
|
||||
update_command.arg("update");
|
||||
// See https://nobaraproject.org/docs/upgrade-troubleshooting/how-do-i-update-the-system/
|
||||
update_command.args([
|
||||
"rpmfusion-nonfree-release",
|
||||
"rpmfusion-free-release",
|
||||
"fedora-repos",
|
||||
"nobara-repos",
|
||||
]);
|
||||
update_command.arg("--refresh").status_checked()?;
|
||||
|
||||
let mut upgrade_command = ctx.run_type().execute(sudo);
|
||||
upgrade_command.arg(&pkg_manager);
|
||||
|
||||
if ctx.config().yes(Step::System) {
|
||||
upgrade_command.arg("-y");
|
||||
}
|
||||
|
||||
upgrade_command.arg("distro-sync");
|
||||
|
||||
upgrade_command.status_checked()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn upgrade_fedora_immutable(ctx: &ExecutionContext) -> Result<()> {
|
||||
let ostree = require("rpm-ostree")?;
|
||||
let mut command = ctx.run_type().execute(ostree);
|
||||
@@ -1115,4 +1152,9 @@ mod tests {
|
||||
fn test_solus() {
|
||||
test_template(include_str!("os_release/solus"), Distribution::Solus);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_nobara() {
|
||||
test_template(include_str!("os_release/nobara"), Distribution::Nobara);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user