From 8f824472bc7c12e72866f12278639c9a2ab5d498 Mon Sep 17 00:00:00 2001 From: PhoenixAceVFX Date: Wed, 11 Dec 2024 14:52:59 -0500 Subject: [PATCH] Installer script changes (#108) * Update README.md Custom URLs for the install script * Update README.md Mirrors because running the script from github is giving me problems (ratelimit or something i have no clue) * Update install.sh * Update README.md * Fix Readme --------- Co-authored-by: thororen1234 Co-authored-by: thororen <78185467+thororen1234@users.noreply.github.com> --- README.md | 1 + misc/install.sh | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2146bb7e..8ed574d8 100644 --- a/README.md +++ b/README.md @@ -190,6 +190,7 @@ Linux ```shell sh -c "$(curl -sS https://raw.githubusercontent.com/Equicord/Equicord/refs/heads/main/misc/install.sh)" ``` + ## Installing Equicord Devbuild ### Dependencies diff --git a/misc/install.sh b/misc/install.sh index 3d760462..1ddcf677 100644 --- a/misc/install.sh +++ b/misc/install.sh @@ -1,36 +1,44 @@ #!/bin/sh + +# Exit immediately if a command exits with a non-zero status set -e +# Check if the script is run as root if [ "$(id -u)" -eq 0 ]; then - echo "Run me as a normal user, not root!" + echo "Run this script as a normal user, not root!" exit 1 fi +# Define variables installer_path="$HOME/.equilotl" github_url="https://github.com/Equicord/Equilotl/releases/latest/download/EquilotlCli-Linux" +# Inform user about the update check echo "Checking if the installer needs updating..." +# Fetch the latest modified date from the server +latest_modified=$(curl -sI "$github_url" | grep -i "last-modified" | cut -d' ' -f2-) -latest_modified=$(curl -sI "https://github.com/Equicord/Equilotl/releases/latest/download/EquilotlCli-Linux" | grep -i "last-modified" | cut -d' ' -f2-) - +# Check if the installer exists locally if [ -f "$installer_path" ]; then + # Get the local file's last modified date local_modified=$(stat -c "%y" "$installer_path" | cut -d' ' -f1-2) + # Compare the local file's date with the server's latest modified date if [ "$local_modified" = "$latest_modified" ]; then echo "The installer is up-to-date." else echo "The installer is outdated. Downloading the latest version..." - curl -sSL "https://github.com/Equicord/Equilotl/releases/latest/download/EquilotlCli-Linux" --output "$installer_path" + curl -sSL "$github_url" --output "$installer_path" chmod +x "$installer_path" fi else echo "Installer not found. Downloading it..." - curl -sSL "https://github.com/Equicord/Equilotl/releases/latest/download/EquilotlCli-Linux" --output "$installer_path" + curl -sSL "$github_url" --output "$installer_path" chmod +x "$installer_path" fi - +# Check for sudo or doas availability to run the installer with elevated privileges if command -v sudo >/dev/null; then echo "Running installer with sudo..." sudo "$installer_path" @@ -41,5 +49,7 @@ else echo "Neither sudo nor doas were found. Please install one to proceed." exit 1 fi + +# Provide script attribution echo "Original script forked from Vencord" echo "Modified by PhoenixAceVFX & Crxaw for Equicord Updater"