forked from ReinerNippes/nextcloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prepare_system.sh
executable file
·154 lines (130 loc) · 3.55 KB
/
prepare_system.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/bin/bash -uxe
#
# Prepare system for nextcloud devel
#
install_pip () {
curl https://bootstrap.pypa.io/get-pip.py | $SUDO $PYTHON_BIN
$SUDO pip install setuptools -U
$SUDO pip install ansible -U
$SUDO pip install netaddr -U
$SUDO pip install dnspython -U
$SUDO pip install passlib -U
$SUDO pip install bcrypt -U
}
prepare_ubuntu() {
$SUDO apt update -y
$SUDO apt dist-upgrade -y
$SUDO apt install software-properties-common curl git mc vim facter python python-is-python3 python-apt aptitude -y
[ $(uname -m) == "aarch64" ] && $SUDO apt install gcc python-dev libffi-dev libssl-dev make -y
PYTHON_BIN=/usr/bin/python
install_pip
$SUDO pip install python-apt -U
set +x
echo
echo " Ubuntu Sytem ready for nextcloud."
echo
ansible --version
}
prepare_debian() {
$SUDO apt update -y
$SUDO apt dist-upgrade -y
$SUDO apt install dirmngr curl git mc vim facter python python-apt aptitude -y
[ $(uname -m) == "aarch64" ] && $SUDO apt install gcc python-dev libffi-dev libssl-dev make -y
PYTHON_BIN=/usr/bin/python
install_pip
$SUDO pip install python-apt -U
set +x
echo
echo " Debian Sytem ready for nextcloud."
echo
ansible --version
}
prepare_raspbian() {
$SUDO apt update -y
$SUDO apt dist-upgrade -y
$SUDO apt install dirmngr mc vim git libffi-dev curl facter -y
PYTHON_BIN=/usr/bin/python
install_pip
set +x
echo
echo " Rasbpian System ready for nextcloud."
echo
ansible --version
}
prepare_centos() {
$SUDO yum install epel-release -y
$SUDO yum install git vim mc curl facter libselinux-python python -y
$SUDO yum update -y
PYTHON_BIN=/usr/bin/python
install_pip
set +x
echo
echo " CentOS Sytem ready for nextcloud."
echo
ansible --version
}
prepare_fedora() {
$SUDO dnf install git vim mc curl facter libselinux-python python python3 python3-dnf -y
$SUDO dnf update -y
PYTHON_BIN=/usr/bin/python
install_pip
$SUDO dnf reinstall python3-pip -y
set +x
echo
echo " Fedora Sytem ready for nextcloud."
echo
ansible --version
}
prepare_amzn() {
$SUDO amazon-linux-extras install epel -y
$SUDO yum install git vim mc curl facter libselinux-python python -y
$SUDO yum update -y
PYTHON_BIN=/usr/bin/python
install_pip
set +x
echo
echo " Amazon Linux 2 ready for nextcloud."
echo
ansible --version
}
usage() {
echo
echo "Linux distribution not detected."
echo "Use: ID=[ubuntu|debian|centos|raspbian|amzn|fedora] prepare_system.sh"
echo "Other distributions not yet supported."
echo
}
if [ -f /etc/os-release ]; then
. /etc/os-release
elif [ -f /etc/debian_version ]; then
$ID=debian
fi
# root or not
if [[ $EUID -ne 0 ]]; then
SUDO='sudo -H'
else
SUDO=''
fi
case $ID in
'ubuntu')
prepare_ubuntu
;;
'debian')
prepare_debian
;;
'raspbian')
prepare_raspbian
;;
'centos')
prepare_centos
;;
'fedora')
prepare_fedora
;;
'amzn')
prepare_amzn
;;
*)
usage
;;
esac