diff --git a/README.md b/README.md
index 637ff95..19d19de 100644
--- a/README.md
+++ b/README.md
@@ -1,23 +1,27 @@
-# TLauncher
+
+
+# tlauncher-arch
+[](https://github.com/mttomaz/tlauncher-arch/stargazers)
+[](https://github.com/mttomaz/tlauncher-arch/issues)
+[](https://github.com/mttomaz/tlauncher-arch)
+[](https://github.com/mttomaz/tlauncher-arch/blob/master/LICENSE)
+
+
+
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
- ```
+```bash
+curl -fsSl https://raw.githubusercontent.com/mttomaz/tlauncher-arch/master/install.sh | sh
+```
## Usage
After the installation, you can just type `tlauncher` in the terminal to launch tlauncher.
diff --git a/install.sh b/install.sh
index 4bcb042..763a906 100755
--- a/install.sh
+++ b/install.sh
@@ -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!"
diff --git a/src/tlauncher b/src/tlauncher
index 46c6328..59d9148 100755
--- a/src/tlauncher
+++ b/src/tlauncher
@@ -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"
@@ -12,7 +14,7 @@ usage() {
Usage:
-h, --help, help | Print this message
-u, --update, update | Update tlauncher.jar
- -r, --remove, remove | Remove tlauncher from your system, except your \$HOME/.minecraft dir
+ -r, --remove, remove | Remove tlauncher from your system, except your \$HOME/.minecraft dir
nothing | Launch TLauncher
"
}
@@ -34,19 +36,16 @@ remove() {
/usr/share/applications/tlauncher.desktop
/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
+ echo -e "\n${GREEN}Removing TLauncher system files ...${END}"
+ 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
diff --git a/src/tlauncher.desktop b/src/tlauncher.desktop
index 3d0bf4c..d787388 100644
--- a/src/tlauncher.desktop
+++ b/src/tlauncher.desktop
@@ -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