forked from ReinerNippes/nextcloud_on_docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prepare_system.sh
executable file
·186 lines (166 loc) · 5.36 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#!/bin/bash -uxe
#
# Prepare system for nextcloud installation
#
prepare_ubuntu() {
$SUDO apt update -y
$SUDO apt-get -o Dpkg::Options::="--force-confold" -fuy dist-upgrade
$SUDO apt-get -o Dpkg::Options::="--force-confold" -fuy install software-properties-common curl git mc vim facter python3 python3-setuptools python3-apt python3-pip python3-passlib python3-wheel python3-bcrypt aptitude -y
$SUDO [ $(uname -m) == "aarch64" ] && $SUDO apt install gcc python3-dev libffi-dev libssl-dev make -y
$SUDO pip3 install ansible -U
set +x
echo
echo "------------------------------------------------------"
echo
echo " Ubuntu System ready to install Nextcloud."
echo
ansible --version
echo
echo "------------------------------------------------------"
echo
}
prepare_debian() {
$SUDO apt update -y
$SUDO apt-get -o Dpkg::Options::="--force-confold" -fuy dist-upgrade
$SUDO apt-get -o Dpkg::Options::="--force-confnew" -fuy install dirmngr curl git mc vim facter python3 python3-pip python3-apt python3-passlib python3-bcrypt python3-wheel python3-setuptools aptitude -y
[ $(uname -m) == "aarch64" ] && $SUDO apt install gcc python3-dev libffi-dev libssl-dev make -y
$SUDO pip3 install ansible -U
set +x
echo
echo "------------------------------------------------------"
echo
echo " Debian System ready to install Nextcloud."
echo
ansible --version
echo
echo "------------------------------------------------------"
echo
}
prepare_raspbian() {
$SUDO apt update -y
$SUDO apt-get -o Dpkg::Options::="--force-confold" -fuy dist-upgrade
$SUDO apt install dirmngr mc vim git libffi-dev curl facter python python-apt python-pip python-passlib python-bcrypt aptitude -y
$SUDO pip install ansible -U
set +x
echo
echo "------------------------------------------------------"
echo
echo " Rasbpian System ready to install Nextcloud."
echo
ansible --version
echo
echo "------------------------------------------------------"
echo
}
prepare_centos() {
$SUDO yum install epel-release -y
$SUDO yum install git vim mc curl facter python3 python3-pip -y
$SUDO yum update -y
$SUDO pip3 install ansible -U
set +x
echo
echo "------------------------------------------------------"
echo
echo " CentOS System ready to install Nextcloud."
echo
ansible --version
echo
echo "------------------------------------------------------"
echo
}
prepare_fedora() {
$SUDO dnf install git vim mc curl facter python3 python3-dnf python3-pip python3-libselinux python3-bcrypt python3-passlib ansible -y
$SUDO dnf update -y
set +x
echo
echo "------------------------------------------------------"
echo
echo " Fedora System ready to install Nextcloud."
echo
ansible --version
echo
echo "------------------------------------------------------"
echo
}
prepare_photon() {
$SUDO tdnf install git python3-pip -y
$SUDO tdnf update -y
$SUDO pip3 install ansible
$SUDO pip3 install --upgrade pip
$SUDO shutdown -r +1
set +x
echo
echo "------------------------------------------------------"
echo
echo " VMware Photon OS System ready to install Nextcloud."
echo " Photon OS will reboot in 1 min "
echo " type shutdown -c to cancel "
echo
ansible --version
echo
echo "------------------------------------------------------"
echo
}
prepare_amzn() {
$SUDO amazon-linux-extras install epel -y
$SUDO amazon-linux-extras install python3 -y
$SUDO yum install git vim mc curl facter -y
$SUDO yum update -y
$SUDO pip3 install ansible -U
$SUDO pip3 install passlib -U
$SUDO pip3 install bcrypt -U
set +x
echo
echo "------------------------------------------------------"
echo
echo " Amazon Linux 2 ready to install Nextcloud."
echo
ansible --version
echo
echo "------------------------------------------------------"
echo
}
usage() {
echo
echo "Linux distribution not detected."
echo "Use: ID=[ubuntu|debian|centos|raspbian|amzn|fedora|proton] 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
;;
'photon')
prepare_photon
;;
'debian')
prepare_debian
;;
'raspbian')
prepare_raspbian
;;
'centos')
prepare_centos
;;
'fedora')
prepare_fedora
;;
'amzn')
prepare_amzn
;;
*)
usage
;;
esac