43 lines
685 B
Bash
43 lines
685 B
Bash
#!/usr/bin/env bash
|
|
|
|
PI=/opt
|
|
EXPECTED_VERSION="2.7.10"
|
|
|
|
get_source(){
|
|
wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tar.xz
|
|
tar xvf Python-2.7.10.tar.xz
|
|
cd Python-2.7.10
|
|
}
|
|
|
|
install_configure(){
|
|
./configure
|
|
make
|
|
make install
|
|
}
|
|
|
|
remove(){
|
|
rm $PI/Python-2.7.10.tar.xz
|
|
rm -rf $PI/Python-2.7.10
|
|
}
|
|
|
|
update_alternatives(){
|
|
update-alternatives --install /usr/bin/python python /usr/local/bin/python 10
|
|
}
|
|
|
|
version(){
|
|
VERSION=$(python -c "print __import__('sys').version[0:6]")
|
|
|
|
if [ "$VERSION" == "$EXPECTED_VERSION" ];
|
|
then echo "Python $VERSION installed OK";
|
|
else echo "FAIL";
|
|
fi
|
|
}
|
|
|
|
cd $PI
|
|
get_source
|
|
install_configure
|
|
update_alternatives
|
|
remove
|
|
|
|
version
|