-
Notifications
You must be signed in to change notification settings - Fork 3
/
express-install.sh
79 lines (73 loc) · 1.97 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 wf2)
if [ -x "$path_check_var" ] ; then
echo "WF2 appears to be in your path! Continuing..."
sleep 2
else
echo "WF2 does not appear to be in your path,"
echo "Would you like the installer to try to auto add WF2 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 WF2"
curl -L "https://github.com/wearejh/wf2/releases/download/v0.18.0/wf2" --output wf2-temp-binary-file
chmod +x ./wf2-temp-binary-file
echo "Download successful!"
echo "You may now be asked for your password to install the WF2 binary"
sudo mkdir -p /opt
sudo chown -R $(whoami) /opt
mv ./wf2-temp-binary-file /opt/wf2
path_check
echo "Now the self-update function will run to get the latest version!"
sleep 2
wf2 self-update
echo "Thank you for using the express installer!"
echo "(You may need to run \"source ~/.zshrc\" - without the quotes - to see wf2)"
}
clear_term
echo "Welcome to the WF2 Express installer!"
echo "Would you like to install WF2? (y/n) "
read continueInstall
if [[ $continueInstall == "y" ]] ; then
echo "Ok, installing now"
path_to_executable=$(which wf2)
if [ -x "$path_to_executable" ] ; then
clear_term
echo "Looks like wf2 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 wf2)
exec_install
else
aborting_install
fi
else
exec_install
fi
else
aborting_install
fi