forked from chadit/dotfiles_old
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_python.sh
executable file
·65 lines (41 loc) · 1.25 KB
/
install_python.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
#!/bin/bash
# Python Setup
func ()
{
local INSTALLVER=3.6.2
local SCRIPTUSER=${SUDO_USER}
local FILETAR="Python-${INSTALLVER}.tar.xz"
local UNTARFOLDERNAME="go"
local INSTALLPATH="/usr/lib64/golang"
local SOURCEURL="https://www.python.org/ftp/python/${INSTALLVER}/${FILETAR}"
# check if already installed
if python3 -V | grep -qi "Python ${INSTALLVER}"; then
echo "this version is already installed"
return
fi
if test "$SCRIPTUSER" = "" || test "$SCRIPTUSER" = "root"; then
SCRIPTUSER=${USER}
fi
echo "user set to $SCRIPTUSER"
# change directory to tmp
cd /tmp/
# Download the sources if file does not exist
if [ ! -f /tmp/${FILETAR} ]; then
sudo wget ${SOURCEURL}
fi
# unpack tar
sudo tar -xvf ${FILETAR}
if python -mplatform | grep -qi Fedora; then
#Prerequisites
# The GCC package contains the GNU Compiler Collection
# http://www.linuxfromscratch.org/blfs/view/svn/general/gcc.html
sudo dnf install -y gcc
cd /tmp/Python-${INSTALLVER}
./configure
make altinstall
fi
# Install to /usr/local
# sudo rsync -av ${UNTARFOLDERNAME}/ ${INSTALLPATH}/
sudo rm -rf Python*
}
func