Skip to content

Commit

Permalink
Merge pull request #64 from tsirysndr/fix/ble.sh-on-mac
Browse files Browse the repository at this point in the history
fix: fix ble.sh install on  macos
  • Loading branch information
tsirysndr authored Jun 22, 2023
2 parents c804335 + 6bb8cfb commit 7a7ff92
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 30 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ license = "MIT"
name = "crosup"
readme = "../../README.md"
repository = "https://github.com/tsirysndr/crosup"
version = "0.4.8"
version = "0.4.9"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
anyhow = "1.0.71"
clap = "3.2.20"
crosup-core = {path = "../core", version = "0.1.7"}
crosup-core = {path = "../core", version = "0.1.8"}
crosup-entity = {version = "0.1.0", path = "../entity"}
crosup-installers = {path = "../installers", version = "0.1.8"}
crosup-installers = {path = "../installers", version = "0.1.11"}
crosup-migration = {path = "../migration", version = "0.1.0"}
crosup-nix = {path = "../nix", version = "0.1.1"}
crosup-repo = {path = "../repo", version = "0.1.0"}
crosup-ssh = {path = "../ssh", version = "0.1.0"}
crosup-tui = {path = "../tui", version = "0.1.0"}
crosup-types = {path = "../types", version = "0.1.4"}
crosup-types = {path = "../types", version = "0.1.7"}
hcl-rs = "0.14.2"
inquire = "0.6.2"
owo-colors = "3.5.0"
Expand Down
6 changes: 3 additions & 3 deletions crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ keywords = ["chromebook", "chromeos", "homebrew", "docker", "nix"]
license = "MIT"
name = "crosup-core"
repository = "https://github.com/tsirysndr/crosup"
version = "0.1.7"
version = "0.1.8"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
anyhow = "1.0.71"
crosup-installers = {path = "../installers", version = "0.1.4"}
crosup-installers = {path = "../installers", version = "0.1.11"}
crosup-macros = {path = "../macros", version = "0.1.3"}
crosup-ssh = {path = "../ssh", version = "0.1.0"}
crosup-types = {path = "../types", version = "0.1.4"}
crosup-types = {path = "../types", version = "0.1.7"}
hcl-rs = "0.14.2"
os-release = "0.1.0"
owo-colors = "3.5.0"
Expand Down
4 changes: 2 additions & 2 deletions crates/installers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ keywords = ["chromebook", "chromeos", "homebrew", "docker", "nix"]
license = "MIT"
name = "crosup-installers"
repository = "https://github.com/tsirysndr/crosup"
version = "0.1.8"
version = "0.1.11"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand All @@ -16,7 +16,7 @@ anyhow = "1.0.71"
crosup-macros = {path = "../macros", version = "0.1.5"}
crosup-nix = {path = "../nix", version = "0.1.1"}
crosup-ssh = {path = "../ssh", version = "0.1.0"}
crosup-types = {path = "../types", version = "0.1.4"}
crosup-types = {path = "../types", version = "0.1.7"}
indexmap = {version = "1.9.3", features = ["serde"]}
owo-colors = "3.5.0"
ssh2 = {version = "0.9.4", features = ["vendored-openssl"]}
2 changes: 1 addition & 1 deletion crates/installers/src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl From<Repository> for GitInstaller {
Self {
name: config.name,
version: "latest".to_string(),
dependencies: vec![],
dependencies: config.depends_on.unwrap_or(vec![]),
url: config.url,
install: config.install,
preinstall: config.preinstall,
Expand Down
2 changes: 1 addition & 1 deletion crates/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ keywords = ["chromebook", "chromeos", "homebrew", "docker", "nix"]
license = "MIT"
name = "crosup-types"
repository = "https://github.com/tsirysndr/crosup"
version = "0.1.4"
version = "0.1.7"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
52 changes: 38 additions & 14 deletions crates/types/src/git.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use indexmap::IndexMap;
use os_release::OsRelease;
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug, Clone, Default)]
Expand Down Expand Up @@ -31,24 +32,47 @@ pub struct Repository {

#[serde(skip_serializing_if = "Option::is_none")]
pub shallow_submodules: Option<bool>,

#[serde(skip_serializing_if = "Option::is_none")]
pub depends_on: Option<Vec<String>>,
}

pub fn default_git_install() -> IndexMap<String, GitConfiguration> {
let mut repo = IndexMap::new();
repo.insert(
"blesh".into(),
Repository {
name: "blesh".into(),
url: "https://github.com/akinomyoga/ble.sh.git".into(),
install: "make -C ble.sh install PREFIX=~/.local".into(),
preinstall: Some("sudo apt-get install -y gawk build-essential".into()),
postinstall: Some("echo 'source ~/.local/share/blesh/ble.sh' >> ~/.bashrc".into()),
install_check: Some("~/.local/share/blesh/ble.sh".into()),
recursive: Some(true),
depth: Some(1),
shallow_submodules: Some(true),
},
);

let mut blesh = Repository {
name: "blesh".into(),
url: "https://github.com/akinomyoga/ble.sh.git".into(),
install: "make -C ble.sh install PREFIX=~/.local".into(),
preinstall: None,
postinstall: Some("echo 'source ~/.local/share/blesh/ble.sh' >> ~/.bashrc".into()),
install_check: Some("~/.local/share/blesh/ble.sh".into()),
recursive: Some(true),
depth: Some(1),
shallow_submodules: Some(true),
depends_on: None,
};

if cfg!(target_os = "linux") {
// determine linux distribution using os-release
if let Ok(os_release) = OsRelease::new() {
let os = os_release.id.to_lowercase();
let os = os.as_str();
match os {
"ubuntu" | "debian" | "linuxmint" | "pop" | "elementary" | "zorin" => {
blesh.preinstall = Some("sudo apt-get install -y gawk build-essential".into());
}
_ => {}
}
}
}

if cfg!(target_os = "macos") {
blesh.preinstall = Some("brew install gawk bash".into());
blesh.depends_on = Some(vec!["homebrew".into()]);
}

repo.insert("blesh".into(), blesh);
let mut git = IndexMap::new();
git.insert("install".into(), GitConfiguration { repo });
git
Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
inherit src;

pname = "crosup";
version = "0.4.8";
version = "0.4.9";
cargoExtraArgs = "--package=crosup";

buildInputs = [
Expand Down

0 comments on commit 7a7ff92

Please sign in to comment.