-
Notifications
You must be signed in to change notification settings - Fork 0
/
express-install.sh
79 lines (73 loc) · 2 KB
/
express-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
72
73
74
75
76
77
78
#!/bin/bash
#set -x #uncomment for debug mode
clear_term() {
#comment out for output
clear
#echo "debug -- clear"
}
aborting_install() {
clear_term
echo "Aborting Install"
}
path_check() {
path_check_var=$(which jhira)
if [ -x "$path_check_var" ] ; then
echo "jhira appears to be in your path! Continuing..."
sleep 2
else
echo "jhira does not appear to be in your path,"
echo "Would you like the installer to try to auto add jhira to your path? (y/n) "
read addToPath
if [[ $addToPath == "y" ]] ; then
touch ~/.zshrc
echo "export PATH=\"$PATH:/opt\"" >> ~/.zshrc
echo "Now we are going to refresh your terminal"
sleep 2
source ~/.zshrc
else
echo "Skipping add to path step"
fi
fi
}
exec_install() {
clear_term
echo "Beginning express download of jhira"
curl -L "https://github.com/wearejh/jhira/releases/download/v0.1.6/jhira" --output jhira-temp-binary-file
chmod +x ./jhira-temp-binary-file
echo "Download successful!"
echo "You may now be asked for your password to install the jhira binary"
sudo mkdir -p /opt
sudo chown -R $(whoami) /opt
mv ./jhira-temp-binary-file /opt/jhira
path_check
echo "Now the self-update function will run to get the latest version!"
sleep 2
jhira self-update
echo "Thank you for using the express installer!"
echo "(You may need to run \"source ~/.zshrc\" - without the quotes - to see jhira)"
}
clear_term
echo "Welcome to the jhira Express installer!"
echo "Would you like to install jhira? (y/n) "
read continueInstall
if [[ $continueInstall == "y" ]] ; then
echo "Ok, installing now"
path_to_executable=$(which jhira)
if [ -x "$path_to_executable" ] ; then
clear_term
echo "Looks like jhira is already installed"
echo "Would you like to reinstall?"
echo " - this will delete your existing installation (y/n) "
read reinstall
if [[ $reinstall == "y" ]] ; then
rm $(which jhira)
exec_install
else
aborting_install
fi
else
exec_install
fi
else
aborting_install
fi