-
Notifications
You must be signed in to change notification settings - Fork 3
/
setup.sh
43 lines (42 loc) · 1.42 KB
/
setup.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
#!/bin/bash
# A script to copy the pyplif to hidden folder inside
# HOME folder then add a 'command-line shortcut'
# to PyPLIF inside that hidden folder.
if [ $1 > 0 ] ; then
if [ $1 = 'uninstall' ]; then
if [ -e $HOME/.pyplif ]; then
rm -r $HOME/.pyplif
gawk '$0 !~/alias pyplif/ { print $0 }' $HOME/.bashrc > .bashrc.tmp
cat .bashrc.tmp > $HOME/.bashrc
echo "PyPLIF has been successfully uninstalled"
else
echo "PyPLIF never been installed before"
fi
elif [ $1 = 'force' ]; then
if [ -e $HOME/.pyplif ]; then
rm -r $HOME/.pyplif
else
echo "alias pyplif='$HOME/.pyplif/pyplif.py'" >> $HOME/.bashrc
fi
cp -r pyplif $HOME/.pyplif
chmod +x $HOME/.pyplif/pyplif.py
echo "PyPLIF successfully installed"
else
echo "Wrong Argument"
fi
else
if `cat $HOME/.bashrc | grep 'pyplif'`; then
echo "PyPLIF installation failed because PyPLIF is already installed"
echo "Use option 'force' to overwrite the old installation:"
echo "./setup.sh force"
exit
else
if [ -e $HOME/.pyplif ]; then
rm -r $HOME/.pyplif
fi
cp -r pyplif $HOME/.pyplif
chmod +x $HOME/.pyplif/pyplif.py
echo "alias pyplif='$HOME/.pyplif/pyplif.py'" >> $HOME/.bashrc
echo "PyPLIF successfully installed"
fi
fi