Add FreeBSD

This commit is contained in:
Roey Darwish Dror
2018-11-12 11:13:43 +02:00
parent b14c948567
commit 1e73011a15
4 changed files with 77 additions and 1 deletions

View File

@@ -27,6 +27,8 @@ extern crate lazy_static;
extern crate self_update;
extern crate walkdir;
#[cfg(target_os = "freebsd")]
mod freebsd;
#[cfg(target_os = "linux")]
mod linux;
#[cfg(target_os = "macos")]
@@ -132,7 +134,7 @@ fn run() -> Result<(), Error> {
let config = Config::read(&base_dirs)?;
let mut report = Report::new();
#[cfg(target_os = "linux")]
#[cfg(any(target_os = "freebsd", target_os = "linux"))]
let sudo = utils::which("sudo");
#[cfg(all(
@@ -200,6 +202,11 @@ fn run() -> Result<(), Error> {
|terminal| unix::run_homebrew(terminal, opt.dry_run),
&mut execution_context,
)?);
#[cfg(target_os = "freebsd")]
report.push_result(execute(
|terminal| freebsd::upgrade_packages(&sudo, terminal, opt.dry_run),
&mut execution_context,
)?);
#[cfg(unix)]
report.push_result(execute(
|terminal| unix::run_nix(terminal, opt.dry_run),
@@ -375,6 +382,16 @@ fn run() -> Result<(), Error> {
}
}
#[cfg(target_os = "freebsd")]
{
if !opt.no_system {
report.push_result(execute(
|terminal| freebsd::upgrade_freebsd(&sudo, terminal, opt.dry_run),
&mut execution_context,
)?);
}
}
#[cfg(windows)]
{
if !opt.no_system {