-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·105 lines (90 loc) · 2.3 KB
/
install.sh
File metadata and controls
executable file
·105 lines (90 loc) · 2.3 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/bash
ROOT="/etc"
LSB_FILE="lsb-release"
DISTRIB_SUFFIX="release"
DEBIAN_FILE="/etc/debian_version"
DEBIAN_NAME="Debian"
FILENAME="/etc/os-release"
UNAME=""
PYTHON_PKG="python3 python3-pip"
# FUNCTIONS
db_install(){
apt-get update
apt-get upgrade -y
apt-get install $PYTHON_PKG -y
}
arch_install(){
pacman -Sy
pacman -Sq --noconfirm $PYTHON_PKG
}
getDistroName(){
if [[ -f $FILENAME ]] ; then
DISTRO=$(head -1 $FILENAME | cut -f 2 -d '"')
DISTRO=${DISTRO/Linux/}
else
FILENAME="/etc/redhat-release"
if [[ ! -f $FILENAME ]] ; then
FILENAME=$(find $ROOT/ -maxdepth 1 \
-name \*$DISTRIB_SUFFIX \
-and ! -name $LSB_FILE \
-and -type f 2> /dev/null \
| head -1 )
fi
if [[ -z $FILENAME ]] ; then
if [[ -f "$DEBIAN_FILE" ]] ; then
DISTRO=$DEBIAN_NAME
else
echo "Unable to find your distro"
fi
else
CONTENT=$(head -1 $FILENAME 2> /dev/null)
DISTRO=$(echo $CONTENT | sed \
-e "s/[[:blank:]][Ll][Ii][Nn][Uu][Xx][[:blank:]]/ /g" \
-e "s/\(.*\)[[:blank:]]release.*/\1/" \
-e "s/[[:blank:]]/ /g" )
fi
fi
}
install(){
getDistroName
echo $DISTRO
if [ $DISTRO == "Mint" ] || [ $DISTRO == "Debian" ] || [ $DISTRO == "Ubuntu" ] ; then
echo "Debian Base Distro :)"
db_install
elif [ $DISTRO == "Arch" ] || [ $DISTRO == "Manjaro" ] || [ $DISTRO == "ManjaroLinux" ] ; then
echo "Arch Base Distro :)"
arch_install
elif [ $DISTRO == "CentOS" ] || [ $DISTRO == "Fedora" ] || [ $DISTRO == "rhel" ] ; then
echo "Redhat Base Distro :)"
echo "Not supportet yet :("
exit
else
echo "Your distro is not supported :("
exit
fi
python3 -m pip install pipenv &> /dev/null
python3 -m pipenv check &> /dev/null
python3 -m pipenv lock &> /dev/null
python3 -m pipenv update &> /dev/null
pythone -m pipenv install -r requirements.txt &> /dev/null
clear
python3 -m pipenv run python3 main.py
}
main(){
if [[ $EUID -ne 0 ]]; then
echo "please run as root"
exit 1
fi
UNAME=$(uname)
if [ $UNAME == "Linux" ] ; then
install
elif [ $UNAME == "Darwin" ] ; then
echo "you use Darwin and this os not supported"
exit
elif [ $UNAME == CYGWIN* ] || [ $UNAME == MINGW* ] ; then
echo "you use Windows and this os not supported"
exit
fi
}
##############################################################
main