-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpython.sh
68 lines (65 loc) · 2.31 KB
/
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
66
67
68
#!/bin/bash
# Default variables
function="install"
python_version=`wget -qO- https://endoflife.date/api/python.json | jq -r ".[0].latest"`
# Options
. <(wget -qO- https://raw.githubusercontent.com/1Malenok1/Stuff/main/colours.sh) --
option_value(){ echo "$1" | sed -e 's%^--[^=]*=%%g; s%^-[^=]*=%%g'; }
while test $# -gt 0; do
case "$1" in
-h|--help)
. <(wget -qO- https://raw.githubusercontent.com/1Malenok1/Stuff/main/logo_mms.sh)
echo
echo -e "${C_LGn}Functionality${RES}: the script installs Python"
echo
echo -e "${C_LGn}Usage${RES}: script ${C_LGn}[OPTIONS]${RES}"
echo
echo -e "${C_LGn}Options${RES}:"
echo -e " -h, --help show the help page"
echo -e " -v, --version VERSION Python VERSION to install (default is ${C_LGn}${python_version}${RES})"
echo
echo -e "You can use either \"=\" or \" \" as an option and value ${C_LGn}delimiter${RES}"
return 0 2>/dev/null; exit 0
;;
-v*|--version*)
if ! grep -q "=" <<< "$1"; then shift; fi
python_version=`option_value "$1"`
shift
;;
*|--)
break
;;
esac
done
# Functions
install() {
echo -e "${C_LGn}Python installation...${RES}"
if ! python3 --version | grep -q "3.8.10"; then
sudo apt update
sudo apt upgrade -y
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev -y
wget "https://www.python.org/ftp/python/${python_version}/Python-${python_version}.tgz"
sudo rm -rf /usr/local/python
sudo tar -C /usr/local -xzf "Python-${python_version}.tgz"
rm "Python-${python_version}.tgz"
sudo mv "/usr/local/Python-${python_version}" /usr/local/python
cd /usr/local/python
./configure --enable-optimizations
make
sudo make altinstall
sudo apt install python3-pip -y
cd
fi
}
# Actions
$function
echo -e "${Bl_Gn}All Operation Completed!${RES}"
. <(wget -qO- https://raw.githubusercontent.com/1Malenok1/Stuff/main/logo_mms.sh)
echo
echo -e "${C_LGn}Visit our resources:${RES}"
echo -e "${C_C}https://mms.team${RES} — Main_Site"
echo -e "${C_C}https://t.me/nftmms${RES} — MMS_Research_Chat"
echo -e "${C_C}https://t.me/cosmochannel_mms${RES} — MMS_Cosmos_Ecosystem_Chat"
echo -e "${C_C}https://t.me/mmsnodes${RES} — MMS_Nodes_Chat"
echo -e "${C_C}https://nodes.mms.team${RES} — Guides_and_Manual's"
echo