-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·45 lines (34 loc) · 922 Bytes
/
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
#!/bin/bash
echo "Building image for kscript..."
docker build -t kscript:latest .
echo ""
echo "Add execute mode to bin/kscript-router.sh"
chmod +x bin/kscript-router.sh
echo ""
echo "Trying to add kscript router to PATH..."
if [[ -e $HOME/.bashrc ]]; then
if ! grep -q "# kscript" "$HOME/.bashrc"; then
echo "" >> "$HOME/.bashrc"
echo "# kscript" >> "$HOME/.bashrc"
echo "export PATH=$(pwd)/bin:$PATH" >> "$HOME/.bashrc"
source $HOME/.bashrc
echo "Added to $HOME/.bashrc!"
fi
else
echo "Could not find $HOME/.bashrc"
echo "Aborting..."
exit -1
fi
echo ""
echo "Trying to add alias for kscript..."
alias_file="$HOME/.bashrc"
if [[ -e $HOME/.bash_aliases ]]; then
alias_file="$HOME/.bash_aliases"
fi
if ! grep -q "# kscript" "$alias_file"; then
echo "" >> $alias_file
echo "# kscript" >> $alias_file
echo "alias kscript=kscript-router.sh" >> $alias_file
source $alias_file
echo "Added!"
fi