diff --git a/LULI.sh b/LULI.sh deleted file mode 100644 index 46ab168..0000000 --- a/LULI.sh +++ /dev/null @@ -1,343 +0,0 @@ -#!/bin/sh -# Lightcord unified Linux installer by https://github.com/GermanBread -# POSIX compliance by https://github.com/pryme-svg - -# -# CHANGE STUFF HERE -# - -# Change this to anything other than "false" to allow installing under NixOS -# Ideally you'd also change $GLOBAL_INSTALL_DIR while you're at it -ALLOW_NIXOS='false' - -# If set to anything other than "false" this will allow you to modify the Lightcord installation even if it was -BYPASS_PACKAGEMANAGER='false' - -# Make sure to trim the trailing forward-slash (/) -GLOBAL_INSTALL_DIR='/opt' -LOCAL_INSTALL_DIR="$HOME/.lightcord" - -# -# DON'T TOUCH BELOW HERE -# - -# URL for downloads -ICON='https://raw.githubusercontent.com/Lightcord/Lightcord/master/discord.png' -LC_APPIMAGE='https://lightcord.org/api/gh/releases/Lightcord/Lightcord/dev/lightcord-linux-x86_64.AppImage' -LC='https://lightcord.org/api/v1/gh/releases/Lightcord/Lightcord/dev/lightcord-linux-x64.zip' -# Fallback URL -ALT_LC_APPIMAGE='https://github.com/Lightcord/Lightcord/releases/latest/download/Lightcord-linux-x86_64.AppImage' -ALT_LC='https://github.com/Lightcord/Lightcord/releases/latest/download/lightcord-linux-x64.zip' - -# Some helper funtions -Info() { - tput setaf 8 - tput bold - printf "==> " - tput setaf 15 - printf "$1\n" - tput sgr0 -} -SubInfo() { - tput setaf 8 - printf "> " - printf "$1\n" - tput sgr0 -} -Warning() { - tput setaf 3 - tput bold - printf "==> " - tput setaf 11 - printf "$1\n" - tput sgr0 -} -Error() { - tput setaf 1 - tput bold - printf "==> " - tput setaf 9 - printf "$1\n" - tput sgr0 -} - -if [ "$TERM" = dumb ]; then - exit 0 -fi - -if [ $(id -u) -eq 0 ]; then - Error "Don't run this script as root" - exit 0 -fi - -# Bedrock Linux warning -if [ -d /bedrock ]; then - Info "Bedrock Linux detected. Here be dragons..." - SubInfo "This script is executed in the $(tput bold && tput setaf 15 && brl which | tr -d '\n') stratum$(tput sgr0 && tput setaf 8). Mention this when filing a bug report!" -fi - -# Check if unzip is installed -if [ ! -e /bin/unzip ]; then - Warning "Unzip does not seem to be installed!\n\tThis script depends on this package.\n\tInstall unzip and restart this script." - Info "Press enter if you believe that this is a false-positive." - read -r REPLY -fi - -# Library checks (should prevent issues like https://github.com/Lightcord/Lightcord/issues/240) -if [ ! -e /lib/libnspr4.so ] || [ ! -e /lib/libnss3.so ]; then - Warning "Some required libraries seem to not be installed!\n\tMake sure that both 'libnspr4.so' and 'libnss3.so' are present in '/lib'" - if [ -e /bin/pacman ]; then - SubInfo "$(tput setaf 12 && tput bold)Arch Linux or Arch-based$(tput sgr0 && tput setaf 15) sudo pacman -S nss nspr" - fi - if [ -e /bin/apt ]; then - SubInfo "$(tput setaf 13 && tput bold)Debian or Debian-based$(tput sgr0 && tput setaf 15) sudo apt install libnspr4 libnss3" - fi - Info "Press enter if you believe that this is a false-positive." - read -r REPLY -fi - -cat << "logo_end" - _ _ _ _ _ - | | (_)__ _| |_| |_ __ ___ _ _ __| | - | |__| / _` | ' \ _/ _/ _ \ '_/ _` | - |____|_\__, |_||_\__\__\___/_| \__,_| - |___/ - Unified Linux Installer and Updater - -logo_end - -# First, we need to figure out what kind of install the user wants (AppImage or System-wide?) -printf "Please select\n" -printf "1: Install Lightcord for all users\n" -printf "2: Install Lightcord only for you (Appimage install)\n" -printf "\n" - -#Repeat only if the user hasn't entered an integer... -while ! echo $method | grep -Eq "^[0-9]"; -do - read -r method; - # If the entered value was not an integer, prompt the user again - if ! echo $method | grep -Eq "^[0-9]"; then - sleep 1 - printf "$(tput setaf 9)Please try again$(tput sgr0)\n" - printf "1: Install Lightcord for all users\n" - printf "2: Install Lightcord only for you (Appimage install)\n" - printf "\n" - fi -done - -if [ "$method" = 1 ]; then - # If there isn't a indicator file present, refuse to continue - if { [ -d /opt/lightcord ] || [ -d /opt/Lightcord ]; } && [ ! -e $GLOBAL_INSTALL_DIR/Lightcord/script_check ] && [ $BYPASS_PACKAGEMANAGER = 'false' ]; then - Error "Lightcord has been installed via a package manager; refusing to continue.\n\tChange variable BYPASS_PACKAGEMANAGER to anything other than \"false\" if you believe that this is a false positive" - exit 1 - fi - - Warning "Warning:\n\tBlindly running software as root is a massive security issue.\n\tIf you don't fully trust the software you're running DON'T RUN IT AS ROOT.\n\tIf you know exactly what you are doing, continue.\n\tOtherwise restart this script and choose the second option." - if [ -d "/nix" ] && [ $ALLOW_NIXOS = 'false' ]; then - Error "Error:\n\tUsing the global install option on NixOS is not supported due to the way this distribution handles software not present in the repositories.\n\tUse the AppImage install method instead.\n\tIf you still plan on installing Lightcord this way, change the \"ALLOW_NIXOS\" variable in this script to any value other than \"false\".\n\tYou should also modify the installation path variables if you want LC to not be wiped automatically at boot." - exit 1 - fi # We want to prevent NixOS users from installing LC this way because: - # A) NixOS is very "special" i.e. it blocks LC from running - # B) /opt gets cleared upon boot - Info "Please enter your password to proceed" - sudo -K - if [ "$(sudo whoami)" != "root" ]; then - Error "Authentication failed" - exit - fi - Info "Authentication complete" -fi - -case $method in - 1) - #Standard installer - tput setaf 208 - tput sgr0 - printf "Please select\n" - printf "1: Install Lightcord\n" - printf "2: Uninstall Lightcord\n" - printf "3: Update Lightcord\n" - printf "\n" - - #Repeat only if the user hasn't entered an integer... - while ! echo $selection | grep -Eq "^[0-9]"; - do - read -r selection; - # If the entered value was not an integer, prompt the user again - if ! echo $method | grep -Eq "^[0-9]"; then - sleep 1; - printf "$(tput setaf 9)Please try again$(tput sgr0)\n"; - printf "1: Install Lightcord\n"; - printf "2: Uninstall Lightcord\n"; - printf "3: Update Lightcord\n" - printf "\n"; - fi - done - - case $selection in - 1) # Install LC - Info "Installing Lightcord" - SubInfo "Preparing" - rm -rf Lightcord.*; - rm -rf Lightcord; - rm -rf lightcord-linux-x64.*; - SubInfo "Downloading Lightcord" - wget -qO lightcord-linux-x64.zip $LC; - if [ ! $? ]; then - SubInfo "Trying alternate URL" - wget -qO lightcord-linux-x64.zip $ALT_LC; - fi - unzip -qq lightcord-linux-x64.zip -d Lightcord; - cd Lightcord; - chmod +x ./lightcord; - cd ..; - sudo mv Lightcord/ $GLOBAL_INSTALL_DIR; - SubInfo "Downloading Lightcord icon" - wget -qO lightcord.png $ICON; - sudo mkdir -p /usr/share/pixmaps; - sudo mv lightcord.png /usr/share/pixmaps; - SubInfo "Creating Desktop entry" - printf "[Desktop Entry]\nName=Lightcord\nComment[fr_FR]=Un client Discord simple et personalisable\nComment=A simple - customizable - Discord Client\nExec=$GLOBAL_INSTALL_DIR/Lightcord/lightcord\nIcon=lightcord\nTerminal=false\nType=Application\nCategories=Network;InstantMessaging;P2P;" > Lightcord.desktop - sudo mv Lightcord.desktop /usr/share/applications/Lightcord.desktop - sudo chmod +x /usr/share/applications/Lightcord.desktop; - SubInfo "Cleaning up" - rm -rf Lightcord.*; - rm -rf Lightcord; - rm -rf lightcord-linux-x64.*; - sudo touch $GLOBAL_INSTALL_DIR/Lightcord/script_check - ;; - - 2) # Uninstall LC - Info "Uninstalling Lightcord" - SubInfo "Deleting Lightcord folder" - sudo rm -r $GLOBAL_INSTALL_DIR/Lightcord; - SubInfo "Deleting Lightcord icon" - sudo rm /usr/share/pixmaps/lightcord.png; - SubInfo "Deleting Desktop entry" - sudo rm /usr/share/applications/Lightcord.desktop; - sudo rm -f /home/*/.local/share/applications/Lightcord.desktop; - ;; - - 3) # Update LC - Info 'Updating Lightcord' - SubInfo "Preparing" - rm -rf Lightcord.*; - rm -rf Lightcord; - rm -rf lightcord-linux-x64.*; - SubInfo "Deleting Lightcord" - sudo rm -r $GLOBAL_INSTALL_DIR/Lightcord; - SubInfo "Downloading Lightcord" - wget -qO lightcord-linux-x64.zip $LC; - if [ ! $? ]; then - SubInfo "Trying alternate URL" - wget -qO lightcord-linux-x64.zip $ALT_LC; - fi - unzip -qq lightcord-linux-x64.zip -d Lightcord; - cd Lightcord; - chmod +x ./lightcord; - cd ..; - sudo mv Lightcord/ $GLOBAL_INSTALL_DIR; - SubInfo "Cleaning up" - rm -rf Lightcord.*; - rm -rf Lightcord; - rm -rf lightcord-linux-x64.*; - sudo touch $GLOBAL_INSTALL_DIR/Lightcord/script_check - ;; - - *) # Do nothing - Error 'Aborting install' - ;; - esac - ;; - - 2) - # Appimage installer - if [ "$TERM" = dumb ]; then - exit; - fi - - tput setaf 208 - tput sgr0 - - - printf "Please select\n"; - printf "1: Install Lightcord\n"; - printf "2: Uninstall Lightcord\n"; - printf "3: Update Lightcord\n" - printf "\n"; - - while ! echo $selection | grep -Eq "^[0-9]"; - do - read -r selection; - # If the entered value was not an integer, prompt the user again - if ! echo $method | grep -Eq "^[0-9]"; then - sleep 1; - printf "$(tput setaf 9)Please try again$(tput sgr0)\n"; - printf "1: Install Lightcord\n"; - printf "2: Uninstall Lightcord\n"; - printf "3: Update Lightcord\n" - printf "\n"; - fi - done - - - case $selection in - 1) # Install LC - Info 'Installing Lightcord' - SubInfo "Downloading Lightcord" - wget -qO lightcord.AppImage $LC_APPIMAGE; - if [ ! $? ]; then - SubInfo "Trying alternate URL" - wget -qO lightcord.AppImage $ALT_LC_APPIMAGE; - fi - SubInfo "Downloading Lightcord icon" - wget -qO lightcord.png $ICON; - mkdir -p "$LOCAL_INSTALL_DIR"; - mv lightcord.AppImage "$LOCAL_INSTALL_DIR"; - chmod +x "$LOCAL_INSTALL_DIR/lightcord.AppImage"; - mkdir -p ~/.local/share/icons/hicolor/512x512/apps - mv lightcord.png ~/.local/share/icons/hicolor/512x512/apps; - SubInfo "Creating local desktop entry" - printf "[Desktop Entry]\nName=Lightcord\nComment[fr_FR]=Un client Discord simple et personalisable\nComment=A simple - customizable - Discord Client\nExec=$LOCAL_INSTALL_DIR/lightcord.AppImage\nIcon=lightcord\nTerminal=false\nType=Application\nCategories=Network;InstantMessaging;P2P;" >> ~/.local/share/applications/lightcord.desktop; - SubInfo "Cleaning up" - ;; - - 2) # Uninstall LC - Info 'Uninstalling Lightcord' - SubInfo "Deleting Lightcord folder" - rm -r "$LOCAL_INSTALL_DIR"; - SubInfo "Deleting Lightcord icon" - rm ~/.local/share/icons/hicolor/512x512/apps/lightcord.png; - SubInfo "Deleting desktop entry" - rm ~/.local/share/applications/lightcord.desktop; - ;; - - 3) # Update LC - Info 'Updating Lightcord' - SubInfo "Deleting Lightcord" - rm "$LOCAL_INSTALL_DIR"/lightcord.AppImage; - SubInfo "Downloading Lightcord" - wget -qO lightcord.AppImage $LC_APPIMAGE; - if [ ! $? ]; then - SubInfo "Trying alternate URL" - wget -qO lightcord.AppImage $ALT_LC_APPIMAGE; - fi - mkdir -p "$LOCAL_INSTALL_DIR"; - mv lightcord.AppImage "$LOCAL_INSTALL_DIR"; - chmod +x "$LOCAL_INSTALL_DIR/lightcord.AppImage"; - SubInfo "Cleaning up" - ;; - - *) - Error 'Aborting install' - ;; - esac - ;; - - *) - Error 'Aborting install' - ;; -esac - -exit diff --git a/README.md b/README.md index f526a78..8390c46 100644 --- a/README.md +++ b/README.md @@ -51,25 +51,7 @@ Alternatively, download the installer from the [releases tab](https://github.com ## Linux -### Arch Linux (or Arch-based) - -You need to install the `base-devel` and `git` packages first - -[Latest git version](https://aur.archlinux.org/packages/lightcord-git/) - -`git clone https://aur.archlinux.org/lightcord-git.git && cd lightcord-git && makepkg -si` - -[Precompiled binaries](https://aur.archlinux.org/packages/lightcord-bin/) - -`git clone https://aur.archlinux.org/lightcord-bin.git && cd lightcord-bin && makepkg -si` - -*AUR helper such as `yay` and `pacaur` can also be used* - -### Other Linux Distributions - -**Warning: This installation method bypasses the package manager!** You should use this script to uninstall Lightcord! - -To install, paste `sh -c "$(curl -s https://raw.githubusercontent.com/Lightcord/Lightcord/master/LULI.sh)"` in terminal and press enter. The installer will guide you through the rest. +[This part has moved!](https://github.com/Lightcord/lc-installer-linux) # Running From Source