forked from chen3feng/blade-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·35 lines (29 loc) · 1.07 KB
/
install
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
#!/bin/bash
blade_dir=$(cd $(dirname $0) && pwd)
cd $blade_dir
echo -n "Installing vim scripts..."
mkdir -p ~/.vim/{syntax,ftdetect,indent}
ln -sf $blade_dir/vim/ftdetect/* ~/.vim/ftdetect/
ln -sf $blade_dir/vim/syntax/* ~/.vim/syntax/
ln -sf $blade_dir/vim/indent/* ~/.vim/indent/
echo ", Done."
mkdir -p ~/bin
echo -n "Installing blade auxiliary tools..."
ln -sf $blade_dir/tool/{genlibbuild,lsnobuild,lsrc,merge-static-libs,bladefunctions} ~/bin
if [ ! -f ~/.bashrc ] || ! grep "bladefunctions" ~/.bashrc 2>&1 >/dev/null; then
echo "test -s ~/bin/bladefunctions && . ~/bin/bladefunctions || true" >> ~/.bashrc
fi
echo ", Done."
echo -n "Installing blade..."
ln -sf $blade_dir/blade ~/bin
echo ", Done."
if ! echo $PATH | grep "$HOME/bin" &> /dev/null; then
profile=~/.bash_profile
if echo $SHELL | grep "zsh" &> /dev/null; then
profile=~/.zshenv
elif [ -f ~/.profile ]; then
profile=~/.profile
fi
echo 'export PATH=~/bin:$PATH' >> $profile
echo -e "\033[1;32mInstall success, please relogin or run 'source $profile' manually to apply\033[0m"
fi