-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1 Add Linux Installer script #219
base: develop
Are you sure you want to change the base?
Changes from all commits
9fd6ff2
a14bae1
430c403
9ed5e93
12e852a
5fb768f
7146ccf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
[![forthebadge cc-by](https://licensebuttons.net/l/by-nc-sa/4.0/88x31.png)](https://creativecommons.org/licenses/by/4.0) [![](https://img.shields.io/badge/Discord-7289DA?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/tyJX8dx) | ||
![Debian](https://img.shields.io/badge/Debian-D70A53?style=for-the-badge&logo=debian&logoColor=white)![Ubuntu](https://img.shields.io/badge/Ubuntu-E95420?style=for-the-badge&logo=ubuntu&logoColor=white) | ||
|
||
## EasyInstall Unitystation-Hub For Gnu_linux | ||
|
||
### Languages used | ||
|
||
Shell .SH | ||
|
||
------------- | ||
|
||
### Project description | ||
|
||
Unitystation installation script for Linux | ||
By creating a desktop shortcut to the executable | ||
|
||
------------- | ||
### Credit, participant, organisation | ||
|
||
Managed by the Unionrolistes development team | ||
List of contributors Credit.md | ||
![Licence.md](https://github.com/Unitystation-fork/Unitystation-Hub/blob/main/LICENSE) | ||
|
||
------------- | ||
|
||
### Project goal / target audience | ||
|
||
Gnu_linux user | ||
|
||
------------- | ||
### Installation | ||
To use it, please copy Unitystation.sh locally and run it as superuser/root. | ||
|
||
Open terminal | ||
```shell | ||
wget https://raw.githubusercontent.com/Unitystation-fork/Unitystation-Others/main/Installation-Script/UnityStationInstaller.sh -O ~/UnityStationInstaller.sh; sudo chmod 750 ~/UnityStationInstaller.sh; sudo ~/UnityStationInstaller.sh | ||
``` | ||
*For no debian user, please remplacer "sudo" by your own command* | ||
|
||
|
||
------------- | ||
### Upgrading | ||
|
||
Once installed, the hub will update to the latest build. | ||
If the Hub version changes, you will need to run this shell script again. | ||
|
||
--- | ||
### Uninstall | ||
please copy past this on your terminal Open terminal | ||
```shell | ||
wget -O ~/UnitystationUnInstaller.sh https://raw.githubusercontent.com/Unitystation-fork/Unitystation-Others/main/Installation-Script/UnitystationUnInstaller.sh ; sudo chmod 750 ~/UnityStationUnInstaller.sh; sudo ~/UnityStationUnInstaller.sh | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you are also giving 750 perms to the wrong script There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no it's the Un-installation script to make the uninstall command as complete as possible. |
||
``` | ||
|
||
------------- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
[![forthebadge cc-by](https://licensebuttons.net/l/by-nc-sa/4.0/88x31.png)](https://creativecommons.org/licenses/by/4.0) [![](https://img.shields.io/badge/Discord-7289DA?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/tyJX8dx) | ||
![Debian](https://img.shields.io/badge/Debian-D70A53?style=for-the-badge&logo=debian&logoColor=white)![Ubuntu](https://img.shields.io/badge/Ubuntu-E95420?style=for-the-badge&logo=ubuntu&logoColor=white) | ||
|
||
## EasyInstall Unitystation-Hub For Gnu_linux | ||
|
||
### Languages utilisés | ||
|
||
Shell .SH | ||
|
||
------------- | ||
|
||
### Description du projet | ||
|
||
Script d'installation pour Linux d'Unitystation | ||
En créant un raccourci bureau de l'executable | ||
|
||
------------- | ||
### Credit , participant, organisation | ||
|
||
Géré par l'équipe de développement de Unionrolistes | ||
Liste des contributeurs Credit.md | ||
![Licence.md](https://github.com/Unitystation-fork/Unitystation-Hub/blob/main/LICENSE) | ||
|
||
------------- | ||
|
||
### But du projet / public cible | ||
|
||
Utilisateur Gnu_linux | ||
|
||
------------- | ||
### Installation | ||
Pour l'utiliser, veuillez copier Unitystation.sh localement et l'exécuter en tant que super utilisateur/racine. | ||
|
||
Open terminal | ||
```shell | ||
wget https://raw.githubusercontent.com/Unitystation-fork/Unitystation-Others/main/Installation-Script/UnityStationInstaller.sh -O ~/UnityStationInstaller.sh ; sudo chmod 750 ~/UnityStationInstaller.sh ; sudo ~/UnityStationInstaller.sh | ||
``` | ||
|
||
------------- | ||
### Mise à jour | ||
|
||
Une fois installé, le hub mettra à jour vers le dernier build. | ||
Si la version du Hub change, il faudra de nouveau executer ce script shell. | ||
|
||
--- | ||
### Uninstall | ||
merci de copier coller le texte suivant dans votre terminal | ||
```shell | ||
wget -O ~/UnitystationUnInstaller.sh https://raw.githubusercontent.com/Unitystation-fork/Unitystation-Others/main/Installation-Script/UnitystationUnInstaller.sh ; sudo chmod 750 ~/UnityStationUnInstaller.sh; sudo ~/UnityStationUnInstaller.sh | ||
``` | ||
|
||
|
||
------------- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 "Choose your distribution :" | ||
echo "1 - Ubuntu/Debian" | ||
echo "2 - Arch-Linux" | ||
echo "3 - Fedora" | ||
echo "4 - OpenSUSE" | ||
echo "5 - CentOS" | ||
echo "6 - Gentoo" | ||
read -p "Enter the number of your choice : " choice | ||
|
||
case $choice in | ||
1) | ||
# Commandes pour Ubuntu | ||
apt update | ||
apt full-upgrade | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do not upgrade the user's system. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as I said earlier, there is no -y it's more for "the sake of ", to remind the user to do his updates There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
this is an awful justification. This script doesn't need the user to upgrade their system, do not upgrade someone's computer because you think it is best for them. Respect the user. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keeping your system up to date is precisely the first recommendation you should make to a user, especially if they're too lazy to do it. and i've created this script for people who want everything to work "all-in-one", the flemmes are a parameter to take into account. you don't seem convinced? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The whole point of a script like this is to do one thing and one thing only, install stationhub. We don't install firefox automatically because some people are too lazy or force them to install Arch Linux because they're too stupid, because it is not our concern what the user does with their PC and we shouldn't be changing anything about it just because we think its for the best. |
||
apt install -y wget p7zip || handle_error | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. try to get rid of these dependencies. All linux distros should already have installed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. simple tools for simple use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. # use curl or wget, depending on which one we find
curl_or_wget=$(if hash curl 2>/dev/null; then echo "curl -s"; elif hash wget 2>/dev/null; then echo "wget -qO-"; fi);
if [ -z "$curl_or_wget" ]; then
echo "Neither curl nor wget found. Installing wget." >&2
//install wget here
fi
x=$($curl_or_wget "$url") see if either is installed in the system before installing the one you prefer. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, I see, a bit of a twisted approach but why not. and why do you insist on using curl? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had the impression that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wasn't basing this reflection on that. curl being a very powerful and versatile command, it often frightens people, and rightly so. wget is all about downloading a file. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know where you got that "it frightens people" thing, but I managed to get curl working pretty quick in my own installer script and the best part is that we didn't need any external dependencies. wget is not available on all platforms or distros, and like I've mentioned; this shell script literally doesn't need an entirely new library for it to work, especially one that can affect user security. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wget, affected the security of user :D best joke ever ... |
||
;; | ||
|
||
2) | ||
# Commandes pour Arch Linux | ||
pacman -Syu --noconfirm | ||
pacman -S --noconfirm wget p7zip || handle_error | ||
;; | ||
|
||
3) | ||
# Commandes pour Fedora | ||
dnf update -y | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You said above:
However this DOES force a user to update their system, please do not do this. |
||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here |
||
yum install -y wget p7zip || handle_error | ||
;; | ||
|
||
6) | ||
# Commandes pour Gentoo | ||
emerge --sync | ||
emerge -av wget p7zip || handle_error | ||
;; | ||
|
||
*) | ||
echo "Invalid choice. Please try again." | ||
;; | ||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks like you are using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. of memory when you want to use archive extration via a script (for example sh or py) you need p7zip but I could be mistaken There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in that case, the script would also have to find if the system has either and use that, like I suggested for curl and wget There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also you can do this to check for the existence of 7zip: echo "Looking for 7zip.."
if ! command -v 7z &> /dev/null
then
echo "7zip could not be found. Extract files manually."
case $OS in
'Linux')
xdg-open https://7-zip.org/
;;
'Windows')
msg "%username%" 7zip could not be found. Extract files manually.
start https://7-zip.org/
;;
'Mac')
open https://7-zip.org/
;;
'AIX') ;;
*) ;;
esac
exit 1
fi
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Your script is crap and you know it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You mad lol There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
eventually, In short, gilles and bod have given me recommendations as soon as I have a bit of time, and I'm going to redo it. However, I have to thank you, so you motivated me to improve my script to prove you wrong, =) |
||
rm -rfv /usr/share/Unitystation/lin-latest.zip || handle_error | ||
chmod -R 777 /usr/share/Unitystation/StationHub || handle_error | ||
|
||
echo "Installation done." | ||
exit 1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[Desktop Entry] | ||
Name=UnityStation | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a desktop entry for StationHub, not for Unitystation. |
||
GenericName=UnityStation | ||
Exec=/usr/share/Unitystation/StationHub | ||
Type=Application | ||
Categories=Game | ||
Comment=UnityStation- Connect to Unitystation servers & manage your installs. | ||
Comment[fr_FR]=UnityStation - Connectez-vous aux serveurs Unitystation & gérez vos installations. | ||
Icon=/usr/share/Unitystation/unityico.png | ||
Path=/usr/share/Unitystation/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
|
||
# Fonction pour afficher un message de confirmation | ||
function confirm_delete { | ||
echo "Voulez-vous vraiment supprimer le jeu Unitystation ?" | ||
read -p "Tapez 'y' pour confirmer ou 'n' pour annuler : " response | ||
if [[ $response == "y" ]]; then | ||
return 0 | ||
else | ||
return 1 | ||
fi | ||
} | ||
|
||
# Fonction pour supprimer uniquement le dossier contenant le Launcher et le raccourci du bureau | ||
function delete_launcher_and_shortcut { | ||
rm -rfv /usr/share/Unitystation | ||
rm -fv /usr/share/applications/Stationhub.desktop | ||
} | ||
|
||
# Fonction pour supprimer TOUS (jeux + raccourcis + données du jeu) | ||
function delete_all { | ||
rm -rfv ~/local/share/StationHub | ||
rm -rfv /usr/share/Unitystation | ||
rm -fv /usr/share/applications/Stationhub.desktop | ||
} | ||
|
||
# Afficher un message de confirmation | ||
confirm_delete | ||
if [ $? -eq 0 ]; then | ||
echo "Choisissez une option :" | ||
echo "1 - Supprimer uniquement le dossier contenant le Launcher et le raccourci du bureau" | ||
echo "2 - Supprimer TOUS (jeux + raccourcis + données du jeu)" | ||
read -p "Entrez le numéro de votre choix : " choice | ||
|
||
case $choice in | ||
1) | ||
delete_launcher_and_shortcut | ||
echo "Suppression du Launcher et du raccourci terminée." | ||
;; | ||
2) | ||
delete_all | ||
echo "Suppression complète terminée." | ||
;; | ||
*) | ||
echo "Choix invalide. Aucune action effectuée." | ||
;; | ||
esac | ||
fi | ||
exit 1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
Version 0.0.4 | ||
Date: 11/10/2023 - 14h | ||
Dev: Fr-Dae | ||
|
||
Fix: | ||
|
||
- Multi OS manage | ||
- fr/en instruction | ||
--------------------------------------------------------------------------------------------- | ||
Version 0.0.3 | ||
Date: 11/10/2023 - 8h | ||
Dev: Fr-Dae | ||
|
||
Fix: | ||
|
||
- Sources of the installer for Linux dekstop | ||
|
||
--------------------------------------------------------------------------------------------- | ||
|
||
Version 0.0.2 | ||
Date: 25/02/2022 - 19h | ||
Dev: Peulleieo | ||
|
||
Added: | ||
|
||
- Sources of the installer for Linux | ||
Ajout: | ||
|
||
- Sources de l'installateur pour Linux | ||
|
||
--------------------------------------------------------------------------------------------- | ||
|
||
Version 0.0.1 | ||
Date: 25/02/2022 - 16h | ||
|
||
Ajout: | ||
|
||
- Création du github par Dae |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are still pointing to the other repo here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please make a branch for me to write in?
I could then have the right links (adding hand)
that's why i wanted to make a submodule, easier to upload without modifying the documentation (and i'm glad i learned that)