1
1
echo "Installing CodePilot"
2
2
3
+ local_bin_path=~/.local/bin
4
+
3
5
# check if git is installed
4
6
if [[ -z $(which git) ]]; then
5
7
echo "Git is not installed"
@@ -16,42 +18,54 @@ if [[ -z $(which gh) ]]; then
16
18
exit 1
17
19
fi
18
20
19
- curl -s https://raw.githubusercontent.com/wasertech/CodePilot/main/scripts/codepilot > codepilot
21
+ # check if wget is installed
22
+ if [[ -z $(which wget) ]]; then
23
+ echo "wget is not installed"
24
+ distro=$(lsb_release -i | cut -f 2-)
25
+ echo "Please install wget on $distro"
26
+ exit 1
27
+ fi
28
+
29
+ wget -O codepilot https://raw.githubusercontent.com/wasertech/CodePilot/main/scripts/codepilot
20
30
chmod +x codepilot
21
- # copy the codepilot script to /usr/local/bin
22
- echo "Copying codepilot script to /usr/local/bin"
23
- sudo cp codepilot /usr/local/bin/codepilot
31
+
32
+ # copy the codepilot script to $local_bin_path
33
+ echo "Copying codepilot script to $local_bin_path"
34
+ cp codepilot $local_bin_path/codepilot
24
35
# source the codepilot script in ~/.bashrc
25
36
# only if it is not already sourced
26
37
27
38
echo "Handling bash"
28
39
if [[ -f ~/.bashrc ]]; then
29
- if [[ $(grep -c "source /usr/local/bin /codepilot" ~/.bashrc) -eq 0 ]]; then
40
+ if [[ $(grep -c "source $local_bin_path /codepilot" ~/.bashrc) -eq 0 ]]; then
30
41
echo "Sourcing codepilot script in ~/.bashrc"
31
- echo "source /usr/local/bin /codepilot" >> ~/.bashrc
42
+ echo "source $local_bin_path /codepilot" >> ~/.bashrc
32
43
else
33
44
echo "CodePilot is already installed"
34
45
exit 0
35
46
fi
36
47
else
37
48
echo "Sourcing codepilot script in ~/.bashrc"
38
- echo "source /usr/local/bin /codepilot" >> ~/.bashrc
49
+ echo "source $local_bin_path /codepilot" >> ~/.bashrc
39
50
fi
40
51
41
52
echo "Handling zsh"
42
53
if [[ -f ~/.zshrc ]]; then
43
- if [[ $(grep -c "source /usr/local/bin /codepilot" ~/.zshrc) -eq 0 ]]; then
54
+ if [[ $(grep -c "source $local_bin_path /codepilot" ~/.zshrc) -eq 0 ]]; then
44
55
echo "Sourcing codepilot script in ~/.zshrc"
45
- echo "source /usr/local/bin /codepilot" >> ~/.zshrc
56
+ echo "source $local_bin_path /codepilot" >> ~/.zshrc
46
57
else
47
58
echo "CodePilot is already installed"
48
59
exit 0
49
60
fi
50
61
else
51
62
echo "Sourcing codepilot script in ~/.zshrc"
52
- echo "source /usr/local/bin /codepilot" >> ~/.zshrc
63
+ echo "source $local_bin_path /codepilot" >> ~/.zshrc
53
64
fi
54
65
66
+ echo "Removing useless files"
67
+ rm codepilot install
68
+
55
69
echo "GitHub Copilot installed successfully"
56
70
57
71
exit 0
0 commit comments