Improve install script

This commit is contained in:
mttomaz
2025-06-05 13:35:00 -03:00
parent a7218ed014
commit b1cb6b6579
4 changed files with 49 additions and 51 deletions

View File

@@ -1,22 +1,26 @@
# TLauncher
<div align="center">
# tlauncher-arch
[![stars](https://img.shields.io/github/stars/mttomaz/tlauncher-arch?color=7E9CD8&style=for-the-badge)](https://github.com/mttomaz/tlauncher-arch/stargazers)
[![issues](https://img.shields.io/github/issues/mttomaz/tlauncher-arch?color=FF5D62&style=for-the-badge)](https://github.com/mttomaz/tlauncher-arch/issues)
[![size](https://img.shields.io/github/repo-size/mttomaz/tlauncher-arch?color=76946A&style=for-the-badge)](https://github.com/mttomaz/tlauncher-arch)
[![license](https://img.shields.io/github/license/mttomaz/tlauncher-arch?color=957FB8&style=for-the-badge)](https://github.com/mttomaz/tlauncher-arch/blob/master/LICENSE)
</div>
This is a repo that i made to install TLauncher on Arch Linux directly from their [site](https://tlauncher.org/).
### Warning !
This script is only a tool to facilitate the download of TLauncher. The use of TLauncher is entirely at your own risk. I am not responsible for any issues that may arise from the use of TLauncher. If you are curious about why this warning even exists, see [this](https://github.com/MatheusTT/tlauncher-arch/issues/1) issue.
> [!Warning]
> This script is only a tool to facilitate the download of TLauncher.
> The use of TLauncher is entirely at your own risk. I am not responsible
> for any issues that may arise from the use of TLauncher. If you are curious
> about why this warning even exists, see [this](https://github.com/MatheusTT/tlauncher-arch/issues/1) issue.
## How to install
## Installing
Run the following command to install TLauncher:
1. Clone and enter the repo
```bash
git clone https://github.com/MatheusTT/tlauncher-arch.git && cd tlauncher-arch
```
2. Change the permissions of the script
```bash
chmod +x ./install.sh
```
3. Install tlauncher
```bash
./install.sh
curl -fsSl https://raw.githubusercontent.com/mttomaz/tlauncher-arch/master/install.sh | sh
```
## Usage

View File

@@ -1,33 +1,26 @@
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
[[ "$(whoami)" = "root" ]] && echo "Script must be run as a normal user." && exit
[[ "$(id -u)" -eq 0 ]] && echo "Script must be run as a normal user." && exit
# Colors
GREEN="\033[1;32m"
END="\033[0m"
info_msg() {
echo -e "\n\033[1;32m${1}\033[0m"
}
## wget is for downloading TLuncher directly from their website.
## All the other packages are java packages recommended by TLauncher
## (They use java 8, but instead i'm installing the most recent java version).
# Downloading packages
pkgs=(
wget
jdk-openjdk
jre-openjdk
jre-openjdk-headless
java-openjfx
)
sudo pacman -Sy --noconfirm --needed "${pkgs[@]}"
info_msg "Installing Packages ..."
sudo pacman -Sy --noconfirm --needed wget git unzip jre-openjdk
# Downloading TLauncher
echo -e "\n${GREEN}Downloading TLauncher...${END}"
info_msg "Cloning Repo ..."
git clone https://github.com/mttomaz/tlauncher-arch.git "$HOME/tlauncher-arch"
cd "$HOME/tlauncher-arch" || exit
info_msg "Downloading TLauncher ..."
wget https://tlauncher.org/jar -P src/
unzip src/jar -d src/tlauncher.d
mv src/tlauncher.d/*.jar src/tlauncher.d/tlauncher.jar
# Moving TLauncher files
echo -e "\n${GREEN}Installing TLauncher...${END}"
info_msg "Installing TLauncher ..."
sudo mkdir /usr/share/tlauncher
sudo mv src/tlauncher.d/* /usr/share/tlauncher
@@ -35,4 +28,6 @@ sudo mv src/tlauncher /usr/bin/
sudo mv src/tlauncher.png /usr/share/icons
sudo mv src/tlauncher.desktop /usr/share/applications
echo -e "\n${GREEN}Installation Complete!${END}"
cd "$OLDPWD" || exit
rm -rf "$HOME/tlauncher-arch"
info_msg "Installation Complete!"

View File

@@ -1,6 +1,8 @@
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
[[ "$(whoami)" = "root" ]] && echo "Script must be run as a normal user." && exit
[[ "$(id -u)" -eq 0 ]] && echo "Script must be run as a normal user." && exit
# Colors
RED="\033[1;31m"
@@ -35,18 +37,15 @@ remove() {
/usr/bin/tlauncher
)
echo -e "\n${GREEN}Removing TLauncher system files ...${END}"
rm -rf "${SYSTEM_FILES[@]}"
echo -en "\nDo you want to keep all those java packages installed (${GREEN}Yy${END}/${RED}Nn${END})?" && read -r KEEP_JAVA
echo -en "\nDo you want to keep your \$HOME/.tlauncher dir (${GREEN}Yy${END}/${RED}Nn${END})?" && read -r KEEP_DOTDIR
[[ "${KEEP_JAVA,,}" = "n" ]] && sudo pacman -Rns jdk-openjdk jre-openjdk{,-headless} java-openjfx
sudo rm -rf "${SYSTEM_FILES[@]}"
echo -en "\nDo you want to keep the package \"jre-openjdk\" installed (${GREEN}Yy${END}/${RED}Nn${END})? " && read -r KEEP_JAVA
echo -en "\nDo you want to keep your \"\$HOME/.tlauncher\" dir (${GREEN}Yy${END}/${RED}Nn${END})? " && read -r KEEP_DOTDIR
[[ "${KEEP_JAVA,,}" = "n" ]] && sudo pacman -Rns jre-openjdk
[[ "${KEEP_DOTDIR,,}" = "n" ]] && rm -rf "$HOME/.tlauncher"
echo -e "\n${GREEN}TLauncher Removed!${END}"
}
launch() {
java -jar /usr/share/tlauncher/tlauncher.jar
}
case "$1" in
case "${1:-}" in
-u | --update | update)
update && exit
;;
@@ -57,6 +56,6 @@ case "$1" in
usage && exit
;;
*)
launch
exec java -jar /usr/share/tlauncher/tlauncher.jar
;;
esac

View File

@@ -1,7 +1,7 @@
[Desktop Entry]
Type=Application
Name=TLauncher
Keywords=game;strategy;
Keywords=game;strategy;Minecraft;
Comment=Minecraft is a sandbox video game developed by Mojang
Icon=tlauncher
Exec=tlauncher