-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnityStationInstaller.sh
More file actions
90 lines (75 loc) · 2.69 KB
/
UnityStationInstaller.sh
File metadata and controls
90 lines (75 loc) · 2.69 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
#!/bin/bash
# Fonction de gestion des erreurs
function handle_error {
echo "Une erreur s'est produite. Sortie du script."
exit 1
}
# Fonction pour obtenir la dernière version depuis l'API GitHub
function get_latest_version {
local repo_url="https://api.github.com/repos/unitystation/stationhub/releases/latest"
local version=$(wget -qO - "$repo_url" | grep -oP '"tag_name": "\K(.*)(?=")')
echo "$version"
}
latest_version=$(get_latest_version)
while true; do
echo "Choisissez votre distribution :"
echo "1 - Ubuntu/Debian"
echo "2 - Arch-Linux"
echo "3 - Fedora"
echo "4 - OpenSUSE"
echo "5 - CentOS"
echo "6 - Gentoo"
read -p "Entrez le numéro de votre choix : " choice
case $choice in
1)
# Commandes pour Ubuntu
apt update
apt full-upgrade
apt install -y wget p7zip || handle_error
;;
2)
# Commandes pour Arch Linux
pacman -Syu --noconfirm
pacman -S --noconfirm wget p7zip || handle_error
;;
3)
# Commandes pour Fedora
dnf update -y
dnf install -y wget p7zip || handle_error
;;
4)
# Commandes pour openSUSE
zypper refresh
zypper install -y wget p7zip || handle_error
;;
5)
# Commandes pour CentOS
yum update -y
yum install -y wget p7zip || handle_error
;;
6)
# Commandes pour Gentoo
emerge --sync
emerge -av wget p7zip || handle_error
;;
*)
echo "Choix invalide. Réessayez."
;;
esac
if [ $choice -ge 1 ] && [ $choice -le 6 ]; then
break # Sort de la boucle si le choix est valide
fi
done
# Téléchargement des fichiers avec wget
mkdir -p /usr/share/Unitystation/
cd /usr/share/Unitystation/
latest_url="https://github.com/unitystation/stationhub/releases/download/$latest_version/lin$latest_version.zip"
wget -O "/usr/share/Unitystation/lin-latest.zip" "$latest_url"
wget -O /usr/share/Unitystation/unityico.png https://raw.githubusercontent.com/unitystation/stationhub/develop/UnitystationLauncher/Assets/unityico.png || handle_error
wget -O /usr/share/applications/Stationhub.desktop https://raw.githubusercontent.com/Unitystation-fork/Unitystation-Others/main/Installation-Script/Unitystation.desktop || handle_error
# Extraction du fichier zip
unzip /usr/share/Unitystation/lin-latest.zip || handle_error
rm -rfv /usr/share/Unitystation/lin-latest.zip || handle_error
chmod -R 777 /usr/share/Unitystation/StationHub || handle_error
echo "Installation terminée."
exit 1