From c8043356cef76d979749e81dea8c5ce86c1473f4 Mon Sep 17 00:00:00 2001 From: Tsiry Sandratraina Date: Thu, 22 Jun 2023 14:21:49 +0000 Subject: [PATCH 1/5] bump flake version --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index fd4f7ea..d915607 100644 --- a/flake.nix +++ b/flake.nix @@ -40,7 +40,7 @@ inherit src; pname = "crosup"; - version = "0.3.2"; + version = "0.4.8"; cargoExtraArgs = "--package=crosup"; buildInputs = [ From edb24e9230ecbb99cb96021e9299b7cd29568b05 Mon Sep 17 00:00:00 2001 From: Tsiry Sandratraina Date: Thu, 22 Jun 2023 16:13:06 +0000 Subject: [PATCH 2/5] fix: fix ble.sh install on macos --- Cargo.lock | 6 ++--- crates/cli/Cargo.toml | 6 ++--- crates/installers/Cargo.toml | 4 +-- crates/installers/src/git.rs | 2 +- crates/types/Cargo.toml | 2 +- crates/types/src/git.rs | 51 ++++++++++++++++++++++++++---------- flake.nix | 2 +- 7 files changed, 48 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index db90cc5..c312942 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1069,7 +1069,7 @@ dependencies = [ [[package]] name = "crosup" -version = "0.4.8" +version = "0.4.9" dependencies = [ "anyhow", "clap 3.2.25", @@ -1122,7 +1122,7 @@ dependencies = [ [[package]] name = "crosup-installers" -version = "0.1.8" +version = "0.1.9" dependencies = [ "anyhow", "crosup-macros", @@ -1191,7 +1191,7 @@ dependencies = [ [[package]] name = "crosup-types" -version = "0.1.4" +version = "0.1.5" dependencies = [ "hcl-rs", "indexmap", diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 6e2e79c..f8978e2 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -8,7 +8,7 @@ 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 @@ -17,13 +17,13 @@ anyhow = "1.0.71" clap = "3.2.20" crosup-core = {path = "../core", version = "0.1.7"} crosup-entity = {version = "0.1.0", path = "../entity"} -crosup-installers = {path = "../installers", version = "0.1.8"} +crosup-installers = {path = "../installers", version = "0.1.9"} 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.5"} hcl-rs = "0.14.2" inquire = "0.6.2" owo-colors = "3.5.0" diff --git a/crates/installers/Cargo.toml b/crates/installers/Cargo.toml index 72fc785..63c6e55 100644 --- a/crates/installers/Cargo.toml +++ b/crates/installers/Cargo.toml @@ -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.9" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -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.5"} indexmap = {version = "1.9.3", features = ["serde"]} owo-colors = "3.5.0" ssh2 = {version = "0.9.4", features = ["vendored-openssl"]} diff --git a/crates/installers/src/git.rs b/crates/installers/src/git.rs index de9d5de..ad39946 100644 --- a/crates/installers/src/git.rs +++ b/crates/installers/src/git.rs @@ -30,7 +30,7 @@ impl From 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, diff --git a/crates/types/Cargo.toml b/crates/types/Cargo.toml index 2b8c2de..c095c37 100644 --- a/crates/types/Cargo.toml +++ b/crates/types/Cargo.toml @@ -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.5" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/types/src/git.rs b/crates/types/src/git.rs index c04c283..54d4aa1 100644 --- a/crates/types/src/git.rs +++ b/crates/types/src/git.rs @@ -1,4 +1,5 @@ use indexmap::IndexMap; +use os_release::OsRelease; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Debug, Clone, Default)] @@ -31,24 +32,46 @@ pub struct Repository { #[serde(skip_serializing_if = "Option::is_none")] pub shallow_submodules: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub depends_on: Option>, } pub fn default_git_install() -> IndexMap { 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: Some(vec!["homebrew".into()]), + }; + + 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".into()); + } + + repo.insert("blesh".into(), blesh); let mut git = IndexMap::new(); git.insert("install".into(), GitConfiguration { repo }); git diff --git a/flake.nix b/flake.nix index d915607..b0c6c9a 100644 --- a/flake.nix +++ b/flake.nix @@ -40,7 +40,7 @@ inherit src; pname = "crosup"; - version = "0.4.8"; + version = "0.4.9"; cargoExtraArgs = "--package=crosup"; buildInputs = [ From 20a0045d0b932db2e67707785e002aa6bc118f84 Mon Sep 17 00:00:00 2001 From: Tsiry Sandratraina Date: Thu, 22 Jun 2023 16:19:24 +0000 Subject: [PATCH 3/5] add `bash` dependency to ble.sh on mac --- Cargo.lock | 6 +++--- crates/cli/Cargo.toml | 6 +++--- crates/core/Cargo.toml | 6 +++--- crates/installers/Cargo.toml | 4 ++-- crates/types/Cargo.toml | 2 +- crates/types/src/git.rs | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c312942..b230af2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1097,7 +1097,7 @@ dependencies = [ [[package]] name = "crosup-core" -version = "0.1.7" +version = "0.1.8" dependencies = [ "anyhow", "crosup-installers", @@ -1122,7 +1122,7 @@ dependencies = [ [[package]] name = "crosup-installers" -version = "0.1.9" +version = "0.1.10" dependencies = [ "anyhow", "crosup-macros", @@ -1191,7 +1191,7 @@ dependencies = [ [[package]] name = "crosup-types" -version = "0.1.5" +version = "0.1.6" dependencies = [ "hcl-rs", "indexmap", diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index f8978e2..7772822 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -15,15 +15,15 @@ version = "0.4.9" [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.9"} +crosup-installers = {path = "../installers", version = "0.1.10"} 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.5"} +crosup-types = {path = "../types", version = "0.1.6"} hcl-rs = "0.14.2" inquire = "0.6.2" owo-colors = "3.5.0" diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index 09ea9a3..825c118 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -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.10"} 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.6"} hcl-rs = "0.14.2" os-release = "0.1.0" owo-colors = "3.5.0" diff --git a/crates/installers/Cargo.toml b/crates/installers/Cargo.toml index 63c6e55..cc4e4eb 100644 --- a/crates/installers/Cargo.toml +++ b/crates/installers/Cargo.toml @@ -7,7 +7,7 @@ keywords = ["chromebook", "chromeos", "homebrew", "docker", "nix"] license = "MIT" name = "crosup-installers" repository = "https://github.com/tsirysndr/crosup" -version = "0.1.9" +version = "0.1.10" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -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.5"} +crosup-types = {path = "../types", version = "0.1.6"} indexmap = {version = "1.9.3", features = ["serde"]} owo-colors = "3.5.0" ssh2 = {version = "0.9.4", features = ["vendored-openssl"]} diff --git a/crates/types/Cargo.toml b/crates/types/Cargo.toml index c095c37..49b4f9b 100644 --- a/crates/types/Cargo.toml +++ b/crates/types/Cargo.toml @@ -7,7 +7,7 @@ keywords = ["chromebook", "chromeos", "homebrew", "docker", "nix"] license = "MIT" name = "crosup-types" repository = "https://github.com/tsirysndr/crosup" -version = "0.1.5" +version = "0.1.6" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/types/src/git.rs b/crates/types/src/git.rs index 54d4aa1..a4f4140 100644 --- a/crates/types/src/git.rs +++ b/crates/types/src/git.rs @@ -68,7 +68,7 @@ pub fn default_git_install() -> IndexMap { } if cfg!(target_os = "macos") { - blesh.preinstall = Some("brew install gawk".into()); + blesh.preinstall = Some("brew install gawk bash".into()); } repo.insert("blesh".into(), blesh); From 79235a8420617552c1be31f754bda6ee8321cf09 Mon Sep 17 00:00:00 2001 From: Tsiry Sandratraina Date: Thu, 22 Jun 2023 16:23:21 +0000 Subject: [PATCH 4/5] add `homebrew` dependency to ble.sh on mac --- crates/types/src/git.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/types/src/git.rs b/crates/types/src/git.rs index a4f4140..7ecb2c6 100644 --- a/crates/types/src/git.rs +++ b/crates/types/src/git.rs @@ -50,7 +50,7 @@ pub fn default_git_install() -> IndexMap { recursive: Some(true), depth: Some(1), shallow_submodules: Some(true), - depends_on: Some(vec!["homebrew".into()]), + depends_on: None, }; if cfg!(target_os = "linux") { @@ -69,6 +69,7 @@ pub fn default_git_install() -> IndexMap { 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); From 6bb8cfbe1fefc7d0927d72f2b1fa9767812fc2c5 Mon Sep 17 00:00:00 2001 From: Tsiry Sandratraina Date: Thu, 22 Jun 2023 16:24:44 +0000 Subject: [PATCH 5/5] chore: bump version code --- Cargo.lock | 4 ++-- crates/cli/Cargo.toml | 4 ++-- crates/core/Cargo.toml | 4 ++-- crates/installers/Cargo.toml | 4 ++-- crates/types/Cargo.toml | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b230af2..92d8280 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1122,7 +1122,7 @@ dependencies = [ [[package]] name = "crosup-installers" -version = "0.1.10" +version = "0.1.11" dependencies = [ "anyhow", "crosup-macros", @@ -1191,7 +1191,7 @@ dependencies = [ [[package]] name = "crosup-types" -version = "0.1.6" +version = "0.1.7" dependencies = [ "hcl-rs", "indexmap", diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 7772822..94207c5 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -17,13 +17,13 @@ anyhow = "1.0.71" clap = "3.2.20" crosup-core = {path = "../core", version = "0.1.8"} crosup-entity = {version = "0.1.0", path = "../entity"} -crosup-installers = {path = "../installers", version = "0.1.10"} +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.6"} +crosup-types = {path = "../types", version = "0.1.7"} hcl-rs = "0.14.2" inquire = "0.6.2" owo-colors = "3.5.0" diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index 825c118..d072498 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -13,10 +13,10 @@ version = "0.1.8" [dependencies] anyhow = "1.0.71" -crosup-installers = {path = "../installers", version = "0.1.10"} +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.6"} +crosup-types = {path = "../types", version = "0.1.7"} hcl-rs = "0.14.2" os-release = "0.1.0" owo-colors = "3.5.0" diff --git a/crates/installers/Cargo.toml b/crates/installers/Cargo.toml index cc4e4eb..ffe56ca 100644 --- a/crates/installers/Cargo.toml +++ b/crates/installers/Cargo.toml @@ -7,7 +7,7 @@ keywords = ["chromebook", "chromeos", "homebrew", "docker", "nix"] license = "MIT" name = "crosup-installers" repository = "https://github.com/tsirysndr/crosup" -version = "0.1.10" +version = "0.1.11" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -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.6"} +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"]} diff --git a/crates/types/Cargo.toml b/crates/types/Cargo.toml index 49b4f9b..a269402 100644 --- a/crates/types/Cargo.toml +++ b/crates/types/Cargo.toml @@ -7,7 +7,7 @@ keywords = ["chromebook", "chromeos", "homebrew", "docker", "nix"] license = "MIT" name = "crosup-types" repository = "https://github.com/tsirysndr/crosup" -version = "0.1.6" +version = "0.1.7" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html