update(script): simplify (#126)
Some checks are pending
Sync to Codeberg / Sync Codeberg and Github (push) Waiting to run
Test / Test (push) Waiting to run

This commit is contained in:
PhoenixAceVFX 2025-01-25 16:31:53 -05:00 committed by GitHub
parent 74e91905fe
commit de1b74f6c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 26 deletions

View file

@ -190,7 +190,6 @@ Linux
```shell
sh -c "$(curl -sS https://raw.githubusercontent.com/Equicord/Equicord/refs/heads/main/misc/install.sh)"
```
## Installing Equicord Devbuild
### Dependencies

View file

@ -1,55 +1,50 @@
#!/bin/sh
# Exit immediately if a command exits with a non-zero status
set -e
# Check if the script is run as root
# Constants
INSTALLER_PATH="$HOME/.equilotl"
GITHUB_URL="https://github.com/Equicord/Equilotl/releases/latest/download/EquilotlCli-Linux"
# Check for root
if [ "$(id -u)" -eq 0 ]; then
echo "Run this script as a normal user, not root!"
echo "Run me 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"
download_installer() {
curl -sSL "$GITHUB_URL" --output "$INSTALLER_PATH"
chmod +x "$INSTALLER_PATH"
}
# 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-)
if [ -f "$INSTALLER_PATH" ]; then
latest_modified=$(curl -sI "$GITHUB_URL" | grep -i "last-modified" | cut -d' ' -f2-)
local_modified=$(stat -c "%y" "$INSTALLER_PATH" | cut -d' ' -f1-2)
# 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 "$github_url" --output "$installer_path"
chmod +x "$installer_path"
download_installer
fi
else
echo "Installer not found. Downloading it..."
curl -sSL "$github_url" --output "$installer_path"
chmod +x "$installer_path"
download_installer
fi
# Check for sudo or doas availability to run the installer with elevated privileges
# Try to run the installer with sudo or doas
if command -v sudo >/dev/null; then
echo "Running installer with sudo..."
sudo "$installer_path"
sudo "$INSTALLER_PATH"
elif command -v doas >/dev/null; then
echo "Running installer with doas..."
doas "$installer_path"
doas "$INSTALLER_PATH"
else
echo "Neither sudo nor doas were found. Please install one to proceed."
exit 1
fi
# Provide script attribution
# Credits
echo "Original script forked from Vencord"
echo "Modified by PhoenixAceVFX & Crxaw for Equicord Updater"