From 611f69646e5095a84f79ecc8f553e586453c66d9 Mon Sep 17 00:00:00 2001 From: Roey Darwish Dror Date: Thu, 2 Sep 2021 06:14:56 +0300 Subject: [PATCH] Support pkgin (fix #748) --- src/config.rs | 1 + src/main.rs | 1 + src/steps/os/unix.rs | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/src/config.rs b/src/config.rs index cb2c0b98..4f1be562 100644 --- a/src/config.rs +++ b/src/config.rs @@ -98,6 +98,7 @@ pub enum Step { Pipx, Pip3, Pkg, + Pkgin, Pnpm, Powershell, Raco, diff --git a/src/main.rs b/src/main.rs index ee17606d..993f3731 100644 --- a/src/main.rs +++ b/src/main.rs @@ -173,6 +173,7 @@ fn run() -> Result<()> { runner.execute(Step::Nix, "nix", || unix::run_nix(&ctx))?; runner.execute(Step::HomeManager, "home-manager", || unix::run_home_manager(run_type))?; runner.execute(Step::Asdf, "asdf", || unix::run_asdf(run_type))?; + runner.execute(Step::Pkgin, "pkgin", || unix::run_pkgin(&ctx))?; } #[cfg(target_os = "dragonfly")] diff --git a/src/steps/os/unix.rs b/src/steps/os/unix.rs index 757ee106..0729dada 100644 --- a/src/steps/os/unix.rs +++ b/src/steps/os/unix.rs @@ -100,6 +100,24 @@ pub fn run_oh_my_fish(ctx: &ExecutionContext) -> Result<()> { ctx.run_type().execute(&fish).args(&["-c", "omf update"]).check_run() } +pub fn run_pkgin(ctx: &ExecutionContext) -> Result<()> { + let pkgin = require("pkgin")?; + + let mut command = ctx.run_type().execute(ctx.sudo().as_ref().unwrap()); + command.arg(&pkgin).arg("update"); + if ctx.config().yes() { + command.arg("-y"); + } + command.check_run()?; + + let mut command = ctx.run_type().execute(ctx.sudo().as_ref().unwrap()); + command.arg(&pkgin).arg("upgrade"); + if ctx.config().yes() { + command.arg("-y"); + } + command.check_run() +} + pub fn run_fish_plug(ctx: &ExecutionContext) -> Result<()> { let fish = require("fish")?; ctx.base_dirs()