-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcentos-workstation-postinstall.sh
executable file
·247 lines (216 loc) · 5.75 KB
/
centos-workstation-postinstall.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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
#! /bin/bash
######## Variables ##############
# enforcing/permissive/disabled : Statut de SELinux à activer
selinux=enforcing
# 0/1 : Ajouter cockpit
cockpit=0
# 0/1 : Activer les Flatpak
addflatpak=1
# 0/1 : Désactiver le parefeu firewalld
disablefirewalld=0
# Liste de logiciels additionnels à installer
addsoftwares="nmon htop vim"
# 0/1 : Si on veut installer les codecs
codecs=1
# 0/1 : Si on veut installer les extensions GNOME dash-to-dock, appindicator
gnomeextensions=1
# 0/1 : Si on veut supprimer les logiciels annexes de GNOME (Avoir un gnome light)
removeextragnome=1
# 0/1 : Si on veut supprimer les services d'impression et scanner
removecupsscan=0
# 0/1 : Si on veut supprimer abrtd
removeabrtd=1
# 0/1 : Si on veut supprimer libvirt installé par défaut
removelibvirt=1
# 0/1 : Si on veut installer NVidia Proprio (Optimus supporté)
# /!\ SecureBoot doit être désactivé pour cette option
nvidiaproprio=0
# 0/1 : Si on veut installer les pilotes Wi-Fi Broadcom
# /!\ SecureBoot doit être désactivé
broadcomwifi=0
# 0/1 : Si on veut installer Steam
steam=0
# 0/1 : Si on veut remplacer Firefox par Vivaldi
vivaldi=1
######## FIN Variables ##########
######## Check root #############
if [[ $EUID -ne 0 ]]
then
sudo chmod +x $(dirname $0)/$0
sudo $(dirname $0)/$0
exit;
fi
######## Vérifs auto ###########
isvbox=$(LANG=C hostnamectl | grep -i virtualization | grep -c oracle)
centos=$(rpm -E %centos)
######## Script ################
# SELinux
sed -e "s/SELINUX=.*/SELINUX=$selinux/" -i /etc/sysconfig/selinux
# Optimisations DNF
if [[ "$centos" -eq "8" ]]
then
isfm=$(grep -c fastestmirror /etc/dnf/dnf.conf)
if [[ "$isfm" -eq "0" ]]
then
echo "fastestmirror=1" >> /etc/dnf/dnf.conf
fi
fi
# MàJ
if [[ "$centos" -eq "8" ]]
then
dnf -y --nogpgcheck --refresh upgrade
dnf -y --nogpgcheck install gnome-tweaks
fi
# Dépôts
if [[ "$centos" -eq "8" ]]
then
dnf config-manager --set-enabled extras
dnf config-manager --set-enabled PowerTools
dnf install -y --nogpgcheck epel-release
dnf install -y --nogpgcheck https://www.elrepo.org/elrepo-release-8.0-2.el8.elrepo.noarch.rpm
dnf install -y --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm
dnf install -y --nogpgcheck https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-8.noarch.rpm
dnf -y --nogpgcheck --refresh upgrade
fi
#Flatpak
if [[ "$centos" -eq "8" ]]
then
if [[ "$addflatpak" -eq "1" ]]
then
dnf install --nogpgcheck -y flatpak
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
fi
fi
# Outils divers
if [[ "$centos" -eq "8" ]]
then
if [[ -n $addsoftwares ]]
then
dnf install --nogpgcheck -y $addsoftwares
fi
fi
# Cockpit
if [[ "$centos" -eq "8" ]]
then
if [[ "$cockpit" -eq "1" ]]
then
dnf install --nogpgcheck -y cockpit
dnf install --nogpgcheck -y cockpit-networkmanager cockpit-selinux cockpit-dashboard cockpit-system cockpit-storaged
systemctl enable cockpit.socket
systemctl start cockpit.socket
firewall-cmd --add-service=cockpit --permanent
firewall-cmd --reload
fi
fi
# Désactiver firewalld
if [[ "$centos" -eq "8" ]]
then
if [[ "$disablefirewalld" -eq "1" ]]
then
systemctl stop firewalld
systemctl disable wirewalld
fi
fi
# Codecs
if [[ "$centos" -eq "8" ]]
then
if [[ "$codecs" -eq "1" ]]
then
dnf install --nogpgcheck -y gstreamer1-plugins-{base,good,bad-free,ugly-free} gstreamer1-libav gstreamer1-plugins-{bad-freeworld,ugly}
fi
fi
# Gnomeextensions
if [[ "$centos" -eq "8" ]]
then
if [[ "$gnomeextensions" -eq "1" ]]
then
dnf install --nogpgcheck -y gnome-shell-extension-{dash-to-dock,appindicator}
fi
fi
# Packagekit
if [[ "$centos" -eq "8" ]]
then
if [[ "$removepackagekit" -eq "1" ]]
then
dnf -y autoremove gnome-software PackageKit
fi
fi
# ExtraGNOME
if [[ "$centos" -eq "8" ]]
then
if [[ "$removeextragnome" -eq "1" ]]
then
dnf -y autoremove baobab cheese epiphany gnome-{calendar,characters,clocks,contacts,dictionary,disk-utility,font-viewer,logs,maps,photos,user-docs,,weather} gucharmap sushi
fi
fi
# Suppression de l'impression et scan
if [[ "$centos" -eq "8" ]]
then
if [[ "$removecupsscan" -eq "1" ]]
then
dnf -y autoremove cups simple-scan
fi
fi
# Abrtd
if [[ "$centos" -eq "8" ]]
then
if [[ "$removeabrtd" -eq "1" ]]
then
dnf autoremove -y abrtd*
fi
fi
# Libvirt
if [[ "$centos" -eq "8" ]]
then
if [[ "$removelibvirt" -eq "1" ]]
then
dnf autoremove -y libvirt*
fi
fi
# Nvidia
if [[ "$centos" -eq "8" ]]
then
if [[ "$nvidiaproprio" -eq "1" ]]
then
dnf install --nogpgcheck -y xorg-x11-drv-nvidia akmod-nvidia xorg-x11-drv-nvidia-cuda
fi
fi
# Broadcom
if [[ "$centos" -eq "8" ]]
then
if [[ "$broadcomwifi" -eq "1" ]]
then
dnf install --nogpgcheck -y akmod-wl
fi
fi
#Steam
if [[ "$centos" -eq "8" ]]
then
if [[ "$steam" -eq "1" ]]
then
dnf install --nogpgcheck -y steam
fi
fi
#Vivaldi
if [[ "$centos" -eq "8" ]]
then
if [[ "$vivaldi" -eq "1" ]]
then
if [ -d "/etc/yum.repos.d" ]
then
echo "[vivaldi]" > /etc/yum.repos.d/vivaldi.repo
echo "name=vivaldi" >> /etc/yum.repos.d/vivaldi.repo
echo "baseurl=http://repo.vivaldi.com/archive/rpm/x86_64" >> /etc/yum.repos.d/vivaldi.repo
echo "enabled=1" >> /etc/yum.repos.d/vivaldi.repo
echo "gpgcheck=1" >> /etc/yum.repos.d/vivaldi.repo
echo "gpgkey=http://repo.vivaldi.com/archive/linux_signing_key.pub" >> /etc/yum.repos.d/vivaldi.repo
dnf install --nogpgcheck -y vivaldi-stable
/opt/vivaldi/update-ffmpeg
/opt/vivaldi/update-widevine
dnf autoremove -y firefox
#TODO awk -F: '$3 >= 1000 AND $3 <= 2000 {print $1}' /etc/passwd
gsettings set org.gnome.shell favorite-apps "$(gsettings get org.gnome.shell favorite-apps | sed -e 's/firefox.desktop/vivaldi-stable.desktop/')"
fi
fi
fi
echo "Préparation terminée, il est recommandé de redémarrer !"