-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_resolver.sh
More file actions
68 lines (58 loc) · 2.19 KB
/
install_resolver.sh
File metadata and controls
68 lines (58 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
set -e
echo -e "installing the resolver cli via curl"
RED="\033[0;31m"
GREEN="\033[0;32m"
YELLOW="\033[0;33m"
WHITE="\033[0m"
# getting the operating system of the machine
OS=$(uname -s)
echo -e "${RED} RED first ,${GREEN} Green next, ${YELLOW} Yellow after"
check_for_pkg_config_openssl() {
echo -e "checking if openssl and pkg_config are available"
if ! pkg-config --exists openssl; then
echo -e "could not find openssl and pkg_config"
#check for the os
echo -e "checking the machine OS and the installing the packages"
if [ "$OS" = "Darwin" ]; then
if ! command -v brew >/dev/null ; then
echo -e "homebrew is not installed, installing homebrew"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
echo -e "installing openssl and pkg_config"
brew install openssl
brew install pkg-config
elif [ "$OS" = "Linux" ]; then
echo -e "updating linux packages"
sudo apt-get update -y || true
echo -e "installing openssl and pkg-config"
sudo apt-get install -y libssl-dev pkg-config
else
echo -e "Unsupported OS: ${OS} detected"
exit 1
fi
else
echo -e "${GREEN} openssl and pkg-config are already installed"
fi
}
echo -e "checking if curl already exists"
if ! command -v curl >/dev/null; then
echo -e "${RED} curl is missing"
exit 1
fi
check_for_pkg_config_openssl
echo -e "checking if rust is installed "
if ! (command -v rustc >/dev/null && cargo >/dev/null); then
#install rust here if not installed
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh -s -- -y
source "$HOME/.cargo/env"
else
echo -e "${GREEN} rust is already installed with ${YELLOW}$(rustc --version), ${YELLOW}$(cargo --version)"
fi
if ! command -v resolver-cli >/dev/null; then
# install resolver here
cargo install resolver-cli
echo -e "${GREEN}resolver-cli has been installed successfully"
else
echo -e "${WHITE} resolver version ${YELLOW}$(resolver-cli --version) is already installed"
fi