-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·42 lines (33 loc) · 1.19 KB
/
install.sh
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
#!/usr/bin/env bash
set -e
echo "Installing evmrup..."
# Define variables
EVMR_DIR="${HOME}/.evm-runners"
EVMR_BIN_DIR="${EVMR_DIR}/bin"
EVMRUP_URL="https://raw.githubusercontent.com/ethernautdao/evm-runners-cli/main/evmrup"
EVMRUP_PATH="$EVMR_BIN_DIR/evmrup"
# Create bin directory if it doesn't exist and download evmrup
mkdir -p "$EVMR_BIN_DIR"
curl -# -L $EVMRUP_URL -o $EVMRUP_PATH
chmod +x $EVMRUP_PATH
# Determine shell
SHELL_NAME="$(basename "$SHELL")"
# Determine appropriate shell configuration file
if [ "$SHELL_NAME" = "bash" ]; then
CONFIG=$HOME/.bashrc
elif [ "$SHELL_NAME" = "zsh" ]; then
CONFIG=$HOME/.zshrc
elif [ "$SHELL_NAME" = "fish" ]; then
CONFIG=$HOME/.config/fish/config.fish
else
echo "unsupported shell: $SHELL_NAME, manually add ${EVMR_BIN_DIR} to your PATH."
exit 1
fi
# Update PATH environment variable in the shell configuration file if it doesn't exist
if [[ ":$PATH:" != *":${EVMR_BIN_DIR}:"* ]]; then
echo >> $CONFIG && echo "export PATH=\"\$PATH:$EVMR_BIN_DIR\"" >> $CONFIG
fi
echo && echo "Detected your preferred shell is $SHELL_NAME and added evmrup to PATH."
echo "Installing evm-runners by running 'evmrup'..." && echo
# Run evmrup
$EVMRUP_PATH