-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_packages.sh
executable file
·307 lines (277 loc) · 7.61 KB
/
install_packages.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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
#!/bin/bash
# Commented commands are those that no longer work or do not work
dnf_commands=(
"gcc"
"code"
"CSFML*"
"terminus-fonts-console"
"docker-ce docker-ce-cli containerd.io"
"pacman"
"thunar"
"valgrind"
"curl git cmake net-tools gcc g++ clang"
"gdb"
"perf"
"libpng"
"nodejs"
"gcovr"
"xbindkeys xvkbd"
"apt"
"xdotool"
"xautomation"
"git-lfs"
"git-filter-repo"
"akmod-VirtualBox kernel-devel-$(uname -r)"
"make time perl gcc dkms kernel-devel kernel-headers"
"unrar"
"touchegg"
"fedora-workstation-repositories"
"rpmfusion-free-release-tainted"
"rpmfusion-nonfree-release-tainted"
"dnf-utils"
"fedy -y"
"redhat-lsb-core anydesk"
"php"
"phpmyadmin"
"nodejs"
"npm"
"links"
"vim"
"nodejs npm"
"SDL2 SDL2-devel SDL2_ttf SDL2_ttf-devel SFML SFML-devel ncurses ncurses-devel"
"SDL2 SDL2-devel SDL2_ttf SDL2_ttf-devel SFML SFML-devel ncurses ncurses-devel"
"snapd"
"kernel-modules"
"fuse squashfuse"
"clang cmake cubeb-devel freeglut-devel git glm-devel gtk3-devel kernel-headers libgcrypt-devel libsecret-devel libtool libusb1-devel nasm ninja-build perl-core systemd-devel zlib-devel"
"apt"
"Cemu"
"gnuplot"
"https://download.postgresql.org/pub/repos/yum/reporpms/F-38-x86_64/pgdg-fedora-repo-latest.noarch.rpm"
"postgresql16-server"
"doxygen"
"doxygen-doxywizard"
"php"
"phpmyadmin"
"openvpn"
)
yum_commands=(
"php-gd"
"gd-devel"
"ruby"
"curl git cmake net-tools gcc g++ clang"
)
npm_commands=(
"dotenv --save"
)
apt_commands=(
"phpmyadmin"
"xautomation"
"--install-recommends winehq-stable"
"kali-linux-everything"
"curl"
)
snap_commands=(
"install flutter --classic"
)
pip_commands=(
"gcovr"
"--user git-filter-repo"
"scipy"
"matplotlib"
"scipy"
"numpy"
)
pacman_commands=(
"wii-dev"
"dkp-libs"
"wiiu-dev"
"ppc-lgd"
"ppc-zlib ppc-libmad ppc-libogg ppc-libgd ppc-freetype ppc-libjpeg-turbo ppc-libpng ppc-libvorbisidec ppc-glm ppc-bzip2"
)
hidden_commands=(
"dnf install docker"
"dnf install software-properties-common gdebi gdebi-kde gdeby-core aptitude build-essential bfg bfg-repo-cleaner brew xdg xbindkeys-config p10k rar winrar \*-firmware laravel snap flutter apt-add apt-add-repository lib32z1 lib32ncurses5 lib32bz2-1.0 nanolib yay wordlists kali-linux-everything metasploit"
"yum install libsfml-dev"
)
# Fonction pour afficher l'usage
usage()
{
echo "Usage: $0 [OPTIONS]"
echo "Options:"
echo " -h, --help Afficher l'usage"
echo " -y, --yes Installer les packages sans confirmation"
echo " -n, --name Vérifier l'existence d'un package et l'installer"
echo " -a, --all Installer tous les packages, y compris les cachés"
exit 1
}
# Fonction pour installer les packages
install_packages()
{
echo -e "\e[32mInstallation des packages...\e[0m"
if [ "$YES" = true ]; then
for cmd in "${dnf_commands[@]}"; do
sudo dnf install -y $cmd
done
for cmd in "${yum_commands[@]}"; do
sudo yum install -y $cmd
done
for cmd in "${npm_commands[@]}"; do
sudo npm install -g $cmd
done
#for cmd in "${apt_commands[@]}"; do
# sudo apt install -y $cmd
#done
for cmd in "${snap_commands[@]}"; do
sudo snap install $cmd
done
for cmd in "${pip_commands[@]}"; do
sudo pip install $cmd
done
for cmd in "${pacman_commands[@]}"; do
sudo pacman -S $cmd --noconfirm
done
else
for cmd in "${dnf_commands[@]}"; do
sudo dnf install $cmd
done
for cmd in "${yum_commands[@]}"; do
sudo yum install $cmd
done
for cmd in "${npm_commands[@]}"; do
sudo npm install -g $cmd
done
#for cmd in "${apt_commands[@]}"; do
# sudo apt install $cmd
#done
for cmd in "${snap_commands[@]}"; do
sudo snap install $cmd
done
for cmd in "${pip_commands[@]}"; do
sudo pip install $cmd
done
for cmd in "${pacman_commands[@]}"; do
sudo pacman -S $cmd
done
fi
if [ "$ALL" = true ]; then
for cmd in "${hidden_commands[@]}"; do
sudo $cmd
done
for cmd in "${apt_commands[@]}"; do
sudo apt install -y $cmd
done
fi
sudo dnf update
}
# Fonction pour vérifier et installer un package
check_and_install_package() {
local package="$1"
local package_installers=()
echo "Vérification de l'existence du package $package..."
if sudo dnf info $package &> /dev/null; then
package_installers+=("dnf")
fi
if sudo yum info $package &> /dev/null; then
package_installers+=("yum")
fi
if npm list -g --depth=0 | grep -q "$package"; then
package_installers+=("npm")
fi
if apt show $package &> /dev/null; then
package_installers+=("apt")
fi
#if snap list | grep -q "$package"; then
# package_installers+=("snap")
#fi
pip_command="python -m pip_search $package"
pip_output=$(eval $pip_command)
pip_output_length=$(echo -n "$pip_output" | wc -m)
if [ $pip_output_length -gt 327 ]; then
package_installers+=("pip")
fi
if pacman -Ss $package &> /dev/null; then
package_installers+=("pacman")
fi
if [ ${#package_installers[@]} -eq 0 ]; then
echo -e "\e[31mLe package $package n'existe pas\e[0m"
else
echo -e "\e[32mLe package $package existe\e[0m"
echo "Installateurs disponibles : ${package_installers[@]}"
for installer in "${package_installers[@]}"; do
echo "Installation avec $installer..."
case $installer in
"dnf")
sudo dnf install $package
;;
"yum")
sudo yum install $package
;;
"npm")
sudo npm install -g $package
;;
"apt")
sudo apt install $package
;;
"snap")
sudo snap install $package
;;
"pip")
pip install $package
;;
"pacman")
sudo pacman -S $package --noconfirm
;;
*)
echo "Installer non supporté: $installer"
;;
esac
done
fi
}
# Vérifier les arguments de ligne de commande
YES=false
ALL=false
NAME=false
# Vérifier si aucun argument n'est fourni ou seulement l'option -y
if [ $# -eq 0 ] || ([ $# -eq 1 ] && [ "$1" = "-y" ] || [ "$1" = "--yes" ]); then
if [ "$1" = "-y" ] || [ "$1" = "--yes" ]; then
YES=true
fi
install_packages "${base_commands[@]}"
exit 0
fi
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-h|--help)
usage
;;
-y|--yes)
YES=true
shift
;;
-a|--all)
ALL=true
shift
;;
-n|--name)
NAME=true
shift
;;
*)
echo "Option non reconnue: $key"
usage
;;
esac
done
# Vérifier les options et exécuter les commandes correspondantes
if [ "$ALL" = true ]; then
install_packages "${all_commands[@]}"
elif [ "$NAME" = true ]; then
echo "Entrez le nom du package à vérifier et installer :"
read package_name
check_and_install_package $package_name
else
usage
fi