Skip to content

Commit

Permalink
update script
Browse files Browse the repository at this point in the history
  • Loading branch information
weezy20 committed May 3, 2024
1 parent 6ebc25b commit 54a23a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions crates/pop-cli/src/commands/install/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// SPDX-License-Identifier: GPL-3.0

use std::process::Stdio;

use anyhow::Context;
use clap::Args;
use tokio::{fs, process::Command};
Expand All @@ -12,6 +14,9 @@ pub(crate) struct InstallArgs;

impl InstallArgs {
pub(crate) async fn execute(self) -> anyhow::Result<()> {
if cfg!(target_os = "windows") {
return Ok(cliclack::log::error("Windows is supported only with WSL2")?);
}
let temp = tempfile::tempdir()?;
let scripts_path = temp.path().join("get_substrate.sh");
let client = reqwest::Client::new();
Expand All @@ -23,10 +28,8 @@ impl InstallArgs {
.text()
.await?;
fs::write(scripts_path.as_path(), script).await?;
if cfg!(target_os = "windows") {
return Ok(cliclack::log::error("Windows is supported only with WSL2")?);
}
Command::new("bash").arg(scripts_path).spawn()?;
Command::new("bash").arg(scripts_path).status().await?;
temp.close()?;
Ok(())
}
}
2 changes: 1 addition & 1 deletion scripts/get_substrate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if [[ "$OSTYPE" == "linux-gnu" ]]; then
elif [ -f /etc/debian_version ]; then
echo "Ubuntu/Debian Linux detected."
$MAKE_ME_ROOT apt update
$MAKE_ME_ROOT apt install -y cmake pkg-config libssl-dev git gcc build-essential git protobuf protobuf-compiler clang libclang-dev
$MAKE_ME_ROOT apt install -y cmake pkg-config libssl-dev git gcc build-essential git protobuf-compiler clang libclang-dev
else
echo "Unknown Linux distribution."
echo "This OS is not supported with this script at present. Sorry."
Expand Down

0 comments on commit 54a23a1

Please sign in to comment.