-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
executable file
·71 lines (61 loc) · 1.84 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
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
69
70
71
#!/bin/bash
echo "Installing git-rsl binaries ..."
echo ""
echo "Checking dependencies ..."
if command -v cargo >/dev/null 2>&1 ; then
echo " cargo found"
echo " version: $(cargo -V)"
else
echo "Error: cargo not found"
exit -1
fi
if command -v git >/dev/null 2>&1 ; then
echo " git found"
echo " version: $(git --version)"
else
echo "Error: git not found"
echo "git-rsl binaries act as git plugins and as such will not work without it."
exit -1
fi
if command -v gpg2 >/dev/null 2>&1 ; then
echo " gpg2 found"
echo " version: $(gpg2 --version | sed -n 1p)"
else
echo "Error: gpg2 not found"
if command -v gpg >/dev/null 2>&1 ; then
echo " gpg found"
echo " version: $(gpg --version | sed -n 1p)"
else
echo "Error: gpg not found"
echo "git-rsl utilizes GPG to verify the author of a commit."
echo "Please install it before proceeding."
echo " $ apt-get install gpg2"
fi
fi
echo "All dependencies present. Proceeding with install."
echo ""
DEST_DIR=$HOME/.cargo/bin
echo "Ensuring $DEST_DIR exists ..."
mkdir -p $DEST_DIR
echo "Running tests ..."
cargo test
if [ $? != 0 ]
then
echo "I cannot install git-rsl in good conscience when tests are failing."
exit -1
fi
echo "All tests pass. Proceeding with install ..."
echo "Building and installing binaries ..."
cargo install
output=$(echo $PATH | grep -F $DEST_DIR)
if [ $? != 0 ]
then
echo "Could not find $DEST_DIR in PATH. Adding to ~/.bashrc"
echo ""
echo "export PATH=\$PATH:$DEST_DIR"
echo "export PATH=\$PATH:$DEST_DIR" >> $HOME/.bashrc
eval "export PATH=$PATH:$DEST_DIR"
fi
echo "Installation successful. To learn about usage of this tool, run any of
the subcommands with the '-h' flag, e.g. 'git secure-push -h'.
For even more information, please consult the README."