Equicord/misc/install.sh

51 lines
1.4 KiB
Bash
Raw Permalink Normal View History

#!/bin/sh
set -e
2025-01-25 16:31:53 -05:00
# 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
2025-01-25 16:31:53 -05:00
echo "Run me as a normal user, not root!"
exit 1
fi
2025-01-25 16:31:53 -05:00
download_installer() {
curl -sSL "$GITHUB_URL" --output "$INSTALLER_PATH"
chmod +x "$INSTALLER_PATH"
}
echo "Checking if the installer needs updating..."
2025-01-25 16:31:53 -05:00
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)
if [ "$local_modified" = "$latest_modified" ]; then
echo "The installer is up-to-date."
else
echo "The installer is outdated. Downloading the latest version..."
2025-01-25 16:31:53 -05:00
download_installer
fi
else
echo "Installer not found. Downloading it..."
2025-01-25 16:31:53 -05:00
download_installer
fi
2025-01-25 16:31:53 -05:00
# Try to run the installer with sudo or doas
if command -v sudo >/dev/null; then
echo "Running installer with sudo..."
2025-01-25 16:31:53 -05:00
sudo "$INSTALLER_PATH"
elif command -v doas >/dev/null; then
echo "Running installer with doas..."
2025-01-25 16:31:53 -05:00
doas "$INSTALLER_PATH"
else
echo "Neither sudo nor doas were found. Please install one to proceed."
exit 1
fi
2025-01-25 16:31:53 -05:00
# Credits
echo "Original script forked from Vencord"
echo "Modified by PhoenixAceVFX & Crxaw for Equicord Updater"