Adds nala on android support (#97)
This commit is contained in:
@@ -5,27 +5,33 @@ use crate::Step;
|
|||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
|
|
||||||
pub fn upgrade_packages(ctx: &ExecutionContext) -> Result<()> {
|
pub fn upgrade_packages(ctx: &ExecutionContext) -> Result<()> {
|
||||||
let pkg = require("pkg")?;
|
//let pkg = require("pkg")?;
|
||||||
|
let pkg = which("nala").or_else(|| which("pkg")).unwrap();
|
||||||
|
|
||||||
print_separator("Termux Packages");
|
print_separator("Termux Packages");
|
||||||
|
|
||||||
|
let is_nala = pkg.end_with("nala");
|
||||||
|
|
||||||
let mut command = ctx.run_type().execute(&pkg);
|
let mut command = ctx.run_type().execute(&pkg);
|
||||||
command.arg("upgrade");
|
command.arg("upgrade");
|
||||||
|
|
||||||
if ctx.config().yes(Step::System) {
|
if ctx.config().yes(Step::System) {
|
||||||
command.arg("-y");
|
command.arg("-y");
|
||||||
}
|
}
|
||||||
command.check_run()?;
|
command.check_run()?;
|
||||||
|
|
||||||
if ctx.config().cleanup() {
|
if !is_nala {
|
||||||
ctx.run_type().execute(&pkg).arg("clean").check_run()?;
|
if ctx.config().cleanup() {
|
||||||
|
ctx.run_type().execute(&pkg).arg("clean").check_run()?;
|
||||||
|
|
||||||
let apt = require("apt")?;
|
let apt = require("apt")?;
|
||||||
let mut command = ctx.run_type().execute(&apt);
|
let mut command = ctx.run_type().execute(&apt);
|
||||||
command.arg("autoremove");
|
command.arg("autoremove");
|
||||||
if ctx.config().yes(Step::System) {
|
if ctx.config().yes(Step::System) {
|
||||||
command.arg("-y");
|
command.arg("-y");
|
||||||
|
}
|
||||||
|
command.check_run()?;
|
||||||
}
|
}
|
||||||
command.check_run()?;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
Reference in New Issue
Block a user