Added a remove option, a one liner to install tlauncher-arch, and formatted some files

This commit is contained in:
MatheusTT
2022-08-23 13:35:59 -03:00
parent 9ebfce62c5
commit 5839bd58d4
3 changed files with 61 additions and 30 deletions

View File

@@ -15,8 +15,14 @@ This is a repo that i made to install TLauncher on Arch Linux directly from thei
```c
./install.sh
```
## Or you can simply do this:
```c
wget https://pastebin.com/raw/TUgwsQdx -O - | tr -d '\r' | sh
```
## Usage
After the installation, you can just type `tlauncher` in the terminal to launch tlauncher.
If you wanna update type `tlauncher --update` or `tlauncher -u`, for downloading the last version of tlauncher _(It's not the best way of doing this, but it will do it for now)_.
If you wanna update type `tlauncher --update` or `tlauncher -u`, for downloading the last version of tlauncher _(It's not the best way of doing this, but it will do it for now)_.
If you wanna remove TLauncher from your system type `tlauncher --remove` or `tlauncher -r`, and then the tlauncher files will be removed and you can opt to remove the java packages, and/or the $HOME/.tlauncher dir.

View File

@@ -1,31 +1,33 @@
#!/bin/bash
#!/usr/bin/env bash
[[ "$(whoami)" = "root" ]] && echo "Script must be run as a normal user." && exit
# Colors
GREEN="\033[1;32m"
END="\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).
pkgs_needed=(
# Downloading packages
pkgs=(
wget
jdk-openjdk
jre-openjdk
jre-openjdk-headless
java-openjfx
)
for pkg in ${pkgs_needed[@]} ; do
if ( ! pacman -Qs | grep -q $pkg ) ; then
sudo pacman -S --noconfirm "$pkg"
fi
done
sudo pacman -S --noconfirm --needed "${pkgs[@]}"
# Downloading TLauncher
echo -e "\n\033[1;32mDownloading TLauncher...\033[0m"
echo -e "\n${GREEN}Downloading TLauncher...${END}"
sudo wget https://tlauncher.org/jar -P src/
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\033[1;32mInstalling TLauncher...\033[0m"
echo -e "\n${GREEN}Installing TLauncher...${END}"
sudo mkdir /usr/share/tlauncher
sudo mv src/tlauncher.d/* /usr/share/tlauncher
@@ -33,4 +35,4 @@ 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\033[1;32mInstallation Complete!\033[0m"
echo -e "\n${GREEN}Installation Complete!${END}"

View File

@@ -1,32 +1,55 @@
#!/bin/bash
#!/usr/bin/env bash
function update() {
echo -e "\n\033[1;32mDownloading the latest version...\033[0m"
[[ "$(whoami)" = "root" ]] && echo "Script must be run as a normal user." && exit
# Colors
RED="\033[1;31m"
GREEN="\033[1;32m"
END="\033[0m"
update() {
echo -e "\n${GREEN}Downloading the latest version...${END}"
wget https://tlauncher.org/jar -P /tmp
unzip /tmp/jar -d /tmp/tlauncher
sudo mv /tmp/tlauncher/*.jar /usr/share/tlauncher/tlauncher.jar
rm /tmp/jar
rm -rf /tmp/tlauncher/
echo -e "\n\033[1;32mDone!\033[0m"
echo -e "\n${GREEN}Done!${END}"
}
function usage() {
usage() {
echo "
Usage:
--update -u | Update tlauncher.jar
nothing | Launch TLauncher
--update, update | Update tlauncher.jar
--remove, remove | Remove tlauncher from your system, except your \$HOME/.minecraft dir
nothing | Launch TLauncher
"
}
while [[ "$1" ]]; do
case "$1" in
"--update" | "-u")
update ; exit ;;
*)
usage ; exit ;;
esac
done
remove() {
SYSTEM_FILES=(
/usr/share/tlauncher
/usr/share/icons/tlauncher.png
/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
[[ "${KEEP_DOTDIR,,}" = "n" ]] && rm -rf "$HOME/.tlauncher"
}
java -jar /usr/share/tlauncher/tlauncher.jar
case "$1" in
-u|--update|update)
update ; exit ;;
-r|--remove|remove)
remove ; exit ;;
*)
usage ; exit ;;
esac
java -jar /usr/share/tlauncher/tlauncher.jar