-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·59 lines (51 loc) · 1.36 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
#!/usr/bin/bash
echo "Checking for the prerequisites..."
pwd=`pwd`
install() {
sudo cp ./src/environment_merge_utility.sh /usr/local/bin/envmerger
sudo chmod 755 /usr/local/bin/envmerger
}
add_alias() {
shell=`basename $SHELL`
shell_config=`echo "/home/$USER/."$shell"rc"`
# echo "Adding alias to ====> $shell_config"
if [[ ! -f $shell_config ]]
then
echo "$shell_config does not exist. Please add the alias given below to your shell config file."
echo "alias envmerger=\"source envmerger\""
echo "Stopping installation"
else
echo "alias envmerger=\"source envmerger\"" >> $shell_config
eval $SHELL
fi
}
if [[ ! -d "$pwd/src" ]] || [[ ! -f "$pwd/src/environment_merge_utility.sh" ]]
then
echo -e "Please check if the repo has been cloned correctly and try again."
return
fi
if [[ -f "/usr/local/bin/envmerger" ]]
then
echo -n "You are re-installing/updating envmerger. Do you wish to proceed? [Y/n]: "
read choice
if [[ "$choice" == "Y" ]] || [[ "$choice" == "y" ]]
then
echo -e "Updating..."
install
echo -e "Succesfully updated."
else
echo "Stopping installation"
fi
else
echo -n "Do you wish to proceed with the installation of envmerger? [Y/n]: "
read choice
if [[ "$choice" == "Y" ]] || [[ "$choice" == "y" ]]
then
echo -e "Installing..."
install
echo -e "Succesfully installed."
add_alias
else
echo "Stopping installation"
fi
fi