Add Android support (#749)

This commit is contained in:
Laurent le Beau-Martin
2021-09-02 16:54:31 +00:00
committed by GitHub
parent ad4648655f
commit ebb66e26a4
3 changed files with 36 additions and 0 deletions

31
src/steps/os/android.rs Normal file
View File

@@ -0,0 +1,31 @@
use crate::execution_context::ExecutionContext;
use crate::terminal::print_separator;
use crate::utils::require;
use anyhow::Result;
pub fn upgrade_packages(ctx: &ExecutionContext) -> Result<()> {
let pkg = require("pkg")?;
print_separator("Termux Packages");
let mut command = ctx.run_type().execute(&pkg);
command.arg("upgrade");
if ctx.config().yes() {
command.arg("-y");
}
command.check_run()?;
if ctx.config().cleanup() {
ctx.run_type().execute(&pkg).arg("clean").check_run()?;
let apt = require("apt")?;
let mut command = ctx.run_type().execute(&apt);
command.arg("autoremove");
if ctx.config().yes() {
command.arg("-y");
}
command.check_run()?;
}
Ok(())
}