-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.bash
70 lines (52 loc) · 1.87 KB
/
install.bash
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
#!/usr/bin/env bash
: '
Author: Aliasgar Khimani (NovusEdge)
Project: github.com/NovusEdge/netpulse
Copyright: GNU General Public License v3.0
See the LICENSE file for more info.
All Rights Reserved
'
VERSION="v1.0.0"
printf "\033[1;36m=================LICENSE NOTICE=================\n";
echo "\
Author: Aliasgar Khimani (NovusEdge)
Project: github.com/NovusEdge/netpulse
Version: $VERSION
Copyright: GNU General Public License v3.0
See the LICENSE file for more info.
All Rights Reserved
=================================================
"; printf "\033[0m"
PROJECT_DIR=$(dirname $(realpath $0))
if ! type "cargo" > /dev/null ; then
printf "\033[1;31m[E]: Cargo not detected!\n";
printf " Please install it from: https://www.rust-lang.org/tools/install \033[0m\n\n";
exit 1;
else
printf "\033[1;32m[+]: Found cargo installation at: \n\t\033[35m$(which cargo)\033[0m\n\n";
RUST=$(which rustc)
CARGO=$(which cargo)
RUSTUP=$(which rustup)
fi
oldcwd=$(pwd)
printf "\033[1;36m[I]:Fetching project dependencies...\033[0m\n";
cd $PROJECT_DIR
$CARGO update
$CARGO build
$CARGO install
cd $oldcwd
printf "\033[1;32m[+]: Done!\033[0m\n\n";
## Making ~/.netpulse if it does not exist.
if [ ! -d $HOME/.netpulse ]; then
printf "\033[1;36m[I]: Making .netpulse in $HOME for storing config files and logs...\033[0m\n";
mkdir $HOME/.netpulse
touch $HOME/.netpulse/env
printf "\033[1;32m[+]: Done!\033[0m\n\n";
fi
## Setting up ~/.netpulse/env
printf "\033[1;36m[I]: Setting up environment file...\033[0m\n";
echo NPULSE_ROOT="$PROJECT_DIR" > $HOME/.netpulse/env
echo NUPLSE_VER="$VERSION" >> $HOME/.netpulse/env
echo NPULSE_ENV="$HOME/.netpulse/env" >> $HOME/.netpulse/env
echo NPULSE_BIN="$PROJECT_DIR/bin" >> $HOME/.netpulse/env
printf "\033[1;32m[+]: Done!\033[0m\n\n";