-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall
executable file
·47 lines (37 loc) · 1.75 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
35
36
37
38
39
40
41
42
43
44
45
46
47
if [ ! -f /usr/local/bin/virtualenvwrapper.sh ]
then
echo -ne "Please install virtualenvwrapper in your system\n\n"
echo -ne " $ sudo pip install virtualenvwrapper\n\n"
echo -ne " or\n\n"
echo -ne " $ sudo pip3 install virtualenvwrapper\n"
return 1
else
type mkvirtualenv || source /usr/local/bin/virtualenvwrapper.sh
fi
echo -ne "Installing pip-save..."
# ~/.zshrc, ~/.bashrc
SHELL_RC_FILE="$HOME/.$(basename $SHELL)rc"
mkdir -p $HOME/.virtualenvs && export WORKON_HOME=~/.virtualenvs
curl -sSLk -o $HOME/.pipsave_cd "https://raw.githubusercontent.com/abhiomkar/pip-save/master/src/pipsave_cd" && \
echo -ne "\n pipsave_cd\n" && \
curl -sSLk -o $HOME/.pipsave_pip "https://raw.githubusercontent.com/abhiomkar/pip-save/master/src/pip" && \
echo " pipsave_pip" && \
curl -sSLk -o $HOME/.pipsave_pip3 "https://raw.githubusercontent.com/abhiomkar/pip-save/master/src/pip3" && \
echo " pipsave_pip3" && \
echo -ne "\n" && \
DOWNLOAD_OK=1 && \
echo -e ">>> Installation successful"
[ -z $DOWNLOAD_OK ] && echo "exiting..." && return 1
[ -f ~/.pipsave_cd ] && source ~/.pipsave_cd
[ -f ~/.pipsave_pip ] && source ~/.pipsave_pip
[ -f ~/.pipsave_pip3 ] && source ~/.pipsave_pip3
# Update Shell rc file (~/.bashrc, ~/.zshrc ..)
grep -q "export WORKON_HOME=~/.virtualenvs" $SHELL_RC_FILE > /dev/null || \
echo "export WORKON_HOME=~/.virtualenvs" >> $SHELL_RC_FILE
grep -q "source /usr/local/bin/virtualenvwrapper.sh" $SHELL_RC_FILE > /dev/null || \
echo "source /usr/local/bin/virtualenvwrapper.sh" >> $SHELL_RC_FILE
grep -q "pipsave_line" $SHELL_RC_FILE > /dev/null || \
echo "
[ -f ~/.pipsave_cd ] && source ~/.pipsave_cd # pipsave_line
[ -f ~/.pipsave_pip ] && source ~/.pipsave_pip # pipsave_line
[ -f ~/.pipsave_pip3 ] && source ~/.pipsave_pip3 # pipsave_line" >> $SHELL_RC_FILE