* Bedrock Linux (fix #745) * Add more distributions * fix * fix * Fix * Merge * Move pacnew to the correct location * Version bump * Correct spelling for GNOME Shell extensions update (#778) * fix gnome shell extensions update object path (#788) * config: ArchPackageManager should be snake_case (#784) * config: ArchPackageManager should be snake_case * Remove unnecessary strum macro * Add arch_package_manager to config.example.toml * Add release pipeline * Run GNOME update only when using GNOME * Delete travis file and appveyor * Bump * Support rust 1.51.0 (#789) * Cross compilation * Bump * fix: GNOME detection for customized version (#790) Signed-off-by: Noel Georgi <git@frezbo.dev> * Add a flag to disable showing Arch Linux news (fix #786) * Bump * Update pacstall (fix #769) * Add an option to force vim plug update (#795) * Add an option to force vim plug update (fix #751) * Rustfmt * Update src/config.rs Co-authored-by: M*C*O <mcofficer@gmx.de> Co-authored-by: M*C*O <mcofficer@gmx.de> * Add new step pacdiff (#796) * Add Support for Spicetify (#798) * Look for ~/.config/emacs directory in Windows (fix #766) * Pass --force to doom when -y is set (fix #799) * Implement cleanup for flatpak (#801) * Cleanup flatpak * Fix compile error * Make sure we only move our values at the very end * Access config.cleanup() through ExecutionContext * Improve man page (#803) Wordings & argument format * Avoid running remote topgrade on the current host (fix #804) (#807) * Merge the command line and the configuration flags of --only and --disable (fix #805) (#806) * Merge the command line and the configuration flags of --only and --disable (fix #805) * Fix * Fix rust requirement in the readme * Selective yes (fix #802) (#808) * Selective yes flag (fix #802) * Selective yes flag (fix #802) * selective yes * MacOS * Fix bedrock detection * Bedrock fixes * format * Fedora fixes Co-authored-by: Björn Daase <bjoern.daase@gmail.com> Co-authored-by: modularTaco <37046961+modularTaco@users.noreply.github.com> Co-authored-by: M*C*O <mcofficer@gmx.de> Co-authored-by: Noel Georgi <git@frezbo.dev> Co-authored-by: Manuel Hässig <mhaessig@users.noreply.github.com> Co-authored-by: Janek <27jf@pm.me>
This commit is contained in:
committed by
GitHub
parent
ab3ff0ecae
commit
4716cb7c94
@@ -141,7 +141,7 @@ impl ArchPackageManager for Pacman {
|
|||||||
impl Pacman {
|
impl Pacman {
|
||||||
pub fn get(ctx: &ExecutionContext) -> Option<Self> {
|
pub fn get(ctx: &ExecutionContext) -> Option<Self> {
|
||||||
Some(Self {
|
Some(Self {
|
||||||
executable: which("powerpill").unwrap_or_else(|| PathBuf::from("/usr/bin/pacman")),
|
executable: which("powerpill").unwrap_or_else(|| PathBuf::from("pacman")),
|
||||||
sudo: ctx.sudo().to_owned()?,
|
sudo: ctx.sudo().to_owned()?,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -152,7 +152,7 @@ fn box_pacakge_manager<P: 'static + ArchPackageManager>(package_manager: P) -> B
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_arch_package_manager(ctx: &ExecutionContext) -> Option<Box<dyn ArchPackageManager>> {
|
pub fn get_arch_package_manager(ctx: &ExecutionContext) -> Option<Box<dyn ArchPackageManager>> {
|
||||||
let pacman = which("powerpill").unwrap_or_else(|| PathBuf::from("/usr/bin/pacman"));
|
let pacman = which("powerpill").unwrap_or_else(|| PathBuf::from("pacman"));
|
||||||
|
|
||||||
match ctx.config().arch_package_manager() {
|
match ctx.config().arch_package_manager() {
|
||||||
config::ArchPackageManager::Autodetect => YayParu::get("paru", &pacman)
|
config::ArchPackageManager::Autodetect => YayParu::get("paru", &pacman)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use crate::utils::{require, require_option, which, PathExt};
|
|||||||
use crate::Step;
|
use crate::Step;
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use ini::Ini;
|
use ini::Ini;
|
||||||
use log::debug;
|
use log::{debug, warn};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
@@ -26,6 +26,7 @@ struct OsRelease {
|
|||||||
pub enum Distribution {
|
pub enum Distribution {
|
||||||
Alpine,
|
Alpine,
|
||||||
Arch,
|
Arch,
|
||||||
|
Bedrock,
|
||||||
CentOS,
|
CentOS,
|
||||||
ClearLinux,
|
ClearLinux,
|
||||||
Fedora,
|
Fedora,
|
||||||
@@ -80,6 +81,10 @@ impl Distribution {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn detect() -> Result<Self> {
|
pub fn detect() -> Result<Self> {
|
||||||
|
if PathBuf::from("/bedrock").exists() {
|
||||||
|
return Ok(Distribution::Bedrock);
|
||||||
|
}
|
||||||
|
|
||||||
if PathBuf::from(OS_RELEASE_PATH).exists() {
|
if PathBuf::from(OS_RELEASE_PATH).exists() {
|
||||||
let os_release = Ini::load_from_file(OS_RELEASE_PATH)?;
|
let os_release = Ini::load_from_file(OS_RELEASE_PATH)?;
|
||||||
|
|
||||||
@@ -105,6 +110,7 @@ impl Distribution {
|
|||||||
Distribution::Exherbo => upgrade_exherbo(ctx),
|
Distribution::Exherbo => upgrade_exherbo(ctx),
|
||||||
Distribution::NixOS => upgrade_nixos(ctx),
|
Distribution::NixOS => upgrade_nixos(ctx),
|
||||||
Distribution::KDENeon => upgrade_neon(ctx),
|
Distribution::KDENeon => upgrade_neon(ctx),
|
||||||
|
Distribution::Bedrock => update_bedrock(ctx),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,6 +125,31 @@ impl Distribution {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn update_bedrock(ctx: &ExecutionContext) -> Result<()> {
|
||||||
|
let sudo = require_option(ctx.sudo().as_ref(), String::from("Sudo required"))?;
|
||||||
|
|
||||||
|
ctx.run_type().execute(sudo).args(&["brl", "update"]);
|
||||||
|
|
||||||
|
let output = Command::new("brl").arg("list").output()?;
|
||||||
|
debug!("brl list: {:?} {:?}", output.stdout, output.stderr);
|
||||||
|
|
||||||
|
let parsed_output = String::from_utf8(output.stdout).unwrap();
|
||||||
|
for distribution in parsed_output.trim().split('\n') {
|
||||||
|
debug!("Bedrock distribution {}", distribution);
|
||||||
|
match distribution {
|
||||||
|
"arch" => archlinux::upgrade_arch_linux(ctx)?,
|
||||||
|
"debian" | "ubuntu" => upgrade_debian(ctx)?,
|
||||||
|
"centos" | "fedora" => upgrade_redhat(ctx)?,
|
||||||
|
"bedrock" => upgrade_bedrock_strata(ctx)?,
|
||||||
|
_ => {
|
||||||
|
warn!("Unknown distribution {}", distribution);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
fn is_wsl() -> Result<bool> {
|
fn is_wsl() -> Result<bool> {
|
||||||
let output = Command::new("uname").arg("-r").check_output()?;
|
let output = Command::new("uname").arg("-r").check_output()?;
|
||||||
debug!("Uname output: {}", output);
|
debug!("Uname output: {}", output);
|
||||||
@@ -134,7 +165,7 @@ fn upgrade_alpine_linux(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn upgrade_redhat(ctx: &ExecutionContext) -> Result<()> {
|
fn upgrade_redhat(ctx: &ExecutionContext) -> Result<()> {
|
||||||
let _ = if let Some(ostree) = Path::new("/usr/bin/rpm-ostree").if_exists() {
|
let _ = if let Some(ostree) = Path::new("rpm-ostree").if_exists() {
|
||||||
if ctx.config().rpm_ostree() {
|
if ctx.config().rpm_ostree() {
|
||||||
let mut command = ctx.run_type().execute(ostree);
|
let mut command = ctx.run_type().execute(ostree);
|
||||||
command.arg("upgrade");
|
command.arg("upgrade");
|
||||||
@@ -149,11 +180,7 @@ fn upgrade_redhat(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
if let Some(sudo) = &ctx.sudo() {
|
if let Some(sudo) = &ctx.sudo() {
|
||||||
let mut command = ctx.run_type().execute(&sudo);
|
let mut command = ctx.run_type().execute(&sudo);
|
||||||
command
|
command
|
||||||
.arg(
|
.arg(which("dnf").unwrap_or_else(|| Path::new("yum").to_path_buf()))
|
||||||
Path::new("/usr/bin/dnf-3")
|
|
||||||
.if_exists()
|
|
||||||
.unwrap_or_else(|| Path::new("/usr/bin/yum")),
|
|
||||||
)
|
|
||||||
.arg(if ctx.config().redhat_distro_sync() {
|
.arg(if ctx.config().redhat_distro_sync() {
|
||||||
"distro-sync"
|
"distro-sync"
|
||||||
} else {
|
} else {
|
||||||
@@ -176,16 +203,23 @@ fn upgrade_redhat(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn upgrade_bedrock_strata(ctx: &ExecutionContext) -> Result<()> {
|
||||||
|
if let Some(sudo) = ctx.sudo() {
|
||||||
|
ctx.run_type().execute(&sudo).args(&["brl", "update"]).check_run()?;
|
||||||
|
} else {
|
||||||
|
print_warning("No sudo detected. Skipping system upgrade");
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
fn upgrade_suse(ctx: &ExecutionContext) -> Result<()> {
|
fn upgrade_suse(ctx: &ExecutionContext) -> Result<()> {
|
||||||
if let Some(sudo) = ctx.sudo() {
|
if let Some(sudo) = ctx.sudo() {
|
||||||
ctx.run_type()
|
ctx.run_type().execute(&sudo).args(&["zypper", "refresh"]).check_run()?;
|
||||||
.execute(&sudo)
|
|
||||||
.args(&["/usr/bin/zypper", "refresh"])
|
|
||||||
.check_run()?;
|
|
||||||
|
|
||||||
ctx.run_type()
|
ctx.run_type()
|
||||||
.execute(&sudo)
|
.execute(&sudo)
|
||||||
.args(&["/usr/bin/zypper", "dist-upgrade"])
|
.args(&["zypper", "dist-upgrade"])
|
||||||
.check_run()?;
|
.check_run()?;
|
||||||
} else {
|
} else {
|
||||||
print_warning("No sudo detected. Skipping system upgrade");
|
print_warning("No sudo detected. Skipping system upgrade");
|
||||||
@@ -198,12 +232,12 @@ fn upgrade_void(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
if let Some(sudo) = ctx.sudo() {
|
if let Some(sudo) = ctx.sudo() {
|
||||||
ctx.run_type()
|
ctx.run_type()
|
||||||
.execute(&sudo)
|
.execute(&sudo)
|
||||||
.args(&["/usr/bin/xbps-install", "-Su", "xbps"])
|
.args(&["xbps-install", "-Su", "xbps"])
|
||||||
.check_run()?;
|
.check_run()?;
|
||||||
|
|
||||||
ctx.run_type()
|
ctx.run_type()
|
||||||
.execute(&sudo)
|
.execute(&sudo)
|
||||||
.args(&["/usr/bin/xbps-install", "-u"])
|
.args(&["xbps-install", "-u"])
|
||||||
.check_run()?;
|
.check_run()?;
|
||||||
} else {
|
} else {
|
||||||
print_warning("No sudo detected. Skipping system upgrade");
|
print_warning("No sudo detected. Skipping system upgrade");
|
||||||
@@ -223,7 +257,7 @@ fn upgrade_gentoo(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
println!("Syncing portage");
|
println!("Syncing portage");
|
||||||
run_type
|
run_type
|
||||||
.execute(&sudo)
|
.execute(&sudo)
|
||||||
.args(&["/usr/bin/emerge", "--sync"])
|
.args(&["emerge", "--sync"])
|
||||||
.args(
|
.args(
|
||||||
ctx.config()
|
ctx.config()
|
||||||
.emerge_sync_flags()
|
.emerge_sync_flags()
|
||||||
@@ -238,7 +272,7 @@ fn upgrade_gentoo(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
|
|
||||||
run_type
|
run_type
|
||||||
.execute(&sudo)
|
.execute(&sudo)
|
||||||
.arg("/usr/bin/emerge")
|
.arg("emerge")
|
||||||
.args(
|
.args(
|
||||||
ctx.config()
|
ctx.config()
|
||||||
.emerge_update_flags()
|
.emerge_update_flags()
|
||||||
@@ -255,7 +289,7 @@ fn upgrade_gentoo(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
|
|
||||||
fn upgrade_debian(ctx: &ExecutionContext) -> Result<()> {
|
fn upgrade_debian(ctx: &ExecutionContext) -> Result<()> {
|
||||||
if let Some(sudo) = &ctx.sudo() {
|
if let Some(sudo) = &ctx.sudo() {
|
||||||
let apt = which("apt-fast").unwrap_or_else(|| PathBuf::from("/usr/bin/apt-get"));
|
let apt = which("apt-fast").unwrap_or_else(|| PathBuf::from("apt-get"));
|
||||||
ctx.run_type().execute(&sudo).arg(&apt).arg("update").check_run()?;
|
ctx.run_type().execute(&sudo).arg(&apt).arg("update").check_run()?;
|
||||||
|
|
||||||
let mut command = ctx.run_type().execute(&sudo);
|
let mut command = ctx.run_type().execute(&sudo);
|
||||||
@@ -287,10 +321,7 @@ fn upgrade_debian(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
|
|
||||||
fn upgrade_solus(ctx: &ExecutionContext) -> Result<()> {
|
fn upgrade_solus(ctx: &ExecutionContext) -> Result<()> {
|
||||||
if let Some(sudo) = ctx.sudo() {
|
if let Some(sudo) = ctx.sudo() {
|
||||||
ctx.run_type()
|
ctx.run_type().execute(&sudo).args(&["eopkg", "upgrade"]).check_run()?;
|
||||||
.execute(&sudo)
|
|
||||||
.args(&["/usr/bin/eopkg", "upgrade"])
|
|
||||||
.check_run()?;
|
|
||||||
} else {
|
} else {
|
||||||
print_warning("No sudo detected. Skipping system upgrade");
|
print_warning("No sudo detected. Skipping system upgrade");
|
||||||
}
|
}
|
||||||
@@ -314,10 +345,7 @@ pub fn run_pacstall(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
|
|
||||||
fn upgrade_clearlinux(ctx: &ExecutionContext) -> Result<()> {
|
fn upgrade_clearlinux(ctx: &ExecutionContext) -> Result<()> {
|
||||||
if let Some(sudo) = &ctx.sudo() {
|
if let Some(sudo) = &ctx.sudo() {
|
||||||
ctx.run_type()
|
ctx.run_type().execute(&sudo).args(&["swupd", "update"]).check_run()?;
|
||||||
.execute(&sudo)
|
|
||||||
.args(&["/usr/bin/swupd", "update"])
|
|
||||||
.check_run()?;
|
|
||||||
} else {
|
} else {
|
||||||
print_warning("No sudo detected. Skipping system upgrade");
|
print_warning("No sudo detected. Skipping system upgrade");
|
||||||
}
|
}
|
||||||
@@ -327,31 +355,28 @@ fn upgrade_clearlinux(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
|
|
||||||
fn upgrade_exherbo(ctx: &ExecutionContext) -> Result<()> {
|
fn upgrade_exherbo(ctx: &ExecutionContext) -> Result<()> {
|
||||||
if let Some(sudo) = ctx.sudo() {
|
if let Some(sudo) = ctx.sudo() {
|
||||||
ctx.run_type()
|
ctx.run_type().execute(&sudo).args(&["cave", "sync"]).check_run()?;
|
||||||
.execute(&sudo)
|
|
||||||
.args(&["/usr/bin/cave", "sync"])
|
|
||||||
.check_run()?;
|
|
||||||
|
|
||||||
ctx.run_type()
|
ctx.run_type()
|
||||||
.execute(&sudo)
|
.execute(&sudo)
|
||||||
.args(&["/usr/bin/cave", "resolve", "world", "-c1", "-Cs", "-km", "-Km", "-x"])
|
.args(&["cave", "resolve", "world", "-c1", "-Cs", "-km", "-Km", "-x"])
|
||||||
.check_run()?;
|
.check_run()?;
|
||||||
|
|
||||||
if ctx.config().cleanup() {
|
if ctx.config().cleanup() {
|
||||||
ctx.run_type()
|
ctx.run_type()
|
||||||
.execute(&sudo)
|
.execute(&sudo)
|
||||||
.args(&["/usr/bin/cave", "purge", "-x"])
|
.args(&["cave", "purge", "-x"])
|
||||||
.check_run()?;
|
.check_run()?;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.run_type()
|
ctx.run_type()
|
||||||
.execute(&sudo)
|
.execute(&sudo)
|
||||||
.args(&["/usr/bin/cave", "fix-linkage", "-x", "--", "-Cs"])
|
.args(&["cave", "fix-linkage", "-x", "--", "-Cs"])
|
||||||
.check_run()?;
|
.check_run()?;
|
||||||
|
|
||||||
ctx.run_type()
|
ctx.run_type()
|
||||||
.execute(&sudo)
|
.execute(&sudo)
|
||||||
.args(&["/usr/bin/eclectic", "config", "interactive"])
|
.args(&["eclectic", "config", "interactive"])
|
||||||
.check_run()?;
|
.check_run()?;
|
||||||
} else {
|
} else {
|
||||||
print_warning("No sudo detected. Skipping system upgrade");
|
print_warning("No sudo detected. Skipping system upgrade");
|
||||||
|
|||||||
Reference in New Issue
Block a user