-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup
executable file
·44 lines (37 loc) · 1.36 KB
/
setup
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
#!/usr/bin/env bash
# The follwoing will attempt to compile and install MgNet
# IMPORTANT - This script is meant to run on a Linux machine
# set some colors
CNT="[\e[1;36mNOTE\e[0m]"
COK="[\e[1;32mOK\e[0m]"
CER="[\e[1;31mERROR\e[0m]"
CAT="[\e[1;37mATTENTION\e[0m]"
CWR="[\e[1;35mWARNING\e[0m]"
CAC="[\e[1;33mACTION\e[0m]"
# set some expectations for the user
echo -e "$CNT - You are about to execute a script that would attempt to setup MgNet."
sleep 1
# get the current folder
current_dir=$(pwd)
if [ ! -d "${current_dir}" ]; then
echo -e "$CER ${current_dir} does not exist! No changes were made to your system."
exit
fi
# Pulling the MgNet image
echo -e "$CNT - Pulling MgNet from Docker Hub..."
docker pull vfold/mgnet:1.0.1
# give the user an option to exit setup
install_path=/usr/local/bin/
echo -e "$CAT - MgNet scripts will be installed to the ${install_path}"
read -rep $'[\e[1;33mACTION\e[0m] - Would you like to continue with the setup (y,n) ' CONTINST
if [[ $CONTINST == "Y" || $CONTINST == "y" ]]; then
echo -e "$CNT - Setup starting..."
else
echo -e "$CNT - You need to manually add the executables (mgnet,mgnet-env,mgnet-run) to your PATH."
exit
fi
# install mgnet to path
echo -e "$CNT - Installing to ${install_path}"
sudo cp -a ./bin/mgnet ./bin/mgnet-env ./bin/mgnet-run ${install_path}
# Script is done
echo -e "$COK - Setup has completed!"