feat(shell): add packer.nu (#414)
* feat(shell): add `packer.nu` * dependency update (#413) * fix(main): move `packer.nu` step before linux package managers --------- Co-authored-by: Thomas Schönauer <37108907+DottoDev@users.noreply.github.com>
This commit is contained in:
@@ -177,6 +177,11 @@ For more information about this issue see https://askubuntu.com/questions/110969
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
// NOTE: Due to breaking `nu` updates, `packer.nu` needs to be updated before `nu` get updated
|
||||
// by other package managers.
|
||||
runner.execute(Step::Shell, "packer.nu", || linux::run_packer_nu(&ctx))?;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
let distribution = linux::Distribution::detect();
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ use crate::steps::os::archlinux;
|
||||
use crate::sudo::Sudo;
|
||||
use crate::terminal::{print_separator, print_warning};
|
||||
use crate::utils::{require, require_option, which, PathExt};
|
||||
use crate::Step;
|
||||
use crate::{Step, HOME_DIR};
|
||||
|
||||
static OS_RELEASE_PATH: &str = "/etc/os-release";
|
||||
|
||||
@@ -553,6 +553,25 @@ pub fn run_pacstall(ctx: &ExecutionContext) -> Result<()> {
|
||||
upgrade_cmd.arg("-Up").status_checked()
|
||||
}
|
||||
|
||||
pub fn run_packer_nu(ctx: &ExecutionContext) -> Result<()> {
|
||||
let nu = require("nu")?;
|
||||
let packer_home = HOME_DIR.join(".local/share/nushell/packer");
|
||||
|
||||
packer_home.clone().require()?;
|
||||
|
||||
print_separator("packer.nu");
|
||||
|
||||
ctx.run_type()
|
||||
.execute(nu)
|
||||
.env("PWD", "/")
|
||||
.env("NU_PACKER_HOME", packer_home)
|
||||
.args([
|
||||
"-c",
|
||||
"use ~/.local/share/nushell/packer/start/packer.nu/api_layer/packer.nu; packer update",
|
||||
])
|
||||
.status_checked()
|
||||
}
|
||||
|
||||
fn upgrade_clearlinux(ctx: &ExecutionContext) -> Result<()> {
|
||||
if let Some(sudo) = &ctx.sudo() {
|
||||
ctx.run_type()
|
||||
|
||||
Reference in New Issue
Block a user