forked from aliyun/aliyun-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
82 lines (76 loc) · 2 KB
/
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/sh
export PYTHONPATH=`pwd`
cd ./packages
InstallPython()
{
tar -zxvf Python-2.7.tgz
cd Python-2.7 && sh ./configure && make
sudo make install
cd ..
sudo rm -rf Python-2.7
}
InstallSetupTool()
{
tar -zvxf setuptools-2.0.1.tar.gz
cd setuptools-2.0.1
sudo python setup.py install
cd ..
sudo rm -rf setuptools-2.0.1
}
InstallPip()
{
tar -zvxf pip-1.3.1.tar.gz
cd pip-1.3.1
sudo python setup.py install
cd ..
sudo rm -rf pip-1.3.1
}
InstallAliyuncli()
{
tar -zvxf aliyuncli-1.0.0.tar.gz
cd aliyuncli-1.0.0
sudo python setup.py install --record ../../files.txt
cd ..
sudo rm -rf aliyuncli-1.0.0
}
pipv=`which pip 2>&1| awk -F: '{print $1}' | awk -F'/' '{print $NF}'`
if [ "$pipv" = "pip" ]
then
echo 'Pip already installed'
else
InstallPip
fi
pyv=`which python 2>&1| awk -F: '{print $1}' | awk -F'/' '{print $NF}'`
if [ "$pyv" = "python" ]
then
echo 'Python already installed'
else
InstallPython
fi
aliyuncli=`which aliyuncli 2>&1| awk -F: '{print $1}' | awk -F'/' '{print $NF}'`
if [ "$aliyuncli" = "aliyuncli" ]
then
echo "Aliyuncli has been installed !!!"
echo -e "Do you want to remove the exisitng version and install the current version ? [Y/N]\c "
read Choice
case $Choice in
y|Y|[Yy][Ee][Ss])
InstallAliyuncli
echo ""
echo "***********************************************************"
echo "* New aliyuncli version has been installed successfully ! *"
echo "***********************************************************"
;;
*)
echo "Skip the installation of this version!"
;;
esac
else
InstallSetupTool
InstallAliyuncli
echo ""
echo "***********************************************************"
echo "* New aliyuncli version has been installed successfully ! *"
echo "***********************************************************"
fi
complete -C '/usr/local/bin/aliyun_completer' aliyuncli